Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
Hi all,
I want to calculate the breakdown time
ex:the breakdown time for machine 1 is 10 min
MachineNumber | Start | Stop |
1 | 07:30 | 08:00 |
1 | 08:10 | 08:50 |
2 | 08:30 | 08:40 |
2 | 09:15 | 09:40 |
3 | 09:47 | 10:23 |
3 | 10:35 | 11:05 |
3 | 11:22 | 11:52 |
May be this:
Table:
LOAD * INLINE [
MachineNumber, Start, Stop, Program, Breakdowntime
1, 07:30, 08:00, Lower Arm, 00:10:00
1, 08:10, 08:50, Lower Arm, 00:25:00
1, 08:30, 08:40, DETECT STOP, 00:00:00
1, 09:15, 09:40, Lower Arm, 00:07:00
1, 09:47, 10:23, Lower Arm, 00:00:00
];
Left Join (Table)
LOAD MachineNumber,
Start,
Stop,
Interval(If(MachineNumber = Previous(MachineNumber), Peek('Start') - Stop)) as Breakdowntime_Calculated
Resident Table
Where Program <> 'DETECT STOP'
Order By MachineNumber, Start desc;
in script:
Stop - Start as BDTime;
the sum(BDTime) for each machine
Hi,
It should be like this
second one start -first one stop
MachineNumber | Start | Stop | Result |
1 | 07:30 | 08:00 | - |
1 | 08:10 | 08:50 | 00:10:00 |
1 | 08:55 | 09:10 | 00:05:00 |
1 | 09:15 | 09:40 | 00:00:00 |
Not sure I understand the logic behind deriving the Result field. Would you be able to walk us through with the calculation there?
Hi Sunny,
I want to find the
machine breakdown time
You can see the machine started at 07:30 and stopped at 08:00 and resumed at 08:10 so the breakdown time is 10 min.
MachineNumber | Start | Stop | Breakdowntime |
1 | 07:30 | 08:00 | 00:10:00 |
1 | 08:10 | 08:50 | 00:10:00 |
1 | 08:55 | 09:10 | 00:05:00 |
1 | 09:15 | 09:40 | 00:00:00 |
Hi,
Try this
LOAD *
, if(MachineNumber=previous(MachineNumber), Start - previous(Stop)) as Breakdowntime
;
[Your load statement]
HTH
Andrei
And first make sure that your source table is ordered by MachineNumber and ascending Start time.
Best,
Peter
TimeStamp#(Coulmn1-Coulmn2, 'DD-MM-YYYY hh:mm:ss') as ResultDateTime
Exactly
Hi Andrei ,
Its working for all values but in somecase its not working
MachineNumber | Start | Stop | Program | Breakdowntime |
1 | 07:30 | 08:00 | Lower Arm | 00:10:00 |
1 | 08:10 | 08:50 | Lower Arm | 00:25:00 |
1 | 08:30 | 08:40 | DETECT STOP | 00:00:00 |
1 | 09:15 | 09:40 | Lower Arm | 00:07:00 |
1 | 09:47 | 10:23 | Lower Arm | 00:00:00 |
IF DETECT STOP comes it should not consider it.
Regards,
Joshua.