This question is closed. Reopen it to edit or answer.

What is the best way to call hardware driver function only on signal change in Simulink?

1 view (last 30 days)
Hi. We are using Simulink Coder and Embedded coder to deploy simulink stateflow models in our control systems. The problem there is that in stateflow controller model we have several boolean signals, which are just commands to switch on and off some control relays or lamps and changed accidentally from state to state. Normally such signals have to be passed to some hardware specific function, which generates message on field bus, so this function has to be called not every time step, but only if appropriate signal is changed. In the model the signals are routed in to top ports- of controller model in order to connect them to plant simulation.
So my question is - what is the best way to implement this in Simulink/stateflow. Currently I see following possibilities: 1. Integrate hardware function call into Stateflow Charts and call it every time on entrance to state or transition. Easy and simple, but I can not eliminate signals itself as they are used to connect to plant model. 2. Use of events? 3. Use of s-functions

Answers (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!