Tuning the start time and the other change states check in the state machine.

This commit is contained in:
skarg
2007-02-26 20:36:29 +00:00
parent f45aa10571
commit 2661171f42
+9 -5
View File
@@ -395,6 +395,7 @@ void Load_Control_State_Machine(int object_index)
case SHED_REQUEST_PENDING: case SHED_REQUEST_PENDING:
if (Load_Control_Request_Written[object_index]) { if (Load_Control_Request_Written[object_index]) {
Load_Control_Request_Written[object_index] = false; Load_Control_Request_Written[object_index] = false;
}
/* request to cancel using default values? */ /* request to cancel using default values? */
switch (Requested_Shed_Level[object_index].type) { switch (Requested_Shed_Level[object_index].type) {
case BACNET_SHED_TYPE_PERCENT: case BACNET_SHED_TYPE_PERCENT:
@@ -419,15 +420,17 @@ void Load_Control_State_Machine(int object_index)
object_index); object_index);
break; break;
} }
} /* clear the flag for Start time if it is written */
if (Start_Time_Property_Written[object_index]) { if (Start_Time_Property_Written[object_index]) {
Start_Time_Property_Written[object_index] = false; Start_Time_Property_Written[object_index] = false;
}
/* request to cancel using wildcards in start time? */ /* request to cancel using wildcards in start time? */
if (datetime_wildcard(&Start_Time[object_index])) { if (datetime_wildcard(&Start_Time[object_index])) {
Load_Control_State[object_index] = SHED_INACTIVE; Load_Control_State[object_index] = SHED_INACTIVE;
printf("Load Control[%d]:Start Time=Wildcard\n",
object_index);
break; break;
} }
}
/* cancel because current time is after start time + duration? */ /* cancel because current time is after start time + duration? */
Update_Current_Time(&Current_Time); Update_Current_Time(&Current_Time);
datetime_copy(&End_Time[object_index], &Start_Time[object_index]); datetime_copy(&End_Time[object_index], &Start_Time[object_index]);
@@ -437,8 +440,8 @@ void Load_Control_State_Machine(int object_index)
if (diff < 0) { if (diff < 0) {
/* CancelShed */ /* CancelShed */
/* FIXME: stop shedding! i.e. relinquish */ /* FIXME: stop shedding! i.e. relinquish */
printf printf("Load Control[%d]:Current Time"
("Load Control[%d]:Current Time is after Start Time + Duration\n", " is after Start Time + Duration\n",
object_index); object_index);
Load_Control_State[object_index] = SHED_INACTIVE; Load_Control_State[object_index] = SHED_INACTIVE;
break; break;
@@ -453,7 +456,8 @@ void Load_Control_State_Machine(int object_index)
Requested_Shed_Level[object_index].type); Requested_Shed_Level[object_index].type);
} else if (diff > 0) { } else if (diff > 0) {
/* current time after to start time */ /* current time after to start time */
printf("Load Control[%d]:Current Time is after Start Time\n", printf("Load Control[%d]:Current Time"
" is after Start Time\n",
object_index); object_index);
/* AbleToMeetShed */ /* AbleToMeetShed */
if (Able_To_Meet_Shed_Request(object_index)) { if (Able_To_Meet_Shed_Request(object_index)) {