use of com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.ProfilePair in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850ScheduleAbsTimeCommand method executeWrite.
@Override
public void executeWrite(final Iec61850Client client, final DeviceConnection connection, final LogicalDevice logicalDevice, final int logicalDeviceIndex, final ProfileDto profile) throws NodeWriteException {
this.checkProfile(profile);
final NodeContainer containingNode = connection.getFcModelNode(logicalDevice, logicalDeviceIndex, this.logicalNode, DATA_ATTRIBUTE, FC);
final ProfilePair profilePair = this.convert(profile.getProfileEntries());
containingNode.writeFloatArray(SubDataAttribute.VALUES, profilePair.getValues());
containingNode.writeDateArray(SubDataAttribute.TIMES, profilePair.getTimes());
}
use of com.alliander.osgp.adapter.protocol.iec61850.domain.valueobjects.ProfilePair in project Protocol-Adapter-IEC61850 by OSGP.
the class Iec61850ScheduleAbsTimeCommand method convert.
private ProfilePair convert(final List<ProfileEntryDto> profileEntries) {
final Float[] values = new Float[ARRAY_SIZE];
final Date[] times = new Date[ARRAY_SIZE];
for (final ProfileEntryDto pe : profileEntries) {
final int i = pe.getId() - 1;
values[i] = (float) pe.getValue();
times[i] = pe.getTime().toDate();
}
// Fill rest of array with default values
final int start = profileEntries.size();
final int end = ARRAY_SIZE;
for (int i = start; i < end; i++) {
values[i] = DEFAULT_VALUE;
times[i] = DEFAULT_TIME;
}
return new ProfilePair(values, times);
}
Aggregations