[Kl...] Posted March 8, 2019 Share Posted March 8, 2019 A Collegue have had asked me to assign the actual shift by PCM. My solution and other stuff. Maybe someone save a little bit time. // Activate Display // --------- --------- --------- --------- --------- display("#displayCLOSE") display("#displayON") // Shift // Start time input decimal Shift_1 = 6.00 // time shift-1 Shift_2 = 14.00 // time shift-2 Shift_3 = 22.00 // time shift-3 pT = chr(9) // single tabulator into parameter pT2 = chr(9)+chr(9) // double tabulator into parameter StartRun = timeInSeconds() // time stamp start //24 hour time format // --------- --------- --------- --------- --------- HoursActual = int(StartRun/3600) MinutesActual = int((StartRun-HoursActual*3600)/60) SecondsActual = StartRun-HoursActual*3600-MinutesActual*60 StartTime = val(HoursActual)+"_"+val(MinutesActual)+"_"+val(SecondsActual) //Assign Shift // --------- --------- --------- --------- --------- //StartRun = 22*3600-1 // unmask for test ShiftSecond_1 = Shift_1*3600 ShiftSecond_2 = Shift_2*3600 ShiftSecond_3 = Shift_3*3600 selectCase StartRun case ShiftSecond_1 to ShiftSecond_2 ShiftActual = "Shift-1" //display(ShiftActual) case ShiftSecond_2 to ShiftSecond_3 ShiftActual = "Shift-2" //display(ShiftActual) caseElse ShiftActual = "Shift-3" //display(ShiftActual) endSelect //Output into display window // --------- --------- --------- --------- --------- display(ShiftActual, pT2, getRecordHead("operator"), pT2, StartTime) display() // Assign record head, Protokollkopf Parameter // ---------- ---------- ---------- ---------- ---------- ---------- setRecordHead("shift", ShiftActual) //Show ASCII char available inside PCM // --------- --------- --------- --------- --------- //Display initialized //display("#displayCLOSE") // unmask for single use //display("#displayON") for i = 1 to 256 // mask 3 lines to deactive it display(i, chr(9), chr(26), chr(9), chr(i)) next i Link to comment Share on other sites More sharing options...
[Ro...] Posted March 9, 2019 Share Posted March 9, 2019 Try this. if (timeInSeconds() >0.0) and (timeInSeconds() <21600) then SHIFT=3 //3rd shift between midnight and 6am endif if (timeInSeconds() >21600) and (timeInSeconds() <50400) then SHIFT=1 endif if (timeInSeconds() >50400) and (timeInSeconds() <79200) then SHIFT=2 endif if (timeInSeconds() >79200) and (timeInSeconds() <86400) then SHIFT=3 //3rd shift between 10pm and midnight endif Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in