PLC工具
取自埔里噶哈巫語的豬
PLC工具
License: MIT License
PLC工具
取自埔里噶哈巫語的豬
線圈、16位元、32位元仝一个函式
內底自動update
AttributeError: 'ExceptionResponse' object has no attribute 'registers'
改用:https://github.com/rimek/fatek-fbs-lib
def __calculate_offset(self):
"""
# coils:
Y(0-255) : 0 - 255
X(0-255) : 1000 - 1255
M(0-2001): 2000 - 4001
S(0-999) : 6000 - 6999
T(0-255) : 9000 - 9255 (current_value=False)
C(0-255) : 9500 - 9755 (current_value=False)
# registers
R(0-4167) : 0 - 4167
R(5000-5998) : 5000 - 5998 (holding or ror)
D(0-2998) : 6000 - 8998
T(0-255) : 9000 - 9255 (current_value = True)
C(0-199) : 9500 - 9699 (16bit, current_value=True)
C(200-255) : 9700 - 9811 (32bit, current_value=True) double offset
"""
target = self.register
number = self.number
current_value = self.current_value
offset_dict = {
'Y': 0,
'X': 1000,
'M': 2000,
'S': 6000,
'T': 9000,
'R': 0,
'D': 6000,
'C': 9500
}
offset = offset_dict[target]
if target == 'C' and current_value == True and number >= 200:
number %= 200
offset = 9700 + 2*(number)
elif target == 'R' and number >= 5000:
number = 0
offset = 5000
return number + offset
def __verify_number(self):
number = self.number
target = self.register
allowed_numbers = {
'Y': (0,256),
'X': (0,256),
'M': (0,2002),
'S': (0,1000),
'T': (0,256),
'D': (0,2999),
'C': (0,256)
}
allowed_r_numbers = ((0, 4168), (5000, 5999))
if target != 'R':
result = number in xrange(*allowed_numbers[target])
else:
result = any([number in xrange(*numbers) for numbers in allowed_r_numbers])
外口較好 catch
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.