Clear Filters
Clear Filters

How can I change Cd parameter of a local restriction for Gas Systems during a simulation run?

1 view (last 30 days)
I am working on a pipe system in the Gas System environment offered in Simscape. I would like to change, as the simulation is running, the Discharge Coefficient (Cd) parameter, in the Variable Local Restriction Block. I have tried to set in my model the default parameter behavior as "Tunable": set_param('MyModel','DefaultParameterBehavior','Tunable').
In the Variable Local Restriction Mask, I change the option from "Compile-Time" to "Run-Time", and then set the Cd parameter for example to 0.4 by using set_param:
set_param('MyModel/PipeSystem/Valve1','Cd','0.4')
However the simulations outputs during the run are unaffected.
I checked the parameter readability by typing in the command window:
para=get_param('MyModel/PipeSystem/Valve1','ObjectParameters')
And saw that in the field "Cd" under 'Attributes' there is 'read-write' and 'link-istance'. So it appears that the parameter should be updated without having to recompile the model.
Any suggestion on what I might be overlooking?
Thanks in advance!
Sam

Answers (0)

Categories

Find more on Gas Models in Help Center and File Exchange

Community Treasure Hunt

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

Start Hunting!