
Keep output value from a switch block constant for the rest of the simulation time at time when switch output first one?
6 views (last 30 days)
Show older comments
I want to store MPPT_Enable value when it becomes 1 for the 1st time and keep the value one(1) for the rest of the simulation. How can i do that? Thank you all.

0 Comments
Answers (1)
Rajanya
on 31 Jan 2025
You can achieve the same with a combination of a 'OR' and a 'Memory/Delay' block.
If the 'Memory' block is connected in feedback to one of the inputs of the 'OR' block, once the output of the 'OR' block becomes high(1), this value is stored by the 'Memory' block. In the next time step, regardless of the other input, the 'OR' block will continue to output a high value because it receives the stored high value from the 'Memory' block as one of its inputs. Consequently, once set to high, the output of the 'OR' block remains high as this goes on in a cycle.
The connection is shown as follows:

Hope this answers your question. Thanks!
0 Comments
See Also
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!