Cancel
Showing results for 
Search instead for 
Did you mean: 

How can I assign value to entity's attribute by frequency?

Pioneer
Pioneer

Hi all,

 

I have a question of assigning value to attributes. For example, I have 3 user defined attributes of an entity: color, shape, size. Value of each attribute based on their frequency. 

color: 10% red, 30% white and 60% black

shape: 50% round and 50% squrare

size: 70% small and 30% regular

 

How can I create a source to random assign entity's attributes by their frequency?

And how can I randomly create a production plan base on these frequency?

 

Please let me know if anything not clear to you.

 

Thanks!

Wendy 

6 REPLIES

Betreff: How can I assign value to entity's attribute by frequency?

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello Wendy Wang,

 

you can use the Variants Generator for this.

There you can define the attributes and the desired probability. It is also possible to define Constraints, combination of attributes which are not allowed.

 

Hope this will help

 

Regards

 

GG

Regards
GG

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

Betreff: How can I assign value to entity's attribute by frequency?

Pioneer
Pioneer

Thanks for your reply GG. Is Variants Generator an existing function in the tool box? 

 

Wendy

Re: How can I assign value to entity's attribute by frequency?

Gears Phenom Gears Phenom
Gears Phenom

Hello

 

This should not be too hard to do on the enterance control of the source.

 

var rand: Integer := round(Z_Uniform(1, 0, 100))

if 10 > rand
	@.VectorGraphicsColor := makeRGBValue(255, 0, 0)
elseif 10 <= rand AND rand < 40
	@.VectorGraphicsColor := makeRGBValue(0, 128, 0)
else
	@.VectorGraphicsColor := 0
end

Hopefuly the above code will give you some idea of what will be needed, this should set the color at roughly the pecentages that you have asked for, you will need to make similar blocks of code to then set the other values that you want (ensuring you get a new random number each time)

 

JamesM

Re: How can I assign value to entity's attribute by frequency?

Pioneer
Pioneer

This helps! Thank you James!

Re: How can I assign value to entity's attribute by frequency?

Siemens Phenom Siemens Phenom
Siemens Phenom

Hello WendyWang,

using the tool VariantsGenerator you can generate the frequency table for a Source object with MUselection “Random”. To load this tool click on Manage Class Library on the Home menu (tab Libraries).

The attached model for Plant Simulation 12.0 shows the solution for your question. You can also define constraints: For instance the variant “white”, “round”, “regular” can be impossible for any reason.

The type statistics of the Drain object can be used for the verification.

Regards,
Peter

Re: How can I assign value to entity's attribute by frequency?

Pioneer
Pioneer
Thanks Peter! It helps a lot!