Search in sources :

Example 26 with ServerModel

use of com.beanit.openiec61850.ServerModel in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850RtuDeviceReportingService method enableEngineReportingOnDevice.

private void enableEngineReportingOnDevice(final DeviceConnection connection, final String deviceIdentification) {
    final ServerModel serverModel = connection.getConnection().getServerModel();
    final String enginePrefix = LogicalDevice.ENGINE.getDescription();
    int i = 1;
    String logicalDeviceName = enginePrefix + i;
    ModelNode engineNode = serverModel.getChild(this.serverName + logicalDeviceName);
    while (engineNode != null) {
        this.enableStatusReportingOnDevice(connection, deviceIdentification, LogicalDevice.ENGINE, i, DataAttribute.REPORT_STATUS_ONE);
        this.enableMeasurementReportingOnDevice(connection, deviceIdentification, LogicalDevice.ENGINE, i, DataAttribute.REPORT_MEASUREMENTS_ONE);
        i += 1;
        logicalDeviceName = enginePrefix + i;
        engineNode = serverModel.getChild(this.serverName + logicalDeviceName);
    }
}
Also used : ServerModel(org.openmuc.openiec61850.ServerModel) ModelNode(org.openmuc.openiec61850.ModelNode)

Example 27 with ServerModel

use of com.beanit.openiec61850.ServerModel in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850RtuDeviceReportingService method enableHeatBufferReportingOnDevice.

private void enableHeatBufferReportingOnDevice(final DeviceConnection connection, final String deviceIdentification) {
    final ServerModel serverModel = connection.getConnection().getServerModel();
    final String heatBufferPrefix = LogicalDevice.HEAT_BUFFER.getDescription();
    int i = 1;
    String logicalDeviceName = heatBufferPrefix + i;
    ModelNode heatBufferNode = serverModel.getChild(this.serverName + logicalDeviceName);
    while (heatBufferNode != null) {
        this.enableStatusReportingOnDevice(connection, deviceIdentification, LogicalDevice.HEAT_BUFFER, i, DataAttribute.REPORT_STATUS_ONE);
        this.enableMeasurementReportingOnDevice(connection, deviceIdentification, LogicalDevice.HEAT_BUFFER, i, DataAttribute.REPORT_MEASUREMENTS_ONE);
        i += 1;
        logicalDeviceName = heatBufferPrefix + i;
        heatBufferNode = serverModel.getChild(this.serverName + logicalDeviceName);
    }
}
Also used : ServerModel(org.openmuc.openiec61850.ServerModel) ModelNode(org.openmuc.openiec61850.ModelNode)

Example 28 with ServerModel

use of com.beanit.openiec61850.ServerModel in project Protocol-Adapter-IEC61850 by OSGP.

the class Iec61850RtuDeviceReportingService method enableBatteryReportingOnDevice.

private void enableBatteryReportingOnDevice(final DeviceConnection connection, final String deviceIdentification) {
    final ServerModel serverModel = connection.getConnection().getServerModel();
    final String batteryPrefix = LogicalDevice.BATTERY.getDescription();
    int i = 1;
    String logicalDeviceName = batteryPrefix + i;
    ModelNode batteryNode = serverModel.getChild(this.serverName + logicalDeviceName);
    while (batteryNode != null) {
        this.enableStatusReportingOnDevice(connection, deviceIdentification, LogicalDevice.BATTERY, i, DataAttribute.REPORT_STATUS_ONE);
        this.enableMeasurementReportingOnDevice(connection, deviceIdentification, LogicalDevice.BATTERY, i, DataAttribute.REPORT_MEASUREMENTS_ONE);
        i += 1;
        logicalDeviceName = batteryPrefix + i;
        batteryNode = serverModel.getChild(this.serverName + logicalDeviceName);
    }
}
Also used : ServerModel(org.openmuc.openiec61850.ServerModel) ModelNode(org.openmuc.openiec61850.ModelNode)

Example 29 with ServerModel

use of com.beanit.openiec61850.ServerModel in project open-smart-grid-platform by OSGP.

the class Iec61850RtuDeviceService method getData.

