numass control update
This commit is contained in:
parent
809c38689a
commit
40231e8802
@ -41,7 +41,7 @@ import inr.numass.control.StorageHelper;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@ -50,7 +50,7 @@ import java.util.Map;
|
||||
* @author Alexander Nozik
|
||||
*/
|
||||
@RoleDef(name = Roles.STORAGE_ROLE)
|
||||
@RoleDef(name = Roles.VIEW_ROLE, objectType = PKT8View.class)
|
||||
@RoleDef(name = Roles.VIEW_ROLE)
|
||||
@ValueDef(name = "port", def = "virtual", info = "The name of the port for this PKT8")
|
||||
public class PKT8Device extends PortSensor<PKT8Result> {
|
||||
public static final String PKT8_DEVICE_TYPE = "numass:pkt8";
|
||||
@ -62,7 +62,7 @@ public class PKT8Device extends PortSensor<PKT8Result> {
|
||||
/**
|
||||
* The key is the letter (a,b,c,d...) as in measurements
|
||||
*/
|
||||
private final Map<String, PKT8Channel> channels = new HashMap<>();
|
||||
private final Map<String, PKT8Channel> channels = new LinkedHashMap<>();
|
||||
private RegularPointCollector collector;
|
||||
private StorageHelper storageHelper;
|
||||
|
||||
@ -191,7 +191,7 @@ public class PKT8Device extends PortSensor<PKT8Result> {
|
||||
updateState(ABUF, Integer.parseInt(response.substring(14)));
|
||||
// getLogger().info("successfully set buffer size to {}", this.abuf);
|
||||
} else {
|
||||
getLogger().error("Setting averaging buffer failsed with message: " + response);
|
||||
getLogger().error("Setting averaging buffer failed with message: " + response);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -72,7 +72,6 @@ public class PKT8View extends DeviceViewConnection<PKT8Device> implements Initia
|
||||
sensorColumn.setCellValueFactory(new PropertyValueFactory<>("channel"));
|
||||
resColumn.setCellValueFactory(new PropertyValueFactory<>("rawString"));
|
||||
tempColumn.setCellValueFactory(new PropertyValueFactory<>("temperatureString"));
|
||||
bindBooleanToState("storing", storeButton.selectedProperty());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -86,6 +85,7 @@ public class PKT8View extends DeviceViewConnection<PKT8Device> implements Initia
|
||||
|
||||
new FragmentWindow(logFragment).bindTo(consoleButton);
|
||||
new FragmentWindow(plotFragment).bindTo(plotButton);
|
||||
bindBooleanToState("storing", storeButton.selectedProperty());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1,11 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<config>
|
||||
<device type="PKT8" name="thermo-1">
|
||||
<!-- Device configuration -->
|
||||
<port>192.168.111.36:4001</port>
|
||||
<abuf>1</abuf>
|
||||
<averagingDuration>"PT60S"</averagingDuration>
|
||||
|
||||
<device type="PKT8"
|
||||
name="thermo-1"
|
||||
port="192.168.111.36:4001"
|
||||
abuf="1"
|
||||
averagingDuration="PT60S">
|
||||
<!-- Channel configuration -->
|
||||
<channel designation="a" name="T1" r0="1000" transformationType="hyperbolic"
|
||||
coefs="[17.066, -249.29, 1663.6, -5263.8, 9004.7, -7151.8, 2288.3]"/>
|
@ -92,7 +92,7 @@ public class MspDevice extends SingleMeasurementDevice implements PortHandler.Po
|
||||
super.shutdown();
|
||||
super.stopMeasurement(true);
|
||||
if(isConnected()) {
|
||||
setFileamentOn(false);
|
||||
setFilamentOn(false);
|
||||
setConnected(false);
|
||||
}
|
||||
getHandler().close();
|
||||
@ -145,7 +145,7 @@ public class MspDevice extends SingleMeasurementDevice implements PortHandler.Po
|
||||
case PortSensor.CONNECTED_STATE:
|
||||
setConnected(value.booleanValue());
|
||||
case "filamentOn":
|
||||
setFileamentOn(value.booleanValue());
|
||||
setFilamentOn(value.booleanValue());
|
||||
default:
|
||||
super.requestStateChange(stateName, value);
|
||||
}
|
||||
@ -243,13 +243,13 @@ public class MspDevice extends SingleMeasurementDevice implements PortHandler.Po
|
||||
* with command name)
|
||||
*
|
||||
* @param commandName
|
||||
* @param paremeters
|
||||
* @param parameters
|
||||
* @return
|
||||
* @throws PortException
|
||||
*/
|
||||
private MspResponse sendAndWait(String commandName, Object... paremeters) throws PortException {
|
||||
private MspResponse sendAndWait(String commandName, Object... parameters) throws PortException {
|
||||
|
||||
String request = buildCommand(commandName, paremeters);
|
||||
String request = buildCommand(commandName, parameters);
|
||||
if (mspListener != null) {
|
||||
mspListener.acceptRequest(request);
|
||||
}
|
||||
@ -289,7 +289,7 @@ public class MspDevice extends SingleMeasurementDevice implements PortHandler.Po
|
||||
* @return
|
||||
* @throws hep.dataforge.exceptions.PortException
|
||||
*/
|
||||
public boolean setFileamentOn(boolean filamentOn) throws PortException {
|
||||
public boolean setFilamentOn(boolean filamentOn) throws PortException {
|
||||
if (filamentOn) {
|
||||
return sendAndWait("FilamentControl", "On").isOK();
|
||||
} else {
|
||||
|
@ -138,7 +138,7 @@ public class MspViewController extends DeviceViewConnection<MspDevice> implement
|
||||
fillamentButton.selectedProperty().addListener((ObservableValue<? extends Boolean> observable, Boolean oldValue, Boolean newValue) -> {
|
||||
try {
|
||||
fillamentSelector.setDisable(newValue);
|
||||
getDevice().setFileamentOn(newValue);
|
||||
getDevice().setFilamentOn(newValue);
|
||||
} catch (PortException ex) {
|
||||
getDevice().getLogger().error("Failed to toggle filaments");
|
||||
}
|
||||
|
@ -28,7 +28,11 @@ public abstract class DeviceViewConnection<D extends Device> extends DeviceConne
|
||||
new ObjectBinding<Value>() {
|
||||
@Override
|
||||
protected Value computeValue() {
|
||||
if(isOpen()) {
|
||||
return getDevice().getState(stateName);
|
||||
} else {
|
||||
return Value.NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
);
|
||||
|
@ -29,7 +29,7 @@ import java.util.function.Predicate;
|
||||
* Created by darksnake on 08-May-17.
|
||||
*/
|
||||
public class NumassControlUtils {
|
||||
public static final String DEFAULT_CONFIG_LOCATION = "numass-control.xml";
|
||||
public static final String DEFAULT_CONFIG_LOCATION = "./numass-control.xml";
|
||||
|
||||
/**
|
||||
* Create a single or multiple storage connections for a device
|
||||
|
@ -105,6 +105,7 @@ public class VacCollectorDevice extends Sensor<DataPoint> {
|
||||
@Override
|
||||
public void shutdown() throws ControlException {
|
||||
super.shutdown();
|
||||
helper.close();
|
||||
for (Sensor sensor : getSensors()) {
|
||||
sensor.shutdown();
|
||||
}
|
||||
@ -116,7 +117,9 @@ public class VacCollectorDevice extends Sensor<DataPoint> {
|
||||
format.setType(s.getName(), ValueType.NUMBER);
|
||||
});
|
||||
|
||||
return LoaderFactory.buildPointLoder(connection.getStorage(), "vactms", "", "timestamp", format.build());
|
||||
String suffix = DateTimeUtils.fileSuffix();
|
||||
|
||||
return LoaderFactory.buildPointLoder(connection.getStorage(), "vactms_" + suffix, "", "timestamp", format.build());
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -183,7 +186,6 @@ public class VacCollectorDevice extends Sensor<DataPoint> {
|
||||
currentTask.cancel(force);
|
||||
executor.shutdown();
|
||||
currentTask = null;
|
||||
helper.close();
|
||||
afterStop();
|
||||
}
|
||||
return isRunning;
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<config>
|
||||
<!--<storage path="D:/temp/test"/>-->
|
||||
<storage path="D:/temp/test"/>
|
||||
<device type="numass:vac">
|
||||
<sensor name="P1" color="red" port="tcp::192.168.111.33:4002" sensorType="mks"/>
|
||||
<sensor name="P2" color="blue" port="tcp::192.168.111.32:4002" sensorType="CM32"/>
|
||||
|
Loading…
Reference in New Issue
Block a user