Search in sources :

Example 1 with SeasonType

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

the class SetActivityCalendarRequestBuilder method getSeasonType.

private SeasonType getSeasonType(final SeasonProfile sp) {
    final SeasonType st = new SeasonType();
    st.setSeasonProfileName(sp.getName());
    st.setSeasonStart(DatatypeConverter.parseHexBinary(sp.getStart()));
    st.setWeekProfile(this.getWeekType(sp.getWeekName()));
    return st;
}
Also used : SeasonType(org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SeasonType)

Example 2 with SeasonType

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SeasonType 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 SeasonType

use of org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SeasonType 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

SeasonType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SeasonType)3 ActivityCalendarType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.ActivityCalendarType)2 DayType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.DayType)2 SeasonsType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.SeasonsType)2 WeekType (org.opensmartgridplatform.adapter.ws.schema.smartmetering.configuration.WeekType)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