question

Kshitij Dhake avatar image
0 Likes"
Kshitij Dhake asked Jason Lightfoot commented

Different processing times for a single label

I have 3 different labels going in to a processor. All 3 labels have different processing time for which, I have used values by case. Can anyone help me on how to divide one of the label processing times further more into percentage?

FlexSim 22.2.0
procesor
· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Jeanette F avatar image Jeanette F ♦♦ commented ·

Hello @Kshitij Dhake,

You will need to edit the code to accomplish this. Can you attach your mode if you would like an example of how to accomplish this?

0 Likes 0 ·
Kshitij Dhake avatar image Kshitij Dhake Jeanette F ♦♦ commented ·

Processor time.fsm

Here is the model. For label "three" .I want the cycle time to be 70 s for 50% of the how many "three" enter the processor and 160 for 30 % of the how many "three" enter the processor

0 Likes 0 ·
processor-time.fsm (27.2 KiB)
Jason Lightfoot avatar image Jason Lightfoot ♦♦ commented ·

Hi @Kshitij Dhake, was Felix Möhlmann's answer helpful? If so, please click the "Accept" button at the bottom of their answer. Or if you still have questions, add a comment and we'll continue the conversation.

If we haven't heard back from you within 3 business days we'll auto-accept an answer, but you can always comment back to reopen your question.

0 Likes 0 ·

1 Answer

Felix Möhlmann avatar image
1 Like"
Felix Möhlmann answered Felix Möhlmann commented

As Jeanette mentioned, you have to edit the code that determines the process time. In the example below I assumed that the missing 20% would be processed for the currently used value of 350s.

/**Custom Code*/
Object current = ownerobject(c); Object item = param(1); Variant value = item.Type; double retValue = 1; if (value == "one"){ retValue = 150;} if (value == "two"){ retValue = 100;} if (value == "three"){     double rand = uniform(0, 100, getstream(current));     if(rand < 50) {         retValue = 70;     }     else if(rand < 80) {         retValue = 160;     }     else {         retValue = 350;     }     } return retValue;

processor-time_1.fsm


· 3
5 |100000

Up to 12 attachments (including images) can be used with a maximum of 23.8 MiB each and 47.7 MiB total.

Kshitij Dhake avatar image Kshitij Dhake commented ·
  1. (rand < 50) {
  2. retValue = 70;
  3. }
  4. else if(rand < 80) {
  5. retValue = 160;



does "rand<80" mean 20% ?

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦♦ Kshitij Dhake commented ·
No - from the code you should be able to see that if rand is between 0 and 50 (out of 100) they get the value 70 - that's 50%. Then if rand is between 50 and 80 it will get 160 - that's 30%, not 20%. The final 20% get the value 350.
0 Likes 0 ·
Felix Möhlmann avatar image Felix Möhlmann Kshitij Dhake commented ·

Those are cumulative values. "rand" is a random number between 0 and 100.

double rand = uniform(0, 100, getstream(current));

The first check asks if the number is smaller than 50 which will be true in 50% of the cases.

if(rand < 50)

The next check, that only happens if the number is larger than 50, asks if the number is smaller than 80. This will be true in 30% of all cases (50 < rand < 80).

else if(rand < 80)

Since there are only three cases, the last case doesn't need a condition, it simply takes all cases that haven't met a condition up to that point.

0 Likes 0 ·