use of com.beanit.openiec61850.ModelNode in project open-smart-grid-platform by OSGP.
the class RtuSimulator method addBoilerDevices.
private void addBoilerDevices(final ServerModel serverModel) {
final String boilerPrefix = "BOILER";
int i = 1;
String logicalDeviceName = boilerPrefix + i;
ModelNode boilerNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
while (boilerNode != null) {
this.logicalDevices.add(new Boiler(this.getDeviceName(), logicalDeviceName, serverModel));
i += 1;
logicalDeviceName = boilerPrefix + i;
boilerNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
}
}
use of com.beanit.openiec61850.ModelNode in project open-smart-grid-platform by OSGP.
the class RtuSimulator method addPqDevices.
private void addPqDevices(final ServerModel serverModel) {
final String pqPrefix = "PQ";
int i = 1;
String logicalDeviceName = pqPrefix + i;
ModelNode pqNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
while (pqNode != null) {
this.logicalDevices.add(new Pq(this.getDeviceName(), logicalDeviceName, serverModel));
i += 1;
logicalDeviceName = pqPrefix + i;
pqNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
}
}
use of com.beanit.openiec61850.ModelNode in project open-smart-grid-platform by OSGP.
the class RtuSimulator method addGasFurnaceDevices.
private void addGasFurnaceDevices(final ServerModel serverModel) {
final String gasFurnacePrefix = "GAS_FURNACE";
int i = 1;
String logicalDeviceName = gasFurnacePrefix + i;
ModelNode gasFurnaceNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
while (gasFurnaceNode != null) {
this.logicalDevices.add(new GasFurnace(this.getDeviceName(), logicalDeviceName, serverModel));
i += 1;
logicalDeviceName = gasFurnacePrefix + i;
gasFurnaceNode = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
}
}
use of com.beanit.openiec61850.ModelNode in project open-smart-grid-platform by OSGP.
the class RtuSimulator method assertValue.
public void assertValue(final String logicalDeviceName, final String node, final String value) {
final LogicalDevice logicalDevice = this.getLogicalDevice(logicalDeviceName);
// Get a new model copy to see values that have been set on the server.
logicalDevice.refreshServerModel(this.server.getModelCopy());
final ModelNode actual = logicalDevice.getBasicDataAttribute(LogicalDeviceNode.fromDescription(node));
final String onLogicalDevice = "\" on logical device \"";
if (actual == null) {
throw new AssertionError("RTU Simulator does not have expected node \"" + node + onLogicalDevice + logicalDeviceName + "\".");
}
if (!(actual instanceof BasicDataAttribute)) {
throw new AssertionError("RTU Simulator value has node \"" + node + onLogicalDevice + logicalDeviceName + "\", but it is not a BasicDataAttribute: " + actual.getClass().getName());
}
final BasicDataAttribute expected = this.getCopyWithNewValue((BasicDataAttribute) actual, value);
if (!BasicDataAttributesHelper.attributesEqual(expected, (BasicDataAttribute) actual)) {
throw new AssertionError("RTU Simulator attribute for node \"" + node + onLogicalDevice + logicalDeviceName + "\" - expected: [" + expected + "], actual: [" + actual + "]");
}
}
use of com.beanit.openiec61850.ModelNode in project open-smart-grid-platform by OSGP.
the class RtuSimulator method addSwitchDevices.
private void addSwitchDevices(final ServerModel serverModel) {
final String logicalDeviceName = "IO";
final ModelNode switchDevice = serverModel.getChild(this.getDeviceName() + logicalDeviceName);
if (switchDevice != null) {
LOGGER.info("Adding switchDevice {}", this.getDeviceName());
this.logicalDevices.add(new SwitchDevice(this.getDeviceName(), logicalDeviceName, serverModel));
}
}
Aggregations