Here is my file, with the Stateflow being in Vehicle Subsystem > Orange Subsystem
Stateflow - functions not connected to other blocks
3 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Hi!
I am trying to create a vehicle body on Simulink, and I am using Stateflow for the gearbox control (following the MathWorks example: https://uk.mathworks.com/help/sdl/ug/about-the-complete-vehicle-model.html)
I have trouble creating the Stateflow subsystem, as the UP/DOWN in my Bloc 1 don't seem to be connected to the ones in the selection state. From the model available online (link above), it seems like I am only missing the yellow colour on these words in order for them to be linked and refered to in the gear selection state. The Stateflow models and examples available online all use this "yellow" feature, so I think it is quite easy to use once you know how to do it, but I can't see how to do it.
Would anyone be able to help me?
Thanks in advance!
Respuestas (3)
Umar
el 2 de Jul. de 2024
Hi Claire,
To answer your question, you need to establish data connections within the Stateflow chart. The "yellow" color you mentioned typically indicates data connections in Stateflow models. To create these connections, Open the Stateflow chart. Then, use data objects to link the UP/DOWN signals in Block 1 to the selection state. Ensure that the data objects are properly defined and accessible within the Stateflow chart. Then, establish transitions or conditions based on these data connections for proper functionality. If you follow these steps and leveraging data connections within Stateflow, you can effectively link the signals and enable seamless communication between Block 1 and the selection state in your Simulink model. Let me know if you need further assistance.
0 comentarios
Umar
el 2 de Jul. de 2024
Hi Claire,
After reading your comments, I have created the data (a single type local data containing my range, 0 to 4). I have applied this so I believe it is stored somewhere in my Stateflow. However, I don't manage to link the UPs and DOWNs in my chart to this data. Would you be able to help me on this?
My suggestions to help you out would be defining variables within Stateflow that represent your dataset. For instance, if your data ranges from 0 to 4, you could create a variable named 'dataValue' of type integer. Then, In your Stateflow chart,use actions or transitions to assign values from your dataset to the 'dataValue' variable. For example, if a transition represents an UP event, you can set 'dataValue = 4' to indicate an increase. Afterwards, connect the UPs and DOWNs in your chart to the 'dataValue' variable. You can use conditions or state transitions based on the value of 'dataValue' to trigger UP or DOWN events. For instance, if 'dataValue > 2', it could trigger a UP event. For example, let’s say you have a Stateflow chart representing a system's temperature control. If your data indicates temperature levels from 0 to 4, you can link an increase in temperature (UP) to 'dataValue = 4' and a decrease (DOWN) to 'dataValue = 0'. By incorporating these assignments into your chart logic, you establish a direct correlation between the data and UPs/Downs.
Hopefully, by following these guidelines and utilizing the example provided, you should be able to successfully link your dataset in Stateflow to the UPs and DOWNs in your chart.
0 comentarios
Ver también
Categorías
Más información sobre Complex Logic en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!