Cancel
Showing results for 
Search instead for 
Did you mean: 

What is the easiest way to generate 1000 Entity of MU ?

Creator
Creator

What is the easiest way to generate 1000 Entity of MU (in this case p1 till p1000) without duplicating 1000 times?

 

(See on the left side of the picture below)

 

1000p.JPG

7 REPLIES 7

Re: What is the easiest way to generate 1000 Entity of MU ?

Siemens Legend Siemens Legend
Siemens Legend

Hello,

 

what about using the source functionality, see the picture below. In this setting the source object will create exactly 1000 MUs.

I think this is the easiest way...

Source_MU_Creation.png

Re: What is the easiest way to generate 1000 Entity of MU ?

Siemens Valued Contributor Siemens Valued Contributor
Siemens Valued Contributor

Hi @Tee 

 

Take a look in the attached model, i already a method to delete the parts because this process could take a long time doing it manually.

Best Regards,
Paulo Araujo

Re: What is the easiest way to generate 1000 Entity of MU ?

Creator
Creator

Thank you for your quick reply.

 

But my question is that I would like to generate 1000 different types of part (I means1000 variants). Those 1000 variants are having differnt quanitity of parts to be produced with different processing time.

 

Is it possible?

Re: What is the easiest way to generate 1000 Entity of MU ?

Siemens Valued Contributor Siemens Valued Contributor
Siemens Valued Contributor

In this case, the parts are independents, in other words, there's no inheritance hierarchy, so, you could set each one as necessary.

 

To create these parts you could use a table as sequence for a source.


For different attributes you could use the table as well.

 

Does it make sense? Maybe i didn't understand what you want to do.

Best Regards,
Paulo Araujo

Re: What is the easiest way to generate 1000 Entity of MU ?

Siemens Legend Siemens Legend
Siemens Legend

Hi Tee,

just as I posted my comment I saw that I did not met the question exacly.

You can do your task easily through SimTalk. Use a method and type in the code as below:

is
do
 local obj : object;

 for local i := 1 to 1000 loop
  obj := .MUs.entity.duplicate;
  obj.name := "P" + to_str(i);
 next;
end;

 

But you can also use the MU creation functionality of the  source object. There you type in the class of an MU, the desired name (an MU ID will be added to the MU name automatically if you want to have more MUs created per line in the table)

And the you have the possibility to assign values to attributes of the created MU instance out of the sub-table in the cration list:

creationTable.png

Re: What is the easiest way to generate 1000 Entity of MU ?

Siemens Phenom Siemens Phenom
Siemens Phenom
I would use a source with the “MU Selection”=Sequence. In the table that you will connect to this source setting, you find a column “Attributes”. There you can provide different attributes for your elements - the source will generate X (depending on the “Number” setting in the table) MUs per line with these same attributes.
The hard part is that you will have to produce a table with 1000 entries if all are different. You could maybe import the data from an xml file (EXCEL does not support the subtables).

Other than that, you will have to write a method with a loop, producing 1000 MUs and i.e. creating random number entries for the attributes with the z_xxxx commands in the method.


-----------------
Siemens Industry Software GmbH & Co. KG; Anschrift: Franz-Geuer-Str. 10, 50674 Köln;
Kommanditgesellschaft: Sitz der Gesellschaft: Köln; Registergericht: Amtsgericht Köln, HRA 28227;
Geschäftsführung und persönlich haftender Gesellschafter: Siemens Industry Software Management GmbH;
Geschäftsführer: Urban August, Daniel Trebes; Sitz der Gesellschaft: Köln; Registergericht: Amtsgericht Köln, HRB 70858

Re: What is the easiest way to generate 1000 Entity of MU ?

Siemens Phenom Siemens Phenom
Siemens Phenom

A little bit different piece of code below. A difference to given example that it creates 100 objects in a separate folder. This way it's easier to delete them Smiley Wink Also it creates a custom attribute for objects.

 

Note that in this example Pxx objects are inherited from Entity (but it should be okay in most cases).

 

is
    obj     : object;
    i        : integer;
do
    -- If folder already exists, delete it
    If existsObject(".User") then
        .User.deleteObject;
    end;
    -- Create folder for user objects
    obj := .createFolder;
    obj.Name := "User";
    -- Create objects
    for i := 1 to 100 loop
        obj := .MUs.Entity.CreateObject(.User, 1, 1, "P"+to_str(i));
        obj.createAttr ("Color", "string");
    next;
end;

 

 

However in my opinion it make sense to create so many different classes only in special conditions. Usually it's easier to create one type and work with custom attributes (i.e. create attribute "PartType"). You may need separate classes for example if you want to have different icons and in the same time use standard icon change behavior (Operational/Waiting). But making 1000x2 different icons is a big effort Smiley Wink

Regards, Vladimir.