Cancel
Showing results for 
Search instead for 
Did you mean: 

code for the scheduling- job shop system

Pioneer
Pioneer

Hi,

I have a problem about job shop scheduling.

I have a model with 3 machines and only 1 buffer before them (it represents a stage and in my model i have 3 stages). When a product arrives at the buffer I want to decide in which machine it has to go.  I'd like to control first the energy status of the machines of the stage. So at the beginning I want to control if there are machines in the operational state, then in the working state and at the end in the standby state.  If at the beginning i find a machine in the operational state the product has to go there; then if there aren't machines in the operational state, but there's a machine in the working state and it finishes in 5 minutes i want the product to go there; then if there aren't machine neither in the working state i want so turn on a machine in the standby state and i want the product to go there.

 

If i don't find a machine in these states the product stays in the buffer and the controls in the method are iterative.

i know that i have to use the <MU>.remainingProcTime and <PATH>.energyCurrentState but I don't know how to write the code.

Thank you so much for your helpSmiley Happy

 

 

cecilia

15 REPLIES

Re: code for the scheduling- job shop system

Solution Partner Legend Solution Partner Legend
Solution Partner Legend

Re: code for the scheduling- job shop system

Pioneer
Pioneer

thanks so much.

i tried to run the simulation in the example but it doesn't work. it says that there is an error in the first "if". Does it say the same to you?

 

Cecilia

Re: code for the scheduling- job shop system

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Well, the file called EnergyRoutingExample.spp works without problems here.

 

Can you be more specific about what you did?


Gert Nomden
Senior Consultant | Tecnomatix Product Manager
cardsplmsolutions.com

Re: code for the scheduling- job shop system

Pioneer
Pioneer

i'm so sorry but if I run the simulation of your file it doesn't work, it says that there is an error in the method. I use the version 12.0.3. Is the same?

thank you 

 

cecilia

Re: code for the scheduling- job shop system

Solution Partner Legend Solution Partner Legend
Solution Partner Legend

I think it is because there is a breakpoint on the first if-statement. Remove the breakpoint, reset the simulation and try again. What you think is an error is actually just the program stopping because we told it to stop at that point so we can see the code (what is called a breakpoint). This window is called the Debugger (use the Help feature of Plant Simulation and search for "Method Debugger" for more information).

 

Click on the line that is yellow when you run the simulation and press F9 to remove the breakpoint on that line. Then press F5 to continue the simulation.

 

If you want to step through the simulation (since it is very fast), do not remove the breakpoint as I said. Instead, use the buttons "Step Into" to step through each line of code as it executes so you see how the program works.

Re: code for the scheduling- job shop system

Pioneer
Pioneer

I'm so sorry, but  I cannot use the simulator! I'm learning and it's not easy! thank you very much!! Smiley Happy

Re: code for the scheduling- job shop system

Pioneer
Pioneer

thanks for your help!

I've tried to do this model following your advice and the syntax of the code is correct but it doesn't do what I desire. it seems that the model doesn't read the "else if". The third job should go to the first machine (singleproc) but it goes to the second (singleproc1)!

can you help me and tell me why?

 

thanks! Smiley Happy

 

Cecilia

Re: code for the scheduling- job shop system

Solution Partner Legend Solution Partner Legend
Solution Partner Legend

It is because the conditions in both "elseif" statements are false when the third (yellow?) object triggers the method. When stepping through the code while the simulation is running, with the debugging window active, hover with your mouse over the conditions and you will see what they equate to.

 

Since none of the elseif-statements are true, it defaults to your "else"-statement which will send the object to Singleproc1. The code works as it should, but if it doesn't work according to how you want it to work you will have to reevaluate the logic you are implementing in your conditions and change the code accordingly.

Re: code for the scheduling- job shop system

Pioneer
Pioneer

following your directions, I saw that the only true statement is the first one (the first if), but in the third job (the yellow one), the true statement should be the second "else if" so the job should go to the singleproc. As a matter of fact when the 2 machines are working, the true statement is the 2nd "elseif" because the singleproc is finishing the operation before than the singleproc1. so when the singleproc finishes to work the true statement should be the 1st "elseif "  and the yellow piece should go to the singleproc. 

anyway i thought the second "elseif" is redundant so I've eliminated the statemant but it doesn't work. 

how can i do? thanks a lot for your kindnessSmiley Happy

 

cecilia