Completely reset nested enabled subsystems

40 views (last 30 days)
Michael
Michael on 16 Nov 2024 at 20:46
Commented: Michael on 19 Nov 2024 at 11:54
Hello, currently I try to build an simulation model (fmu) containing different components of an embedded device. When the device switchs off it stores some values in non volatile memory. After startup everything is reset and the data is restored from that memory. Now I want to simulate this behaviour in the simulink model. The components itself (all designed as libraries) containining further enabled subsystems with the output ports set to held. Now I need to somehow reset not only the states in the subsystem I also need the port output values to reset to their initial value.
My problem using an parent enabled subsystem: During an On cycle the output of the enabled subsystem switches from its initial state "invalid" to "valid". In the next On cycle the port remains on valid but i need the port initially to reset until the system gets enabled.
Is there a way to get this running? From the description of conditional subsystem it seems not possible to override the childs settings. Is their another possibility to control / override the states and initial port values of enabled subsystems?

Answers (1)

Aravind
Aravind on 19 Nov 2024 at 4:19
Hello @Michael,
It sounds like you are looking for a way to reset the states of an enabled subsystem each time it is enabled.
You can accomplish this by adjusting the "States when enabling" parameter of the "Enable" block within the subsystem to "reset" instead of "held." By doing so, whenever the subsystem is enabled, all the blocks within it will reset to their initial states. You can find more details in the official documentation here: https://www.mathworks.com/help/simulink/slref/enable.html#mw_ae5a05ce-5d0f-403a-ad76-9ada6908e3cb.
Setting this parameter to "reset" allows you to reset the output of the enabled subsystem to "invalid" at the start of each "On" cycle, as you described.
To help you get started with using the "reset" option of the "States when enabling" parameter of the "Enable" block, here are some examples:
  1. Example illustrating the Law of Large Numbers: https://www.mathworks.com/help/simulink/slref/illustration-of-law-of-large-numbers.html
  2. Example that implements control algorithms: https://www.mathworks.com/help/simulink/slref/enabled-subsystems.html
  3. An advanced example that uses both "reset" and "held" options to demonstrate their difference: https://www.mathworks.com/help/simulink/slref/advanced-enabled-subsystems.html
I hope this helps resolve your query.
  1 Comment
Michael
Michael on 19 Nov 2024 at 11:54
Hi, thanks a lot for your help.
It's not the states which causes my trouble. The reset of the states works fine. I want to reset the output of the port which is configured to "held".
The system has following structure:
The 1st layer is the parent enabled subsystem which is set to "reset states when enabling". It is used to simulate the On / Off cycle of the device.
The 2nd layer consis of several function call subsystems for the modules which simulates the state-machine of the device
In the 3rd layer (module layer) contains some control logic to activate the "child enabled subsystem".
Finaly the 4th layer is the "child enabled subsystem". It is configured to "reset" too. But the ports are configured to held. This is necessary for the functionality during the "On" cycle of the device
If the device (in the 1st layer) switches On - Off - On the outputs of the "child enabled subsystem" still keep the values. It is stated in the documentation for nested enabled subsystems that the child does not inherit from its parent. So I'm searching for a workaround to change the behaviour of the port output without changing the logic in the module.
Best regards

Sign in to comment.

Products


Release

R2018b

Community Treasure Hunt

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

Start Hunting!