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

Attribute of an object is not updated when changing the state with StateFlow in Compose

I followed the last Google tutorials to introduce Compose/ViewModel/State in a new project, but I encounter a problem that I don't understand. When I use a method in Viewmodel to update an object from null to new instance, UI is updated, but when I…
0
votes
0 answers

Jetpack Compose Recomposition Flow Room Database SQL

I have a problem with Lazycolumn refreshing if data in sql database changes. The list is on flow and refresh works if i start searching. But I don't know how to call the change of the list again after clicking the button that saves new data to the…
Krystian
  • 3
  • 1
0
votes
0 answers

Call user defined C functions on every state transition in matlab state flow

After designing my state machine using matlab state flow and generating its C code using code generation, I could easily run it in my application in visual studio. However, after a while I needed to call specific functions at each state transitions.…
siii fsxa
  • 45
  • 5
0
votes
1 answer

Update RecyclerView from StateFlow doesn't work

Is there a way to update (automatically) the RecyclerView when a list is populated with data? I created a simple app (here is the repository for the app). In HomeFragment there is a RecyclerView and a button to refresh the data. The app works fine…
Dimitris
  • 725
  • 1
  • 10
  • 28
0
votes
0 answers

Updating stateFlow value from multiple threads

I am facing an issue wherein when updating stateFlow value in viewmodel from multiple threads, for some of the value I am not getting callback in UI. As an experiment I have tried the following Below is the viewmodel code. class MainViewModel :…
0
votes
0 answers

How to set Bus element in Matlab Stateflow

I have a BUS in Matlab Stateflow which all its elements are of type boolean. If i want to set an element in a state I can access bus using dot operator. How can I access all the elements at once not one by one.
Sherif Beshr
  • 23
  • 1
  • 8
0
votes
1 answer

Automatically update a flow from a changes of another flow (StateFlow) Jetpack Compose

I have a StateFlow from which my List composable collects any changes as a State. private val _people = MutableStateFlow(personDataList()) val people = _people.asStateFlow() And inside my viewModel, I perform modifications on _people and I verify…
z.g.y
  • 5,512
  • 4
  • 10
  • 36
0
votes
0 answers

How To Dynamically Change States In Stateflow?

One way to change states is by connecting a transition from the source state to the destination state. I was wondering if there’s a way to transition to another state by calling a function or by changing some state property. The idea here is that I…
Amjad
  • 70
  • 6
0
votes
1 answer

How to run two states in parallel after a given time is met?

I have a very simple example. Two fans (A and B) are in a facility, representing each as a state. State Fan B will enter after 20 seconds state Fan A starts working. Therefore, after 20 sec, state FanA and state FanB will work in parallel. How can I…
ananvodo
  • 371
  • 5
  • 13
0
votes
1 answer

Battery management using MATLAB Simulink and Stateflow

I am designing a battery model and its control to undergo cyclic charge and discharge. The battery model is created by using a simscape electrical battery block (Table-based). The control is modeled using Stateflow. The stateflow chart takes SOC…
Joshni
  • 3
  • 1
0
votes
1 answer

Observe the state of a Worker withou LiveData

So, I am using workmanager to retrieve data from an FTP server. I have to display one type or information or another type deppending on the state of the worker. I was using getWorkInfoByIdLiveData on the viewmodel and I was observing the state of…
0
votes
1 answer

How to deal with viewholder and flow in recyclerview?

I would like to use my variable flow to save integer and keep him. Then every viewholder in recyclerview observe flow and react if it is clicked. For example: I have cardView when I click on that I use…
0
votes
1 answer

Accessing Simulink Functions from inside Atomic Subchart

For reasons far outside my control, I have now been thrust into doing MATLAB/Simulink/Stateflow work. I've done the On-Ramp training, and already I despise how unintuitive it is to do things that are just common and easy in any text-based…
0
votes
1 answer

Android LiveData advantage than other observable libraries

In 2022, What scenario can imagine LiveData is better than other observable libraries such as StateFlow, SharedFlow, Coroutine Channel and etc.
0
votes
0 answers

App Crash when observing a Live Data in Jetpack Compose Composable due to memory issue

I have one Composable which has one Callback function which is responsible to perform some action based on value it is observing in ViewModel. The Composable looks like. @Composable fun MyComposable( viewModel: MyViewModel = hiltViewModel(), …
1 2 3
8 9