Cancel
Showing results for 
Search instead for 
Did you mean: 

unload vehicle and refill next

Pioneer
Pioneer

Hey guys it's me again,

i need again your help. After all my other questions i asked the weeks before i reached a new limit. This time it's a bigger problem so i explain it as clear as possible.

 

I have a simulation about the delivering of different machines. At first the source producues 3 different kinds of MUs which all are transfered to a vehicle. Before the loading happens a method creates seperate tablefiles for every vehicle (see my post create table via method). After that an other method writes some MU attributes in the specific table.

 

When the capaticity of the vehicle is full, it drives to Station1. There when it reaches a sensor the vehicle stopps and starts unloading the MUs with the "finding"-method for tables. (see my post unload vehicle)

 

My problem:

Now i want to insert a second sensor after the first one. At this sensor a vehicle should stop when its capaticity isn't full. I want to fill this vehicle with a MU which represent a small load carriers (KLT). Therefor a method should search in the specific table for an empty space and create there that MU. The creation should only happen when the vehicle at the first sensor unloads a MU to the station.

With that way i want to simplify the fact that the MUs in the verhicels aren't all the time in such a KLT.

 

I tried to use a variable (as object) which is written by the passing vehicle at sensor 2. But then i couldn't use it to address the right table.. (the tables are named like FTF_1_Bestand -> FTF is the name of the vehicle and 1 (e.g.) is the ID).

 

Problem 2:

At the first sensor my vehicle unloads MUs for an assembly station. But i can't move the MU direct to the station. So i inserted a buffer which can only carry 1 MU. For the assembly station i have a second source which produces other MUs which should later be assembled with the MUs of the vehicles. These MUs are produces radomly so i don't know which comes next. So my unloading isn't working right because of the buffer between. E.g. my source produces Part_A, in my assembly station is Part_B, my buffer has MU_B and my vehicle unloads MU_A... short: there is a delay of 1 part between every assembly (2 different types of MUs are mixed). I think the problem is my waituntil in the "FTF_Auslagern"-method or the setting of the varibale to the wrong time. Maybe there is a specific attribut of the assembly station which says there is 1 MU and only the other one is needed. But i couldn't find something like that in the attribut list.

 

Hope you guys understand what i want to say. If not i can write my problems again in german (for those of you who are german or understand it)

 

I uploaded my model for a better view for the problem.

 

Thanks in advance

Carsten

11 REPLIES 11

Re: unload vehicle and refill next

Pioneer
Pioneer

addendum:

i think i need an init-method which produce a vehicle near sensor 2 and is filled half of the capaticity. But how can i create a table with this init method with the name structure of "FTF_ID_Bestand", like my other method in the post before?

 

Greetings

Carsten

Re: unload vehicle and refill next

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

The name of the parts to be assembled you find e.g. in the AssemblyList of the AssemblyStation.

 

If you create a transporter in the init method, then the create method retuns the created transporter. So you can read the id of the transporter, e.g.

 

local transp:object;
transp:=.MUs.Transporter.create(track, position);
local TabellenName: string := (transp.name+"_"+to_str(transp.id)+"_Bestand");
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: unload vehicle and refill next

Pioneer
Pioneer

Hi,

thanks for your reply and sorry for my late answer.

 

I tried like you said but then there comes an error message "id could not be used for classes" ( id nicht auf Klassen anwendbar)

 

Greetings

Carsten

Re: unload vehicle and refill next

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

it should work (see attachment)

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

Re: unload vehicle and refill next

Pioneer
Pioneer

I don't know what i made different but somehow your code works.. Thank you

 

Greetings

Carsten

Re: unload vehicle and refill next

Pioneer
Pioneer

Sry guys but i have to open the thread again...

 

I have a new method which should unload some MUs from a vehicle and at the same time it should create new MUs in another vehicle.

 

Now my problem: I can't address my second vehicle which should be filled with new MUs

 

