Cancel
Showing results for 
Search instead for 
Did you mean: 

find in tablefile

Pioneer
Pioneer

Hello everyone,

 

I have a model that creates trucks, gives the trucks the number of parts it contains, unload the truck in to 11 diferent buffers. buffer 1-6 are linked to singleproc 1 and buffer 7-11 are linked to singleproc 2. The parts in the buffer have to be processed on the singleprocs according to a schedule and several constraints. The model that I added only consists of the truck arrival.

 

To determine if the truck should be unloaded in a buffer of 1 until 6 or in 7-11 i need to know if the truck that is unloading is the last truck to arrive before a specified time according to the planning. 

 

An example:

Planned arrival:

2015/01/05 03:30:00.0000  FS
2015/01/05 03:45:00.0000  WG
2015/01/05 04:00:00.0000  WG
2015/01/05 04:15:00.0000  FS
2015/01/05 04:45:00.0000  WG
2015/01/05 05:00:00.0000  FS
2015/01/05 05:15:00.0000  WG
2015/01/05 05:30:00.0000  WG
2015/01/05 05:45:00.0000  WG
2015/01/05 05:45:00.0000  FS
2015/01/05 06:15:00.0000  WG
2015/01/05 06:45:00.0000  FS

 

If i am unloading the truck that was planned at 05:00 (FS) i need to know if this is the last FS truck on the planning until 2015/01/05 06:00:00.0000 or not. For the FS truck at 5:00 this should be false but for the FS truck arriving at 5:45 it should be true.

 

Can anyone help me with this??

 

Thanks in advance.

 

2 REPLIES

Re: find in tablefile

Siemens Phenom Siemens Phenom
Siemens Phenom

Hi Steven5,

 

the time period (planning horizon) for the decision is set 1 hour.

This time interval ist defined by the local variables startdatetime and enddatetime.

Please read about findCeil and findFloor in the documentation.

After the determination of the range in your tablefile

you can search the string ”FS” in the third column.

 

ceil_floor.jpg

 

 Delivery.setCursor(1,1);
local startdatetime := str_to_datetime("2015/01/05 05:0:0");
local enddatetime := startdatetime + 3600;
if Delivery.findCeil({1,1}..{1,*},startdatetime) then
local startRow := Delivery.cursorY + 1;
Delivery.setCursor(3,startRow);
if Delivery.findFloor({1,1}..{1,*},enddatetime) then
local endRow := Delivery.cursorY;
Delivery.setCursor(3,startRow);
if Delivery.find({3,1}..{3,endRow},"FS") then
print "It was not the last Truck for FS, next: ",
Delivery[1,Delivery.cursorY];
else
print "It was the last Truck for FS";
end;
end;
end;

Regards,

Peter

Re: find in tablefile

Pioneer
Pioneer

Thanks!