changes
This commit is contained in:
@ -11,9 +11,9 @@ def dummyPublisher(processImage):
|
|||||||
analogInputChangeset = processImage.getChangedAnalogsInputs()
|
analogInputChangeset = processImage.getChangedAnalogsInputs()
|
||||||
|
|
||||||
if discreteInputChangeset != []:
|
if discreteInputChangeset != []:
|
||||||
print("Discrete: ".format(discreteInputChangeset))
|
print("Discrete: {}".format(discreteInputChangeset))
|
||||||
if analogInputChangeset != []:
|
if analogInputChangeset != []:
|
||||||
print("Analog: ".format(analogInputChangeset))
|
print("Analog: {}".format(analogInputChangeset))
|
||||||
|
|
||||||
# for discreteInputChangeItem in discreteInputChangeset:
|
# for discreteInputChangeItem in discreteInputChangeset:
|
||||||
# print("Discrete input {} changed from {} to {}"
|
# print("Discrete input {} changed from {} to {}"
|
||||||
|
@ -39,17 +39,14 @@ def modbusHandler(processImage):
|
|||||||
client.connect()
|
client.connect()
|
||||||
|
|
||||||
reg = client.read_input_registers(0, analogInputBits // 8)
|
reg = client.read_input_registers(0, analogInputBits // 8)
|
||||||
print("M0: ".format(type(reg)))
|
|
||||||
if isinstance(reg, ModbusIOException):
|
if isinstance(reg, ModbusIOException):
|
||||||
raise Exception(reg)
|
raise Exception(reg)
|
||||||
analogInputs = reg.registers
|
analogInputs = reg.registers
|
||||||
print("M1: ".format(reg.registers))
|
|
||||||
|
|
||||||
reg = client.read_discrete_inputs(0, digitalInputBits)
|
reg = client.read_discrete_inputs(0, digitalInputBits)
|
||||||
if isinstance(reg, ModbusIOException):
|
if isinstance(reg, ModbusIOException):
|
||||||
raise Exception(reg)
|
raise Exception(reg)
|
||||||
discreteInputs = reg.bits
|
discreteInputs = reg.bits
|
||||||
print("M2: ".format(reg.bits))
|
|
||||||
|
|
||||||
coils = None
|
coils = None
|
||||||
with processImage:
|
with processImage:
|
||||||
|
@ -40,12 +40,12 @@ class ProcessImage(Condition):
|
|||||||
def getChangedDiscreteInputs(self):
|
def getChangedDiscreteInputs(self):
|
||||||
if not self.initialized:
|
if not self.initialized:
|
||||||
raise NotInitializedException
|
raise NotInitializedException
|
||||||
print("D1: ".format(self.discreteInputs))
|
print("D1: {}".format(self.discreteInputs))
|
||||||
print("D2: ".format(self.shadowDiscreteInputs))
|
print("D2: {}".format(self.shadowDiscreteInputs))
|
||||||
changedDiscreteInputs = zippingFilter(self.discreteInputs, self.shadowDiscreteInputs)
|
changedDiscreteInputs = zippingFilter(self.discreteInputs, self.shadowDiscreteInputs)
|
||||||
print("D3: ".format(changedDiscreteInputs))
|
print("D3: {}".format(changedDiscreteInputs))
|
||||||
self.shadowDiscreteInputs = self.discreteInputs
|
self.shadowDiscreteInputs = self.discreteInputs
|
||||||
print("D4: ".format(self.shadowDiscreteInputs))
|
print("D4: {}".format(self.shadowDiscreteInputs))
|
||||||
return changedDiscreteInputs
|
return changedDiscreteInputs
|
||||||
|
|
||||||
def getDiscreteInputs(self):
|
def getDiscreteInputs(self):
|
||||||
|
Reference in New Issue
Block a user