[no commit message]
This commit is contained in:
parent
2e0cbaee97
commit
0c0d9f2aa4
@ -1,6 +1,6 @@
|
|||||||
apply plugin: 'application'
|
apply plugin: 'application'
|
||||||
|
|
||||||
version = "0.2.3"
|
version = "0.2.4"
|
||||||
|
|
||||||
if (!hasProperty('mainClass')) {
|
if (!hasProperty('mainClass')) {
|
||||||
ext.mainClass = 'inr.numass.control.msp.fx.MspApp'
|
ext.mainClass = 'inr.numass.control.msp.fx.MspApp'
|
||||||
|
@ -18,6 +18,7 @@ package inr.numass.control.msp;
|
|||||||
import hep.dataforge.control.connections.Roles;
|
import hep.dataforge.control.connections.Roles;
|
||||||
import hep.dataforge.control.connections.StorageConnection;
|
import hep.dataforge.control.connections.StorageConnection;
|
||||||
import hep.dataforge.control.devices.SingleMeasurementDevice;
|
import hep.dataforge.control.devices.SingleMeasurementDevice;
|
||||||
|
import hep.dataforge.control.devices.annotations.RoleDef;
|
||||||
import hep.dataforge.control.measurements.AbstractMeasurement;
|
import hep.dataforge.control.measurements.AbstractMeasurement;
|
||||||
import hep.dataforge.control.measurements.Measurement;
|
import hep.dataforge.control.measurements.Measurement;
|
||||||
import hep.dataforge.control.ports.PortHandler;
|
import hep.dataforge.control.ports.PortHandler;
|
||||||
@ -48,6 +49,7 @@ import java.util.function.Consumer;
|
|||||||
*
|
*
|
||||||
* @author Alexander Nozik
|
* @author Alexander Nozik
|
||||||
*/
|
*/
|
||||||
|
@RoleDef(name = Roles.STORAGE_ROLE)
|
||||||
public class MspDevice extends SingleMeasurementDevice implements PortHandler.PortController {
|
public class MspDevice extends SingleMeasurementDevice implements PortHandler.PortController {
|
||||||
|
|
||||||
// private static final String PEAK_SET_PATH = "peakJump.peak";
|
// private static final String PEAK_SET_PATH = "peakJump.peak";
|
||||||
@ -64,7 +66,6 @@ public class MspDevice extends SingleMeasurementDevice implements PortHandler.Po
|
|||||||
// public MspDevice(String name, Context context, Meta config) {
|
// public MspDevice(String name, Context context, Meta config) {
|
||||||
// super(name, context, config);
|
// super(name, context, config);
|
||||||
// }
|
// }
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void init() throws ControlException {
|
public void init() throws ControlException {
|
||||||
super.init();
|
super.init();
|
||||||
@ -126,7 +127,7 @@ public class MspDevice extends SingleMeasurementDevice implements PortHandler.Po
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void command(String commandName, Value argument) throws ControlException {
|
public void command(String commandName, Value argument) throws ControlException {
|
||||||
switch(commandName){
|
switch (commandName) {
|
||||||
case "connect":
|
case "connect":
|
||||||
setConnected(argument.booleanValue());
|
setConnected(argument.booleanValue());
|
||||||
case "setFilamentOn":
|
case "setFilamentOn":
|
||||||
@ -139,6 +140,9 @@ public class MspDevice extends SingleMeasurementDevice implements PortHandler.Po
|
|||||||
/**
|
/**
|
||||||
* Startup MSP: get available sensors, select sensor and control.
|
* Startup MSP: get available sensors, select sensor and control.
|
||||||
*
|
*
|
||||||
|
* @param connected
|
||||||
|
* @return
|
||||||
|
* @throws hep.dataforge.exceptions.ControlException
|
||||||
*/
|
*/
|
||||||
public boolean setConnected(boolean connected) throws ControlException {
|
public boolean setConnected(boolean connected) throws ControlException {
|
||||||
String sensorName;
|
String sensorName;
|
||||||
@ -216,7 +220,7 @@ public class MspDevice extends SingleMeasurementDevice implements PortHandler.Po
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Send specific command and wait for its results (the result must begin
|
* Send specific command and wait for its results (the result must begin
|
||||||
with command name)
|
* with command name)
|
||||||
*
|
*
|
||||||
* @param commandName
|
* @param commandName
|
||||||
* @param paremeters
|
* @param paremeters
|
||||||
@ -393,7 +397,7 @@ public class MspDevice extends SingleMeasurementDevice implements PortHandler.Po
|
|||||||
Format format = builder.build();
|
Format format = builder.build();
|
||||||
|
|
||||||
//TODO Переделать!!!
|
//TODO Переделать!!!
|
||||||
String run = meta().getString("numass.run", "");
|
String run = meta().getString("storage.run", "");
|
||||||
|
|
||||||
String suffix = Integer.toString((int) Instant.now().toEpochMilli());
|
String suffix = Integer.toString((int) Instant.now().toEpochMilli());
|
||||||
PointLoader loader = LoaderFactory
|
PointLoader loader = LoaderFactory
|
||||||
@ -423,6 +427,7 @@ public class MspDevice extends SingleMeasurementDevice implements PortHandler.Po
|
|||||||
throw new ControlException("Can't add mass to measurement measurement for msp");
|
throw new ControlException("Can't add mass to measurement measurement for msp");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
prepareLoaders();
|
||||||
} else {
|
} else {
|
||||||
throw new ControlException("Can't create measurement for msp");
|
throw new ControlException("Can't create measurement for msp");
|
||||||
}
|
}
|
||||||
|
@ -17,6 +17,8 @@ package inr.numass.control.msp.fx;
|
|||||||
|
|
||||||
import hep.dataforge.context.Context;
|
import hep.dataforge.context.Context;
|
||||||
import hep.dataforge.context.GlobalContext;
|
import hep.dataforge.context.GlobalContext;
|
||||||
|
import hep.dataforge.control.connections.Roles;
|
||||||
|
import hep.dataforge.control.connections.StorageConnection;
|
||||||
import hep.dataforge.points.MapPoint;
|
import hep.dataforge.points.MapPoint;
|
||||||
import hep.dataforge.exceptions.ControlException;
|
import hep.dataforge.exceptions.ControlException;
|
||||||
import hep.dataforge.exceptions.PortException;
|
import hep.dataforge.exceptions.PortException;
|
||||||
@ -28,6 +30,8 @@ import hep.dataforge.meta.MetaBuilder;
|
|||||||
import hep.dataforge.plots.data.DynamicPlottable;
|
import hep.dataforge.plots.data.DynamicPlottable;
|
||||||
import hep.dataforge.plots.data.DynamicPlottableSet;
|
import hep.dataforge.plots.data.DynamicPlottableSet;
|
||||||
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
|
import hep.dataforge.plots.jfreechart.JFreeChartFrame;
|
||||||
|
import hep.dataforge.storage.commons.StorageManager;
|
||||||
|
import hep.dataforge.storage.filestorage.FileStorage;
|
||||||
import hep.dataforge.values.Value;
|
import hep.dataforge.values.Value;
|
||||||
import inr.numass.control.msp.MspDevice;
|
import inr.numass.control.msp.MspDevice;
|
||||||
import inr.numass.control.msp.MspListener;
|
import inr.numass.control.msp.MspListener;
|
||||||
@ -155,14 +159,17 @@ public class MspViewController implements Initializable, MspListener {
|
|||||||
device.setName(mspName);
|
device.setName(mspName);
|
||||||
device.setContext(context);
|
device.setContext(context);
|
||||||
device.setMeta(mspConfig);
|
device.setMeta(mspConfig);
|
||||||
|
if (mspConfig.hasNode("storage")) {
|
||||||
|
device.connect(new StorageConnection(StorageManager.buildFrom(context).buildStorage(mspConfig.getNode("storage"))), Roles.STORAGE_ROLE);
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
getDevice().setListener(this);
|
getDevice().setListener(this);
|
||||||
getDevice().init();
|
getDevice().init();
|
||||||
// getDevice().startMeasurement("peakJump");
|
// getDevice().startMeasurement("peakJump");
|
||||||
} catch (ControlException ex) {
|
} catch (ControlException ex) {
|
||||||
showError(String.format("Can't connect to %s:%d. The port is either busy or not the MKS mass-spectrometer port",
|
showError(String.format("Can't connect to %s:%d. The port is either busy or not the MKS mass-spectrometer port",
|
||||||
config.getString("connection.ip", "127.0.0.1"),
|
device.meta().getString("connection.ip", "127.0.0.1"),
|
||||||
config.getInt("connection.port", 10014)));
|
device.meta().getInt("connection.port", 10014)));
|
||||||
throw new RuntimeException("Can't connect to device");
|
throw new RuntimeException("Can't connect to device");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
@ -3,7 +3,7 @@ apply plugin: 'application'
|
|||||||
version = "0.4.0"
|
version = "0.4.0"
|
||||||
|
|
||||||
if (!hasProperty('mainClass')) {
|
if (!hasProperty('mainClass')) {
|
||||||
ext.mainClass = 'inr.numass.readvac.Main'
|
ext.mainClass = 'inr.numass.readvac.app.ReadVac'
|
||||||
}
|
}
|
||||||
mainClassName = mainClass
|
mainClassName = mainClass
|
||||||
|
|
||||||
|
@ -55,21 +55,21 @@ public class ReadVac extends Application {
|
|||||||
Sensor<Double> p1 = new MKSVacDevice(config.getString("p1.port", "com::/dev/ttyUSB0"));
|
Sensor<Double> p1 = new MKSVacDevice(config.getString("p1.port", "com::/dev/ttyUSB0"));
|
||||||
p1.configure(config.getNode("p1", Meta.empty()));
|
p1.configure(config.getNode("p1", Meta.empty()));
|
||||||
p1.setName(config.getString("p1.name", "P1"));
|
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"));
|
Sensor<Double> p2 = new CM32Device(config.getString("p2.port", "tcp::192.168.111.32:4002"));
|
||||||
p1.configure(config.getNode("p2", Meta.empty()));
|
p2.configure(config.getNode("p2", Meta.empty()));
|
||||||
p2.setName(config.getString("p2.name", "P2"));
|
p2.setName(config.getString("p2.name", "P2"));
|
||||||
Sensor<Double> p3 = new CM32Device(config.getString("p3.port", "tcp::192.168.111.32:4003"));
|
Sensor<Double> p3 = new CM32Device(config.getString("p3.port", "tcp::192.168.111.32:4003"));
|
||||||
p1.configure(config.getNode("p3", Meta.empty()));
|
p3.configure(config.getNode("p3", Meta.empty()));
|
||||||
p3.setName(config.getString("p3.name", "P3"));
|
p3.setName(config.getString("p3.name", "P3"));
|
||||||
Sensor<Double> px = new VITVacDevice(config.getString("px.port", "com::/dev/ttyUSB1"));
|
Sensor<Double> px = new VITVacDevice(config.getString("px.port", "com::/dev/ttyUSB1"));
|
||||||
p1.configure(config.getNode("px", Meta.empty()));
|
px.configure(config.getNode("px", Meta.empty()));
|
||||||
px.setName(config.getString("px.name", "Px"));
|
px.setName(config.getString("px.name", "Px"));
|
||||||
Sensor<Double> baratron = new MKSBaratronDevice(config.getString("baratron.port", "tcp::192.168.111.33:4004"));
|
Sensor<Double> baratron = new MKSBaratronDevice(config.getString("baratron.port", "tcp::192.168.111.33:4004"));
|
||||||
|
baratron.configure(config.getNode("baratron", Meta.empty()));
|
||||||
baratron.setName(config.getString("baratron.name", "Baratron"));
|
baratron.setName(config.getString("baratron.name", "Baratron"));
|
||||||
p1.configure(config.getNode("baratron", Meta.empty()));
|
|
||||||
|
|
||||||
VacCollectorDevice collector = new VacCollectorDevice();
|
VacCollectorDevice collector = new VacCollectorDevice();
|
||||||
|
collector.configure(config);
|
||||||
collector.setSensors(p1, p2, p3, px, baratron);
|
collector.setSensors(p1, p2, p3, px, baratron);
|
||||||
collector.init();
|
collector.init();
|
||||||
|
|
||||||
@ -81,7 +81,8 @@ public class ReadVac extends Application {
|
|||||||
|
|
||||||
controller.setLoaderFactory((VacCollectorDevice device, Storage localStorage) -> {
|
controller.setLoaderFactory((VacCollectorDevice device, Storage localStorage) -> {
|
||||||
try {
|
try {
|
||||||
String runName = "";
|
String runName = device.meta().getString("storage.run", "");
|
||||||
|
if (config.hasNode("numass")) {
|
||||||
try {
|
try {
|
||||||
logger.info("Obtaining run information from cetral server...");
|
logger.info("Obtaining run information from cetral server...");
|
||||||
NumassClient client = new NumassClient(config.getString("numass.ip", "192.168.111.1"),
|
NumassClient client = new NumassClient(config.getString("numass.ip", "192.168.111.1"),
|
||||||
@ -91,6 +92,7 @@ public class ReadVac extends Application {
|
|||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
logger.warn("Failed to download current run information", ex);
|
logger.warn("Failed to download current run information", ex);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
FormatBuilder format = new FormatBuilder().setFormat("timestamp", ValueType.TIME);
|
FormatBuilder format = new FormatBuilder().setFormat("timestamp", ValueType.TIME);
|
||||||
device.getSensors().stream().forEach((s) -> {
|
device.getSensors().stream().forEach((s) -> {
|
||||||
@ -104,7 +106,7 @@ public class ReadVac extends Application {
|
|||||||
throw new RuntimeException(ex);
|
throw new RuntimeException(ex);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Scene scene = new Scene(loader.getRoot(), 800, 600);
|
Scene scene = new Scene(loader.getRoot(), 800, 700);
|
||||||
|
|
||||||
primaryStage.setTitle("Numass vacuum measurements");
|
primaryStage.setTitle("Numass vacuum measurements");
|
||||||
primaryStage.setScene(scene);
|
primaryStage.setScene(scene);
|
||||||
|
@ -9,6 +9,7 @@ import hep.dataforge.control.devices.PortSensor;
|
|||||||
import hep.dataforge.control.measurements.Measurement;
|
import hep.dataforge.control.measurements.Measurement;
|
||||||
import hep.dataforge.control.measurements.SimpleMeasurement;
|
import hep.dataforge.control.measurements.SimpleMeasurement;
|
||||||
import hep.dataforge.control.ports.ComPortHandler;
|
import hep.dataforge.control.ports.ComPortHandler;
|
||||||
|
import hep.dataforge.control.ports.PortFactory;
|
||||||
import hep.dataforge.control.ports.PortHandler;
|
import hep.dataforge.control.ports.PortHandler;
|
||||||
import hep.dataforge.description.ValueDef;
|
import hep.dataforge.description.ValueDef;
|
||||||
import hep.dataforge.exceptions.ControlException;
|
import hep.dataforge.exceptions.ControlException;
|
||||||
@ -28,9 +29,14 @@ public class CM32Device extends PortSensor<Double> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected PortHandler buildHandler(String portName) throws ControlException {
|
protected PortHandler buildHandler(String portName) throws ControlException {
|
||||||
String port = meta().getString("port", portName);
|
getLogger().info("Connecting to port {}", portName);
|
||||||
PortHandler newHandler = new ComPortHandler(port, 2400, 8, 1, 0);
|
PortHandler newHandler;
|
||||||
newHandler.setDelimeter("T--");
|
if (portName.startsWith("com")) {
|
||||||
|
newHandler = new ComPortHandler(portName, 2400, 8, 1, 0);
|
||||||
|
} else {
|
||||||
|
newHandler = PortFactory.getdPort(portName);
|
||||||
|
}
|
||||||
|
newHandler.setDelimeter("T--\r");
|
||||||
return newHandler;
|
return newHandler;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,6 +50,10 @@ public class CM32Device extends PortSensor<Double> {
|
|||||||
return meta().getString("type", "Leibold CM32");
|
return meta().getString("type", "Leibold CM32");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// @Override
|
||||||
|
// protected int timeout() {
|
||||||
|
// return meta().getInt("timeout", 1000);
|
||||||
|
// }
|
||||||
@Override
|
@Override
|
||||||
protected Object calculateState(String stateName) throws ControlException {
|
protected Object calculateState(String stateName) throws ControlException {
|
||||||
if (getHandler() == null) {
|
if (getHandler() == null) {
|
||||||
@ -63,7 +73,6 @@ public class CM32Device extends PortSensor<Double> {
|
|||||||
// }
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private class CMVacMeasurement extends SimpleMeasurement<Double> {
|
private class CMVacMeasurement extends SimpleMeasurement<Double> {
|
||||||
|
|
||||||
private static final String CM32_QUERY = "MES R PM 1\r\n";
|
private static final String CM32_QUERY = "MES R PM 1\r\n";
|
||||||
|
@ -23,10 +23,12 @@ import javafx.beans.property.adapter.JavaBeanBooleanPropertyBuilder;
|
|||||||
*/
|
*/
|
||||||
@ValueDef(name = "address", def = "253")
|
@ValueDef(name = "address", def = "253")
|
||||||
@ValueDef(name = "channel", def = "5")
|
@ValueDef(name = "channel", def = "5")
|
||||||
|
@ValueDef(name = "powerButton", type = "BOOLEAN", def = "true")
|
||||||
public class MKSVacDevice extends PortSensor<Double> {
|
public class MKSVacDevice extends PortSensor<Double> {
|
||||||
|
|
||||||
public MKSVacDevice(String portName) {
|
public MKSVacDevice(String portName) {
|
||||||
super(portName);
|
super(portName);
|
||||||
|
super.getConfig().setValue("powerButton", true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private String talk(String requestContent) throws ControlException {
|
private String talk(String requestContent) throws ControlException {
|
||||||
@ -84,6 +86,14 @@ public class MKSVacDevice extends PortSensor<Double> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void shutdown() throws ControlException {
|
||||||
|
setPowerOn(false);
|
||||||
|
super.shutdown();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public boolean isPowerOn() {
|
public boolean isPowerOn() {
|
||||||
return getState("power").booleanValue();
|
return getState("power").booleanValue();
|
||||||
}
|
}
|
||||||
@ -134,21 +144,25 @@ public class MKSVacDevice extends PortSensor<Double> {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected synchronized Double doMeasure() throws Exception {
|
protected synchronized Double doMeasure() throws Exception {
|
||||||
|
// if (getState("power").booleanValue()) {
|
||||||
String answer = talk("PR" + getChannel() + "?");
|
String answer = talk("PR" + getChannel() + "?");
|
||||||
if (answer == null || answer.isEmpty()) {
|
if (answer == null || answer.isEmpty()) {
|
||||||
invalidateState("connection");
|
invalidateState(CONNECTION_STATE);
|
||||||
this.progressUpdate("No connection");
|
this.progressUpdate("No connection");
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
double res = Double.parseDouble(answer);
|
double res = Double.parseDouble(answer);
|
||||||
if (res <= 0) {
|
if (res <= 0) {
|
||||||
this.progressUpdate("Non positive");
|
this.progressUpdate("No power");
|
||||||
invalidateState("power");
|
invalidateState("power");
|
||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
this.progressUpdate("OK");
|
this.progressUpdate("OK");
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
|
// } else {
|
||||||
|
// return null;
|
||||||
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -51,6 +51,14 @@ public class VacCollectorDevice extends Sensor<DataPoint> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void init() throws ControlException {
|
||||||
|
super.init();
|
||||||
|
for (Sensor s : sensorMap.values()) {
|
||||||
|
s.init();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Object calculateState(String stateName) throws ControlException {
|
protected Object calculateState(String stateName) throws ControlException {
|
||||||
//TODO add dot path notation for states
|
//TODO add dot path notation for states
|
||||||
@ -101,7 +109,12 @@ public class VacCollectorDevice extends Sensor<DataPoint> {
|
|||||||
currentTask = executor.scheduleWithFixedDelay(() -> {
|
currentTask = executor.scheduleWithFixedDelay(() -> {
|
||||||
sensorMap.entrySet().stream().parallel().forEach((entry) -> {
|
sensorMap.entrySet().stream().parallel().forEach((entry) -> {
|
||||||
try {
|
try {
|
||||||
Object value = entry.getValue().read();
|
Object value;
|
||||||
|
if (entry.getValue().meta().getBoolean("disabled", false)) {
|
||||||
|
value = null;
|
||||||
|
} else {
|
||||||
|
value = entry.getValue().read();
|
||||||
|
}
|
||||||
collector.put(entry.getKey(), value);
|
collector.put(entry.getKey(), value);
|
||||||
} catch (Exception ex) {
|
} catch (Exception ex) {
|
||||||
collector.put(entry.getKey(), Value.NULL);
|
collector.put(entry.getKey(), Value.NULL);
|
||||||
|
@ -125,7 +125,11 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
|
|||||||
consolePane = new TextArea();
|
consolePane = new TextArea();
|
||||||
consolePane.setEditable(false);
|
consolePane.setEditable(false);
|
||||||
consolePane.setWrapText(true);
|
consolePane.setWrapText(true);
|
||||||
ConsoleDude.hookStdStreams(consolePane);
|
// consolePane.textProperty().addListener((ObservableValue<? extends String> observable, String oldValue, String newValue) -> {
|
||||||
|
// if (newValue.length() > 10000) {
|
||||||
|
// consolePane.clear();
|
||||||
|
// }
|
||||||
|
// });
|
||||||
consoleWindow = new Stage();
|
consoleWindow = new Stage();
|
||||||
consoleWindow.setTitle("Vacuum measurement console");
|
consoleWindow.setTitle("Vacuum measurement console");
|
||||||
consoleWindow.setScene(new Scene(consolePane, 800, 200));
|
consoleWindow.setScene(new Scene(consolePane, 800, 200));
|
||||||
@ -173,7 +177,7 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
|
|||||||
});
|
});
|
||||||
plottables.setEachConfigValue("thickness", 3);
|
plottables.setEachConfigValue("thickness", 3);
|
||||||
//TODO make history length edittable
|
//TODO make history length edittable
|
||||||
plottables.setMaxAge(3*60*60*1000);
|
plottables.setMaxAge(3 * 60 * 60 * 1000);
|
||||||
plotContainer.setPlot(setupPlot(plottables));
|
plotContainer.setPlot(setupPlot(plottables));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,6 +259,7 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
|
|||||||
DirectoryChooser chooser = new DirectoryChooser();
|
DirectoryChooser chooser = new DirectoryChooser();
|
||||||
File storageDir = chooser.showDialog(plotHolder.getScene().getWindow());
|
File storageDir = chooser.showDialog(plotHolder.getScene().getWindow());
|
||||||
if (storageDir == null) {
|
if (storageDir == null) {
|
||||||
|
storeButton.setSelected(false);
|
||||||
throw new RuntimeException("User canceled directory selection");
|
throw new RuntimeException("User canceled directory selection");
|
||||||
}
|
}
|
||||||
device.getConfig().putNode(new MetaBuilder("storage")
|
device.getConfig().putNode(new MetaBuilder("storage")
|
||||||
@ -294,10 +299,12 @@ public class VacCollectorController implements Initializable, DeviceListener, Me
|
|||||||
|
|
||||||
@FXML
|
@FXML
|
||||||
private void onLogToggle(ActionEvent event) {
|
private void onLogToggle(ActionEvent event) {
|
||||||
if (logButton.isSelected() && logButton.isSelected()!=consoleWindow.isShowing()) {
|
if (logButton.isSelected() && logButton.isSelected() != consoleWindow.isShowing()) {
|
||||||
consoleWindow.show();
|
consoleWindow.show();
|
||||||
|
ConsoleDude.hookStdStreams(consolePane);
|
||||||
} else {
|
} else {
|
||||||
consoleWindow.hide();
|
consoleWindow.hide();
|
||||||
|
ConsoleDude.restoreStdStreams();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,12 +22,15 @@ import java.time.ZoneId;
|
|||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ResourceBundle;
|
import java.util.ResourceBundle;
|
||||||
import javafx.application.Platform;
|
import javafx.application.Platform;
|
||||||
|
import javafx.beans.value.ChangeListener;
|
||||||
|
import javafx.beans.value.ObservableValue;
|
||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.fxml.FXMLLoader;
|
import javafx.fxml.FXMLLoader;
|
||||||
import javafx.fxml.Initializable;
|
import javafx.fxml.Initializable;
|
||||||
import javafx.scene.Node;
|
import javafx.scene.Node;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
import javafx.scene.paint.Color;
|
import javafx.scene.paint.Color;
|
||||||
|
import org.controlsfx.control.ToggleSwitch;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
@ -52,6 +55,9 @@ public class VacuumeterView extends DeviceViewController implements MeasurementL
|
|||||||
@FXML
|
@FXML
|
||||||
Label status;
|
Label status;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
ToggleSwitch disableButton;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
public void accept(Device device, String measurementName, Measurement measurement) {
|
public void accept(Device device, String measurementName, Measurement measurement) {
|
||||||
@ -84,6 +90,13 @@ 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.selectedProperty().addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
|
||||||
|
getDevice().getConfig().setValue("disabled", !newValue);
|
||||||
|
if(!newValue){
|
||||||
|
valueLabel.setText("---");
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -96,7 +109,7 @@ public class VacuumeterView extends DeviceViewController implements MeasurementL
|
|||||||
public void onMeasurementFailed(Measurement measurement, Throwable exception) {
|
public void onMeasurementFailed(Measurement measurement, Throwable exception) {
|
||||||
Platform.runLater(() -> {
|
Platform.runLater(() -> {
|
||||||
valueLabel.setText("Err");
|
valueLabel.setText("Err");
|
||||||
setStatus("Error: " + exception.getMessage());
|
// setStatus("Error: " + exception.getMessage());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import java.net.*?>
|
||||||
|
<?import javafx.geometry.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import org.controlsfx.control.*?>
|
||||||
<?import java.net.URL?>
|
<?import java.net.URL?>
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
@ -10,7 +16,7 @@
|
|||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?import org.controlsfx.control.ToggleSwitch?>
|
<?import org.controlsfx.control.ToggleSwitch?>
|
||||||
|
|
||||||
<AnchorPane styleClass="vacBox" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1">
|
<AnchorPane styleClass="vacBox" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1">
|
||||||
<stylesheets>
|
<stylesheets>
|
||||||
<URL value="@/styles/vacstyles.css" />
|
<URL value="@/styles/vacstyles.css" />
|
||||||
</stylesheets>
|
</stylesheets>
|
||||||
@ -19,16 +25,23 @@
|
|||||||
<children>
|
<children>
|
||||||
<AnchorPane styleClass="namePane">
|
<AnchorPane styleClass="namePane">
|
||||||
<children>
|
<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" />
|
<Label id="name" fx:id="deviceNameLabel" alignment="CENTER" prefHeight="40.0" text="device Name" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="50.0" AnchorPane.topAnchor="0.0" />
|
||||||
|
<ToggleSwitch fx:id="disableButton" alignment="CENTER" layoutX="130.0" layoutY="10.0" prefWidth="40.0" selected="true" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0" />
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
<Separator />
|
<Separator />
|
||||||
<BorderPane>
|
<BorderPane>
|
||||||
<left>
|
<left>
|
||||||
<Label id="pressure" fx:id="valueLabel" alignment="CENTER_RIGHT" minWidth="110.0" prefHeight="60.0" text="--- " BorderPane.alignment="CENTER" />
|
<Label id="pressure" fx:id="valueLabel" alignment="CENTER_RIGHT" minWidth="110.0" prefHeight="60.0" text="---" BorderPane.alignment="CENTER">
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
|
</padding></Label>
|
||||||
</left>
|
</left>
|
||||||
<right>
|
<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">
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
|
</padding></Label>
|
||||||
</right>
|
</right>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
<Separator />
|
<Separator />
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import org.controlsfx.control.*?>
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import java.net.*?>
|
||||||
|
<?import javafx.geometry.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
<?import java.net.URL?>
|
<?import java.net.URL?>
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.Label?>
|
<?import javafx.scene.control.Label?>
|
||||||
@ -8,7 +14,7 @@
|
|||||||
<?import javafx.scene.layout.BorderPane?>
|
<?import javafx.scene.layout.BorderPane?>
|
||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
|
|
||||||
<AnchorPane styleClass="vacBox" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1">
|
<AnchorPane styleClass="vacBox" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1">
|
||||||
<stylesheets>
|
<stylesheets>
|
||||||
<URL value="@/styles/vacstyles.css" />
|
<URL value="@/styles/vacstyles.css" />
|
||||||
</stylesheets>
|
</stylesheets>
|
||||||
@ -17,16 +23,26 @@
|
|||||||
<children>
|
<children>
|
||||||
<AnchorPane styleClass="namePane">
|
<AnchorPane styleClass="namePane">
|
||||||
<children>
|
<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" />
|
<Label id="name" fx:id="deviceNameLabel" alignment="CENTER" prefHeight="40.0" text="device Name" AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="50.0" AnchorPane.topAnchor="0.0" />
|
||||||
|
<ToggleSwitch fx:id="disableButton" alignment="CENTER" layoutX="140.0" layoutY="20.0" prefWidth="40.0" selected="true" AnchorPane.bottomAnchor="10.0" AnchorPane.rightAnchor="10.0" AnchorPane.topAnchor="10.0" />
|
||||||
</children>
|
</children>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
<Separator />
|
<Separator />
|
||||||
<BorderPane VBox.vgrow="ALWAYS">
|
<BorderPane VBox.vgrow="ALWAYS">
|
||||||
<left>
|
<left>
|
||||||
<Label id="pressure" fx:id="valueLabel" alignment="CENTER_RIGHT" minWidth="110.0" prefHeight="60.0" text="--- " BorderPane.alignment="CENTER" />
|
<Label id="pressure" fx:id="valueLabel" alignment="CENTER_RIGHT" minWidth="110.0" prefHeight="60.0" text="---" BorderPane.alignment="CENTER">
|
||||||
|
<BorderPane.margin>
|
||||||
|
<Insets />
|
||||||
|
</BorderPane.margin>
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
|
</padding></Label>
|
||||||
</left>
|
</left>
|
||||||
<right>
|
<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">
|
||||||
|
<padding>
|
||||||
|
<Insets bottom="5.0" left="5.0" right="5.0" top="5.0" />
|
||||||
|
</padding></Label>
|
||||||
</right>
|
</right>
|
||||||
</BorderPane>
|
</BorderPane>
|
||||||
<Separator />
|
<Separator />
|
||||||
|
@ -1,5 +1,11 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
|
<?import java.lang.*?>
|
||||||
|
<?import java.net.*?>
|
||||||
|
<?import javafx.geometry.*?>
|
||||||
|
<?import javafx.scene.control.*?>
|
||||||
|
<?import javafx.scene.layout.*?>
|
||||||
|
<?import javafx.scene.text.*?>
|
||||||
<?import java.net.URL?>
|
<?import java.net.URL?>
|
||||||
<?import javafx.geometry.Insets?>
|
<?import javafx.geometry.Insets?>
|
||||||
<?import javafx.scene.control.ChoiceBox?>
|
<?import javafx.scene.control.ChoiceBox?>
|
||||||
@ -13,18 +19,13 @@
|
|||||||
<?import javafx.scene.layout.VBox?>
|
<?import javafx.scene.layout.VBox?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
|
|
||||||
<AnchorPane id="root" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="inr.numass.readvac.fx.VacCollectorController">
|
<AnchorPane id="root" prefHeight="600.0" prefWidth="800.0" xmlns="http://javafx.com/javafx/8.0.40" xmlns:fx="http://javafx.com/fxml/1" fx:controller="inr.numass.readvac.fx.VacCollectorController">
|
||||||
<stylesheets>
|
<stylesheets>
|
||||||
<URL value="@/styles/vacstyles.css" />
|
<URL value="@/styles/vacstyles.css" />
|
||||||
</stylesheets>
|
</stylesheets>
|
||||||
<children>
|
<children>
|
||||||
<HBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
<HBox AnchorPane.bottomAnchor="0.0" AnchorPane.leftAnchor="0.0" AnchorPane.rightAnchor="0.0" AnchorPane.topAnchor="0.0">
|
||||||
<children>
|
<children>
|
||||||
<VBox fx:id="vacBoxHolder" minWidth="200.0" spacing="2.0">
|
|
||||||
<HBox.margin>
|
|
||||||
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
|
|
||||||
</HBox.margin></VBox>
|
|
||||||
<Separator orientation="VERTICAL" />
|
|
||||||
<VBox alignment="TOP_CENTER" HBox.hgrow="ALWAYS">
|
<VBox alignment="TOP_CENTER" HBox.hgrow="ALWAYS">
|
||||||
<children>
|
<children>
|
||||||
<ToolBar>
|
<ToolBar>
|
||||||
@ -57,6 +58,11 @@
|
|||||||
</HBox>
|
</HBox>
|
||||||
</children>
|
</children>
|
||||||
</VBox>
|
</VBox>
|
||||||
|
<Separator orientation="VERTICAL" />
|
||||||
|
<VBox fx:id="vacBoxHolder" minWidth="200.0" spacing="2.0">
|
||||||
|
<HBox.margin>
|
||||||
|
<Insets bottom="2.0" left="2.0" right="2.0" top="2.0" />
|
||||||
|
</HBox.margin></VBox>
|
||||||
</children>
|
</children>
|
||||||
</HBox>
|
</HBox>
|
||||||
</children>
|
</children>
|
||||||
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<config>
|
|
||||||
<storage path="/home/numass-storage/"/>
|
|
||||||
<serialconfig P1="/dev/ttyUSB0" P2="/dev/ttyS5" P3="/dev/ttyS4" Px="/dev/ttyUSB1"/>
|
|
||||||
<run>12_2015</run>
|
|
||||||
</config>
|
|
@ -0,0 +1,12 @@
|
|||||||
|
/*
|
||||||
|
* To change this license header, choose License Headers in Project Properties.
|
||||||
|
* To change this template file, choose Tools | Templates
|
||||||
|
* and open the template in the editor.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package inr.numass.scripts
|
||||||
|
|
||||||
|
import inr.numass.client.NumassClient
|
||||||
|
|
||||||
|
NumassClient client = new NumassClient("192.168.111.1", 8335);
|
||||||
|
print client.startRun("2016_04")
|
Loading…
Reference in New Issue
Block a user