@Override
public void getData(final GetDataDeviceRequest deviceRequest, final DeviceResponseHandler deviceResponseHandler) throws JMSException {
    try {
        final String serverName = this.getServerName(deviceRequest);
        final ServerModel serverModel = this.connectAndRetrieveServerModel(deviceRequest, serverName);
        final ClientAssociation clientAssociation = this.iec61850DeviceConnectionService.getClientAssociation(deviceRequest.getDeviceIdentification());
        final GetDataResponseDto getDataResponse = this.handleGetData(new DeviceConnection(new Iec61850Connection(new Iec61850ClientAssociation(clientAssociation, null), serverModel), deviceRequest.getDeviceIdentification(), deviceRequest.getOrganisationIdentification(), serverName), deviceRequest);
        if (getDataResponse == null) {
            throw new ProtocolAdapterException("No valid response received during GetData");
        }
        final GetDataDeviceResponse deviceResponse = new GetDataDeviceResponse(deviceRequest, DeviceMessageStatus.OK, getDataResponse);
        deviceResponseHandler.handleResponse(deviceResponse);
    } catch (final ConnectionFailureException se) {
        LOGGER.error("Could not connect to device after all retries", se);
        final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest, DeviceMessageStatus.FAILURE);
        deviceResponseHandler.handleConnectionFailure(se, deviceResponse);
    } catch (final Exception e) {
        LOGGER.error("Unexpected exception during Get Data", e);
        final EmptyDeviceResponse deviceResponse = new EmptyDeviceResponse(deviceRequest, DeviceMessageStatus.FAILURE);
        deviceResponseHandler.handleException(e, deviceResponse);
    }
}
Also used : GetDataDeviceResponse(org.opensmartgridplatform.adapter.protocol.iec61850.device.ssld.responses.GetDataDeviceResponse) ServerModel(com.beanit.openiec61850.ServerModel) Iec61850Connection(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.Iec61850Connection) Iec61850ClientAssociation(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.Iec61850ClientAssociation) GetDataResponseDto(org.opensmartgridplatform.dto.valueobjects.microgrids.GetDataResponseDto) ConnectionFailureException(org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ConnectionFailureException) DeviceConnection(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection) Iec61850ClientAssociation(org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.Iec61850ClientAssociation) ClientAssociation(com.beanit.openiec61850.ClientAssociation) ProtocolAdapterException(org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ProtocolAdapterException) ConnectionFailureException(org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ConnectionFailureException) ProtocolAdapterException(org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ProtocolAdapterException) JMSException(javax.jms.JMSException) EmptyDeviceResponse(org.opensmartgridplatform.adapter.protocol.iec61850.device.ssld.responses.EmptyDeviceResponse)

Example 30 with ServerModel

use of com.beanit.openiec61850.ServerModel 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);
    }
}
Also used : GasFurnace(org.opensmartgridplatform.simulator.protocol.iec61850.server.logicaldevices.GasFurnace) ModelNode(com.beanit.openiec61850.ModelNode)

Aggregations

ServerModel (org.openmuc.openiec61850.ServerModel)17 ModelNode (com.beanit.openiec61850.ModelNode)16 ServerModel (com.beanit.openiec61850.ServerModel)12 ModelNode (org.openmuc.openiec61850.ModelNode)10 ProtocolAdapterException (org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)8 ProtocolAdapterException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ProtocolAdapterException)7 JMSException (javax.jms.JMSException)6 ClientAssociation (com.beanit.openiec61850.ClientAssociation)5 ConnectionFailureException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.ConnectionFailureException)4 Iec61850ClientAssociation (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.Iec61850ClientAssociation)4 Iec61850Connection (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.Iec61850Connection)4 DeviceConnection (com.alliander.osgp.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection)4 ClientAssociation (org.openmuc.openiec61850.ClientAssociation)4 ConnectionFailureException (org.opensmartgridplatform.adapter.protocol.iec61850.exceptions.ConnectionFailureException)4 Iec61850ClientAssociation (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.Iec61850ClientAssociation)4 Iec61850Connection (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.Iec61850Connection)4 DeviceConnection (org.opensmartgridplatform.adapter.protocol.iec61850.infra.networking.helper.DeviceConnection)4 EmptyDeviceResponse (com.alliander.osgp.adapter.protocol.iec61850.device.ssld.responses.EmptyDeviceResponse)3 EmptyDeviceResponse (org.opensmartgridplatform.adapter.protocol.iec61850.device.ssld.responses.EmptyDeviceResponse)3 BasicDataAttribute (com.beanit.openiec61850.BasicDataAttribute)2