Cancel
Showing results for 
Search instead for 
Did you mean: 

Issue with a method

Valued Contributor
Valued Contributor

Hi guys, I'm still struggling with my model.

 

The model shoul move in drain all the entities that stayed in the buffer for 600 seconds or more. I tryed with 

is
	i:integer;
do
	variable1:=buffer.numMU;
	
	for i:= 1 to variable1 loop
		
	if eventcontroller.simTime-buffer.cont.entrytime >= 600
	then buffer.cont.move(drain);
	end;
	print buffer.cont;
		next;
		
	self.methcall(30);
end;

but it doesn't work well. I attach the model too.

Any help is much appreciated

 

9 REPLIES

Re: Issue with a method

Siemens Phenom Siemens Phenom
Siemens Phenom

A drain has a capacity of one. So you cannot move multiple parts at once onto the drain.

 

The following method waits until the drain is empty before moving the next part:

is
	i:integer;
do
	variable1:=buffer.numMU;
	
	if buffer.cont /= void and eventcontroller.simTime-buffer.cont.entrytime >= 600
	then
		for i:= 1 to variable1 loop
			waituntil Drain.empty prio 1;
		 	buffer.cont.move(drain);
			print buffer.cont;
		next;
	end;
	self.methcall(30);
end;

For performance reason I moved the if condition out of the for loop.

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Issue with a method

Valued Contributor
Valued Contributor

Dear Ralf,

thank for your answer.

Your seggestion about the drain capacity is great! 

Actually the code you posted do not calculate the time for all the entities, but only for the first.

Anyway, based on your seggestion, I fixed it. Here is the code for future users reference:

is
	i:integer;
do
	variable1:=buffer.numMU;
	if variable1 >0 then
	 for i:= 1 to variable1 loop
		
		if eventcontroller.simTime-buffer.cont.entrytime >= 600
		then 
		waituntil Drain.empty prio 1;
		buffer.cont.move(drain);
		end;
	
	 print buffer.cont;
	
	 next;
	end;
		
self.methcall(30);
end;

Bests,

Alessandro

 

Highlighted

Re: Issue with a method

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

Actually you don't need the drain at all.

You could simply delete the entity and avoid using waituntil.

cortega@interlatin.com.mx
+52 (81) 10801310
InterLatin S de RL de CV

Re: Issue with a method

Valued Contributor
Valued Contributor
in the case I remove the drain, how can I track the stastistics?

Re: Issue with a method

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi Alessandro,

 

depends on the statistics you need.

 

If you need the amount of parts, it would be easy to use a Variable object were you increase the sum by one each time you destroy a MU.

Regards,

Ralf
------------------------------------------------------------------------------------------------------
Did you like the answer? Then click the Thumbs Up button.
Did the answer solve your problem? Then accept the answer as solution.

Re: Issue with a method

Solution Partner Valued Contributor Solution Partner Valued Contributor
Solution Partner Valued Contributor

Sorry for the delay but my timezone does not help the matter.

 

As Ralf said you can create all your statistics using variables or tablefiles. If you use tablefiles is even easier to pass this informantion into charts.

 

But it will really be related to your needs. I may suggest you do a little more trial by error on your own so you get the gist of it.

cortega@interlatin.com.mx
+52 (81) 10801310
InterLatin S de RL de CV

Re: Issue with a method

Solution Partner Phenom Solution Partner Phenom
Solution Partner Phenom

Alessandro,

 

More suggestions from my side, to add to your list of ideas.

 

1) You could consider to set a dwell time of 600 seconds for your buffer. Any MU that exits the buffer in a regular way has been there for 10 minutes. If the MUs are to be consumed before by some other process, you need to program it, though.

 

2) To prevent coding (condition checking) I would place an unlimited buffer in front of your Drain.

 

Good luck!

 

Gert Nomden


Gert Nomden
Senior Consultant | Tecnomatix Product Manager
cardsplmsolutions.com

Re: Issue with a method

Valued Contributor
Valued Contributor

Thak you for yut answers.

I will try to reduce the number of suspending methods as you suggested. In addition I would like to understand is I can just increase the number of maximum suspended methods in the software preference; is it a good option?

Re: Issue with a method

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

first you should check the number of suspended methods (Debugger...). It is very bad, if you suspend the same method several times. This causes a chaotic behavior of your model.

 

You should only increase the number of suspended methods, if you have a big number of different methods or if you use the wait command in many methods.

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