The function block LightControl is the control for the on and off interval of the light. The user can set the interval for how long the light should be on and off, and see how much time is left of the current interval. Here comes the input for the light override as well. The function block also gives out the status of the light. So, if the light is overridden off or on, or if the light is auto off or on.

Override light

Override ValueDescription
0Auto
1Manual On
2Manual Off

Light states

Override Alarm ValueDescription
0Auto Off
1Auto On
2Manual On
3Manual Off


With everything explained the Inputs and Outputs are the following,

INPUT

  • Start → BOOL
  • lightOnTime → TIME
  • lightOffTime → TIME
  • override → INT

OUTPUT

  • OUT → BOOL
  • CDPout→ INT
  • TimeRemainingOn → TIME
  • TimeRemaningOff → TIME

Intern Variables

  • TimerLightOff → TON
  • TimerLightOn → TOF
  • Light → LIGHT


CODED SOLUTION

Variable Decleration:

CODE:






  • No labels