This FGP will decide a current operating State, to be used elsewhere in your sequences.
The current state will be dependent upon the status of a 7-day Schedule and an Afterhours timer. The Schedule will provide a single On and Off time for each of the seven days of the week. In additon, up to seven Special Day times can be defined. The Main State will reflect the status of the Schedule. If the Schedule is On, the Main State will be set to Occupied. If the Schedule is Off, the Main State will be set to Unoccupied.
If the Afterhours timer receives a request, the Afterhours timer will start, and will remain active for the value held in it's Time Allowed setting. While the Afterhours timer is active, the Main State shall be set to Occupied. When the Afterhours Timer expires, the Mains State will follow the status of the Schedule.
Adjust the On and Off times of the Schedule Object to match the actual project needs. If you are not using Special Events as defined in the Calendar Object, you can disable the Special 1 values.
You will have to adjust the Time Allowed and Minimum Time values in the Afterhours Object. There are set for 5 minutes each in the FGP, for testing purposes. After testing, increase them to the actual time period needed.
If you are not using the Afterhours Object, then do not link a handle to the Request Handle. As another safeguard, disable Interlock 1 in the State Object.