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