Cancel
Showing results for 
Search instead for 
Did you mean: 

Trigger the source

Hello,

 

I have 4 parts A1, A2, A3, A4 being produced (1000 each - input using table) in sequence from source, which are sent to Singleproc, then loaded (Transferstation) to transporter and sent to next process.

These parts are unloaded (Transferstation) and sent to their buffers BFA1, BFA2, BFA3, BFA4 respectively. These 4 parts are assembled in an assembly station and sent to sink.

 

Here my challenge is to trigger my source only when my buffer (BFA1, BFA2, BFA3, BFA4 ) count goes below 50 parts.

 

Can anyone help me on this?

 

Thanks in advance.

Regards,

Sharad

 

14 REPLIES

Re: Trigger the source

Legend
Legend

Sharad:

 

You could try adding a front exit control to your Source so that a part will not be released to Singleproc until the buffer count is less than 50.

 

For example

 

-- front exit control for Source

 

waituntil (BFA1.NumMU + BFA2.NumMU + BFA3.NumMU + BFA4.NumMU) < 50 prio 1

@.move

Re: Trigger the source

Hello Robert,

 

Thank you for your reply.

 

As shown in the attached image, I have 4 parts thl1, thl2, thl3, thl4  given as an input from a table (Input_platinen). I want this to be executed once, i.e. thl1 (1000), thl2 (1000), thl3 (1000) and thl4 (1000).

 

All these are loaded to their respective transporters and sent to their respective Buffers (Buffer_thl1, Buffer_thl2, Buffer_thl3, Buffer_thl4). These buffers have a capacity of 1000 each.

 

Later, thl1+thl2+thl3+thl4 becomes thl in an assembly station.

 

I have an initial capacity of 200 in Buffer_thl1, Buffer_thl2, Buffer_thl3, Buffer_thl4 to start the assembly process.In this case source is already producing its first set of parts and meantime my buffer capacity is going low.

 

I want my source to initiate the production only when any of these buffer counts (Buffer_thl1, Buffer_thl2, Buffer_thl3, Buffer_thl4) goes below 100 parts. I have tried doing keeping a buffer immediately after the source and use a method to produce parts and its not working for me.

 

Please help!

 

Regards,

Sharad

 

 

 

Re: Trigger the source

Legend
Legend

Sharad:

 

I suggest replacing your Source with two methods.  The first method, TriggerParts, watches the buffers and when one goes below 100, triggers the other method, CreateParts, to create the new parts specified in the table.

 

The two new methods run continuously during the simulation and are started by an Init method in the frame.

 

-- method TriggerParts

is

do

     while true loop
            waituntil Buffer_thl1.numMU < 100 or Buffer_thl2.numMU < 100 or
              Buffer_thl3.numMU < 100 or Buffer_thl4.numMU < 100 prio 1;
           blnTrigger := true;
           wait 0.1;
      end;
end;

 

-- method CreateParts

is
     i : integer;
     j : integer;
     nextPart : object;

do
     while true loop

           waituntil blnTrigger = true prio 1;

           for i := 1 to input_Platinen.ydim loop
               for j := 1 to input_Paltinen[2,i] loop
                    nextPart := input_Paltinen[1,i].create(Buffer);
                    nextPart.Name := input_Paltinen[3,i].create(Buffer);
               next;
           next;

          blnTrigger := false;
      end;
end;

 

-- method Init

is
do
     blnTrigger := false;
     ref(TriggerParts).methCall(0);
     ref(CreateParts).methCall(0);

end;

 

 

Re: Trigger the source

Thank you for your reply Robert.

 

I just implemented your approach. I replaced the Source with the 2 methods. I am getting an error here.

 

 

Re: Trigger the source

Legend
Legend

That was an error in my code.  Replace the line with

 

nextPart.Name := input_Paltinen[3,i];

Re: Trigger the source

I replaced it with new code and I am getting a new error.

Re: Trigger the source

Legend
Legend

It looks like nextPart was not created.  Since it's void, you cannot set its Name attribute.

Perhaps Buffer capacity is too small.  Try setting its capacity to -1 for infinite capacity.

Re: Trigger the source

Hello Robert,

 

I did change the buffer size to -1.

 

My simulation is being performed at a very slow speed (milliseconds). What could be the reason? Is it because of the while loop and waituntil?

 

Could you please help me on this. It will be of great help.

 

Regards,

Sharad

 

Re: Trigger the source

Hello Robert,

 

That is because of wait 0.1 in this below mentioned method

 

-- method TriggerParts

is

do

     while true loop
            waituntil Buffer_thl1.numMU < 100 or Buffer_thl2.numMU < 100 or
              Buffer_thl3.numMU < 100 or Buffer_thl4.numMU < 100 prio 1;
           blnTrigger := true;
           wait 0.1;
      end;
end;

 

I am running this simulation for 30 days, so what could be the suitable value for wait in my case?

 

Or have I understood it wrong Smiley Sad

 

Regards,

Sharad