Hello:
In the Initialization tab of the Simulation parameters, can I have variables that work anywhere in the hierarchy of the model. i.e. global? At the moment, I create different variables and then I always have to create a mask for the top level block and pass the variables down. i.e.
In Initialization tab:
Rds=100e-3;
Then in the top-level block, I would have to have a parameter Rds equal to Rds and then use Rds in the block at the level below, and keep doing that if I wanted to pass that variable further down the hierarchy.
I’m wondering if I can avoid having to create a mask for the blocks in the hierarchy, with parameters for each of my variables, and just have a global variable I can use anywhere in the hierarchy.
Thanks,….Roger
Hi Roger,
Good question. Unfortunately I do think you need to define all mask variables used inside a subsystem if you mask it. But if you don’t create the mask, the variables can be passed down the layer without needing to initialize them.
Another option I can think of for certain blocks (gains, controllable sources, etc.) would be to define the variable (variable(s) with a vector) in a Constant block at the top-level, then use Signal To/Signal From to send the setpoint to your target block in a lower layer elsewhere in the model. This would obviously not be a solution for defining block parameters at a lower level.
Best regards,
Kris
Thank-you Kris. Ah now that explains why at first I had some variables that were working but then after I created a mask for the top-level block, I started getting error messages about undefined variables. I hadn’t put two and two together.
The vector idea is interesting.
…Roger