Cancel
Showing results for 
Search instead for 
Did you mean: 

change paramethers of just one frame

Pioneer
Pioneer

hello,

 

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.

 

regards

10 REPLIES 10

Re: change paramethers of just one frame

Phenom
Phenom

I cannot follow, what you exactly mean, as for the model

 

I've attached, you can individually change the assembly list through a method.

 

Unbenannt.png

Re: change paramethers of just one frame

Pioneer
Pioneer

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.)intersocks.png

Re: change paramethers of just one frame

Phenom
Phenom

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).

 

 

 

 

 

 

 

Re: change paramethers of just one frame

Pioneer
Pioneer

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:

 

var objSmiley Surprisedbject

obj:=?
?.AssemblyList[2,1]:=NO_of_Socks

 

Re: change paramethers of just one frame

Phenom
Phenom

From where did you start the method- from .models.KM  or individually from each KM(i=1..k) ?

 

How is NO_of_socks defined ?

 

 

Re: change paramethers of just one frame

Pioneer
Pioneer

So I wrote method as Use-defined attribute of KM1 and then insert that method to each KM (i=2..k)

 

 NO_of_socks is variable inside of each KM

Re: change paramethers of just one frame

Phenom
Phenom

O.K. to keep this post short.

 

Please send the model or a representativ part of the model, so I can have a look at.

 

 

Highlighted

Re: change paramethers of just one frame

Pioneer
Pioneer

I have really no idea what is going on here Smiley Happy The closest to what i want to achive is KM2_2

Re: change paramethers of just one frame

Phenom
Phenom

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

1.1 TIP

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

 

Finally

 

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