numass cryotemp update

This commit is contained in:
darksnake 2016-10-20 05:04:33 +03:00
parent 4c8f740d26
commit 3226c1aebc
3 changed files with 23 additions and 17 deletions

View File

@ -1,6 +1,6 @@
apply plugin: 'application' apply plugin: 'application'
version = "0.4.0" version = "0.4.1"
if (!hasProperty('mainClass')) { if (!hasProperty('mainClass')) {
ext.mainClass = 'inr.numass.readvac.app.ReadVac' ext.mainClass = 'inr.numass.readvac.app.ReadVac'

View File

@ -53,7 +53,7 @@ import java.io.File;
import java.net.URL; import java.net.URL;
import java.time.Instant; import java.time.Instant;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.ZoneId; import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -71,7 +71,7 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
private final String[] intervalNames = {"1 sec", "5 sec", "10 sec", "30 sec", "1 min"}; private final String[] intervalNames = {"1 sec", "5 sec", "10 sec", "30 sec", "1 min"};
private final int[] intervals = {1000, 5000, 10000, 30000, 60000}; private final int[] intervals = {1000, 5000, 10000, 30000, 60000};
private final List<VacuumeterView> views = new ArrayList<>(); private final List<VacuumeterView> views = new ArrayList<>();
ConsoleFragment consoleWindow; private ConsoleFragment consoleWindow;
private Logger logger; private Logger logger;
private LoaderConnection storageConnection; private LoaderConnection storageConnection;
private VacCollectorDevice device; private VacCollectorDevice device;
@ -156,8 +156,15 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
public void onMeasurementResult(Measurement<DataPoint> measurement, DataPoint result, Instant time) { public void onMeasurementResult(Measurement<DataPoint> measurement, DataPoint result, Instant time) {
if (plottables != null) { if (plottables != null) {
plottables.put(result); plottables.put(result);
//workaround to fix autorange problem
// for (String n : result.names()) {
// Value val = result.getValue(n);
// if (val.doubleValue() > 0) {
// plottables.put(n, val);
// }
// }
} }
Platform.runLater(() -> timeLabel.setText(TIME_FORMAT.format(LocalDateTime.ofInstant(time, ZoneId.systemDefault())))); Platform.runLater(() -> timeLabel.setText(TIME_FORMAT.format(LocalDateTime.ofInstant(time, ZoneOffset.UTC))));
} }
private void setupView() { private void setupView() {
@ -171,7 +178,6 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
plottables.addPlottable(plot); plottables.addPlottable(plot);
}); });
plottables.setEachConfigValue("thickness", 3); plottables.setEachConfigValue("thickness", 3);
//TODO make history length edittable
plottables.setMaxAge(java.time.Duration.ofHours(3)); plottables.setMaxAge(java.time.Duration.ofHours(3));
plotContainer.setPlot(setupPlot(plottables)); plotContainer.setPlot(setupPlot(plottables));
} }

View File

@ -13,14 +13,6 @@ import hep.dataforge.meta.Annotated;
import hep.dataforge.meta.Meta; import hep.dataforge.meta.Meta;
import hep.dataforge.names.Named; import hep.dataforge.names.Named;
import hep.dataforge.values.Value; import hep.dataforge.values.Value;
import java.io.IOException;
import java.net.URL;
import java.text.DecimalFormat;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.ResourceBundle;
import javafx.application.Platform; import javafx.application.Platform;
import javafx.beans.value.ObservableValue; import javafx.beans.value.ObservableValue;
import javafx.fxml.FXML; import javafx.fxml.FXML;
@ -31,8 +23,16 @@ import javafx.scene.control.Label;
import javafx.scene.paint.Color; import javafx.scene.paint.Color;
import org.controlsfx.control.ToggleSwitch; import org.controlsfx.control.ToggleSwitch;
import java.io.IOException;
import java.net.URL;
import java.text.DecimalFormat;
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneOffset;
import java.time.format.DateTimeFormatter;
import java.util.ResourceBundle;
/** /**
*
* @author Alexander Nozik <altavir@gmail.com> * @author Alexander Nozik <altavir@gmail.com>
*/ */
public class VacuumeterView extends DeviceViewController implements MeasurementListener<Double>, Initializable, Named, Annotated { public class VacuumeterView extends DeviceViewController implements MeasurementListener<Double>, Initializable, Named, Annotated {
@ -89,10 +89,10 @@ public class VacuumeterView extends DeviceViewController implements MeasurementL
Platform.runLater(() -> { Platform.runLater(() -> {
unitLabel.setText(getDevice().meta().getString("units", "mbar")); unitLabel.setText(getDevice().meta().getString("units", "mbar"));
deviceNameLabel.setText(getDevice().getName()); deviceNameLabel.setText(getDevice().getName());
disableButton.setSelected(!getDevice().meta().getBoolean("disabled",false)); disableButton.setSelected(!getDevice().meta().getBoolean("disabled", false));
disableButton.selectedProperty().addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> { disableButton.selectedProperty().addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
getDevice().getConfig().setValue("disabled", !newValue); getDevice().getConfig().setValue("disabled", !newValue);
if(!newValue){ if (!newValue) {
valueLabel.setText("---"); valueLabel.setText("---");
} }
}); });
@ -131,7 +131,7 @@ public class VacuumeterView extends DeviceViewController implements MeasurementL
String resString = FORMAT.format(result); String resString = FORMAT.format(result);
Platform.runLater(() -> { Platform.runLater(() -> {
valueLabel.setText(resString); valueLabel.setText(resString);
setStatus("OK: " + TIME_FORMAT.format(LocalDateTime.ofInstant(time, ZoneId.systemDefault()))); setStatus("OK: " + TIME_FORMAT.format(LocalDateTime.ofInstant(time, ZoneOffset.UTC)));
}); });
} }