Cancel
Showing results for 
Search instead for 
Did you mean: 

Pull Count MUs and move

Hi everyone, 

 

I have a question regarding my pull model. 

 

I am now struggling with converting my Pull model from Single Part Flow to Batch flow. My pull signals are sent to two tables where the name of the parts are registered, when they are available in the buffers, immediately they are moved to either Production or Transportation. 

 

What I would like to do is to make them wait and count in those Pull Tables and move them when they reach a fixed amount. 

 

First of all, I think I can assign global variables to each parts and count them till let's say 5 and then delete them from the table by moving them to the next station. 

 

But lately, my code checks all the buffers and if the part is available, it moves the parts to the next station. 

 

A count loop could be used, for example when I reach the amount it will go back to 0 and start counting the set amount again. 

"

CountA := CountA +1; 

 

if CountA= 5 then CountA:= 0; "

 

 

Which command or object is good  for that, or is there a small example where I can see how to count the part numbers which appear in  a table and wait until the required amount is reached then deleted and moved to the next station ? 

 

Thank you very much, 

Erkan

 

 

30 REPLIES

Re: Pull Count MUs and move

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor
you could try an observer for the attribute yDim in the table; it is called after each change of number of entries in your table; the observer method has a parameter oldValue, so you can check, if the value is increasing or decreasing.
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Pull Count MUs and move

Dear Steffen, 

 

Thank you for your quick answer. My goal is actually to control the variable. 

 

To be more spesific, 

 

The parts are seen in a table as strings, but if they are available in the buffer, they are immediately deleted. My goal is to keep them appear until they reach a certain amount ( e.g. 5) and then move as a batch. 

 

I think with the observer, I can only see the number change, right ?

 

Thanks, 

Erkan

Re: Pull Count MUs and move

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor
the observer for yDim reacts to changing in entries (lines) of a table
how do you count the available parts?
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Pull Count MUs and move

for local k:=1 to RAW.dim loop --cardfile with all buffers ( Buffer 1,......,9)
    --check, if the part from the order-table is available
	  if RAW.read(k).occupied and PullTable1[1,i] = RAW.read(k).cont.name then
		RAW.read(k).cont.move(Produce); -- available parts are sent to production
		PullTable1.cutRow(i);
        exitloop 2;
    end;
  next;

Here is the code for my pull logic. I am using the card file, with the signal coming to my pull table from a source. Now there is, single part flow so whenever the part is available, they are moved and deleted from the table. 

 

I would like to keep them until they reach for example 5, in my pull table and then move. That's what I was asking about if the observer can keep them till they reach the required amount and then move them all together. 

 

Thanks, 

Erkan

Re: Pull Count MUs and move

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

you could use a second cardfile to "remember" the parts you want to move, until you have 5:

for local k:=1 to RAW.dim loop --cardfile with all buffers ( Buffer 1,......,9)
  --check, if the part from the order-table is available
  if RAW.read(k).occupied and PullTable1[1,i] = RAW.read(k).cont.name then
    pullTable2.append(RAW.read(k).cont);
    PullTable1.cutRow(i);
    exitloop 2;
  end;
next;
-- available parts are sent to production
if pullTable2.dim = 5 then
  -- available parts are sent to production
  while pulltable2.dim > 0 loop
    pulltable2[1].move(produce);--simtalk 1.0 only
    -- may be you need to wait here
  end;
end;

 

 

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

Re: Pull Count MUs and move

Dear Steffen, 

 

Thank you for your answer. I have implemented the code to my model, but the questions I have right now are; 

 

- I have put a cardfile and I see how many parts were moved but I suppose it counts the number of parts (objects) through their column. I am supposed to move when each part is 5. For example; 

 

Part A : 5 --> move

Part B: 5 --> move

 

So in this case I have to modify the code for each part ? 

 

- You have a comment saying that I have to wait. What do you exactly mean by that ? Can wait be done with waituntil in this context ? 

 

Regards, 

Erkan

Re: Pull Count MUs and move

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor
if you "collect" different parts, you could use for each part one cardFile (pullTable)

if you move to a buffer or a line, plant simulation need a time to "shift" the parts foreward; so you need to wait a little time between the move commands (e.g. wait(1)) in the loop, otherwhise the move command fails (return false)
Steffen Bangsow
freelance simulation specialist  
web: www.bangsow.eu
mail: steffen@bangsow.net

Re: Pull Count MUs and move

for i:=1 to PullTable1.yDim loop
	
