Apr-15-2020, 09:11 PM
What can I add to my code
in order to save the output into a excel shett but with format table
this is the code (part of it, due to it is to long)
and this is the output
STATION DATE STATUS
D2M_250 2020-04-15 14:20 D2M_250 = ACTUDADOR 7 HOME SENSOR BY PASS
in order to save the output into a excel shett but with format table
this is the code (part of it, due to it is to long)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
with PLC() as comm: comm.IPAddress = '172.21.11.10' comm.ProcessorSlot = 0 ret = comm.GetPLCTime() print ( "Fecha y Hora de Registro Revision Fallas" , ret.Value, ) time.sleep( 1 ) Estacion = "D2M017" ACTUADOR = comm.Read( 'D2M_017.Status.Act._1.WBypassed' ) ret = comm.GetPLCTime() Numero_Act_EnBypass = 0 if ACTUADOR.Value = = True : Sensor = "ACTUADOR 1 WORK SENSOR EN BY PASS" Numero_Act_EnBypass = (Numero_Act_EnBypass + 1 ) print (Estacion, ret.Value, "D2M017 =" ,Sensor) else : Sensor = "ACTUADOR 1 WORK OK" ACTUADOR = comm.Read( 'D2M_017.Status.Act._1.HBypassed' ) ret = comm.GetPLCTime() if ACTUADOR.Value = = True : Sensor = "ACTUADOR 1 HOME SENSOR EN BY PASS" Numero_Act_EnBypass = (Numero_Act_EnBypass + 1 ) print (Estacion, ret.Value, "D2M017 =" ,Sensor) else : Sensor = "ACTUADOR 1 HOME OK" #ACTUADOR 2 ACTUADOR = comm.Read( 'D2M_017.Status.Act._2.WBypassed' ) ret = comm.GetPLCTime() if ACTUADOR.Value = = True : Sensor = "ACTUADOR 2 WORK SENSOR EN BY PASS" Numero_Act_EnBypass = (Numero_Act_EnBypass + 1 ) print (Estacion, ret.Value, "D2M017 =" ,Sensor) else : Sensor = "ACTUADOR 2 WORK OK" ACTUADOR = comm.Read( 'D2M_017.Status.Act._2.HBypassed' ) ret = comm.GetPLCTime() if ACTUADOR.Value = = True : Sensor = "ACTUADOR 2 HOME SENSOR EN BY PASS" Numero_Act_EnBypass = (Numero_Act_EnBypass + 1 ) print (Estacion, ret.Value, "D2M017 =" ,Sensor) else : Sensor = "ACTUADOR 2 HOME OK" |
Output:D2M_250 2020-04-15 14:20 D2M_250 = ACTUDADOR 7 HOME SENSOR BY PASS
I need to split that text intoSTATION DATE STATUS
D2M_250 2020-04-15 14:20 D2M_250 = ACTUDADOR 7 HOME SENSOR BY PASS