use of org.opensmartgridplatform.dto.valueobjects.microgrids.ProfileEntryDto in project open-smart-grid-platform 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);
}
use of org.opensmartgridplatform.dto.valueobjects.microgrids.ProfileEntryDto in project open-smart-grid-platform by OSGP.
the class Iec61850ScheduleAbsTimeCommand method convert.
private List<ProfileEntryDto> convert(final NodeContainer profileNode) {
final Float[] values = profileNode.getFloatArray(SubDataAttribute.VALUES);
final Date[] times = profileNode.getDateArray(SubDataAttribute.TIMES);
final List<ProfileEntryDto> profileEntries = new ArrayList<>();
for (int i = 0; i < ARRAY_SIZE; i++) {
final double value = values[i];
final Date time;
if (times[i] == null) {
time = DEFAULT_TIME;
} else {
time = times[i];
}
if (!time.equals(DEFAULT_TIME)) {
profileEntries.add(new ProfileEntryDto(i + 1, new DateTime(time), value));
}
}
return profileEntries;
}
Aggregations