-------------------------------------------------------------------------------- -- -- A railway crossing example -- -- Author(s) : Willem Hagemann -- -- -- fomc --flowpipe --noonion -- --configStringFlowpipe "max_steps=50000; step_width=1/30; \ -- result_denominator=4096;" -- --configStringFomc "flowpipeGCPreimage=false;" -- -- This model was checked for different disturbtions -------------------------------------------------------------------------------- DECL bool flow ; -- state of drive [0,3] int d_mode ; const [0,3] int braking = 0; const [0,3] int normal = 1; const [0,3] int accel = 2; const [0,3] int emergency = 3; -- phases of operation [0,4] int phases; const [0,4] int far = 0; const [0,4] int requesting = 1; const [0,4] int negotiation = 2; const [0,4] int correcting = 3; const [0,4] int passed = 4; -- desired velocity const real v_desired = 30.0; -- borders for the normal drive-mode const real v_max_normal = 45.0; const real v_min_normal = 20.0; -- borders for the braking drive-mode const real v_min_braking = 42.0; -- borders for the accel drive-mode const real v_max_accel = 22.0; -- Points of phase change const real ActivatedPoint = 400.0; //activation point const real AcknowledgePoint = 450.0; //receive acknowledge const real BrakingPoint = ActivatedPoint + 400.0; //braking point const real EOA = ActivatedPoint + 770.0; //control point -- train length const real TL = 90.0; -- Global constraints for position and velocity [0.0, 60.0] real v; [0.0, EOA + 100.0] real p; -- EoA bool newEoa; input bool i_newEoa; bool EoaFailure; -- Xing bool isXing; input bool i_isXing; bool XingAck; input bool i_XingAck; bool XingSafe; input bool i_XingSafe; bool XingReqLock; bool XingFailure; bool failure; INIT EoaFailure = false; XingFailure = false; XingReqLock = false; failure = false; flow = true; p = TL; phases = far; (d_mode = normal and v >= v_min_normal and v <= v_max_normal) or (d_mode = accel and v >= 0.0 and v <= v_max_accel) or (d_mode = braking and v >= v_min_braking and v <= 50.0); INVAR JUMP ---DRIVE ----------------------------------- -- exits d_mode = braking and v <= v_min_braking -> flow' = false ; d_mode = normal and v >= v_max_normal -> flow' = false ; d_mode = normal and v <= v_min_normal -> flow' = false ; d_mode = accel and v >= v_max_accel -> flow' = false ; -- entries !(d_mode = emergency) and v >= v_max_normal -> d_mode' = braking ; !(d_mode = emergency) and v < v_max_normal and v > v_min_normal -> d_mode' = normal ; !(d_mode = emergency) and v <= v_min_normal -> d_mode' = accel ; d_mode = emergency -> flow' = true ; --- PHASE CTRL ----------------------------------- -- exits phases = far and p >= ActivatedPoint -> flow' = false and isXing' = i_isXing ; phases = requesting and p >= AcknowledgePoint -> flow' = false and XingAck' = i_XingAck ; phases = negotiation and p >= BrakingPoint -> flow' = false and newEoa' = i_newEoa and XingSafe' = i_XingSafe ; phases = correcting and p >= EOA + TL -> flow' = false ; -- entries !(phases = far) and p < ActivatedPoint -> phases' = far ; !(phases = requesting) and p >= ActivatedPoint and p < AcknowledgePoint -> phases' = requesting ; !(phases = negotiation) and p >= AcknowledgePoint and p < BrakingPoint -> phases' = negotiation ; !(phases = correcting) and p >= BrakingPoint and p < EOA + TL -> phases' = correcting ; !(phases = passed) and p >= EOA + TL -> phases' = passed ; -- XING PROTOCOL isXing and !XingReqLock -> XingReqLock' = true ; XingReqLock and p = AcknowledgePoint and !XingAck and !XingFailure -> XingFailure' = true ; isXing and p = BrakingPoint and !XingSafe and !XingFailure -> XingFailure' = true ; -- EOA PROTOCOL p = BrakingPoint and !newEoa and !EoaFailure -> EoaFailure' = true ; -- ERROR CTRL failure and !EoaFailure and !XingFailure -> failure' = false ; !failure and EoaFailure -> failure' = true ; !failure and XingFailure -> failure' = true ; !(d_mode = emergency) and failure -> d_mode' = emergency ; FLOW d_mode = braking -> d/dt(v) = -1.5 and d/dt(p) = v; d_mode = normal -> d/dt(v) = 0.1*v_desired - 0.1*v and d/dt(p) = v; d_mode = accel -> d/dt(v) = 1.0 and d/dt(p) = v; d_mode = emergency -> d/dt(v) = //0.1 is safe, 0.3 unsafe -3.0 and d/dt(p) = v; TARGET -- MAIN TARGETS (d_mode = emergency) -> p <= EOA; //(1) // (d_mode = emergency or p <= EOA); //(2) //(1) safe: in case of emergency the train stops before end of authority //(2) unsafe: in case of no emergency the train passes position EOA