0

I'm looking for a way to use event-based temporal logic in Simulink Stateflow.

Example: [State_1] --> [after(3,sec) && e] --> [State_2]

Scenario:

  • 0 sec: State_1 is active
  • 2 sec: e is true
  • 5 sec: State_2 is active (only after 3s of e)

Expection: [State_1] --> (after 3s of e) --> [State_2]

Result: [State_1] --> (after 3s of State_1) --> [State_2]

Is there a solution for that? I did not found one in official MathWorks documentation (MathWorks - Control Chart Execution Using Temporal Logic)

Thank you

Community
  • 1
  • 1
WainR
  • 21
  • 3
  • 1
    Events are discrete, happening at one instance of time, so `after 3s of e` doesn't make sense. Do you want the transition to occur 3 seconds after `e` has occurred or is `e` really an enable signal that needs to be high for 3 seconds before the transition will occur? Both of those are implementable relatively easily. – Phil Goddard Sep 27 '18 at 14:15
  • e is an enable signal that needs to be high for 3 seconds before the transition will occur and state_2 will be active. For sure, I could use a further state as timer, but I hope there is a smarter solution. – WainR Sep 27 '18 at 19:37
  • 1
    The **smart** solution is to use another state indicating that the event has happened, but which drops back to the original state if the enable signal goes low within the 3s window. There is no reason not to do that, and it helps explain the logic that you implement. – Phil Goddard Sep 27 '18 at 23:24
  • ok, it seems to be a smart solution in that case. Thank you for your feedback. – WainR Sep 29 '18 at 20:10

1 Answers1

-1

This is how I did it:

[State_1] --> [ e] --> [State_1_copy]--> (after 3s) --> [State_2]

combined with:

[State_1] <-- [ ~e] <-- [State_1_copy]

Entry and left action of state 1 may need to be changed depending on cases.

Sylhare
  • 5,907
  • 8
  • 64
  • 80
  • Hi! Welcome to stackoverflow, thank you for the answer, be sure to check https://stackoverflow.com/help/how-to-answer you might find some useful tips – Sylhare Dec 13 '18 at 22:45