Group Abstract Group Abstract

Message Boards Message Boards

6
|
13K Views
|
4 Replies
|
9 Total Likes
View groups...
Share
Share this post:

Specify sets of parameters in SystemModeler

Attachments:
POSTED BY: Patrik Ekenberg
4 Replies
Attachments:
POSTED BY: Neil Singer

Patrik,

I like the feature of the first approach in that you get to see the parameter of the set in the model view (In your figure the set block in the upper left corder has the values for m,c and f visible in the model view) . The second approach is more convenient to use, but the parameters do not appear anywhere on the model view. Is there a way to do the second approach and have the values used in the set appear in the model? I tried to experiment with this but could not get values to display.

Is there a way to use the replaceable components (that you show in the golf and soccer model) to redeclare the record so the visual changes to show some indication of the values in the record (for example: m=1 for one and m=2 for another, etc.)?

Thanks

POSTED BY: Neil Singer

Yes, replaceable components could be used for that. If you put:

replaceable ParameterSets.Records.Set1 set

Then as before you can add choices for the user in the annotation. You can either add a choice like this:

choice(redeclare ParameterSets.Records.Set1 set(m=2,c=2,f=2) "Set 2")

Where you directly in the annotation hard code the different values.

For scale up, I would suggest using this instead:

choices(choice(redeclare ParameterSets.Records.Set1 set "Set 1"),choice(redeclare ParameterSets.Records.Set2 set "Set 2"),choice(redeclare ParameterSets.Records.Set2Alt set "Set 2 alternative"))

Now the actual values can be changed in the records instead and it is easier to add new ones.

You need to create a base class with this replaceable component. In an extended class, you can choose to redeclare the record:

diagram before redeclaration

redeclare record

diagram after redeclaration

I updated the model file and attached it below!

Attachments:
POSTED BY: Patrik Ekenberg

enter image description here - you have earned "Featured Contributor" badge, congratulations !

This is a great post and it has been selected for the curated Staff Picks group. Your profile is now distinguished by a "Featured Contributor" badge and displayed on the "Featured Contributor" board.

POSTED BY: EDITORIAL BOARD
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard