Instantiate unique children when instantiating parent block

685 Views Asked by At

I'm currently working from Cameo Systems Modeler 19.0, using IBDs and BDDs.

The system I'm currently modeling involves a component (:Parent) composed of two sub components (:first, :second), and I've established as much within my main BDD. Each :Parent is made up of 1 unique :first, and 1 unique :second. A 1 to 1 composition relationship has been set up from :Parent to :first, and :Parent to :second.

There are multiple instances of this main component being used within the context of the system - on the ibd for the system, I'm able to instantiate as many :Parent classes as I need (i.e. Parent 1 : Parent, Parent 2 : Parent, Parent 3 : Parent, etc.)

My issue is that when I display the parts that each parent instance is made up of (to show that each :Parent is composed of a unique :first and :second instance), each nested class is displaying as the same instance. Changes to the :first and :second children on Parent 1 : Parent applies the same change to all instances of :Parent.

I want to instantiate these nested blocks as being unique to their parent - so far the only way I've made it work even a little bit is to simply define redundant blocks and display them as needed, but I feel like there has to be something I'm missing that would allow me to instantiate separate children references for each instance of the parent.

1

There are 1 best solutions below

0
On

When you display the parts tree of your system it looks like this (I added names to the Parent's parts):

 - «System» System1
  - «part» part1:Parent
     - «part» itsFirst:first
     - «part» itsSecond:second
  - «part» part2:Parent
     - «part» itsFirst:first
     - «part» itsSecond:second

An instance of this System will contain two instances of first and two instances of second. Both instances of the same type will look identical, but are nevertheless distiguishable instances. To illustrate this fact, you could create an object diagram showing an example of the seven unique InstanceSpecifications consistent with your ibd.

The fact, that they must be individual instances is given by the composition relationship. Its semantics is exclusivity. Any instance can only be part of one composite. Please note that I said "can". An instance of first could also rest on a shelf somewhere, and be part of no composite at all. Therefore the relationship is 0..1 to 1. An instance of first could also be part of some other composite, just not at the same time - hence exclusivity.

Now you say you want to change some properties of first and second to have different values, depending on whether they are nested parts of part1 or part2. For example they could have a physical location within the system. Of course it will be different for each instance. For this purpose SysML introduced context specific initial values. Cameo Systems modeler supports them nicely. You will find an entry in the context menue of the part in the ibd of the system (you have to show the nested parts of part1 and part2). Just select "tools/define context-specific initial value".

The way this works, is that the tool then creates InstanceSpecifications with slots for the values and sets them as default value for the respective system parts. So don't be surprised, when you find completely new elements next to your system block.