for local k:=1 to RAW.dim loop --cardfile with all buffers ( Buffer 1,......,9)
  --check, if the part from the order-table is available
	if RAW.read(k).occupied and PullTable1[1,i] = RAW.read(k).cont.name then
		
	inspect PullTable1[1,PullTable1.ydim]
    when "Part1" then 
	Part1Pull.append(RAW.read(k).cont);
	PullTable1.cutRow(i);
	when "Part2" then
	Part2Pull.append(RAW.read(k).cont);
	PullTable1.cutRow(i);
	when "Part3" then
	Part3Pull.append(RAW.read(k).cont);
	PullTable1.cutRow(i);
	when "Part4" then
	Part4Pull.append(RAW.read(k).cont);
	PullTable1.cutRow(i);
	when "Part5" then
        Part5Pull.append(RAW.read(k).cont);
	PullTable1.cutRow(i);
	when "Part6" then
	Part6Pull.append(RAW.read(k).cont);
	PullTable1.cutRow(i);
	when "Part7" then
	Part7Pull.append(RAW.read(k).cont);
	PullTable1.cutRow(i);
	when "Part8" then
	Part8Pull.append(RAW.read(k).cont);
	PullTable1.cutRow(i);
	when "Part9" then
	Part9Pull.append(RAW.read(k).cont);
	PullTable1.cutRow(i);
	end;		
		
    exitloop 2;
  end;
next;

-- available parts are sent to production
if Part1Pull.dim = 5 then
  -- available parts are sent to production
	while Part1.dim > 0 loop
		wait(1);
    Part1Pull[1].move(produce);--simtalk 1.0 only
    -- may be you need to wait here
  end;
  end;
  
  if Part2Pull.dim = 5 then
  -- available parts are sent to production
  while Part2Pull.dim > 0 loop
   Part2Pull[1].move(produce);--simtalk 1.0 only
    -- may be you need to wait here
  end;
  end;
  
  if Part3Pull.dim = 5 then
  -- available parts are sent to production
  while Part3Pull.dim > 0 loop
   Part3Pull.move(produce);--simtalk 1.0 only
    -- may be you need to wait here
  end;
  end;
  
   if Part4Pull.dim = 5 then
  -- available parts are sent to production
  while Part4Pull.dim > 0 loop
   Part4Pull.move(produce);--simtalk 1.0 only
    -- may be you need to wait here
  end;
   end;
  
    if Part5Pull.dim = 5 then
  -- available parts are sent to production
  while Part5Pull.dim > 0 loop
   Part5Pull.move(produce);--simtalk 1.0 only
    -- may be you need to wait here
  end;
	end;
  
  if Part6Pull.dim = 5 then
  -- available parts are sent to production
  while Part6Pull.dim > 0 loop
   Part6Pull.move(produce);--simtalk 1.0 only
    -- may be you need to wait here
  end;
  end;
  
   if Part7Pull.dim = 5 then
  -- available parts are sent to production
  while Part7Pull.dim > 0 loop
   Part7Pull.move(produce);--simtalk 1.0 only
    -- may be you need to wait here
  end;
   end;
  
   if Part8Pull.dim = 5 then
  -- available parts are sent to production
  while Part8Pull.dim > 0 loop
   Part8Pull.move(produce);--simtalk 1.0 only
    -- may be you need to wait here
  end;
   end;

   if Part9Pull.dim = 5 then
  -- available parts are sent to production
  while Part9Pull.dim > 0 loop
   Part9Pull.move(produce);--simtalk 1.0 only
    -- may be you need to wait here
  end;
   end;

Here I have thought of this code, and for only one part 'Wait(1)"is implemented. But the problem I am facing here is all card files are the same. So I could not succeed to distinguish the names through separate card files. 

 

Another issue is , I have set the MUs as objects in card file but at the end of the name of the MUs there appears really high numbers. I am giving an example for it. 

 

ExampleCardFile.png

 

 

Best Regards, 

Erkan 

Re: Pull Count MUs and move

Gears Esteemed Contributor Gears Esteemed Contributor
Gears Esteemed Contributor

You can shorten your code using a variable:

local partname:string;
	for i:=1 to PullTable1.yDim loop
	
		for local k:=1 to RAW.dim loop --cardfile with all buffers ( Buffer 1,......,9)
 			 --check, if the part from the order-table is available
			if RAW.read(k).occupied and PullTable1[1,i] = RAW.read(k).cont.name then
				partname:=RAW.read(k).cont.name;
				--enter into the cardFiles
				str_to_obj(partname+"Pull").append(RAW.read(k).cont);
				PullTable1.cutRow(i);
			end;
			
			if str_to_obj(partname+"Pull").dim = 5 then
 			 	-- available parts are sent to production
				while str_to_obj(partname+"Pull").dim > 0 loop		
    				(str_to_obj(partname+"Pull"))[1].move(produce);--simtalk 1.0 only	
					wait(0.01);
  				end;
  			end;			
		next;
	next;

one wait is sufficient, it is inside the loop

to check the names click in the cardFile with the right mouse button on the reference --> open object; here you can see the name of the object;

 

The last number of the reference of the MU is its id (instance number).

You should check the names of your MUs.

 

 

 

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