Cancel
Showing results for 
Search instead for 
Did you mean: 

counting jobs

Pioneer
Pioneer

Hi!

My model is composed by the source, a buffer, a machine and the drain. I want that my SingleProc has to go in a standby state when there are two jobs in the buffer. So I have to count jobs in the buffer. How can I do? 

thank you! Smiley Happy

 

Cecilia

8 REPLIES

Re: counting jobs

Legend
Legend

Hello Cecilia,

You can create method in order to watch the buffer all the time.
Call it for example the "Buffer_Watching" and it could be defined like this :

is
do
    if (number of jobs > 2) then
         standby state
    else
         normal state
    end;
self.methcall(1); end;

You can execute this method manually. Or create an init method which call the " Buffer_Watching" at the init. 
The init (method) could be writen like this : 

is 
do
    -- if you want the method be executed at t = 0 sec   
    Buffer_Watching.execute() ; 
    -- or be executed at t = x seconds use this : 
    Buffer_Watching.methcall(x) ; 
end;

Re: counting jobs

Pioneer
Pioneer

How can I trasform it in the language code?

 

is

do

if (number of jobs>2) then

singleproc.energycurrentstate:="standby";

else singleproc.energycurrentstate:="operational";

end;

 

what is self.methcall(1)?

 

thank you! Smiley Happy

Re: counting jobs

Legend
Legend

So what is exactly the number of jobs in your case ? Is it the number of MUs ? 

 

when you write this for example : 

myMethod.methcall(10) ;

 The method "myMethod" will be executed in 10 secondes. So when add the methCall line into the method. This method will be executed every 10 seconds. 

In your case, I'm checking the buffer state every 1 sec. 
Try to have a look on the help, there is a clearer explanation with some examples. 

Re: counting jobs

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Cecilia,

There must be more to your problem. When you set it to standby, under what conditions do you set it to operational?

 

What is the trigger for these transitions, is it completion of a job (exit of MU from machine) or arrival in buffer, both?

 

You can use entrance and exit controls, or implement an observer method for the buffer (Buffer>Tools>Edit observers>New, the observed value should be NumMU, the method is triggered every time NumMU changes).

 


Gert Nomden
Senior Consultant | Tecnomatix Product Manager
cardsplmsolutions.com

Re: counting jobs

Pioneer
Pioneer

if i do tools>observers>new, i put NumMu as a observed value but i what can I write in executed method?

and then when i write the exit control of the machine, how can i recall it?

 

thank you!

Re: counting jobs

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

You specify the method that executes your code to toggle the standby state. The software will already fill in some code for you.

 

What do you mean by recall?

 

Your model is small, so just try it! If it does not work at the end of the day, post it!

 


Gert Nomden
Senior Consultant | Tecnomatix Product Manager
cardsplmsolutions.com

Re: counting jobs

Legend
Legend
Thank you Nomden. I never heard about Observers before !
It's the best way to respond to Cecilia's request.

Re: counting jobs

Gears Phenom Gears Phenom
Gears Phenom

Hello.

 

Observers and controls are the best way to solve this as they are event based tasks and will only be triggered when they are needed as oposed to using a methcall or a loop with a wait statment which will run very often pooling the conditions to see if it should run.

 

Observers are triggered when the value being observed has been modfied and they are given the attributes name and the old value it use to have so you can if needed use the old value before it is discarded and multiple different attributes can use the same methord for the observer.

 

Also from experiance, if you edit a observed value to be the same as what it was before then it will not trigger the observer method, it will only trigger it if the value has been changed.

 

JamesM