Cancel
Showing results for 
Search instead for 
Did you mean: 

Get MU Type

Valued Contributor
Valued Contributor

Hi,

 

how do i get the type or class of an MU ? I tried this but did not work

print ref(.MUs.TestEntity).class;

It returns just "VOID".

I need something like ".MUs.Entity" or ".MUs.Container" how do i do this ?

 

 

 

6 REPLIES

Re: Get MU Type

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi Readock,

 

you need an instance to get the class, e.g.:

print .MUs.Entity:1.class;

 In your example you ask a class for it's class, which is void if the class isn't derived from another class.

 

Regards,

Ralf

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Get MU Type

Valued Contributor
Valued Contributor

ah ok i understand the problem but it still does not work.

Is there a mistake in your syntax ?

('void' cant receive a Method 'Class')

Re: Get MU Type

Siemens Phenom Siemens Phenom
Siemens Phenom

You need to create an instance of your class .MUs.Entity.

 

You can do this by just putting an entity on a SingleProc.

If this is your first instance it has the instance number 1, otherwise you have to replace the 1 by the actual instance number.

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Get MU Type

Valued Contributor
Valued Contributor

I want to create a new MU class with the same type as the TestEntity

so something like this

is
    s:string;
do
    s := .MUs.TestEntity.class;
    execute("is do "+s+".createObject(.MUs,50,50,\"NewEntity\"); end;");
end;

 

Get MU Type PlantSimulation.png

 

 

 

 

Re: Get MU Type

Siemens Phenom Siemens Phenom
Siemens Phenom

You can either derive a class or duplicate a class to get a new class:

is
do
  local derivedClass := .MUs.Entity.derive;
  derivedClass.name := "NewMU1";
  print derivedClass;
  local duplicatedClass := .MUs.Entity.duplicate;
  duplicatedClass.name := "NewMU2";
  print duplicatedClass;
end;

 

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Get MU Type

Valued Contributor
Valued Contributor

ah ok thanks