@@ -1799,9 +1799,9 @@ def test_get_json(self):
1799
1799
m .groups ['Crv' ][0 ].points ['DeptRef' ].sf_value = 3
1800
1800
m .groups ['Crv' ][0 ].points ['Pri' ].sf_required = True
1801
1801
m .groups ['Crv' ][0 ].points ['Pri' ].sf_value = 3
1802
- assert m .groups ['Crv' ][0 ].get_json (computed = True ) == '''{"ActPt": 4, "DeptRef": 1000.0,''' + \
1803
- ''' "Pri ": 1000.0 , "VRef ": 1 , "VRefAuto ": 0 , "VRefAutoEna ": null, "VRefAutoTms ": null ,''' + \
1804
- ''' "RspTms": 6, " ReadOnly": 1, "Pt": [{"V": 92.0, "Var": 30.0}, {"V": 96.7, "Var": 0.0},''' + \
1802
+ assert m .groups ['Crv' ][0 ].get_json (computed = True ) == '''{"ActPt": 4, "DeptRef": 1000.0, "Pri": 1000.0, ''' + \
1803
+ ''' "VRef ": 0.01 , "VRefAuto ": 0.0 , "VRefAutoEna ": null , "VRefAutoTms ": null, "RspTms ": 6 ,''' + \
1804
+ ''' "ReadOnly": 1, "Pt": [{"V": 92.0, "Var": 30.0}, {"V": 96.7, "Var": 0.0},''' + \
1805
1805
''' {"V": 103.0, "Var": 0.0}, {"V": 107.0, "Var": -30.0}]}'''
1806
1806
1807
1807
def test_set_json (self ):
@@ -2042,9 +2042,9 @@ def test_get_mb(self):
2042
2042
m .groups ['Crv' ][0 ].points ['DeptRef' ].sf_value = 3
2043
2043
m .groups ['Crv' ][0 ].points ['Pri' ].sf_required = True
2044
2044
m .groups ['Crv' ][0 ].points ['Pri' ].sf_value = 3
2045
- assert m .groups ['Crv' ][0 ].get_mb (computed = True ) == b'\x00 \x04 \x03 \xe8 \x03 \xe8 \x00 \x01 \x00 \x00 \xff \xff \xff ' \
2046
- b'\xff \x00 \x00 \x00 \x06 \x00 \x01 \x00 \\ \x00 \x1e \x00 `\x00 \x00 ' \
2047
- b'\x00 g\x00 \x00 \x00 k\xff \xe2 '
2045
+ assert m .groups ['Crv' ][0 ].get_mb (computed = True ) == b'\x00 \x04 \x03 \xe8 \x03 \xe8 \x00 \x00 \x00 \x00 \xff \xff \xff ' \
2046
+ b'\xff \x00 \x00 \x00 \x06 \x00 \x01 \x00 \\ \x00 \x1e \x00 `\x00 ' \
2047
+ b'\x00 \ x00 g\x00 \x00 \x00 k\xff \xe2 '
2048
2048
2049
2049
def test_set_mb (self ):
2050
2050
gdata_705 = {
@@ -2299,6 +2299,21 @@ def test__init__(self):
2299
2299
assert m2 .mid is None
2300
2300
assert m2 .device is None
2301
2301
2302
+ def test_model_1 (self ):
2303
+
2304
+ mdata = {
2305
+ "ID" : 1 ,
2306
+ "L" : 68 ,
2307
+ "Mn" : "Test manuf" ,
2308
+ "Md" : "Test model" ,
2309
+ "Opt" : "Test options" ,
2310
+ "Vr" : "Test version" ,
2311
+ "SN" : "Test serial num" ,
2312
+ "DA" : 12 ,
2313
+ "Pad" : 0
2314
+ }
2315
+ m = device .Model (1 , data = mdata )
2316
+
2302
2317
def test__error (self ):
2303
2318
m = device .Model (704 )
2304
2319
m .add_error ('test error' )
@@ -2467,16 +2482,16 @@ def test_get_dict(self):
2467
2482
assert d .get_dict (computed = True ) == {'name' : None , 'did' : None , 'models' : [
2468
2483
{'ID' : 705 , 'L' : 67 , 'Ena' : 1 , 'AdptCrvReq' : 0 , 'AdptCrvRslt' : 0 , 'NPt' : 4 , 'NCrv' : 3 , 'RvrtTms' : 0 ,
2469
2484
'RvrtRem' : 0 , 'RvrtCrv' : 0 , 'V_SF' : - 2 , 'DeptRef_SF' : - 2 , 'RspTms_SF' : None , 'Crv' : [
2470
- {'ActPt' : 4 , 'DeptRef' : 1000.0 , 'Pri' : 1000.0 , 'VRef' : 1 , 'VRefAuto' : 0 , 'VRefAutoEna' : None ,
2485
+ {'ActPt' : 4 , 'DeptRef' : 1000.0 , 'Pri' : 1000.0 , 'VRef' : 0.01 , 'VRefAuto' : 0. 0 , 'VRefAutoEna' : None ,
2471
2486
'VRefAutoTms' : None , 'RspTms' : 6 , 'ReadOnly' : 1 ,
2472
2487
'Pt' : [{'V' : 92.0 , 'Var' : 30.0 }, {'V' : 96.7 , 'Var' : 0.0 }, {'V' : 103.0 , 'Var' : 0.0 },
2473
2488
{'V' : 107.0 , 'Var' : - 30.0 }]},
2474
- {'ActPt' : 4 , 'DeptRef' : 1 , 'Pri' : 1 , 'VRef' : 1 , 'VRefAuto' : 0 , 'VRefAutoEna' : None , 'VRefAutoTms ' : None ,
2475
- 'RspTms' : 6 , 'ReadOnly' : 0 ,
2489
+ {'ActPt' : 4 , 'DeptRef' : 1 , 'Pri' : 1 , 'VRef' : 0.01 , 'VRefAuto' : 0.0 , 'VRefAutoEna' : None ,
2490
+ 'VRefAutoTms' : None , ' RspTms' : 6 , 'ReadOnly' : 0 ,
2476
2491
'Pt' : [{'V' : 93.0 , 'Var' : 30.0 }, {'V' : 95.7 , 'Var' : 0.0 }, {'V' : 102.0 , 'Var' : 0.0 },
2477
2492
{'V' : 106.0 , 'Var' : - 40.0 }]},
2478
- {'ActPt' : 4 , 'DeptRef' : 1 , 'Pri' : 1 , 'VRef' : 1 , 'VRefAuto' : 0 , 'VRefAutoEna' : None , 'VRefAutoTms ' : None ,
2479
- 'RspTms' : 6 , 'ReadOnly' : 0 ,
2493
+ {'ActPt' : 4 , 'DeptRef' : 1 , 'Pri' : 1 , 'VRef' : 0.01 , 'VRefAuto' : 0.0 , 'VRefAutoEna' : None ,
2494
+ 'VRefAutoTms' : None , ' RspTms' : 6 , 'ReadOnly' : 0 ,
2480
2495
'Pt' : [{'V' : 94.0 , 'Var' : 20.0 }, {'V' : 95.7 , 'Var' : 0.0 }, {'V' : 105.0 , 'Var' : 0.0 },
2481
2496
{'V' : 108.0 , 'Var' : - 20.0 }]}], 'mid' : None , 'error' : '' , 'model_id' : 705 }]}
2482
2497
@@ -2603,17 +2618,18 @@ def test_get_json(self):
2603
2618
m .groups ['Crv' ][0 ].points ['DeptRef' ].sf_value = 3
2604
2619
m .groups ['Crv' ][0 ].points ['Pri' ].sf_required = True
2605
2620
m .groups ['Crv' ][0 ].points ['Pri' ].sf_value = 3
2606
- assert d .get_json (computed = True ) == '''{"name": null, "did": null, "models": [{"ID": 705,''' + \
2607
- ''' "L": 67, "Ena": 1, "AdptCrvReq": 0, "AdptCrvRslt": 0, "NPt": 4, "NCrv": 3, "RvrtTms": 0,''' + \
2608
- ''' "RvrtRem": 0, "RvrtCrv": 0, "V_SF": -2, "DeptRef_SF": -2, "RspTms_SF": null, ''' + \
2609
- '''"Crv": [{"ActPt": 4, "DeptRef": 1000.0, "Pri": 1000.0, "VRef": 1, "VRefAuto": 0, ''' + \
2610
- '''"VRefAutoEna": null, "VRefAutoTms": null, "RspTms": 6, "ReadOnly": 1, ''' + \
2611
- '''"Pt": [{"V": 92.0, "Var": 30.0}, {"V": 96.7, "Var": 0.0}, {"V": 103.0, "Var": 0.0},''' + \
2612
- ''' {"V": 107.0, "Var": -30.0}]}, {"ActPt": 4, "DeptRef": 1, "Pri": 1, "VRef": 1,''' + \
2613
- ''' "VRefAuto": 0, "VRefAutoEna": null, "VRefAutoTms": null, "RspTms": 6, "ReadOnly": 0,''' + \
2614
- ''' "Pt": [{"V": 93.0, "Var": 30.0}, {"V": 95.7, "Var": 0.0}, {"V": 102.0, "Var": 0.0},''' + \
2615
- ''' {"V": 106.0, "Var": -40.0}]}, {"ActPt": 4, "DeptRef": 1, "Pri": 1, "VRef": 1, "VRefAuto": 0,''' + \
2621
+ assert d .get_json (computed = True ) == '''{"name": null, "did": null, "models":''' + \
2622
+ ''' [{"ID": 705, "L": 67, "Ena": 1, "AdptCrvReq": 0, "AdptCrvRslt": 0,''' + \
2623
+ ''' "NPt": 4, "NCrv": 3, "RvrtTms": 0, "RvrtRem": 0, "RvrtCrv": 0, "V_SF": -2,''' + \
2624
+ ''' "DeptRef_SF": -2, "RspTms_SF": null, "Crv": [{"ActPt": 4, "DeptRef": 1000.0,''' + \
2625
+ ''' "Pri": 1000.0, "VRef": 0.01, "VRefAuto": 0.0, "VRefAutoEna": null,''' + \
2626
+ ''' "VRefAutoTms": null, "RspTms": 6, "ReadOnly": 1, "Pt": [{"V": 92.0, "Var": 30.0},''' + \
2627
+ ''' {"V": 96.7, "Var": 0.0}, {"V": 103.0, "Var": 0.0}, {"V": 107.0, "Var": -30.0}]},''' + \
2628
+ ''' {"ActPt": 4, "DeptRef": 1, "Pri": 1, "VRef": 0.01, "VRefAuto": 0.0,''' + \
2616
2629
''' "VRefAutoEna": null, "VRefAutoTms": null, "RspTms": 6, "ReadOnly": 0,''' + \
2630
+ ''' "Pt": [{"V": 93.0, "Var": 30.0}, {"V": 95.7, "Var": 0.0}, {"V": 102.0, "Var": 0.0},''' + \
2631
+ ''' {"V": 106.0, "Var": -40.0}]}, {"ActPt": 4, "DeptRef": 1, "Pri": 1, "VRef": 0.01,''' + \
2632
+ ''' "VRefAuto": 0.0, "VRefAutoEna": null, "VRefAutoTms": null, "RspTms": 6, "ReadOnly": 0,''' + \
2617
2633
''' "Pt": [{"V": 94.0, "Var": 20.0}, {"V": 95.7, "Var": 0.0}, {"V": 105.0, "Var": 0.0},''' + \
2618
2634
''' {"V": 108.0, "Var": -20.0}]}], "mid": null, "error": "", "model_id": 705}]}'''
2619
2635
@@ -2733,14 +2749,15 @@ def test_get_mb(self):
2733
2749
m .groups ['Crv' ][0 ].points ['DeptRef' ].sf_value = 3
2734
2750
m .groups ['Crv' ][0 ].points ['Pri' ].sf_required = True
2735
2751
m .groups ['Crv' ][0 ].points ['Pri' ].sf_value = 3
2736
- assert d .get_mb (computed = True ) == b'\x02 \xc1 \x00 C\x00 \x01 \x00 \x00 \x00 \x00 \x00 \x04 \x00 \x03 \x00 \x00 \x00 ' \
2737
- b'\x00 \x00 \x00 \x00 \x00 \x00 \x00 \xff \xfe \xff \xfe \x80 \x00 \x00 \x04 \x03 ' \
2738
- b'\xe8 \x03 \xe8 \x00 \x01 \x00 \x00 \xff \xff \xff \xff \x00 \x00 \x00 \x06 \x00 ' \
2739
- b'\x01 \x00 \\ \x00 \x1e \x00 `\x00 \x00 \x00 g\x00 \x00 \x00 k\x00 \x1e \x00 \x04 ' \
2740
- b'\x00 \x01 \x00 \x01 \x00 \x01 \x00 \x00 \xff \xff \xff \xff \x00 \x00 \x00 \x06 ' \
2741
- b'\x00 \x00 \x00 ]\x00 \x1e \x00 _\x00 \x00 \x00 f\x00 \x00 \x00 j\x00 (\x00 \x04 ' \
2742
- b'\x00 \x01 \x00 \x01 \x00 \x01 \x00 \x00 \xff \xff \xff \xff \x00 \x00 \x00 \x06 ' \
2743
- b'\x00 \x00 \x00 ^\x00 \x14 \x00 _\x00 \x00 \x00 i\x00 \x00 \x00 l\x00 \x14 '
2752
+ assert d .get_mb (computed = True ) == b'\x02 \xc1 \x00 C\x00 \x01 \x00 \x00 \x00 \x00 \x00 \x04 \x00 \x03 \x00 \x00 \x00 \x00 \x00 ' \
2753
+ b'\x00 \x00 \x00 \x00 \x00 \xff \xfe \xff \xfe \x80 \x00 \x00 \x04 \x03 \xe8 \x03 \xe8 \x00 ' \
2754
+ b'\x00 \x00 \x00 \xff \xff \xff \xff \x00 \x00 \x00 \x06 \x00 \x01 \x00 \\ \x00 \x1e \x00 `' \
2755
+ b'\x00 \x00 \x00 g\x00 \x00 \x00 k\x00 \x1e \x00 \x04 \x00 \x01 \x00 \x01 \x00 \x00 \x00 ' \
2756
+ b'\x00 \xff \xff \xff \xff \x00 \x00 \x00 \x06 \x00 \x00 \x00 ]\x00 \x1e \x00 _\x00 \x00 ' \
2757
+ b'\x00 f\x00 \x00 \x00 j\x00 (\x00 \x04 \x00 \x01 \x00 \x01 \x00 \x00 \x00 \x00 \xff \xff ' \
2758
+ b'\xff \xff \x00 \x00 \x00 \x06 \x00 \x00 \x00 ^\x00 \x14 \x00 _\x00 \x00 \x00 i\x00 \x00 ' \
2759
+ b'\x00 l\x00 \x14 '
2760
+
2744
2761
2745
2762
def test_set_mb (self ):
2746
2763
d = device .Device ()
0 commit comments