Search in sources :

Example 1 with DayProfileAction

use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.DayProfileAction in project open-smart-grid-platform by OSGP.

the class ActivityCalendarMappingTest method checkListMapping.

// method to test mapping of Filled Lists
private void checkListMapping(final List<SeasonProfile> seasonProfileList, final List<SeasonProfileDto> seasonProfileDtoList) {
    assertThat(seasonProfileList).isNotNull();
    assertThat(seasonProfileDtoList).isNotNull();
    assertThat(seasonProfileList.isEmpty()).isFalse();
    assertThat(seasonProfileDtoList.isEmpty()).isFalse();
    final SeasonProfile seasonProfile = seasonProfileList.get(0);
    final SeasonProfileDto seasonProfileDto = seasonProfileDtoList.get(0);
    assertThat(seasonProfileDto.getSeasonProfileName()).isEqualTo(seasonProfile.getSeasonProfileName());
    this.checkCosemDateTimeMapping(seasonProfile.getSeasonStart(), seasonProfileDto.getSeasonStart());
    final WeekProfile weekProfile = seasonProfile.getWeekProfile();
    final WeekProfileDto weekProfileDto = seasonProfileDto.getWeekProfile();
    assertThat(weekProfileDto.getWeekProfileName()).isEqualTo(weekProfile.getWeekProfileName());
    final DayProfile dayProfile = weekProfile.getMonday();
    final DayProfileDto dayProfileDto = weekProfileDto.getMonday();
    assertThat(dayProfileDto.getDayId()).isEqualTo(dayProfile.getDayId());
    assertThat(dayProfile.getDayProfileActionList().size()).isEqualTo(dayProfile.getDayProfileActionList().size());
    final DayProfileAction dayProfileAction = dayProfile.getDayProfileActionList().get(0);
    final DayProfileActionDto dayProfileActionDto = dayProfileDto.getDayProfileActionList().get(0);
    assertThat(dayProfileActionDto.getScriptSelector()).isEqualTo(dayProfileAction.getScriptSelector());
    final CosemTime cosemTime = dayProfileAction.getStartTime();
    final CosemTimeDto cosemTimeDto = dayProfileActionDto.getStartTime();
    assertThat(cosemTimeDto.getHour()).isEqualTo(cosemTime.getHour());
    assertThat(cosemTimeDto.getMinute()).isEqualTo(cosemTime.getMinute());
    assertThat(cosemTimeDto.getSecond()).isEqualTo(cosemTime.getSecond());
    assertThat(cosemTimeDto.getHundredths()).isEqualTo(cosemTime.getHundredths());
}
Also used : WeekProfile(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.WeekProfile) CosemTime(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CosemTime) DayProfile(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.DayProfile) DayProfileAction(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.DayProfileAction) SeasonProfileDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.SeasonProfileDto) WeekProfileDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.WeekProfileDto) DayProfileDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.DayProfileDto) SeasonProfile(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SeasonProfile) DayProfileActionDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.DayProfileActionDto) CosemTimeDto(org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemTimeDto)

Example 2 with DayProfileAction

use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.DayProfileAction in project open-smart-grid-platform by OSGP.

the class ActivityCalendarBuilder method withFilledList.

public ActivityCalendarBuilder withFilledList() {
    final CosemDate date = new CosemDate(2016, 3, 16);
    final CosemTime time = new CosemTime(11, 45, 33);
    final int deviation = 1;
    final ClockStatus clockStatus = new ClockStatus(ClockStatus.STATUS_NOT_SPECIFIED);
    final CosemDateTime seasonStart = new CosemDateTime(date, time, deviation, clockStatus);
    final CosemTime startTime = time;
    final DayProfileAction dayProfileAction = new DayProfileAction(new Integer(10), startTime);
    final List<DayProfileAction> dayProfileActionList = new ArrayList<>();
    dayProfileActionList.add(dayProfileAction);
    final DayProfile dayProfile = new DayProfile(new Integer(10), dayProfileActionList);
    final WeekProfile weekProfile = WeekProfile.newBuilder().withWeekProfileName("weekProfile1").withMonday(dayProfile).withTuesday(dayProfile).withWednesday(dayProfile).withThursday(dayProfile).withFriday(dayProfile).withSaturday(dayProfile).withSunday(dayProfile).build();
    final SeasonProfile seasonProfile = new SeasonProfile("profile1", seasonStart, weekProfile);
    this.seasonProfileList.add(seasonProfile);
    return this;
}
Also used : WeekProfile(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.WeekProfile) ClockStatus(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ClockStatus) CosemTime(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CosemTime) ArrayList(java.util.ArrayList) DayProfile(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.DayProfile) DayProfileAction(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.DayProfileAction) CosemDateTime(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CosemDateTime) CosemDate(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CosemDate) SeasonProfile(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SeasonProfile)

Example 3 with DayProfileAction

use of org.opensmartgridplatform.domain.core.valueobjects.smartmetering.DayProfileAction in project open-smart-grid-platform by OSGP.

the class ActivityCalendarConverter method processDayProfileActionType.

private DayProfileAction processDayProfileActionType(final DayProfileActionType dpat) {
    final Integer scriptSelector = dpat.getScriptSelector() != null ? dpat.getScriptSelector().intValue() : null;
    final CosemTime startTime = this.mapperFacade.map(dpat.getStartTime(), CosemTime.class);
    return new DayProfileAction(scriptSelector, startTime);
}
Also used : CosemTime(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CosemTime) DayProfileAction(org.opensmartgridplatform.domain.core.valueobjects.smartmetering.DayProfileAction)

Aggregations

CosemTime (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CosemTime)3 DayProfileAction (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.DayProfileAction)3 DayProfile (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.DayProfile)2 SeasonProfile (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.SeasonProfile)2 WeekProfile (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.WeekProfile)2 ArrayList (java.util.ArrayList)1 ClockStatus (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.ClockStatus)1 CosemDate (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CosemDate)1 CosemDateTime (org.opensmartgridplatform.domain.core.valueobjects.smartmetering.CosemDateTime)1 CosemTimeDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.CosemTimeDto)1 DayProfileActionDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.DayProfileActionDto)1 DayProfileDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.DayProfileDto)1 SeasonProfileDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.SeasonProfileDto)1 WeekProfileDto (org.opensmartgridplatform.dto.valueobjects.smartmetering.WeekProfileDto)1