Cancel
Showing results for 
Search instead for 
Did you mean: 

Method getfreeplacce ends simulation

Creator
Creator

Dear simulators,

 

in my model the incoming parts are stored in a warehouse. To detect a free place I used methods which I called getfreeplace as attributes of the warehouse. For each different part there is one getfreeplace method which looks as follows:

(byRef x,y:integer):boolean
is
	i:integer;
	k:integer;
	
do
		if self.~.full then
		return false;

	else
		i := 7; 
		for k := 1 to self.~.yDim loop
				if self.~.pe(i,k).empty then
					--save coords into parameters
					x:=i;
					y:=k;
					exitloop;
				end;
				
		next;
		return true;
					end;	
	end;

The parts are then drawn out of the warehouse by the method Lager_Ausgang:

is
	x:integer;
	y:integer;
	part:string;
	found:boolean;

do
	--look for the next partName in the cycleTable
	part:=Zyklustabelle[1,Zyklustabelle.position];
	--look for the part in the stock of the warehouse
	Lagertabelle.setCursor(1,1);
	found:=Lagertabelle.find(part);
	if found and Puffer3.full=false then
		-- read coords from stock
		x:=Lagertabelle["X",Lagertabelle.cursorY];
		y:=Lagertabelle["Y",Lagertabelle.cursorY];
			--delete row in the stock-table
		Lagertabelle.cutRow(Lagertabelle.cursorY);
		-- increase position in cycle
		
		if Zyklustabelle.position = Zyklustabelle.YDim then
			Zyklustabelle.position:=1;
		else
			Zyklustabelle.position:=Zyklustabelle.position+1;
		end;
		
		Lager.pe(x,y).cont.move(Puffer3);
	
	end;
end;

The warehouse has a capacity of 5000 parts (5 different parts --> 1000 store places for each part). Incoming parts are stored in the table "Lagertabelle" and outgoing parts are deleted from that table.

What happens in the model now is that when k=1000 of the method getfreeplace is reached the simulation stops after 334 days with the bug call: "A 'Void' can not receive the method 'empty'". The problem is that the parameter y is set as 0, so no real space in the warehouse is targeted.

My question now is: Why does this happen? As I understand the method it shall look from k=1 to k=1000 for every incoming part. When you look at the table "Lagertabelle" after 334 days you can see that when the simulation stops the warehouse is not full. There are about 500 parts of the part called "Elektrik". Nonetheless the method doesn't try to store the new parts in k=1 or other free places but in k=1000 which leads to the bug.

Can you help me with this problem? I have attached the model for you to see what I mean.

 

Best regards

Thomas

2 REPLIES

Re: Method getfreeplacce ends simulation

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor
the failure is (in german) "Zielindex außerhalb des gültigen Bereichs", you set i to 7, but the store test_lager has only a x-dimension of 5; this causes the error

in the following after 525 days the store lager is full; in this case the getFreePlace method returns false, the parameters keep the value 0 --> error if you access a place with pe()
--> so you need to catch the case, that the store is full!
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Method getfreeplacce ends simulation

Creator
Creator

Thank you very much for your advice, this helped me a lot Smiley Happy