03-01-2015 12:57 PM - edited 03-01-2015 01:22 PM
Hello. I would like to ask for help.
Now i have model and it is working like this:
In store accumulates X products, once the store is full, the products coming from the store to the next process. If the store reaches the 0 it should load to X products
And again, the product is sent to the next process, and so on.
I`m using method observer for store:
(attribute: string; oldValue: any)
is
do
if Store.numMU = X then
ref(deliver100).methCall(0);
Store.entranceLocked := true;
end;
if Store.numMU = 0 then
Store.entranceLocked := false;
end;
end;
and method (deliver100):
is
b:boolean;
do
for local j := 1 to X loop
waituntil NOT Bufor1.full prio 1;
b := Store.cont.move(Bufor1);
if not b then debug end;
next;
end;
The problem is that i`m using Delivery table:
In deliveryTable i have something like this:
1:00:00.0000 .Models.item1 100 item1
3:00:00.0000 .Models.item1 50 item1
6:00:00.0000 .Models.item1 50 item1
9:00:00.0000 .Models.item1 100 item1
12:00:00.0000 .Models.item1 20 item1
17:00:00.0000 .Models.item1 80 item1
20:00:00.0000 .Models.item1 100 item1
And now i want to store capacity was example 100, but i dont want from store to wait till its full to move on with products. It should sent products to production (bufer1) when it reach amount of first delivery from table, second delivery from table etc.
For example:
for first delivery (1h), products should be moved to bufor1 when store.NumMu=100,
for second delivery (3h), products should be moved to bufor1 when store.NumMu=50, etc...
I think i need to change my X to some function which would read values from table for first delivery, second, third etc. However im still beginer with SimTalk and i dont know how do solve that problem.
Could you help me?
Yours
U_jacob
Solved! Go to Solution.
03-01-2015 04:36 PM - edited 03-01-2015 04:38 PM
you need a global variable for the position in the delivery table (e.g posit:integer). Than you need to change the method:
(attribute: string; oldValue: any)
is
do
if Store.numMU = deliveryTable[3,posit] then
ref(deliver100).methCall(0,deliveryTable[3,posit]);
posit:=posi+1;
Store.entranceLocked := true;
end;
if Store.numMU = 0 then
Store.entranceLocked := false;
end;
end;
in your delivery method you need to include a parameter:
(number:integer)
is
b:boolean;
do
for local j := 1 to number loop
waituntil NOT Bufor1.full prio 1;
b := Store.cont.move(Bufor1);
if not b then debug end;
next;
end;
Steffen Bangsow freelance simulation specialist web: www.bangsow.eu mail: steffen@bangsow.net | ![]() |
03-01-2015 07:29 PM
I created variable "posit" and in init wrote "posit:=1;" Then in method:
(attribute: string; oldValue: any)
is
do
if Store.numMU = .Models.Frame.TableFile[3,posit] then
ref(deliver100).methCall(0,.Models.Frame.TableFile[3,posit]);
posit:=posit+1;
Store.entranceLocked := true;
end;
if Store.numMU = 0 then
Store.entranceLocked := false;
end;
And it works great! Thanks
Best regards,
U_Jacob