Showing results for 
Search instead for 
Do you mean 
Reply
Solved! Go to solution

QueueFile error

I have a simulation where a QueueFile is read, and a correspdoning MU (A, B, or C) is triggered to move from it's buffer (Buffer_A, Buffer_B, Buffer_C) into a combined buffer.

 

I have the simulation waiting until there's room in the combined buffer, and waiting until there are values in the QueueFile. My simulation crashes before I get to second shift, though, always with this error:

   "The list ...QueueFile is empty." 

 

How is this so? The method just read and triggered an action according to the contents of the QueueFile.

 

Any ideas on how to avoid this error? Is there something about .top and .pop that I'm missing?

 

Here's my method:

 

waituntil Buffer.full = false
if QueueFile.empty = true
	wait 5
elseif QueueFile.top = "A"
	if Buffer_A.empty = true
		repeat
			 wait 10
		until Buffer_A.empty = false
	end
	Buffer_A.cont.move(Buffer)
	QueueFile.pop
elseif QueueFile.top = "B"
	if Buffer_B.empty = true
		repeat
			wait 10
		until Buffer_B.empty = false
	end
	Buffer_B.cont.move(Buffer)
	QueueFile.pop
elseif QueueFile.top = "C"
	if Buffer_C.empty = true
		repeat
			wait 10
		until Buffer_C.empty = false
	end
	Buffer_C.cont.move(Buffer)
	QueueFile.pop
end

 

Nothing else in my model uses .pop.

 

Any assistance you could provide would be very helpful.

 

 

 

Thank you, 

efk

 

 

4 REPLIES

Re: QueueFile error

How do you call this method?

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


Re: QueueFile error

I use a generator that I set to active in my init method [Generator.active := true]

The Generator has a start time of 6:00:00 (when 1st shift starts).
The Generator has an interval of 0:10.

At the interval, the method is executed.
Solution
Solution
Accepted by topic author efk
‎11-01-2016 04:49 PM

Re: QueueFile error

these structur:

 

repeat
wait 10
until Buffer_A.empty = false

 

is very problematic.

 

So it may happen, that one method call is just running, while the generator starts the method again. The resulting behavior is chaotic.

 

There are other ways to do this:

Just include the condition Buffer_A.empty = false into the top conditions. If the condition is not met, nothing happens and the method waits for their next call e.g.

if  Buffer.full or  QueueFile.empty  then
  return
end

if QueueFile.top = "A" and Buffer_A.empty =false then
	Buffer_A.cont.move(Buffer)
	QueueFile.pop
elseif QueueFile.top = "B" and Buffer_B.empty = false then
	Buffer_B.cont.move(Buffer)
	QueueFile.pop
elseif QueueFile.top = "C" and Buffer_C.empty = false then
	Buffer_C.cont.move(Buffer)
	QueueFile.pop
end

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


Re: QueueFile error

Thank you!