Page 1 of 1

Defining products on a source

Posted: Monday 21 May, 2012 - 10:41
by rolsroberts
is it possible to create differents products(with differents labelnames and colors) with one source?

thanks

Re: !!! in source atom

Posted: Monday 21 May, 2012 - 10:43
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!

Re: !!! in source atom

Posted: Monday 21 May, 2012 - 10:55
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

Re: !!! in source atom

Posted: Monday 21 May, 2012 - 13:56
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

Re: !!! in source atom

Posted: Monday 21 May, 2012 - 14:18
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

Re: Defining products on a source

Posted: Tuesday 25 September, 2012 - 13:57
by CaseB
Hey there,
Thanks for your reply, it saved my life :)
Have a nice one