I created one new frame (named "KM") and then insert that frame 30 times into main frame.
the problem is that if I change parameter in Assembly process (AssemblyList -> NO of predecessors) of one frame "KM" with enter method all others "KM" gets same value. I would like to change every parameter of KM onec at the time.
Solved! Go to Solution.
So I created frame KM and then inserted this frame into main frame 30 times (black squares)
and operation assembly has entery method that changes the number of predecessors. The problem is that this method in K-1 changes number of predecessors in all frames (K-2, K-3, K-4, etc.)
It seems you are changing the parameters in the KM class object (.models.km) and all inherited
KM objects have the same (inherited) values.
Well that's the idea of object orientated systems ( including Plant simulation )
If you want to individually change the parameters of an inherited object
you must indiviually address the object parameters via the object path
e.g. km1.assemblylist:= ... from the frame (node).
Now I am even more confused, because one of 30 sub-frames is working corectly
Now I inserted method to each KM indivudualy, but all excpet one still changes values of all sub-frames.
I put the code:
I had a look at your model.
to get the assembly list setting working correctly:
1. switch on the entry control inheritance of all interited km.assembly objects
to get rid of the ".Models.Frame.KM1_1.Assembly.enter" method.
You don't need it here
select the assembly class object in the class library , press right mouse and select "show inheritance"
then expand .models.KM.assembly to
get a list of all KM assembly objects you need to change ( acc. to 1)
This is easier than clicking through the inherited KM frames
2. delete both userdefined methods "enter" and "init" in the KM1_1.assembly.
3. create a (new) init method in the KM class frame (.models.KM)
4. insert the following code in the init method
var assemblyList : table[integer,integer] assemblyList.create assembly.assemblyList:=assembly.assemblyList -- deactivate assemblyList assemblyList.writeRow(1,1,2,NO_OF_SOCKS) assembly.assemblyList:=assemblyList
here's some code to check the set assembly lists
Some still have NO_of_socks = 0 !
var A :object := .models.km.assembly var C :object for var i:=1 to A.numChildren C:=A.childNO(i) print i,chr(9),C,chr(9),C.assemblyList[1,1],chr(9),C.assemblyList[2,1] ,chr(9), c.~.NO_of_socks next