Defining products on a source

All topics on the Atoms in any Enterprise Dynamics Library.
Post Reply
rolsroberts
Posts: 9
Joined: Tuesday 10 April, 2012 - 08:25

Defining products on a source

Post by rolsroberts »

is it possible to create differents products(with differents labelnames and colors) with one source?

thanks
rolsroberts
Posts: 9
Joined: Tuesday 10 April, 2012 - 08:25

Re: !!! in source atom

Post by rolsroberts »

1)hi i want to create 4 differents TYPES of products from one source with differents labelnames and colors. these product schould enter the system at specific rates. how could i apply it . for example ( product a =25% ,B =50% ,C =10%, d=15%). so at the end we schould have 4 differents colors and labelnames. i know i schould set it on trigger on exit but how

thanks for an Answer!
MarvinH
Posts: 93
Joined: Tuesday 25 January, 2011 - 11:07
Contact:

Re: !!! in source atom

Post by MarvinH »

Hello!

Yes, indeed you could use the OnCreation or OnExit trigger. With the following code, the products will have different colors and label values on the rate that you provided:

Code: Select all

Do(
  Var([valP], vbValue),
  
  valP := Uniform(0, 1),
  
  Case(
    WhichIsTrue(
      valP <= 0.25,
      valP <= 0.75,
      valP <= 0.85,
      valP <= 1
    ),
    Do(
      Color(i) := ColorRed,
      Label([Name], i) := [Type1]
    ),
    Do(
      Color(i) := ColorBlue,
      Label([Name], i) := [Type2]
    ),
    Do(
      Color(i) := ColorYellow,
      Label([Name], i) := [Type3]
    ),
    Do(
      Color(i) := ColorLime,
      Label([Name], i) := [Type4]
    )
  )
)
Good luck!

Kind regards,

Marvin
rolsroberts
Posts: 9
Joined: Tuesday 10 April, 2012 - 08:25

Re: !!! in source atom

Post by rolsroberts »

the code u gave me doesnt work. i can´t have differents products from the source. i think 4 differents labelnames schould be created with this code on trigger on exit. i used a studentversion.

Code: Select all

Do(
  Var([valP], vbValue),
  
  valP := Uniform(0, 1),
  
  Case(
    WhichIsTrue(
      valP <= 0.25,
      valP <= 0.75,
      valP <= 0.85,
      valP <= 1
    ),
    Do(
      Color(i) := ColorRed,
      Label([Name], i) := [Type1]
    ),
    Do(
      Color(i) := ColorBlue,
      Label([Name], i) := [Type2]
    ),
    Do(
      Color(i) := ColorYellow,
      Label([Name], i) := [Type3]
    ),
    Do(
      Color(i) := ColorLime,
      Label([Name], i) := [Type4]
    )
  )
)

Thanks for your Answer
MarvinH
Posts: 93
Joined: Tuesday 25 January, 2011 - 11:07
Contact:

Re: !!! in source atom

Post by MarvinH »

Hello,

What is your criterion to determine the code does not work? What labels are you using? In what way are you using the labels in the other parts of the simulation model?

I created one label [Name], and assigned four different values to this particular label ([Type1], [Type2], [Type3], [Type4]). In case you want the different products to have different labels, you can assign these label on the particular positions. For example, you could do the following:

Code: Select all

Do(
  Var([valP], vbValue),
 
  valP := Uniform(0, 1),
 
  Case(
    WhichIsTrue(
      valP <= 0.25,
      valP <= 0.75,
      valP <= 0.85,
      valP <= 1
    ),
    Do(
      Color(i) := ColorRed,
      Label([Type1], i) := 1
    ),
    Do(
      Color(i) := ColorBlue,
      Label([Type2], i) := 1
    ),
    Do(
      Color(i) := ColorYellow,
      Label([Type3], i) := 1
    ),
    Do(
      Color(i) := ColorLime,
      Label([Type4], i) := 1
    )
  )
)
This way, all products will have one particular label with the value 1. In case the use of labels is not clear, please post your model with a description of what you are trying to accomplish, and maybe I can have a look with you.

Kind regards,

Marvin
CaseB
Posts: 1
Joined: Tuesday 25 September, 2012 - 13:39

Re: Defining products on a source

Post by CaseB »

Hey there,
Thanks for your reply, it saved my life :)
Have a nice one
Post Reply