[no commit message]
This commit is contained in:
parent
f9e63d9e2c
commit
fef472f22e
@ -438,16 +438,16 @@ public class MspDevice extends SingleMeasurementDevice implements PortHandler.Po
|
||||
this.error("Failed to start scan", null);
|
||||
}
|
||||
} catch (ControlException ex) {
|
||||
onError(ex);
|
||||
error(ex);
|
||||
}
|
||||
onStart();
|
||||
afterStart();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stop(boolean force) throws MeasurementException {
|
||||
try {
|
||||
boolean stop = sendAndWait("ScanStop").isOK();
|
||||
onFinish();
|
||||
afterStop();
|
||||
responseDelegate = null;
|
||||
return stop;
|
||||
} catch (PortException ex) {
|
||||
@ -514,9 +514,9 @@ public class MspDevice extends SingleMeasurementDevice implements PortHandler.Po
|
||||
|
||||
public void error(String errorMessage, Throwable error) {
|
||||
if (error == null) {
|
||||
onError(new MeasurementException(errorMessage));
|
||||
error(new MeasurementException(errorMessage));
|
||||
} else {
|
||||
onError(error);
|
||||
error(error);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -6,8 +6,15 @@
|
||||
package inr.numass.readvac.app;
|
||||
|
||||
import hep.dataforge.control.measurements.Sensor;
|
||||
import hep.dataforge.exceptions.StorageException;
|
||||
import hep.dataforge.io.MetaFileReader;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.points.FormatBuilder;
|
||||
import hep.dataforge.storage.api.PointLoader;
|
||||
import hep.dataforge.storage.api.Storage;
|
||||
import hep.dataforge.storage.commons.LoaderFactory;
|
||||
import hep.dataforge.values.ValueType;
|
||||
import inr.numass.client.NumassClient;
|
||||
import inr.numass.readvac.devices.CM32Device;
|
||||
import inr.numass.readvac.devices.MKSBaratronDevice;
|
||||
import inr.numass.readvac.devices.MKSVacDevice;
|
||||
@ -19,6 +26,8 @@ import javafx.application.Application;
|
||||
import javafx.fxml.FXMLLoader;
|
||||
import javafx.scene.Scene;
|
||||
import javafx.stage.Stage;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -27,6 +36,7 @@ import javafx.stage.Stage;
|
||||
public class ReadVac extends Application {
|
||||
|
||||
VacCollectorController controller;
|
||||
Logger logger = LoggerFactory.getLogger("ReadVac");
|
||||
|
||||
@Override
|
||||
public void start(Stage primaryStage) throws Exception {
|
||||
@ -42,38 +52,64 @@ public class ReadVac extends Application {
|
||||
config = Meta.empty();
|
||||
}
|
||||
|
||||
Sensor<Double> p1 = new MKSVacDevice(config.getString("p1.port","com::/dev/ttyUSB0"));
|
||||
p1.configure(config.getNode("p1",Meta.empty()));
|
||||
p1.setName(config.getString("p1.name","P1"));
|
||||
Sensor<Double> p1 = new MKSVacDevice(config.getString("p1.port", "com::/dev/ttyUSB0"));
|
||||
p1.configure(config.getNode("p1", Meta.empty()));
|
||||
p1.setName(config.getString("p1.name", "P1"));
|
||||
p1.getConfig().putValue("powerButton", true);
|
||||
Sensor<Double> p2 = new CM32Device(config.getString("p2.port","tcp::192.168.111.32:4002"));
|
||||
p1.configure(config.getNode("p2",Meta.empty()));
|
||||
p2.setName(config.getString("p2.name","P2"));
|
||||
Sensor<Double> p3 = new CM32Device(config.getString("p3.port","tcp::192.168.111.32:4003"));
|
||||
p1.configure(config.getNode("p3",Meta.empty()));
|
||||
p3.setName(config.getString("p3.name","P3"));
|
||||
Sensor<Double> px = new VITVacDevice(config.getString("px.port","com::/dev/ttyUSB1"));
|
||||
p1.configure(config.getNode("px",Meta.empty()));
|
||||
px.setName(config.getString("px.name","Px"));
|
||||
Sensor<Double> baratron = new MKSBaratronDevice(config.getString("baratron.port","tcp::192.168.111.33:4004"));
|
||||
baratron.setName(config.getString("baratron.name","Baratron"));
|
||||
p1.configure(config.getNode("baratron",Meta.empty()));
|
||||
Sensor<Double> p2 = new CM32Device(config.getString("p2.port", "tcp::192.168.111.32:4002"));
|
||||
p1.configure(config.getNode("p2", Meta.empty()));
|
||||
p2.setName(config.getString("p2.name", "P2"));
|
||||
Sensor<Double> p3 = new CM32Device(config.getString("p3.port", "tcp::192.168.111.32:4003"));
|
||||
p1.configure(config.getNode("p3", Meta.empty()));
|
||||
p3.setName(config.getString("p3.name", "P3"));
|
||||
Sensor<Double> px = new VITVacDevice(config.getString("px.port", "com::/dev/ttyUSB1"));
|
||||
p1.configure(config.getNode("px", Meta.empty()));
|
||||
px.setName(config.getString("px.name", "Px"));
|
||||
Sensor<Double> baratron = new MKSBaratronDevice(config.getString("baratron.port", "tcp::192.168.111.33:4004"));
|
||||
baratron.setName(config.getString("baratron.name", "Baratron"));
|
||||
p1.configure(config.getNode("baratron", Meta.empty()));
|
||||
|
||||
VacCollectorDevice collector = new VacCollectorDevice();
|
||||
collector.setSensors(p1, p2, p3, px, baratron);
|
||||
collector.init();
|
||||
|
||||
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/VacCollector.fxml"));
|
||||
loader.load();
|
||||
controller = loader.getController();
|
||||
controller.setDevice(collector);
|
||||
controller.setLogger(logger);
|
||||
|
||||
controller.setLoaderFactory((VacCollectorDevice device, Storage localStorage) -> {
|
||||
try {
|
||||
String runName = "";
|
||||
try {
|
||||
logger.info("Obtaining run information from cetral server...");
|
||||
NumassClient client = new NumassClient(config.getString("numass.ip", "192.168.111.1"),
|
||||
config.getInt("numass.port", 8335));
|
||||
runName = client.getCurrentRun().getString("path", "");
|
||||
logger.info("Run name is '{}'", runName);
|
||||
} catch (Exception ex) {
|
||||
logger.warn("Failed to download current run information", ex);
|
||||
}
|
||||
|
||||
FormatBuilder format = new FormatBuilder().setFormat("timestamp", ValueType.TIME);
|
||||
device.getSensors().stream().forEach((s) -> {
|
||||
format.setFormat(s.getName(), ValueType.NUMBER);
|
||||
});
|
||||
|
||||
PointLoader pl = LoaderFactory.buildPointLoder(localStorage, "vactms", runName, "timestamp", format.build());
|
||||
return pl;
|
||||
|
||||
} catch (StorageException ex) {
|
||||
throw new RuntimeException(ex);
|
||||
}
|
||||
});
|
||||
Scene scene = new Scene(loader.getRoot(), 800, 600);
|
||||
|
||||
primaryStage.setTitle("Numass vacuum measurements");
|
||||
primaryStage.setScene(scene);
|
||||
primaryStage.show();
|
||||
controller.startMeasurement();
|
||||
// controller.startMeasurement();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -74,19 +74,19 @@ public class CM32Device extends PortSensor<Double> {
|
||||
String answer = getHandler().sendAndWait(CM32_QUERY, timeout());
|
||||
|
||||
if (answer.isEmpty()) {
|
||||
this.onProgressUpdate("No signal");
|
||||
this.progressUpdate("No signal");
|
||||
updateState(CONNECTION_STATE, false);
|
||||
return null;
|
||||
} else if (answer.indexOf("PM1:mbar") < -1) {
|
||||
this.onProgressUpdate("Wrong answer: " + answer);
|
||||
this.progressUpdate("Wrong answer: " + answer);
|
||||
updateState(CONNECTION_STATE, false);
|
||||
return null;
|
||||
} else if (answer.substring(14, 17).equals("OFF")) {
|
||||
this.onProgressUpdate("Off");
|
||||
this.progressUpdate("Off");
|
||||
updateState(CONNECTION_STATE, true);
|
||||
return null;
|
||||
} else {
|
||||
this.onProgressUpdate("OK");
|
||||
this.progressUpdate("OK");
|
||||
updateState(CONNECTION_STATE, true);
|
||||
return Double.parseDouble(answer.substring(14, 17) + answer.substring(19, 23));
|
||||
}
|
||||
|
@ -6,15 +6,12 @@
|
||||
package inr.numass.readvac.devices;
|
||||
|
||||
import hep.dataforge.control.devices.PortSensor;
|
||||
import static hep.dataforge.control.devices.PortSensor.CONNECTION_STATE;
|
||||
import hep.dataforge.control.measurements.Measurement;
|
||||
import hep.dataforge.control.measurements.Sensor;
|
||||
import hep.dataforge.control.measurements.SimpleMeasurement;
|
||||
import hep.dataforge.control.ports.ComPortHandler;
|
||||
import hep.dataforge.control.ports.PortHandler;
|
||||
import hep.dataforge.description.ValueDef;
|
||||
import hep.dataforge.exceptions.ControlException;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -27,17 +24,6 @@ public class MKSBaratronDevice extends PortSensor<Double> {
|
||||
super(portName);
|
||||
}
|
||||
|
||||
private String talk(String request) throws ControlException {
|
||||
String answer = getHandler().sendAndWait(String.format("%s\r", request), timeout());
|
||||
|
||||
Matcher match = Pattern.compile("(.*)\r").matcher(answer);
|
||||
if (match.matches()) {
|
||||
return match.group(1);
|
||||
} else {
|
||||
throw new ControlException(answer);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Measurement<Double> createMeasurement() {
|
||||
return new BaratronMeasurement();
|
||||
@ -54,7 +40,7 @@ public class MKSBaratronDevice extends PortSensor<Double> {
|
||||
handler.setDelimeter("\r");
|
||||
return handler;
|
||||
}
|
||||
|
||||
|
||||
private int getChannel() {
|
||||
return meta().getInt("channel", 2);
|
||||
}
|
||||
@ -63,20 +49,22 @@ public class MKSBaratronDevice extends PortSensor<Double> {
|
||||
|
||||
@Override
|
||||
protected synchronized Double doMeasure() throws Exception {
|
||||
|
||||
String answer = talk("AV" + getChannel());
|
||||
String answer = getHandler().sendAndWait("AV" + getChannel() + "\r", timeout());
|
||||
if (answer == null || answer.isEmpty()) {
|
||||
// invalidateState("connection");
|
||||
this.onProgressUpdate("No connection");
|
||||
updateState(CONNECTION_STATE, false);
|
||||
this.progressUpdate("No connection");
|
||||
return null;
|
||||
} else {
|
||||
updateState(CONNECTION_STATE, true);
|
||||
}
|
||||
double res = Double.parseDouble(answer);
|
||||
if (res <= 0) {
|
||||
this.onProgressUpdate("Non positive");
|
||||
this.progressUpdate("Non positive");
|
||||
// invalidateState("power");
|
||||
return null;
|
||||
} else {
|
||||
this.onProgressUpdate("OK");
|
||||
this.progressUpdate("OK");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
@ -137,16 +137,16 @@ public class MKSVacDevice extends PortSensor<Double> {
|
||||
String answer = talk("PR" + getChannel() + "?");
|
||||
if (answer == null || answer.isEmpty()) {
|
||||
invalidateState("connection");
|
||||
this.onProgressUpdate("No connection");
|
||||
this.progressUpdate("No connection");
|
||||
return null;
|
||||
}
|
||||
double res = Double.parseDouble(answer);
|
||||
if (res <= 0) {
|
||||
this.onProgressUpdate("Non positive");
|
||||
this.progressUpdate("Non positive");
|
||||
invalidateState("power");
|
||||
return null;
|
||||
} else {
|
||||
this.onProgressUpdate("OK");
|
||||
this.progressUpdate("OK");
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
@ -72,7 +72,7 @@ public class VITVacDevice extends PortSensor<Double> {
|
||||
String answer = getHandler().sendAndWait(VIT_QUERY, timeout());
|
||||
|
||||
if (answer.isEmpty()) {
|
||||
this.onProgressUpdate("No signal");
|
||||
this.progressUpdate("No signal");
|
||||
updateState("connection", false);
|
||||
return null;
|
||||
} else {
|
||||
@ -86,11 +86,11 @@ public class VITVacDevice extends PortSensor<Double> {
|
||||
}
|
||||
BigDecimal res = BigDecimal.valueOf(base * Math.pow(10, exp));
|
||||
res = res.setScale(4, RoundingMode.CEILING);
|
||||
this.onProgressUpdate("OK");
|
||||
this.progressUpdate("OK");
|
||||
updateState("connection", true);
|
||||
return res.doubleValue();
|
||||
} else {
|
||||
this.onProgressUpdate("Wrong answer: " + answer);
|
||||
this.progressUpdate("Wrong answer: " + answer);
|
||||
updateState("connection", false);
|
||||
return null;
|
||||
}
|
||||
|
@ -11,10 +11,12 @@ import hep.dataforge.control.connections.Roles;
|
||||
import hep.dataforge.control.devices.annotations.RoleDef;
|
||||
import hep.dataforge.control.measurements.AbstractMeasurement;
|
||||
import hep.dataforge.control.measurements.Measurement;
|
||||
import hep.dataforge.control.measurements.MeasurementListener;
|
||||
import hep.dataforge.control.measurements.Sensor;
|
||||
import hep.dataforge.points.DataPoint;
|
||||
import hep.dataforge.exceptions.ControlException;
|
||||
import hep.dataforge.exceptions.MeasurementException;
|
||||
import hep.dataforge.points.MapPoint;
|
||||
import hep.dataforge.points.PointListener;
|
||||
import hep.dataforge.values.Value;
|
||||
import java.time.Instant;
|
||||
@ -26,6 +28,8 @@ import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.ScheduledExecutorService;
|
||||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.BiConsumer;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
*
|
||||
@ -103,7 +107,6 @@ public class VacCollectorDevice extends Sensor<DataPoint> {
|
||||
Object value = entry.getValue().read();
|
||||
collector.put(entry.getKey(), value);
|
||||
} catch (Exception ex) {
|
||||
onError(ex);
|
||||
collector.put(entry.getKey(), Value.NULL);
|
||||
}
|
||||
});
|
||||
@ -118,15 +121,25 @@ public class VacCollectorDevice extends Sensor<DataPoint> {
|
||||
});
|
||||
}
|
||||
|
||||
private DataPoint terminator() {
|
||||
MapPoint p = new MapPoint();
|
||||
p.putValue("timestamp", Instant.now());
|
||||
sensorMap.keySet().stream().forEach((n) -> {
|
||||
p.putValue(n, null);
|
||||
});
|
||||
return p;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean stop(boolean force) {
|
||||
boolean isRunning = currentTask != null;
|
||||
if (isRunning) {
|
||||
getLogger().debug("Stoping vacuum collector measurement");
|
||||
getLogger().debug("Stoping vacuum collector measurement. Writing terminator point");
|
||||
result(terminator());
|
||||
currentTask.cancel(force);
|
||||
executor.shutdown();
|
||||
currentTask = null;
|
||||
onFinish();
|
||||
afterStop();
|
||||
}
|
||||
return isRunning;
|
||||
}
|
||||
|
@ -19,6 +19,7 @@ import hep.dataforge.exceptions.StorageException;
|
||||
import hep.dataforge.meta.Meta;
|
||||
import hep.dataforge.meta.MetaBuilder;
|
||||
import hep.dataforge.plots.PlotFrame;
|
||||
import hep.dataforge.plots.XYPlottable;
|
||||
import hep.dataforge.plots.data.DynamicPlottable;
|
||||
import hep.dataforge.plots.data.DynamicPlottableSet;
|
||||
import hep.dataforge.plots.fx.PlotContainer;
|
||||
@ -32,6 +33,7 @@ import hep.dataforge.storage.commons.StorageManager;
|
||||
import hep.dataforge.values.Value;
|
||||
import hep.dataforge.values.ValueType;
|
||||
import inr.numass.readvac.devices.VacCollectorDevice;
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.time.Instant;
|
||||
import java.time.LocalDateTime;
|
||||
@ -40,7 +42,9 @@ import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.ResourceBundle;
|
||||
import java.util.stream.Collectors;
|
||||
import java.util.function.BiFunction;
|
||||
import java.util.function.Function;
|
||||
import java.util.logging.Level;
|
||||
import javafx.application.Platform;
|
||||
import javafx.beans.value.ObservableValue;
|
||||
import javafx.collections.FXCollections;
|
||||
@ -52,6 +56,7 @@ import javafx.scene.control.Label;
|
||||
import javafx.scene.control.ToggleButton;
|
||||
import javafx.scene.layout.AnchorPane;
|
||||
import javafx.scene.layout.VBox;
|
||||
import javafx.stage.DirectoryChooser;
|
||||
import javafx.util.Duration;
|
||||
import org.controlsfx.control.Notifications;
|
||||
import org.slf4j.Logger;
|
||||
@ -64,7 +69,7 @@ import org.slf4j.LoggerFactory;
|
||||
*/
|
||||
public class VacCollectorController implements Initializable, DeviceListener, MeasurementListener<DataPoint> {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger("ValCollector");
|
||||
private Logger logger;
|
||||
|
||||
private final DateTimeFormatter TIME_FORMAT = DateTimeFormatter.ISO_LOCAL_DATE_TIME;
|
||||
|
||||
@ -77,6 +82,7 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
|
||||
private final List<VacuumeterView> views = new ArrayList<>();
|
||||
private PlotContainer plotContainer;
|
||||
private DynamicPlottableSet plottables;
|
||||
private BiFunction<VacCollectorDevice, Storage, PointLoader> loaderFactory;
|
||||
|
||||
@FXML
|
||||
private AnchorPane plotHolder;
|
||||
@ -149,6 +155,7 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
|
||||
plot.configure(controller.meta());
|
||||
plottables.addPlottable(plot);
|
||||
});
|
||||
plottables.setEachConfigValue("thickness", 3);
|
||||
plotContainer.setPlot(setupPlot(plottables));
|
||||
}
|
||||
|
||||
@ -198,30 +205,70 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
|
||||
}
|
||||
}
|
||||
|
||||
public void setLoaderFactory(BiFunction<VacCollectorDevice, Storage, PointLoader> loaderFactory) {
|
||||
this.loaderFactory = loaderFactory;
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void onStartStopToggle(ActionEvent event) throws ControlException {
|
||||
private void onStartStopToggle(ActionEvent event) {
|
||||
if (startStopButton.isSelected() != getDevice().isMeasuring()) {
|
||||
if (startStopButton.isSelected()) {
|
||||
startMeasurement();
|
||||
} else {
|
||||
stopMeasurement();
|
||||
}
|
||||
//Starting measurement on non-UI thread
|
||||
new Thread(() -> {
|
||||
if (startStopButton.isSelected()) {
|
||||
try {
|
||||
startMeasurement();
|
||||
} catch (ControlException ex) {
|
||||
getLogger().error("Failed to start measurement", ex);
|
||||
startStopButton.setSelected(false);
|
||||
}
|
||||
} else {
|
||||
stopMeasurement();
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
}
|
||||
|
||||
@FXML
|
||||
private void onStoreToggle(ActionEvent event) {
|
||||
if (storeButton.isSelected()) {
|
||||
try {
|
||||
Meta storageConfig = device.meta().getNode("storage");
|
||||
Storage storage = StorageManager.buildFrom(device.getContext())
|
||||
.buildStorage(storageConfig);
|
||||
storageConnection = new LoaderConnection(storage, device.meta().getString("storage.shelf", ""));
|
||||
device.connect(storageConnection, Roles.STORAGE_ROLE);
|
||||
} catch (Exception ex) {
|
||||
logger.error("Failed to start data storing", ex);
|
||||
storeButton.setSelected(false);
|
||||
//creating storage on UI thread
|
||||
if (!device.meta().hasNode("storage")) {
|
||||
getLogger().info("Storage not defined. Starting storage selection dialog");
|
||||
DirectoryChooser chooser = new DirectoryChooser();
|
||||
File storageDir = chooser.showDialog(plotHolder.getScene().getWindow());
|
||||
if (storageDir == null) {
|
||||
throw new RuntimeException("User canceled directory selection");
|
||||
}
|
||||
device.getConfig().putNode(new MetaBuilder("storage")
|
||||
.putValue("path", storageDir.getAbsolutePath()));
|
||||
}
|
||||
Meta storageConfig = device.meta().getNode("storage");
|
||||
Storage localStorage = StorageManager.buildFrom(device.getContext())
|
||||
.buildStorage(storageConfig);
|
||||
//Start storage creation on non-UI thread
|
||||
new Thread(() -> {
|
||||
try {
|
||||
|
||||
PointLoader loader;
|
||||
|
||||
if (loaderFactory != null) {
|
||||
loader = loaderFactory.apply(device, localStorage);
|
||||
} else {
|
||||
FormatBuilder format = new FormatBuilder().setFormat("timestamp", ValueType.TIME);
|
||||
device.getSensors().stream().forEach((s) -> {
|
||||
format.setFormat(s.getName(), ValueType.NUMBER);
|
||||
});
|
||||
|
||||
loader = LoaderFactory.buildPointLoder(localStorage, "vactms",
|
||||
device.meta().getString("storage.shelf", ""), "timestamp", format.build());
|
||||
}
|
||||
storageConnection = new LoaderConnection(loader);
|
||||
device.connect(storageConnection, Roles.STORAGE_ROLE);
|
||||
} catch (Exception ex) {
|
||||
getLogger().error("Failed to start data storing", ex);
|
||||
storeButton.setSelected(false);
|
||||
}
|
||||
}).start();
|
||||
} else if (storageConnection != null) {
|
||||
device.disconnect(storageConnection);
|
||||
}
|
||||
@ -231,15 +278,29 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
|
||||
private void onLogToggle(ActionEvent event) {
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the logger
|
||||
*/
|
||||
public Logger getLogger() {
|
||||
if (logger == null) {
|
||||
logger = LoggerFactory.getLogger("ValCollector");
|
||||
}
|
||||
return logger;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param logger the logger to set
|
||||
*/
|
||||
public void setLogger(Logger logger) {
|
||||
this.logger = logger;
|
||||
}
|
||||
|
||||
private class LoaderConnection implements PointListener, Connection<Device> {
|
||||
|
||||
private final PointLoader loader;
|
||||
|
||||
public LoaderConnection(Storage storage, String shelfName) throws StorageException {
|
||||
this.loader = LoaderFactory.buildPointLoder(storage, "vactms", shelfName, "timestamp",
|
||||
new FormatBuilder(device.getSensors().stream().map(sensor -> sensor.getName()).collect(Collectors.toList()))
|
||||
.setFormat("timestamp", ValueType.TIME)
|
||||
.build());
|
||||
public LoaderConnection(PointLoader loader) {
|
||||
this.loader = loader;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -247,7 +308,7 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
|
||||
try {
|
||||
loader.push(point);
|
||||
} catch (StorageException ex) {
|
||||
logger.error("Error while pushing data", ex);
|
||||
getLogger().error("Error while pushing data", ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,7 @@ import javafx.scene.paint.Color;
|
||||
*/
|
||||
public class VacuumeterView extends DeviceViewController implements MeasurementListener<Double>, Initializable, Named, Annotated {
|
||||
|
||||
private static final DecimalFormat FORMAT = new DecimalFormat("0.##E0");
|
||||
private static final DecimalFormat FORMAT = new DecimalFormat("0.###E0");
|
||||
private static final DateTimeFormatter TIME_FORMAT = DateTimeFormatter.ISO_LOCAL_TIME;
|
||||
|
||||
protected Node node;
|
||||
|
@ -56,7 +56,7 @@ public class TestVac extends Application {
|
||||
collector.setSensors(sensor1, sensor2, sensor3);
|
||||
collector.init();
|
||||
|
||||
collector.getConfig().putNode(new MetaBuilder("storage").putValue("path", "D:\\temp\\test").putValue("monitor", false));
|
||||
// collector.getConfig().putNode(new MetaBuilder("storage").putValue("path", "D:\\temp\\test"));
|
||||
|
||||
FXMLLoader loader = new FXMLLoader(getClass().getResource("/fxml/VacCollector.fxml"));
|
||||
loader.load();
|
||||
|
@ -17,22 +17,19 @@
|
||||
<children>
|
||||
<VBox layoutX="50.0" layoutY="6.0" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||
<children>
|
||||
<AnchorPane styleClass="namePane">
|
||||
<children>
|
||||
<AnchorPane styleClass="namePane">
|
||||
<children>
|
||||
<Label id="name" fx:id="deviceNameLabel" alignment="CENTER" prefHeight="40.0" text="device Name" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
</AnchorPane>
|
||||
<Separator />
|
||||
<BorderPane>
|
||||
<left>
|
||||
<Label id="pressure" fx:id="valueLabel" alignment="CENTER_RIGHT" prefHeight="60.0" prefWidth="100.0" text="#.##E-0" BorderPane.alignment="CENTER" />
|
||||
<Label id="pressure" fx:id="valueLabel" alignment="CENTER_RIGHT" minWidth="110.0" prefHeight="60.0" text="--- " BorderPane.alignment="CENTER" />
|
||||
</left>
|
||||
<right>
|
||||
<Label id="units" fx:id="unitLabel" prefHeight="60.0" prefWidth="75.0" text="mbar" BorderPane.alignment="CENTER" />
|
||||
<Label id="units" fx:id="unitLabel" prefHeight="60.0" prefWidth="75.0" text=" mbar" BorderPane.alignment="CENTER" />
|
||||
</right>
|
||||
<center>
|
||||
<Pane minWidth="-Infinity" prefWidth="25.0" BorderPane.alignment="CENTER" />
|
||||
</center>
|
||||
</BorderPane>
|
||||
<Separator />
|
||||
<Pane minHeight="30.0" prefHeight="30.0" VBox.vgrow="ALWAYS">
|
||||
@ -40,15 +37,15 @@
|
||||
<ToggleSwitch fx:id="powerSwitch" layoutX="58.0" layoutY="5.0" text="Power" />
|
||||
</children>
|
||||
</Pane>
|
||||
<Separator />
|
||||
<AnchorPane styleClass="statusPane">
|
||||
<children>
|
||||
<Label fx:id="status" maxWidth="200.0" text="Initializing" wrapText="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</AnchorPane>
|
||||
<Separator />
|
||||
<AnchorPane styleClass="statusPane">
|
||||
<children>
|
||||
<Label fx:id="status" maxWidth="200.0" text="Initializing" wrapText="true" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0" />
|
||||
</children>
|
||||
<padding>
|
||||
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||
</padding>
|
||||
</AnchorPane>
|
||||
</children>
|
||||
</VBox>
|
||||
</children>
|
||||
|
@ -6,7 +6,6 @@
|
||||
<?import javafx.scene.control.Separator?>
|
||||
<?import javafx.scene.layout.AnchorPane?>
|
||||
<?import javafx.scene.layout.BorderPane?>
|
||||
<?import javafx.scene.layout.Pane?>
|
||||
<?import javafx.scene.layout.VBox?>
|
||||
|
||||
<AnchorPane styleClass="vacBox" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1">
|
||||
@ -24,14 +23,11 @@
|
||||
<Separator />
|
||||
<BorderPane VBox.vgrow="ALWAYS">
|
||||
<left>
|
||||
<Label id="pressure" fx:id="valueLabel" alignment="CENTER_RIGHT" prefHeight="60.0" prefWidth="100.0" text="#.##E-0" BorderPane.alignment="CENTER" />
|
||||
<Label id="pressure" fx:id="valueLabel" alignment="CENTER_RIGHT" minWidth="110.0" prefHeight="60.0" text="--- " BorderPane.alignment="CENTER" />
|
||||
</left>
|
||||
<right>
|
||||
<Label id="units" fx:id="unitLabel" prefHeight="60.0" prefWidth="75.0" text="mbar" BorderPane.alignment="CENTER" />
|
||||
<Label id="units" fx:id="unitLabel" prefHeight="60.0" prefWidth="75.0" text=" mbar" BorderPane.alignment="CENTER" />
|
||||
</right>
|
||||
<center>
|
||||
<Pane minWidth="-Infinity" prefWidth="25.0" BorderPane.alignment="CENTER" />
|
||||
</center>
|
||||
</BorderPane>
|
||||
<Separator />
|
||||
<AnchorPane styleClass="statusPane">
|
||||
|
@ -35,7 +35,7 @@
|
||||
<Label text="Interval: " />
|
||||
<ChoiceBox fx:id="intervalSelector" prefWidth="150.0" />
|
||||
<Separator orientation="VERTICAL" />
|
||||
<Pane maxWidth="1.7976931348623157E308" />
|
||||
<Pane HBox.hgrow="ALWAYS" />
|
||||
<Separator orientation="VERTICAL" />
|
||||
<ToggleButton fx:id="logButton" mnemonicParsing="false" onAction="#onLogToggle" text="Log" />
|
||||
</items>
|
||||
|
@ -57,6 +57,7 @@ public class NumassClient extends MessageFactory implements Closeable {
|
||||
|
||||
public NumassClient(String address, int port) throws IOException {
|
||||
socket = new Socket(address, port);
|
||||
socket.setSoTimeout(300);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
Reference in New Issue
Block a user