Showing results for 
Search instead for 
Did you mean: 

Method moves container 338 times, can't do it for the 339th


I have stations in my model (a changed duplicate of SingleProc). I use a method that sets the station's setup time and proctime, creates a container on the station, pauses the station, then make some parts enter the container on the station (custom assembly solution). Then the method makes the container enter an object called Swap (that does nothing), then switches the station's pause attribute to false, then moves the container back to the station. (See explanation of the necessity of the Swap in the link below).


This is why the Swap is needed


The cut version of the method is (the cut parts contain mainly information handling, but they are not in connection with the problem):

param Station,input_workpiece:object

var state, product:string
var pid_local,id_child,id_assembly:integer
var tab_Assembly_row,station_row,agvo_row,Process_Log_row,inventory_row :integer
var destination,workpiece,store,palette,swap :object
var tab_Assembly:table
var procTime, setup_time:time

if @ /= void
	workpiece := @
	workpiece := input_workpiece

state := "waiting_for_parts"
product := workpiece.product
tab_Assembly := Assembly_graphs["tab_Assembly",product]
pid_local :=
Process_Log_row := search_tab_for_any(Process_Log,"pid",pid_local)
id_child  := workpiece.id_child 
id_assembly  := getParent(workpiece.id_child)
palette := workpiece.location
swap := str_to_obj(target_frame + ".swap")

if Station.empty
	tab_Assembly_row := search_tab_for_any(tab_Assembly,"ID",id_assembly)
	// set station proctime and setup_time
	// find setup_time based on the previous assembly type and the next assembly_type
	setup_time  := str_to_time(Station.setup_table[Station.assembly_type,Process_Log["assembly_type",Process_Log_row]])
	// find proctime
	tab_Assembly_row := search_tab_for_any(tab_Assembly,"ID",id_assembly)
	station_row := search_object_in_table(tab_Assembly["station",tab_Assembly_row],Station)
	proctime  := tab_Assembly["station",tab_Assembly_row]["proctime",station_row]
	station.SetupTime := setup_time
	station.proctime := proctime
	Station.pause := true
	// assembly begins when the total number of parts arrives. The type of parts is not at all watched!
	// Again, 8 bolts count as 8 parts.
	Station.cont.ydim  := tab_Assembly["no_parts", tab_Assembly_row] := -1

if not Station.cont.full
	Station.cont.part_weight += workpiece.part_weight

// check if container is full - assembly can be started 
if Station.cont.full
	// waituntil swap.cont.finished prio 1
	Station.pause := false
	// set new assembly_type
	Station.assembly_type  := Process_Log["assembly_type",Process_Log_row]
	// wait the setup time + processing time then exit station
	Station.stat_processing_time += proctime
	Station.stat_setup_time += setup_time
	waituntil /*station.occupied and*/ station.cont.finished prio 1
	store := Find_obj_in_Location_List(station,"store")


This works 338 times. When I try to process the 339th container, the swap.cont.move(station) line does not work. The interpreter processes it, but nothing happens. There is no error message. I have tried this with a Swap made from Singleproc (setup = 0 and processing time = 0) and with a Swap made of Store (its size was 1x1x1).


Do you know why this is so?

I can't attach the simulation file.


Re: Method moves container 338 times, can't do it for the 339th

Siemens Phenom Siemens Phenom
Siemens Phenom

I think the object swap is no longer necessary when you use outIn(-1, true) after the create or when pause is set to false.

See documentation: This setting is particularly useful when an MU is created on a station. Then it is full processed and ready to exit. If it is to be processed still, you can enter outIn(-1, true) directly after create to start processing. 


When the 339th container is not moved the station may be full, failed, paused, entrance locked, ...  or the object swap has exit locked, is failed.

Without the model it is not possible to determine the cause.


Kind regards


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