using "types";
FlowSheet sample_timer
PARAMETERS
Timer as Switcher(Valid = ["closed", "opened"], Default = "closed");
TimeOpened as time_sec;
TimeClosed as time_sec;
VARIABLES
Clock as Real;
flow as flow_vol;
SET
TimeOpened = 2*'s';
TimeClosed = 4*'s';
EQUATIONS
switch Timer
case "closed":
flow = 0 * 'm^3/h';
diff(Clock) = 1/TimeClosed;
when Clock > 1 switchto "opened";
case "opened":
flow = 1 * 'm^3/h';
diff(Clock) = -1/TimeOpened;
when Clock < 0 switchto "closed";
end
INITIAL
Clock = 0;
OPTIONS
TimeStep = 0.1;
end