My system is as shown where I read an input from a displacement sensor. If the input is more than absolute 0.5, I want the system to output the signal present in the signal builder. I am currently trying to use an enabled subsystem to ensure that the voltage output only happens if the condition becomes true. However, the output signal does not start from T=0, it starts from whatever time has elapsed since the start of the simulation (e.g., if the condition was first met at T = 10 s, it outputs the signal from its intermediate value at T = 10 s]. How should I set the system up such that the output signal starts from its initial point when the condition becomes true?
Notes:
In the enable subsystem, “States when enabling” is set to reset.
My sample time for the Signal Builder is 0.
I cannot set the sample time for the enable subsystem (its set to -1 by default), as the Enable block is not at the root.
Image of current Simulink setup:
Things tried so far:
- I’ve tried using enabled, triggered and reset subsystems.
- I’ve tried letting the input signal be within the enable subsystem with the sample time set to 0.
- I’ve tried to use a reset subsystem nested with an enable system, as well nested enable subsystems.
- I’ve tried using “From workspace” source instead of signal builder.
2