Please take a minute to review and accept our Terms of Use.
Welcome to the PLECS User Forum, where you can ask questions and receive answers from other members of the community.

Many technical questions regarding PLECS are answered on the Technical Solutions page of our website. Tutorial videos, specific application examples, and pre-recorded webinars are available on our YouTube page. Please follow us on LinkedIn for the latest Plexim news.

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

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












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
asked Aug 27 by rcolbeck (21 points)

1 Answer

0 votes
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.

answered Aug 28 by Kris Eberle (910 points)