Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- IF "o_supplypump" THEN
- "s_flowrate" := "i_flowrate":P;
- #ctime := TIME_TCK();
- "s_targetvolume" := "s_targetvolume" - (#ctime - "s_prevtime") * "s_flowrate";
- "s_prevtime" := #ctime;
- ELSE
- "s_prevtime" := TIME_TCK();
- END_IF;
- CASE "s_state" OF
- "state_init":
- IF "i_restankmid" THEN
- "s_state" := "state_drain";
- ELSE
- "s_targetvolume" := "ui_volume1" * "volumefactor";
- "s_state" := "state_fill1";
- END_IF;
- "state_fill1":
- IF "s_targetvolume" <= 0 THEN
- "s_state" := "state_wait1";
- END_IF;
- "state_wait1":
- IF "s_timer" THEN
- "s_targetvolume" := "ui_volume2" * "volumefactor";
- "s_state" := "state_fill2";
- END_IF;
- "state_fill2":
- IF "s_targetvolume" <= 0 THEN
- "s_state" := "state_wait2";
- END_IF;
- "state_wait2":
- IF "s_timer" THEN
- "s_targetvolume" := "ui_volume3" * "volumefactor";
- "s_state" := "state_fill3";
- END_IF;
- "state_fill3":
- IF "s_targetvolume" <= 0 THEN
- "s_state" := "state_wait3";
- END_IF;
- "state_wait3":
- IF "s_timer" THEN
- "s_state" := "state_init";
- END_IF;
- "state_drain":
- IF NOT "i_restanklow" THEN
- "s_state" := "state_cooldown";
- END_IF;
- "state_cooldown":
- IF "s_timer" THEN
- "s_state" := "state_init";
- END_IF;
- END_CASE;
- "IEC_Timer_0_DB".TON(IN:="s_state" = "state_wait1" OR "s_state" = "state_wait2" OR "s_state" = "state_wait3" OR "s_state" = "state_cooldown",
- PT:=T#1s,
- Q=>"s_timer");
- "o_drainpump" := "s_state" = "state_drain";
- CASE "s_state" OF
- "state_fill1":
- "o_supplypump" := "i_tank1low";
- "state_fill2":
- "o_supplypump" := "i_tank2low";
- "state_fill3":
- "o_supplypump" := "i_tank3low";
- ELSE
- "o_supplypump" := FALSE;
- END_CASE;
- "o_valve1" := "s_state" = "state_fill1";
- "o_valve2" := "s_state" = "state_fill2";
- "o_valve3" := "s_state" = "state_fill3";
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement