Skip to content

Commit

Permalink
版本0.0.4
Browse files Browse the repository at this point in the history
* 表內底囥 名:所在
  • Loading branch information
sih4sing5hong5 committed Mar 18, 2017
1 parent 5cc571c commit 2f4e819
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 61 deletions.
6 changes: 3 additions & 3 deletions bauzak/Modbus控制器.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def 讀一个(self, 所在):

def 讀線圈的資料(self, ):
位置名對應表 = {}
for , in .items():
for , in .items():
位置名對應表[Symbol(, current_value=False).offset] =

這段開始 = None
Expand Down Expand Up @@ -60,7 +60,7 @@ def _讀線圈一段資料(self, 位置名對應表, 上尾資料, 這段開始,

def 讀16位元的資料(self, ):
位置名對應表 = {}
for , in .items():
for , in .items():
位置名對應表[Symbol(, current_value=True).offset] =

這段開始 = None
Expand Down Expand Up @@ -95,7 +95,7 @@ def _讀16位元一段資料(self, 位置名對應表, 上尾資料, 這段開

def 讀32位元的資料(self, ):
位置名對應表 = {}
for , in .items():
for , in .items():
位置名對應表[Symbol(, current_value=True).offset] =

這段開始 = None
Expand Down
38 changes: 19 additions & 19 deletions saanu/test讀16位元.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ def test_無半个(self):

def test_一个(self):
= {
'R1036': 'A做了幾項',
'A做了幾項': 'R1036',
}
self.PLC控制.讀16位元的資料()
self.PLC控制.連線.read_holding_registers.assert_called_once_with(1036, 1)

def test_特殊counter(self):
= {
'C255': 'A做了幾項',
'A做了幾項': 'C255',
}
self.PLC控制.讀16位元的資料()
try:
Expand All @@ -40,46 +40,46 @@ def test_特殊counter(self):

def test_讀的表佇仝一段(self):
= {
'R1036': 'A做了幾項',
'R1038': 'B做了幾項',
'A做了幾項': 'R1036',
'B做了幾項': 'R1038',
}
self.PLC控制.讀16位元的資料()
self.PLC控制.連線.read_holding_registers.assert_called_once_with(1036, 3)

def test_仝段上遠(self):
= {
'R1000': 'A做了幾項',
'R1124': 'B做了幾項',
'A做了幾項': 'R1000',
'B做了幾項': 'R1124',
}
self.PLC控制.讀16位元的資料()
self.PLC控制.連線.read_holding_registers.assert_called_once_with(1000, 125)

def test_讀的表佇無仝一段(self):
= {
'R1000': 'A做了幾項',
'R1125': 'B做了幾項',
'A做了幾項': 'R1000',
'B做了幾項': 'R1125',
}
self.PLC控制.讀16位元的資料()
self.PLC控制.連線.read_holding_registers.assert_any_call(1000, 1)
self.PLC控制.連線.read_holding_registers.assert_any_call(1125, 1)

def test_無仝的暫存器嘛會使(self):
= {
'R1036': 'A做了幾項',
'R1136': 'AA做了幾項',
'D100': 'B做了幾項',
'D110': 'BB做了幾項',
'A做了幾項': 'R1036',
'AA做了幾項': 'R1136',
'B做了幾項': 'D100',
'BB做了幾項': 'D110',
}
self.PLC控制.讀16位元的資料()
self.PLC控制.連線.read_holding_registers.assert_any_call(1036, 101)
self.PLC控制.連線.read_holding_registers.assert_any_call(6100, 11)

def test_暫存器數字(self):
= {
'R1036': 'A做了幾項',
'R1038': 'AA做了幾項',
'D100': 'B做了幾項',
'D104': 'BB做了幾項',
'A做了幾項': 'R1036',
'AA做了幾項': 'R1038',
'B做了幾項': 'D100',
'BB做了幾項': 'D104',
}
答案 = {
'A做了幾項': 10,
Expand All @@ -98,9 +98,9 @@ def test_暫存器數字(self):

def test_連續暫存器(self):
= {
'R1036': 'A做了幾項',
'R1037': 'AA做了幾項',
'R1038': 'AAA做了幾項',
'A做了幾項': 'R1036',
'AA做了幾項': 'R1037',
'AAA做了幾項': 'R1038',
}
答案 = {
'A做了幾項': 1,
Expand Down
38 changes: 19 additions & 19 deletions saanu/test讀32位元.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ def test_無半个(self):

def test_一个(self):
= {
'R1036': 'A做了幾項',
'A做了幾項': 'R1036',
}
self.PLC控制.讀32位元的資料()
self.PLC控制.連線.read_holding_registers.assert_called_once_with(1036, 2)

def test_特殊counter(self):
= {
'C255': 'A做了幾項',
'A做了幾項': 'C255',
}
self.PLC控制.讀32位元的資料()
try:
Expand All @@ -40,46 +40,46 @@ def test_特殊counter(self):

def test_讀的表佇仝一段(self):
= {
'R1036': 'A做了幾項',
'R1038': 'B做了幾項',
'A做了幾項': 'R1036',
'B做了幾項': 'R1038',
}
self.PLC控制.讀32位元的資料()
self.PLC控制.連線.read_holding_registers.assert_called_once_with(1036, 4)

def test_仝段上遠(self):
= {
'R1000': 'A做了幾項',
'R1123': 'B做了幾項',
'A做了幾項': 'R1000',
'B做了幾項': 'R1123',
}
self.PLC控制.讀32位元的資料()
self.PLC控制.連線.read_holding_registers.assert_called_once_with(1000, 125)

def test_讀的表佇無仝一段(self):
= {
'R1000': 'A做了幾項',
'R1124': 'B做了幾項',
'A做了幾項': 'R1000',
'B做了幾項': 'R1124',
}
self.PLC控制.讀32位元的資料()
self.PLC控制.連線.read_holding_registers.assert_any_call(1000, 2)
self.PLC控制.連線.read_holding_registers.assert_any_call(1124, 2)

def test_無仝的暫存器嘛會使(self):
= {
'R1036': 'A做了幾項',
'R1136': 'AA做了幾項',
'D100': 'B做了幾項',
'D110': 'BB做了幾項',
'A做了幾項': 'R1036',
'AA做了幾項': 'R1136',
'B做了幾項': 'D100',
'BB做了幾項': 'D110',
}
self.PLC控制.讀32位元的資料()
self.PLC控制.連線.read_holding_registers.assert_any_call(1036, 102)
self.PLC控制.連線.read_holding_registers.assert_any_call(6100, 12)

def test_暫存器數字(self):
= {
'R1036': 'A做了幾項',
'R1038': 'AA做了幾項',
'D100': 'B做了幾項',
'D104': 'BB做了幾項',
'A做了幾項': 'R1036',
'AA做了幾項': 'R1038',
'B做了幾項': 'D100',
'BB做了幾項': 'D104',
}
答案 = {
'A做了幾項': 10,
Expand All @@ -98,9 +98,9 @@ def test_暫存器數字(self):

def test_連續暫存器(self):
= {
'R1036': 'A做了幾項',
'R1037': 'AA做了幾項',
'R1038': 'AAA做了幾項',
'A做了幾項': 'R1036',
'AA做了幾項': 'R1037',
'AAA做了幾項': 'R1038',
}
答案 = {
'A做了幾項': 65536 * 2 + 1,
Expand Down
38 changes: 19 additions & 19 deletions saanu/test讀線圈.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ def test_無半个(self):

def test_一个(self):
= {
'M1036': 'A做了幾項',
'A做了幾項': 'M1036',
}
self.PLC控制.讀線圈的資料()
self.PLC控制.連線.read_coils.assert_called_once_with(3036, 1)

def test_特殊counter(self):
= {
'C255': 'A做了幾項',
'A做了幾項': 'C255',
}
self.PLC控制.讀線圈的資料()
self.PLC控制.連線.read_coils.assert_called_once_with(
Expand All @@ -35,46 +35,46 @@ def test_特殊counter(self):

def test_讀的表佇仝一段(self):
= {
'S36': 'A做了幾項',
'S38': 'B做了幾項',
'A做了幾項': 'S36',
'B做了幾項': 'S38',
}
self.PLC控制.讀線圈的資料()
self.PLC控制.連線.read_coils.assert_called_once_with(6036, 3)

def test_仝段上遠(self):
= {
'M0': 'A做了幾項',
'M1999': 'B做了幾項',
'A做了幾項': 'M0',
'B做了幾項': 'M1999',
}
self.PLC控制.讀線圈的資料()
self.PLC控制.連線.read_coils.assert_called_once_with(2000, 2000)

def test_讀的表佇無仝一段(self):
= {
'M0': 'A做了幾項',
'M2000': 'B做了幾項',
'A做了幾項': 'M0',
'B做了幾項': 'M2000',
}
self.PLC控制.讀線圈的資料()
self.PLC控制.連線.read_coils.assert_any_call(2000, 1)
self.PLC控制.連線.read_coils.assert_any_call(4000, 1)

def test_無仝的暫存器嘛會使(self):
= {
'Y36': 'A做了幾項',
'Y136': 'AA做了幾項',
'T100': 'B做了幾項',
'T110': 'BB做了幾項',
'A做了幾項': 'Y36',
'AA做了幾項': 'Y136',
'B做了幾項': 'T100',
'BB做了幾項': 'T110',
}
self.PLC控制.讀線圈的資料()
self.PLC控制.連線.read_coils.assert_any_call(36, 101)
self.PLC控制.連線.read_coils.assert_any_call(9100, 11)

def test_暫存器數字(self):
= {
'Y100': '0做了幾項',
'Y104': '00做了幾項',
'C36': 'A做了幾項',
'C39': 'AA做了幾項',
'0做了幾項': 'Y100',
'00做了幾項': 'Y104',
'A做了幾項': 'C36',
'AA做了幾項': 'C39',
}
答案 = {
'0做了幾項': True,
Expand All @@ -93,9 +93,9 @@ def test_暫存器數字(self):

def test_連續暫存器(self):
= {
'X36': 'A做了幾項',
'X37': 'AA做了幾項',
'X38': 'AAA做了幾項',
'A做了幾項': 'X36',
'AA做了幾項': 'X37',
'AAA做了幾項': 'X38',
}
答案 = {
'A做了幾項': True,
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
setup(
name='Bauzak',
packages=['bauzak'],
version='0.0.3',
version='0.1.0',
description='PLC工具',
long_description='PLC工具',
author='薛丞宏',
Expand Down

0 comments on commit 2f4e819

Please sign in to comment.