![gxdn](/files/frontie/gxdn-header.png)
Activity calendar is used to handle tariff structures in the meter.
Properties
-
1. Logical Name
Logical name of the object.
-
2. Calendar name active
Active calendar name
-
3. Season profile active
Season profile defines seasons when Week profile table is called.
-
4.Week profile table active
Week profile table defines week days when given Day profile table is executed.
-
5. Day profile table active
Day profile table defines executed script and time when it's executed.
Writing an active table directly is not allowed. Write new settings for the passive day profile and then activate the new profile with Activate passive calendar -action. -
6. Calendar name passive
Passive calendar name
-
7. Season profile passive
Season profile defines seasons when Week profile table is called.
-
8.Week profile table passive
Week profile table defines week days when given Day profile table is executed.
-
9. Day profile table passive
Day profile table defines executed script and time when it's executed.
Actions
-
1. Activate passive calendar
Copy all passive calendar targets to active.
Access data from ANSI C
//How to loop through all active season profiles. int pos; gxSeasonProfile* it; gxActivityCalendar* ac = (gxActivityCalendar*)object; for (pos = 0; pos != ac->seasonProfileActive.size; ++pos) { ret = arr_getByIndex(arr, pos, (void**)& it); if (ret != DLMS_ERROR_CODE_OK) { return ret; } printf("Name: %.*s\n", it->name.size, it->name.data)); time_print(it->start); printf("Name: %.*s\n", it->weekName.size, it->weekName.data)); }
//How to loop through all active week profiles. int pos; gxActivityCalendar* ac = (gxActivityCalendar*)object; gxWeekProfile* it; int pos, ret; for (pos = 0; pos != ac->weekProfileTableActive->.size; ++pos) { ret = arr_getByIndex(arr, pos, (void**)& it); if (ret != DLMS_ERROR_CODE_OK) { return ret; } printf("Name: %.*s\n", it->name.size, it->name.data)); printf("Monday: %d\n", it>monday); printf("Tuesday: %d\n", it>tuesday); printf("Wednesday: %d\n", it>wednesday); printf("Thursday: %d\n", it>thursday); printf("Friday: %d\n", it>friday); printf("Saturday: %d\n", it>saturday); printf("Sunday: %d\n", it>sunday); }
//How to loop through all active day profiles. int pos; gxActivityCalendar* ac = (gxActivityCalendar*)object; gxDayProfile* dp; gxDayProfileAction *it; int pos, pos2, ret; for (pos = 0; pos != ac->dayProfileTableActive.size; ++pos) { ret = arr_getByIndex(arr, pos, (void**)&dp); if (ret != DLMS_ERROR_CODE_OK) { return ret; } printf("DayId: %d\n", dp-> dayId); for (pos2 = 0; pos2 != dp->daySchedules.size; ++pos2) { ret = arr_getByIndex(& dp-> daySchedules, pos2, (void**)&it); if (ret != DLMS_ERROR_CODE_OK) { return ret; } printf("Logical name: %.*s\n", it->scriptLogicalName.size, it->scriptLogicalName.data)); printf("%d\n"it - > scriptSelector); time_print(it->startTime); } }
gxDayProfile* dp; gxSeasonProfile* sp; gxWeekProfile* wp; gxDayProfileAction* act; int ret; const unsigned char ln[6] = { 0,0,13,0,0,255 }; if ((ret = cosem_init2((gxObject*)&activityCalendar, DLMS_OBJECT_TYPE_ACTIVITY_CALENDAR, ln)) == 0) { bb_addString(&activityCalendar.calendarNamePassive, "Passive"); sp = (gxSeasonProfile*)malloc(sizeof(gxSeasonProfile)); bb_init(&sp->name); bb_addString(&sp->name, "Winter time"); time_init(&sp->start, -1, 10, 30, 1, 0, 0, -1, -1); bb_init(&sp->weekName); arr_push(&activityCalendar.seasonProfilePassive, sp); //Add week profile. wp = (gxWeekProfile*)malloc(sizeof(gxWeekProfile)); bb_init(&wp->name); bb_addString(&wp->name, "Tuesday"); wp->monday = wp->tuesday = wp->wednesday = wp->thursday = wp->friday = wp->saturday = wp->sunday = 1; arr_push(&activityCalendar.weekProfileTablePassive, wp); //Add day profile. dp = (gxDayProfile*)malloc(sizeof(gxDayProfile)); arr_init(&dp->daySchedules); dp->dayId = 1; act = (gxDayProfileAction*)malloc(sizeof(gxDayProfileAction)); time_init(&act->startTime, -1, -1, 1, 1, 0, 0, -1, -1); act->script = BASE(actionSchedule); act->scriptSelector = 1; arr_push(&dp->daySchedules, act); arr_push(&activityCalendar.dayProfileTablePassive, dp); }