예제 #1
0
 def on_settings_update(self, name, settings):
     """Catches the 'settings_update' signal for 'valueset'"""
     # This signal is sent on startup and whenever settings are changed by the server
     self.plcip   = settings.get(self.livecfg, 'splcip')
     self.plcport = settings.get_integer(self.livecfg, 'splcport', 9600)
     self.memadr  = settings.get(self.livecfg, 'smemaddr', "A0")        
     self.savevalue = settings.get_float(self.livecfg, 'savevalue', 0.0)
     self.log.debug(" SettingValue updated: valueset {}:{}".format(self.memadr, self.savevalue))
     
     #write data to Omron PLC:
     plc = OmronPLC( )
     plc.openFins( self.plcip, self.plcport)
     plc.writeFloat( self.memadr, self.savevalue)
     plc.close()
예제 #2
0
    def poll(self):
        """Called on a schedule defined in dataplicity.conf"""

        #read data from Omron PLC:
        plc = OmronPLC()
        plc.openFins(self.plcip, self.plcport)
        value = plc.readFloat(self.memadr)
        plc.close()

        self.log.debug("SAMPLE: {}".format(value))
        self.do_sample(value)
예제 #3
0
 def poll(self):
     """Called on a schedule defined in dataplicity.conf"""
     
     #read data from Omron PLC:
     plc = OmronPLC( )
     plc.openFins( self.plcip, self.plcport)
     value = plc.readFloat( self.memadr)
     plc.close()
     
     self.log.debug( "SAMPLE: {}".format( value))
     self.do_sample(value)