I got the method so far: FTF_Auslagerung

(SensorID : integer; Bug : boolean;)
is
	TabellenNameS1 : object;
	TabellenNameS2 : object;
	BE : object;
	KLT : object;
do
	
	if SensorID = 1 then
		
		S1 := @;
		
		TabellenNameS1 := (S1.name+"_"+to_str(S1.id)+"_Bestand");
				
		@.angehalten := true;
		@.Entladung := true;
		
		while @.Entladung = true loop
			
			TabellenNameS1.setzeZeiger(3,1); 
						
			if TabellenNameS1.finden({3,*}, (Eingang1)) = true then
				
				local y : integer := TabellenNameS1.ZeigerY;
				
				BE := TabellenNameS1.alsObjekt(1,y);
				
				BE.umlagern(P1);

				--Inhalt aus Zeile löschen
				TabellenNameS1.löschen({1,y}..{*,y});	
								
				--als nicht voll beladen deklarieren
				@.beladen := false;
				
					--freien Lagerplatz in FTF bei Sensor 2 suchen
					TabellenNameS2 := (S2.name+"_"+to_str(S2.id)+"_Bestand");
				
					print TabellenNameS2;
					
					TabellenNameS2.setzeZeiger(4,1);
					
					if TabellenNameS2.finden({4,*}, void) = true then
						
						--print TabellenNameS2 + " " + TabellenNameS2.ZeigerY;
						KLT := .Montageablauf11.KLT;
						
						local Inhalt : object := KLT.erzeugen(S2[TabellenNameS2.ZeigerX,1]);
		
    					TabellenNameS2[1,TabellenNameS2.ZeigerY] := Inhalt;
						TabellenNameS2[4,TabellenNameS2.ZeigerY] := true;
						
							if S2.voll = true then
								S2.beladen := true;
							end;

					end;
					
				waituntil P1.leer = true prio 1;
				
			else
				@.Entladung := false;
			end;
			
		end;	
		
		-- Wenn nicht gefunden weiterfahren
		@.angehalten := false;
		
		S1 := void;
		
	end;
	
	if SensorID = 2 then
		
		S2 := @;
		
		TabellenNameS2 := (S2.name+"_"+to_str(S2.id)+"_Bestand");
		
		@.angehalten := true;
		
		waituntil @.beladen = true prio 1;
		
		S2 := void;
		
		@.angehalten := false;
		
	end;

end; 
	

in my opinion the problem is in the bold-written part. My method couldn't get there, but at the unloading it works.. i tried str_to_obj or to_str before but i get everytime the same result.

 

S1 and S2 are variables with that i communicate with the method which vehicle is at which sensor.

 

Hope you guys can help me as good as always Smiley Happy

 

thanks in advance

 

Greetings

Carsten

 

PS: my model is attached

Re: unload vehicle and refill next

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

I guess, it waits at Sensor2 until @.beladen=true, but you dont set this condition at sensor1: only

 

if S2.voll = true then S2.beladen := true;

 

But S2 is not full...

 

There is missing a condition for starting the transporter at sensor2.

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

Re: unload vehicle and refill next

Pioneer
Pioneer

I thought because of the while-loop that everytime a MU of vehicle at Sensor 1 is unloaded, another MU is created at the vehicle on Sensor 2.

 

I couldn't create with my method a new MU at the vehicle on Sensor 2. So my if-condition is never met.

 

And for the driving at Sensor 2 there is the "waituntil @.beladen  = true" before this vehicle drives again. So i don't see where i condition is missing.

 

I think there is a problem with my table address but i don't get it.

 

If you need more explaination i can create a PAP (program flow chart) tomorrow but in my first post there are all informations for my problem.

 

Thanks for your patience Smiley Very Happy

 

Greetings

Carsten

Re: unload vehicle and refill next

Pioneer
Pioneer

beladen is an attribut i set if the vehicle is full. Or should i rename it?