I wish to write data to a file when an integrator saturates. I would like to route the integrator's saturation output port to one of the s-function's inputs. I realize that I can continuously poll the signal, but I'd like to explore triggering on the signal. In other words, for the s-function to behave similarly to a software interrupt.
Asked
Active
Viewed 371 times
2 Answers
0
Madison,
If you like to call s-function based on trigger, you might explore using a relational operator to check the condition. When the condition is True, function would be triggered.
Trying to embed a screenshot below:

Shafik M
- 11
- 2
-
Shafik M, your suggested approach works, and it is indeed what I am already doing. The deficiency that I find is that the s-function samples the trigger during every sample interval whether or not the trigger is active. If on the other hand the s-function is "activated" by the trigger, it is only called when there is data to be processed. I am trying to streamline the execution of the model to increase execution speed. – F. Madison Apr 24 '21 at 11:21
0
F. Madison,
If you like to trigger it on signal change from 0 to 1, you can make use of a condition made up of relational operator and Unit delay:

Shafik M
- 11
- 2
-
Shafik M, once again your solution will work. Though, it does so by polling input(s). I suspect that this may be the best that can be done. I was hoping to find a way for a signal to trigger an interrupt. – F. Madison Apr 26 '21 at 00:17