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
1
vote
1 answer

StateFlow Observer is being triggered Two Times - Is this a good solution?

Okay so I've been using StateFlow with Room database for a while. Now I have one common case. At the start of my app I have a logic that if ROOM database is empty I should show an EmptyContent(), otherwise I will show the ListContent() from ROOM…
Stefan
  • 2,829
  • 5
  • 20
  • 44
1
vote
1 answer

Prevent concurrent execution of part of two suspend functions

I have two suspend methods that I launch parallely inside a ViewModel: init { viewModelScope.launch(Dispatchers.Default) { launch { loadTotalCirculation() } launch { loadMarketPrice() } } } private suspend fun…
Shivam Verma
  • 7,973
  • 3
  • 26
  • 34
1
vote
1 answer

Build state machine with 2 variables

I am new with Modelica but I would like to build an easy state machine with 2 variables : The initial step is "off" (the variable Light_cabin==0) then if button_Evac == 1 (second variable) then go to step "on" and Light_Cabin == 1 if Button_Evac==0…
Eloise
  • 37
  • 4
1
vote
1 answer

How to resolve'updates persistent or state variables while computing outputs, therefore it cannot be used in an algebraic loop....' error with Charts

I have a Model with 2 charts created with code. My first chart is a test simulation which go to a TIMER EXPIRED state when TimerStatus = 1;. The error occurs with my timer chart : When I try to simulate I get the error…
Lucas
  • 247
  • 3
  • 13
1
vote
1 answer

Close Stateflow editor programmatically

Is there a way to close (or hide) a Stateflow Editor programmatically? I could not find any hint about this in the documentation or the net. The only way I know of is to close the model entirely, but I do not want this, as a changed model might need…
walderich
  • 500
  • 1
  • 9
  • 24
1
vote
1 answer

How can I extract the location of the Stateflow blocks in a given Simulink model?

I have a Simulink model and I would like to extract the location of the Stateflow blocks it contains. I am looking for a command inspired by this command that gives the total number of blocks. How could I do this or where can I find more…
Karlo
  • 1,630
  • 4
  • 33
  • 57
1
vote
1 answer

Simulink/StateFlow error with my Clock

I created this state machine chart in Simulink using the StateFlow : There are two states (S1,S2), one of which (S1) has 3 nested parallel FSM , each one has 4 states (SS1, SS2, SS2, SS4) , I put a default state in all of the 3 FSMs (SS1), and in…
Sam Gomari
  • 733
  • 4
  • 13
  • 37
1
vote
1 answer

How to process vector input in StateFlow

I'm new to StateFlow and have been looking at StateFlow tutorials but have not seen one that processes vectors. My simulink model generates vectors of audio data for which I would like to process with a state machine. For example, if the audio data…
Chuck Carlson
  • 977
  • 8
  • 26
1
vote
1 answer

How to print a stateflow chart as svg file

I would like to print an existing stateflow chart to a svg file. I have found... sfprint ...but sfprint does not support svg format. BUT, when I use "Export to web..." from my simulink model the generated webview has the stateflow diagrams as an…
jayveesea
  • 23
  • 4
1
vote
2 answers

How to give ascii characters as input in simulink

I have to give ascii characters as input from simulink to stateflow and need to check whether the input matches with the existing ascii character. Can anyone help me to solve this? will be of a great help? Example: If I give ascii characters 'AF' as…
1
vote
3 answers

My simple simulink model runs too fast

I have designed a simple simulink and stateflow diagrams on Matlab. It works perfectly! But I have two issues: 1) The model runs too fast. The transition time between two states are amazingly fast that I can not see. I tried to change some…
user1196937
1
vote
1 answer

Matlab and simulink stateflow chart error

I have been trying to use "stateflow chart" block for hours. However, I keep getting this error: The current directory is c:\program files\matlab13\bin, which is reserved for MATLAB files. Please change your current directory to a writable…
1
vote
1 answer

All possible combinations for evalution of conditions

Example : if(A & B) { if(C) { } if(D) { } } We have four different states for all the conditions in this code. 0 represents False and 1 represents true state. * shows that the condition is not valid in this state flow. So…
1
vote
1 answer

How do you deselect a Stateflow element?

I'm using the Stateflow API's view method to select/highlight elements in a Stateflow chart, but I want to clear the highlight afterward. I know I can get a handle to the Stateflow object and call the view method on it to highlight it: theObject =…
rob
  • 6,147
  • 2
  • 37
  • 56
1
vote
0 answers

Clear Tag property on object copy operation

I'd like to use a stateflow object's Tag property to hold persistent data relative to that object. The problem arises when the user performs a copy of the object using a right-click/drag/release of the object. Under this (and all copy operations),…
checker
  • 63
  • 6
1 2
3
8 9