(* Tank level control. *) (* The process draws water all the time. Open the fill valve when the level falls below 40 percent and close it above 80, so it never overflows and never runs dry. Copy the level to the panel meter. When the Auto selector is switched off, close the valve and keep it closed. Level reads 0 to 1000 for 0 to 100 percent. *) VAR_GLOBAL Auto_Mode AT %IX0.0 : BOOL; (* Auto/manual selector, 1 is auto *) Level AT %IW0 : INT; (* Level transmitter, 0 to 1000 is 0 to 100 percent *) LSH AT %IX0.1 : BOOL; (* High level switch, 1 above 90 percent *) LSL AT %IX0.2 : BOOL; (* Low level switch, 1 below 10 percent *) Fill_Valve AT %QX0.0 : BOOL; (* Fill valve solenoid, 1 opens *) High_Alarm AT %QX0.1 : BOOL; (* High level alarm lamp *) Level_Meter AT %QW0 : INT; (* Panel meter, 0 to 1000 *) END_VAR PROGRAM Main (* Write the logic here. *) END_PROGRAM