Different processing times for a single label

Different processing times for a single label

kd777
Not applicable
18 Views
7 Replies
Message 1 of 8

Different processing times for a single label

kd777
Not applicable

[ FlexSim 22.2.0 ]

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?

0 Likes
Accepted solutions (1)
19 Views
7 Replies
Replies (7)
Message 2 of 8

Jeanette_Fullmer
Community Manager
Community Manager

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
Message 3 of 8

kd777
Not applicable

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
Message 4 of 8

moehlmann_fe
Explorer
Explorer
Accepted solution

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

Message 5 of 8

kd777
Not applicable
  1. (rand < 50) {
  2. retValue = 70;
  3. }
  4. else if(rand < 80) {
  5. retValue = 160;



does "rand<80" mean 20% ?

0 Likes
Message 6 of 8

jason_lightfootVL7B4
Autodesk
Autodesk
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
Message 7 of 8

moehlmann_fe
Explorer
Explorer

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
Message 8 of 8

jason_lightfootVL7B4
Autodesk
Autodesk

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