Way to put info on SubModel that does not update when clones refresh?

78 views
Skip to first unread message

Jerry Levasseur

unread,
Jul 19, 2022, 9:24:35 AM7/19/22
to Jaamsim Users Discussion Group
I am really liking the Submodel feature.. it is saving me a lot of time.

There is one thing though I would like to do that I have not figured out yet.  Is there a way I can mark info on the clones that doesn't update when the clones refresh?

For example, I may want to mark a clone as being part of Scenario 2.  Or I may want to say this clone is Type 1, another is Type 2, another Type 3.

Of course, I could make a copy (not clone) of the SubModel, but then I must make any new changes in each copy.

Or, perhaps I want to connect the clones to different Next Components when an object leaves the clone.

I may be able to put some logic in that initializes and sets values like this when the model starts, but it gets complicated fast.

-- Jerry

Harry King

unread,
Jul 19, 2022, 9:40:20 AM7/19/22
to Jaamsim Users Discussion Group
Jerry,

Any inputs you set on the SubModel clones will be saved correctly and not updated as long as the input was not set in prototype SubModel. This applies to inputs to both the SubModel object itself and its components. Eventually, we want to allow an input to a clone to override an input to its prototype, but much more development work is needed before that feature is possible.

If there is an input that needs to be set in the prototype SubModel, but you want to override it in the clones, you can set the input to an attribute value (i.e. the expression this.attrib) and then assign different values to the attribute.

Harry

Jerry Levasseur

unread,
Jul 19, 2022, 10:05:35 AM7/19/22
to Jaamsim Users Discussion Group
Thanks for the super-quick response, Harry.

Yes, I found I can send an entity in to specific clones and use something like 'sub.Type = this.obj.Type' to set the attribute.  I notice that arrows (NextConnection) going into the clones can be set individually, but going out will all follow the prototype.  So I can solve my problem.  :)

     " Any inputs you set on the SubModel clones will be saved correctly and not updated as long as the input was not set in prototype SubModel."

I must be misunderstanding this.  Say my prototype Submodel does not have an attribute "Type4" and I go to my clone which I want to be Type 4, if I add an attribute { Type4  4 } to the clone's AttributeDefinitionsList, this attribute will disappear when I Update Clones.  Is this intended behavior? (I had assumed it was).

(By the way, I noticed you changed the behavior so that if I make an error entering a field, instead of simply losing my line, I now get the option to Edit or Reset.  That used to be so annoying, so thanks for this!)

Harry King

unread,
Jul 19, 2022, 10:27:11 AM7/19/22
to Jaamsim Users Discussion Group
Yes, it does appear that AttributeDefinitionList input for a clone is cleared even when the prototype input is blank. I'm not sure whether this is necessary or not. Will look into it.

One thing you can do to increase the flexibility of the SubModel feature is to use the 'KeywordList' input for the prototype to define new inputs for the prototype and its clones. This allows you to set inputs to the SubModel components through the SubModel object.

Harry

Reply all
Reply to author
Forward
0 new messages