How can I easily change multiple initialization variables based on a single part number (or variable) selection?

I would like to change a group of variables based on the selection of a part number in our device family.

i.e.

Device1

K1=20;

config1=0;

Fmin=20e3;

Device2

K1=3;

config1=1;

Fmin=40e3;


Then the user would just specify Device=1 or Device=2 or even the string “Device1” and then have a statement that says if Device=Device1 then set the following group of variables to pre-specified values.

I’m not very familiar with the programming options available to me in the Initialization tab of the Simulation Parameters. I have at least figured out that I can lookup a value in an array with an index but not sure if case statements exist or the like.

Also can the same sort of thing be done in the mask of a masked subsystem. Can a user just pick from a dropdown menu, the device they want, and have the mask initialize a bunch of variables/parameters based on the dropdown menu selection?

Thanks, …Roger

Hello again,

There are a few options of how you could do this in the initialization code, yes. I have attached an example showing one way, that admittedly is not the most elegant, but otherwise very straightforward. To implement Dropdown menu items you would need to use a masked subsystem and the logic in the subsystem’s initialization commands. Let me know if you have any questions.

Kris

boost_converter_multiple_configurations.plecs (11.4 KB)