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)
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)
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"and this is the outputOutput:D2M_250 2020-04-15 14:20 D2M_250 = ACTUDADOR 7 HOME SENSOR BY PASSI need to split that text intoSTATION DATE STATUS
D2M_250 2020-04-15 14:20 D2M_250 = ACTUDADOR 7 HOME SENSOR BY PASS
