Cancel
Showing results for
Did you mean:
Highlighted

# Case pack restriction

Creator

Hallo all,

I am simulating part of the supply chain of a grocery retail chain for my master thesis.

I have the model up and running fine, except for one aspect.

The products in the stores are sold individually, but the distribution center is delivering the products in case packs.

This entails that the DC can only deliver the products in multiples of case packs.

For instance if the case pack is 4, they can only deliver 4, 8, 12.... etc products.

I can't seem to find how I should model this restriction in plant simulation, could someone please help me?

The loop I have now is;

is
_time:datetime;
i:integer;
do
_time:=eventController.absSimTime;
if DayOfWeek(_time)=1 then
if ~.Store_1.stock_level_1 <= ~.Store_1.Prod_1_must_order_level then
from i:=~.Store_1.Shelf_prod_1.numMu until i=60 loop
BufferProd_1.MU(1).move(~.Store_1.Inbound_Store1);
i:=i+1;
end;

end;

So for Monday for store 1 it determines if the stock level of product 1 is at or below the re-order level, if that is the case, it moves the products from the DC to store 1 till the max shelf capacity (which is 60). This however does not incorporate the case pack restriction, does someone know how to incorporate this?

I've been thinking about adding a check to divide the difference between the stock level and the max shelf capacity and then round that number down to the lowest integer, and then multiply this number by the case pack size. But I have no idea how to model this correctly.

I would really appreciate the help.

Regards,

Robin.

10 REPLIES 10

# Re: Case pack restriction

Creator
I mean ' divide the difference between the stock level and the max shelf capacity by the case pack size, and then round that number down to the nearest integer....'

# Re: Case pack restriction

Gears Esteemed Contributor

I guess you could use the modulo to solve this. You could subtract the remainder of the integer division of the case pack size from the stock, like this:

```is

_time:datetime;

i:integer;
stock:integer;

do

_time:=eventController.absSimTime;

if DayOfWeek(_time)=1 then

if ~.Store_1.stock_level_1 <= ~.Store_1.Prod_1_must_order_level then
-- subtract remainder of integer division
stock:=(60 - ~.Store_1.Shelf_prod_1.numMu) -              ((60-~.Store_1.Shelf_prod_1.numMu)\\casePackSize);

for  i:=1 to stock loop

BufferProd_1.MU(1).move(~.Store_1.Inbound_Store1);.
next;
end;
end;
end;```

You should parameterize the 60...

 Steffen Bangsowfreelance simulation specialist  web: www.bangsow.eumail: steffen@bangsow.net

# Re: Case pack restriction

Creator

Thank you very much for your quick response!

I will incorporate this tonight in my model and will let you know if it works well.

Regards,

Robin

# Re: Case pack restriction

Creator

Dear Mr. Bangsow,

I have incorporated the case pack restriction as you suggested (see picture below).

The '60' is parameterized by 'Shelf1', 'Shelf 2' etc., the case pack size is parameterized by 'CaseSize_prod1' etc.

As you can see, plant simulation gives an error message; 'syntax error near line 10 at <;>'.

I can't seem to find the cause of this, because that <;> should really be there.

I would rather not send the model publically, as I am not sure which information might be confident.

But if you would like to have the model, because I can imagine it is easier for you to find the problem, I could send it to you.

I would really appreciate your help.

With kind regards,

Robin Meulenbroek.

# Re: Case pack restriction

Gears Esteemed Contributor

copy the method into the forum, then I will try to correct it. You have too much end; in your code..

 Steffen Bangsowfreelance simulation specialist  web: www.bangsow.eumail: steffen@bangsow.net

# Re: Case pack restriction

Creator
Ah okay, that would be great, thanks!
As you can see I have it for 3 products now, and after those 3 products, the next delivery day starts (in this case Wednesday)

The method;

is
_time:datetime;
i:integer;
stock:integer;
do
_time:=eventController.absSimTime;
if DayOfWeek(_time)=1 then
if ~.Store_1.Shelf_prod_1.numMu <= ~.Store_1.Prod_1_must_order_level then
stock:=(~.Store_1_Shelf1 - ~.Store_1.Shelf_prod_1.numMu) -
(((~.Store_1_Shelf1 - ~.Store_1.Shelf_prod_1.numMu)\\CaseSize_prod1);
for i:=1 to stock loop
BufferProd_1.MU(1).move(~.Store_1.Inbound_Store1);
next;
end;
end;
if ~.Store_1.Shelf_prod_2.numMu <= ~.Store_1.Prod_2_must_order_level then
stock:=(~.Store_1_Shelf2 - ~.Store_1.Shelf_prod_2.numMu) -
(((~.Store_1_Shelf2 - ~.Store_1.Shelf_prod_2.numMu)\\CaseSize_prod2);
for i:=1 to stock loop
BufferProd_2.MU(1).move(~.Store_1.Inbound_Store1);
next;
end;
end;
if ~.Store_1.Shelf_prod_3.numMu <= ~.Store_1.Prod_3_must_order_level then
stock:=(~.Store_1_Shelf3 - ~.Store_1.Shelf_prod_3.numMu) -
(((~.Store_1_Shelf3 - ~.Store_1.Shelf_prod_3.numMu)\\CaseSize_prod3);
for i:=1 to stock loop
BufferProd_3.MU(1).move(~.Store_1.Inbound_Store1);
next;
end;
end;
-- The next delivery day starts (in this case Wednesday)
elseif DayofWeek(_time)=3 then

etc etc.

# Re: Case pack restriction

Gears Esteemed Contributor

try this

```is
_time:datetime;
i:integer;
stock:integer;

do

_time:=eventController.absSimTime;
if DayOfWeek(_time)=1 then
if ~.Store_1.Shelf_prod_1.numMu <= ~.Store_1.Prod_1_must_order_level then
stock:=(~.Store_1_Shelf1 - ~.Store_1.Shelf_prod_1.numMu) -
(((~.Store_1_Shelf1 - ~.Store_1.Shelf_prod_1.numMu)\\CaseSize_prod1);
for i:=1 to stock loop
BufferProd_1.MU(1).move(~.Store_1.Inbound_Store1);
next;
end;

if ~.Store_1.Shelf_prod_2.numMu <= ~.Store_1.Prod_2_must_order_level then
stock:=(~.Store_1_Shelf2 - ~.Store_1.Shelf_prod_2.numMu) -
(((~.Store_1_Shelf2 - ~.Store_1.Shelf_prod_2.numMu)\\CaseSize_prod2);
for i:=1 to stock loop
BufferProd_2.MU(1).move(~.Store_1.Inbound_Store1);
next;
end;
if ~.Store_1.Shelf_prod_3.numMu <= ~.Store_1.Prod_3_must_order_level then
stock:=(~.Store_1_Shelf3 - ~.Store_1.Shelf_prod_3.numMu) -
(((~.Store_1_Shelf3 - ~.Store_1.Shelf_prod_3.numMu)\\CaseSize_prod3);
for i:=1 to stock loop
BufferProd_3.MU(1).move(~.Store_1.Inbound_Store1);
next;
end;

-- The next delivery day starts (in this case Wednesday).

elseif DayofWeek(_time)=3 then```
 Steffen Bangsowfreelance simulation specialist  web: www.bangsow.eumail: steffen@bangsow.net

# Re: Case pack restriction

Creator

It keeps saying; 'Syntax error at <;>'

# Re: Case pack restriction

Gears Esteemed Contributor

delete one of the "(", you need only two in this line

 Steffen Bangsowfreelance simulation specialist  web: www.bangsow.eumail: steffen@bangsow.net