Search in sources :

Example 1 with WeekType

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.WeekType in project open-smart-grid-platform by OSGP.

the class SetActivityCalendarRequestBuilder method getWeekType.

private WeekType getWeekType(final String weekName) {
    final WeekType wt = new WeekType();
    final WeekProfile wp = this.activityCalendar.getWeekProfiles().get(weekName);
    wt.setWeekProfileName(wp.getName());
    wt.setMonday(this.getDayType(wp.getMondayDayId()));
    wt.setTuesday(this.getDayType(wp.getTuesdayDayId()));
    wt.setWednesday(this.getDayType(wp.getWednesdayDayId()));
    wt.setThursday(this.getDayType(wp.getThursdayDayId()));
    wt.setFriday(this.getDayType(wp.getFridayDayId()));
    wt.setSaturday(this.getDayType(wp.getSaturdayDayId()));
    wt.setSunday(this.getDayType(wp.getSundayDayId()));
    return wt;
}
Also used : WeekProfile(org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.WeekProfile) WeekType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.WeekType)

Example 2 with WeekType

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.WeekType in project open-smart-grid-platform by OSGP.

the class SetActivityCalendarRequestFactory method fetchActivityCalendar.

private static ActivityCalendarType fetchActivityCalendar() {
    final ActivityCalendarType activityCalendarType = new ActivityCalendarType();
    final String activatePassiveCalendarTime = "FFFFFFFEFFFFFFFFFF000000";
    final byte[] decodedActivatePassiveCalendarTime;
    try {
        decodedActivatePassiveCalendarTime = Hex.decodeHex(activatePassiveCalendarTime.toCharArray());
        activityCalendarType.setActivatePassiveCalendarTime(decodedActivatePassiveCalendarTime);
    } catch (final DecoderException e) {
        LOGGER.error("Unexpected exception during decode activatePassiveCalendarTime.", e);
    }
    activityCalendarType.setCalendarName("Cal Name");
    final SeasonsType seasonsType = new SeasonsType();
    final List<SeasonType> seasons = new ArrayList<>();
    final SeasonType season = new SeasonType();
    season.setSeasonProfileName("1");
    final String seasonStart = "FFFF0C03FFFFFFFFFF000000";
    final byte[] decodedSeasonStart;
    try {
        decodedSeasonStart = Hex.decodeHex(seasonStart.toCharArray());
        season.setSeasonStart(decodedSeasonStart);
    } catch (final DecoderException e) {
        LOGGER.error("Unexpected exception during decode seasonStart.", e);
    }
    final WeekType weekType = new WeekType();
    final DayType normalDay = createDayType(1, "06050000");
    final DayType weekendDay = createDayType(2, "07050000");
    weekType.setMonday(normalDay);
    weekType.setTuesday(normalDay);
    weekType.setWednesday(normalDay);
    weekType.setThursday(normalDay);
    weekType.setFriday(normalDay);
    weekType.setSaturday(weekendDay);
    weekType.setSunday(weekendDay);
    weekType.setWeekProfileName("1");
    season.setWeekProfile(weekType);
    seasons.add(season);
    seasonsType.getSeason().addAll(seasons);
    activityCalendarType.setSeasonProfile(seasonsType);
    return activityCalendarType;
}
Also used : SeasonsType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SeasonsType) DecoderException(org.apache.commons.codec.DecoderException) SeasonType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SeasonType) ActivityCalendarType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ActivityCalendarType) ArrayList(java.util.ArrayList) DayType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayType) WeekType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.WeekType)

Example 3 with WeekType

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.WeekType in project open-smart-grid-platform by OSGP.

the class ActivityCalendarTypeMappingTest method buildActivityCalendarTypeObject.

/**
 * Method to build an ActivityCalendarType object
 */
private ActivityCalendarType buildActivityCalendarTypeObject() {
    // Build a DayType
    final DayProfileActionsType dayProfileActionsType = new DayProfileActionsType();
    final DayProfileActionType dayProfileActionType = new DayProfileActionType();
    dayProfileActionType.setScriptSelector(BigInteger.ZERO);
    dayProfileActionType.setStartTime(COSEMTIME_BYTE_ARRAY);
    dayProfileActionsType.getDayProfileAction().add(dayProfileActionType);
    final DayType dayType = new DayType();
    dayType.setDayId(BigInteger.TEN);
    dayType.setDaySchedule(dayProfileActionsType);
    // Build a WeekType
    final WeekType weekType = new WeekType();
    weekType.setWeekProfileName(WEEKPROFILENAME);
    weekType.setSunday(dayType);
    weekType.setMonday(dayType);
    weekType.setTuesday(dayType);
    weekType.setWednesday(dayType);
    weekType.setThursday(dayType);
    weekType.setFriday(dayType);
    weekType.setSaturday(dayType);
    // Build a SeasonType
    final SeasonType seasonType = new SeasonType();
    seasonType.setSeasonProfileName(SEASONPROFILENAME);
    seasonType.setSeasonStart(COSEMDATETIME_BYTE_ARRAY);
    seasonType.setWeekProfile(weekType);
    // Build an ActivityCalendarType.
    final ActivityCalendarType activityCalendarType = new ActivityCalendarType();
    final SeasonsType seasonsType = new SeasonsType();
    seasonsType.getSeason().add(seasonType);
    activityCalendarType.setActivatePassiveCalendarTime(COSEMDATETIME_BYTE_ARRAY);
    activityCalendarType.setCalendarName(CALENDARNAME);
    activityCalendarType.setSeasonProfile(seasonsType);
    return activityCalendarType;
}
Also used : SeasonsType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SeasonsType) SeasonType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SeasonType) DayProfileActionType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayProfileActionType) ActivityCalendarType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ActivityCalendarType) DayProfileActionsType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayProfileActionsType) DayType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayType) WeekType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.WeekType)

Aggregations

WeekType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.WeekType)3 ActivityCalendarType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ActivityCalendarType)2 DayType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayType)2 SeasonType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SeasonType)2 SeasonsType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SeasonsType)2 ArrayList (java.util.ArrayList)1 DecoderException (org.apache.commons.codec.DecoderException)1 DayProfileActionType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayProfileActionType)1 DayProfileActionsType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayProfileActionsType)1 WeekProfile (org.opensmartgridplatform.cucumber.platform.smartmetering.support.ws.smartmetering.bundle.activitycalendar.WeekProfile)1