Cancel
Showing results for 
Search instead for 
Did you mean: 

Worker assignement problem

Experimenter
Experimenter

Hi All,

 

I'm trying to build a model where workers can only be assigned to a station when certain conditions met. So I created a method to override the broker Importer request control. However it seems to me that somehow this method is not called everytime it should be.

 

To test the broker I created a really simple model containing only two sequentially connected singleprocceses and a buffer between them. In the beginning station 1 is working, the importer method neglects any request from the second station. When the number of mu-s in the buffer reaches a predefined level the method switches and the worker is directed to station 2 and station 2 remains active untill the ammount of mu-s is under a level in the buffer. But after this first switch the import method is not called anymore, however the open request from station 1 is shown in the broker somehow it does not trigger the method.

 

While I was trying to search the topics here, I found this topic which is very similar to my problem but in the answer posted the importers trigger the method properly.

What is really strange is that I created the described simple model in PS 8.1 and it is running flawlessly since then, but the same model fails in version 10.1, 11 TR2, 12 and 12.3. Another twist is that the model fails after the first "switch" in 10.1, 11 TR2 and 12, while it fails after the second switch in 12.3.

 

It could easily be the case that I missed or overlooked something, but since the test model is very simple I really don't see what went wrong, so please if someone knows the answer let me know.

 

Thank you,

Csaba

 

ps in addition I get an error message when trying to attach the model file which says: "content type (text/xml) does not match its file extension and has been removed." so I'm linking my model here.

3 REPLIES

Re: Worker assignement problem

Solution Partner Genius Solution Partner Genius
Solution Partner Genius

Hello Csaba,

 

Analysis of your model showed that, your model is not running according to your expectations because of the difference in the instances program 'ImportControl' and 'NumMUObserver' are being called. The way you have modelled, NumMUObserver should get called first which will trigger the change in 'ActiveStation', if any. After that 'ImportControl'. should get called. However, it  'ImportControl' was getting called before the NumMUObserver.

 

Now to rectify this, i have added a new boolean 'Obs_running' and using this to track the observer. I have changed 'ImportControl' as follows.

(obj : object;   -- Importer
 type : integer) -- Importer type (0=failure importer, 1=setup importer, 2=processing importer, 3=transport importer)
is
	workersToBeExported: table;
do	
	if singleproc.occupied=false then
		wait(0.001); --- give some time to start observer program
	end;
	waituntil Obs_running=false prio 1;
	workersToBeExported.create;
	
	if not ?.testImportFor(obj, type, workersToBeExported) then 
		return;
	end;
	
	if CheckConditions(obj, type) then
		broker.engage(obj, type, workersToBeExported);
	end;
end;

And, i have changed 'NumMUObserver' as follows.

(attribute: string; oldValue: any)
is
do
	obs_running := true;--start observer
	if activeStation = "First" then
		if ?.nummu > 50 then
			activeStation := "Second";
		end;
	elseif activeStation = "Second" then
		if ?.nummu < 20 then
			activeStation := "First"
		end;
	end;
	obs_running := false;-- end observer
end;

I have attached changed model in 11 TR2.

 

Hope this will help.

Re: Worker assignement problem

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

I do now know exactly, why it works in some versions of Plant Simulation. But you get a deadlock, if you change from machine2 to machine1. First the MU in SingleProc calls the Broker, but it is still "second"  --> no mediation, then after completing the last "second" part, the MU calls the Broker, but now it is "First" --> no mediation.

 

You could use one additional trigger, when it changes from second to first or first to second and the station is occupied (and called already the worker).

e.g. Observer of activeStation (attribute value):

 

(attribute: string; oldValue: any)
is
do
 if ?.value="First" and SingleProc.occupied then
  singleProc.cont.move(singleProc);
 elseif ?.value="Second" and SingleProc1.occupied then
  singleProc1.cont.move(singleProc1);
 end;
 
end;

 

Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Worker assignement problem

Experimenter
Experimenter

Thank you both for the quick responses, they really helped me a lot, now I have a better understanding about how my model works.

 

Thanks,

Csaba