Questions tagged [stateflow]

StateFlow is a toolbox from MathWorks for development of state machines. For questions regarding the StateFlow interface from Kotlin's kotlinx.coroutines library, use the [kotlin-stateflow] tag instead.

Stateflow is an toolbox (extension) of Matlab from Mathworks. It is a commercial, and proprietary toolset.

Generally, Stateflow extends Simulink with the ability to design and test state machines. It is commonly used in control design, where algorithms can be either MATLAB scripts & formulas, Simulink blocks or embedded code (in the form of so-called S-functions).

Code generation is supported on the host platform, but for target code additional tools are required (such as Simulink Real-Time (previously known as real time Workshop) or Embedded Coder).

Advantages compared to software-only tooling (like IBM Rhapsody):

  • use with hardware (in the loop)
  • seamless integration with Simulink

Disadvantages compared to software-only tooling:

  • high license cost for code generation

Links:

131 questions
0
votes
0 answers

Read out the state of the state machine

experts ;) Working on the following problem. Have a state machine with the states A and B. State block 1 is called: A, info in the block: entry: A=1; State block 2 is called: B, info in the block: entry: A=0; Conditions for switching from A to…
check
  • 39
  • 5
0
votes
1 answer

How can I used Event-Based Temporal Logic in MATLAB/Simulink Stateflow?

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:…
WainR
  • 21
  • 3
0
votes
1 answer

Calling a function from stateflow

I am trying to call a function (can be matlab function or a simlink function) from a stateflow in one subsystem, the function must be located in another subsystem as shown below: enter image description here The first subsystem will have a stateflow…
Jack
  • 1
  • 3
0
votes
1 answer

What built-in options for documentation are there in MATLAB?

I'm looking for a way to document the code and models created or generated by MATLAB (m-files) Simulink models (S-functions etc.) and Stateflow. In the last five years I was using Octave so I'm not familiar with newer MATLAB features. The…
Medi1Saif
  • 285
  • 7
  • 19
0
votes
0 answers

Define simulink function that uses Stateflow chart as input

How can i define a simulink function that uses a stateflow chart as input? Let's say i've modeled a stateflow chart and i want to use it in a simulink function, so that my function take as argument the created statechart and it looks like:…
Spartacus
  • 131
  • 1
  • 7
0
votes
1 answer

How to concatenate multiple signals into one signal?

I have multiple signals which are In-ports to a subsystem with different datatypes.I am using State flow to develop a function where I have to use these in-ports and compare with some constants or true/false for boolean. For e.g: Lets say 3 signals…
Priyanka
  • 97
  • 1
  • 2
  • 9
0
votes
1 answer

multiple return variables from graphical function in stateflow

I'm using stateflow graphical function and one of my return parameters are not updated after exiting the function. I'm using matlab as my default code language. Is it possible to return more than one variable from a graphical function? What is the…
Yair R
  • 1
0
votes
1 answer

Visualizing a Stateflow Model

I have a pretty simple MATLAB stateflow model that I would like to visualize. I don't need anything fancy - even if I could just display a different image based on which substate a parallel state is in. Does anyone have any suggestions about what I…
0
votes
0 answers

Stateflow access array elements in matlab action language

I'm using Stateflow (Matlab R2016b) with a vector output signal. The usage of matlab action language is hard to understand. Set a value for whole array Within matlab I use: >> x = ones(1,3) x = 1 1 1 >> x(:) = 2 x = 2 2 …
amw
  • 452
  • 1
  • 5
  • 14
0
votes
1 answer

Simulink Stateflow - 'after' condition not precise?

I implemented an integrator (grounded capacitor driven by piece-wise constant current source) using Stateflow and the 'after' condition. See code. With the given setting the capacitor should change its voltage every 1 sec, but does so about every…
bardo
  • 390
  • 1
  • 9
0
votes
1 answer

How to generate .NET DLL Library from Simulink and Stateflow

How can Simulink and Stateflow models be compiled into a .NET shared DLL library? Is this a feature of Matlab? Is there a specific version or Matlab package required? I am currently using Matlab 2017a on Windows 7. Any starting points would really…
sammy
  • 101
  • 2
  • 8
0
votes
0 answers

How to design a counter with reset in simulink and stateflow

Design a counter that decrements and increments by 1 with rest option which means it rests to zero and starts the counting from one.this problem should be done using both simulink and stateflow.
Yo Yo
  • 1
  • 1
0
votes
2 answers

Find a junction by its number in Stateflow

I'm developing an embedded system in MATLAB Simulink which contains some Stateflow charts. I successfully generate C-code out of it. Unfortunately, building the model throws up some warnings. One of them is: Warning: Junction #1277 does not have an…
c-a
  • 94
  • 1
  • 12
0
votes
1 answer

Write to DataStore from Matlab script

So what I'm trying to do is this: I have a simulink stateflow model. To display some stuff from this model I built a GUI. In this GUI I have a button that should set a flag to true when pressed, which I want to use inside my stateflow model to start…
Vince
  • 1,517
  • 2
  • 18
  • 43
0
votes
1 answer

Matlab Stateflow - after() function on transition not working

In my Stateflow model the after() function is not working. If i put for examle after(10,sec) there is no delay in the states, it switches directly from on to the next. I use a Pulse Generator as an eternal clock for Stateflow with following…
Robin
  • 303
  • 1
  • 4
  • 16
1 2 3
8 9