jaintapauljp
I am recently using structured text for controlling a plc and psm for linux (python) for hardware layers. I am trying to find out the time stated in both of these. if they are different how do we synchronise them?

PSM File
if __name__ == "__main__":
    hardware_init()
    while (not psm.should_quit()):
        update_inputs()
        update_outputs()
        time.sleep(0.1) #You can adjust the psm cycle time here
    psm.stop()
 
ST File


CONFIGURATION Config0

  RESOURCE Res0 ON PLC
    TASK task0(INTERVAL := T#20ms,PRIORITY := 0);
    PROGRAM instance0 WITH task0 : plc1;
  END_RESOURCE
END_CONFIGURATION
 
Reply 0 0
thiagoralves
The time on Config0 is related to the PLC tasks you have in your project. PSM is a hardware driver that runs on a separate thread. Time on PSM is related to the period for the driver loop. Since PSM and PLC tasks run on separate threads, they are not synchronized and there isn’t a way to guarantee synchronization.
Reply 0 0
Reply