Info

Cette question est clôturée. Rouvrir pour modifier ou répondre.

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

1 vue (au cours des 30 derniers jours)
Artyom
Artyom le 22 Jan 2014
Clôturé : MATLAB Answer Bot le 20 Août 2021
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
  1 commentaire
Madhu Govindarajan
Madhu Govindarajan le 10 Déc 2015
Have you tried triggered subsystems? In this everything inside the subsystem will work only after receiving the trigger.

Réponses (0)

Community Treasure Hunt

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

Start Hunting!

Translated by