question

Shubham K2 avatar image
0 Likes"
Shubham K2 asked Eric M answered

Assigning of jobs to similar machine

How to assigned pending jobs from one machine to another similar machine during the breakdown of the first machine. As I connected both with common queue and set breakdown for the first one. As I want the transfer of pending jobs to another machine only during breakdown but in my case, as I run the simulation equal number of jobs transfer to both machines, I explore many parameters but do not get what I want please help.

FlexSim 21.0.2
flexsim 21.0.2flexibilty
5 |100000

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

Eric M avatar image
0 Likes"
Eric M answered Shubham K2 commented

Hi @Shubham K2, I've attached a model that only opens the port to Processor2 if Processor1 is in the breakdown state. I did this by adding an On State Change trigger to Processor1 and adding some code. I looked up what the "breakdown" state value in the manual (11). That's why the code checks to see if the state is changing to 11 (breakdown) in order to determine whether to open or close the ports of Processor2. Here's the code I used along with the model:

treenode current = c;
treenode profile = i;
int toState = eventcode;
int fromState = getstatenum(c);

Object involved = Model.find("Processor2").as(Object);
if (toState == 11) {
openinput(involved);
}
else 
{
closeinput(involved);
}

switch-on-breakdown-only-em.fsm


· 5
5 |100000

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

Shubham K2 avatar image Shubham K2 commented ·

Thank you @Eric M problem solved. Have a great life.

0 Likes 0 ·
Shubham K2 avatar image Shubham K2 commented ·

Hi @Eric M this approach is working but I have used a little bit different model for my work. As I attached the screenshot of my model. In that model I used two similar processors with two different sources, I want processor 1 can take job from source1 and processor 2 can take job from source 2, and during the breakdown of processor 1, the remaining task of processor 1 will be assigned to processor 2. But as per your code processor, 2 will only take from source1, I want processor 2 can do their own work and also the remaining work of processor1. I think you get my point.

0 Likes 0 ·
screenshot-2110.png (331.8 KiB)
Eric M avatar image Eric M Shubham K2 commented ·

In that case, change the Object line to this:

Object involved = Model.find("Processor2").as(Object).inObjects[1];

That will make it so only the first input port connection will be closed. This works really well with the source directly connected to the processor, but troubles came up if I had any objects in between the source and the processor. So as long as you have the source directly connected, this should work.

0 Likes 0 ·
Shubham K2 avatar image Shubham K2 Eric M commented ·

Hi @Eric M As I tried your way but one problem occurs with that code, as breakdown occurs at processor1 then only the processor2 input port opens else close before breakdown Processor2 not take source2 job as it was close. I want input to processor2 continuously from source2 and once the breakdown of processor1 will occur then only the source1 will assign pending jobs. Here processor2 works as an alternative(for example someday a person wants to take half day leave, they assign their work to their colleagues). I tried to change the coding after else statement but getting error. Hope you understand my problem.

0 Likes 0 ·
Jason Lightfoot avatar image Jason Lightfoot ♦ commented ·

Instead of '11' use the 'STATE_BREAKDOWN' macro.

0 Likes 0 ·
Eric M avatar image
0 Likes"
Eric M answered

@Shubham K2 I found a solution that should work better than the code using process flow. A token is created on breakdown and proceeds to send items to Queue2 one at a time until the breakdown time is over. Right now, Queue2 is set to always send Type1 items before Type2 items, but this can be changed in the properties of Queue2. You should be able to adjust the process flow if you need to get what you're looking for.

breakdown-switch-em.fsm


5 |100000

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

Write an Answer

Hint: Notify or tag a user in this post by typing @username.

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