pvblocks 0.1.0__py3-none-any.whl → 0.1.2__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of pvblocks might be problematic. Click here for more details.
- pvblocks/__init__.py +2 -2
- pvblocks/constants.py +40 -39
- pvblocks/pvblocks_system.py +19 -55
- {pvblocks-0.1.0.dist-info → pvblocks-0.1.2.dist-info}/METADATA +1 -1
- pvblocks-0.1.2.dist-info/RECORD +10 -0
- {pvblocks-0.1.0.dist-info → pvblocks-0.1.2.dist-info}/WHEEL +1 -1
- pvblocks-0.1.0.dist-info/RECORD +0 -10
- {pvblocks-0.1.0.dist-info → pvblocks-0.1.2.dist-info}/licenses/LICENSE +0 -0
- {pvblocks-0.1.0.dist-info → pvblocks-0.1.2.dist-info}/top_level.txt +0 -0
pvblocks/__init__.py
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
VERSION = '0.
|
|
2
|
-
__version__ = VERSION
|
|
1
|
+
VERSION = '0.1.2'
|
|
2
|
+
__version__ = VERSION
|
pvblocks/constants.py
CHANGED
|
@@ -1,42 +1,43 @@
|
|
|
1
|
-
|
|
1
|
+
IDLE_COMMAND = 0
|
|
2
|
+
BLINK_COMMAND = 1
|
|
3
|
+
VOLTAGE_COMMAND = 2
|
|
4
|
+
MPP_COMMAND = 3
|
|
5
|
+
READ_COMMAND = 4
|
|
6
|
+
CURVE_COMMAND = 5
|
|
7
|
+
TRANSFER_CURVE_COMMAND = 6
|
|
8
|
+
EXTERNAL_MPP_COMMAND = 7
|
|
9
|
+
TRIGGERED_CURVE_COMMAND = 8
|
|
10
|
+
GET_STATUS = 13
|
|
11
|
+
WRITE_EEPROM_COMMAND = 14
|
|
12
|
+
SET_TRIGGER_COMMAND = 15
|
|
13
|
+
READ_EEPROM_COMMAND = 16
|
|
14
|
+
UPDATE_CONFIG_COMMAND = 17
|
|
15
|
+
GET_CONFIG_COMMAND = 18
|
|
16
|
+
START_FIRMWARE_UPDATE = 19
|
|
17
|
+
ENABLE_FAST_COMMUNICATIONS = 20
|
|
18
|
+
DISABLE_BROADCAST = 21
|
|
19
|
+
TRIGGERED_READ_COMMAND = 50
|
|
20
|
+
ALIVE = 100
|
|
21
|
+
LIST_MODULES = 101
|
|
22
|
+
OPEN_MODULE = 106
|
|
23
|
+
CLOSE_MODULE = 107
|
|
24
|
+
RESET_MODULE = 108
|
|
25
|
+
RESET_CONTROLLER = 109
|
|
26
|
+
TRIGGER_ALL = 110
|
|
27
|
+
BROADCAST_THRESHOLD_EXCEEDED = 111
|
|
28
|
+
CURVE_RUNNING = 250
|
|
2
29
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
VoltageCommand = 2,
|
|
7
|
-
MppCommand = 3,
|
|
8
|
-
ReadCommand = 4,
|
|
9
|
-
CurveCommand = 5,
|
|
10
|
-
TransferCurveCommand = 6,
|
|
11
|
-
ExternalMppCommand = 7,
|
|
12
|
-
TriggeredCurveCommand = 8,
|
|
13
|
-
GetStatus = 13,
|
|
14
|
-
WriteEepromCommand = 14,
|
|
15
|
-
SetTriggerCommand = 15,
|
|
16
|
-
ReadEepromCommand = 16,
|
|
17
|
-
UpdateConfigCommand = 17,
|
|
18
|
-
GetConfigCommand = 18,
|
|
19
|
-
StartFirmwareUpdate = 19,
|
|
20
|
-
EnableFastCommunications = 20,
|
|
21
|
-
DisableBroadcast = 21,
|
|
22
|
-
TriggeredReadCommand = 50,
|
|
23
|
-
Alive = 100,
|
|
24
|
-
ListModules = 101,
|
|
25
|
-
OpenModule = 106,
|
|
26
|
-
CloseModule = 107,
|
|
27
|
-
ResetModule = 108,
|
|
28
|
-
ResetController = 109,
|
|
29
|
-
TriggerAll = 110,
|
|
30
|
-
BroadcastThresholdExceeded = 111,
|
|
31
|
-
CurveRunning = 250
|
|
30
|
+
IVMPP_READ_IVPOINT = 20
|
|
31
|
+
IVMPP_APPLY_STATE = 21
|
|
32
|
+
PV_IRR_READ_IRRADIANCES = 30
|
|
32
33
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
VOC = 0
|
|
35
|
+
ISC = 1
|
|
36
|
+
MPP = 2
|
|
37
|
+
VOLTAGE_BIAS = 3
|
|
37
38
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
39
|
+
ISC_TO_VOC = 0,
|
|
40
|
+
SWEEP_VOC_TO_ISC = 1
|
|
41
|
+
EXTENT_CURVE_DELAY = 2
|
|
42
|
+
SWEEP_VOC_ISC_VOC = 4
|
|
43
|
+
SWEEP_ISC_VOC_ISC = 8
|
pvblocks/pvblocks_system.py
CHANGED
|
@@ -41,12 +41,12 @@ class PvBlocks(object):
|
|
|
41
41
|
self.PvIrrBlocks = []
|
|
42
42
|
|
|
43
43
|
def init_system(self):
|
|
44
|
-
self.uart.write(serial.to_bytes([1, constants.
|
|
44
|
+
self.uart.write(serial.to_bytes([1, constants.ALIVE]))
|
|
45
45
|
sleep(0.5)
|
|
46
46
|
bts = ReadSerial(self.uart)
|
|
47
47
|
if len(bts) != 2:
|
|
48
48
|
raise exceptions.NoResponseException()
|
|
49
|
-
return bts[0] == 3 and bts[1] == constants.
|
|
49
|
+
return bts[0] == 3 and bts[1] == constants.ALIVE
|
|
50
50
|
|
|
51
51
|
|
|
52
52
|
def close_system(self):
|
|
@@ -54,11 +54,11 @@ class PvBlocks(object):
|
|
|
54
54
|
|
|
55
55
|
|
|
56
56
|
def scan_blocks(self):
|
|
57
|
-
self.uart.write(serial.to_bytes([1, constants.
|
|
57
|
+
self.uart.write(serial.to_bytes([1, constants.LIST_MODULES]))
|
|
58
58
|
sleep(2)
|
|
59
59
|
bts = ReadSerial(self.uart)
|
|
60
60
|
|
|
61
|
-
if (bts[0] != 3) or (bts[1] != constants.
|
|
61
|
+
if (bts[0] != 3) or (bts[1] != constants.LIST_MODULES):
|
|
62
62
|
raise exceptions.UnexpectedResponseException()
|
|
63
63
|
|
|
64
64
|
module_count = bts[3]
|
|
@@ -84,37 +84,10 @@ class PvBlocks(object):
|
|
|
84
84
|
if not self.uart.is_open:
|
|
85
85
|
self.uart.open()
|
|
86
86
|
|
|
87
|
-
self.uart.write(serial.to_bytes([1, constants.
|
|
87
|
+
self.uart.write(serial.to_bytes([1, constants.RESET_CONTROLLER]))
|
|
88
88
|
sleep(3)
|
|
89
89
|
|
|
90
90
|
|
|
91
|
-
def read_irradiances(self, pvblock):
|
|
92
|
-
if self.open_block(pvblock):
|
|
93
|
-
self.uart.write(serial.to_bytes([2, constants.Rr1700Command.ReadCommand]))
|
|
94
|
-
sleep(0.5)
|
|
95
|
-
bts = ReadSerial(self.uart)
|
|
96
|
-
if len(bts) < 10:
|
|
97
|
-
raise exceptions.UnexpectedResponseException()
|
|
98
|
-
|
|
99
|
-
r1 = int.from_bytes(bts[3:7], "little") / 1000.0
|
|
100
|
-
r2 = int.from_bytes(bts[7:11], "little") / 1000.0
|
|
101
|
-
if bts[2] == 16:
|
|
102
|
-
r3 = int.from_bytes(bts[11:15], "little") / 1000.0
|
|
103
|
-
r4 = int.from_bytes(bts[15:19], "little") / 1000.0
|
|
104
|
-
return r1, r2, r3, r4
|
|
105
|
-
else:
|
|
106
|
-
return r1, r2
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
else:
|
|
110
|
-
raise exceptions.CannotOpenBlockException()
|
|
111
|
-
|
|
112
|
-
return (0, 0, 0, 0)
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
91
|
class PvBlock(object):
|
|
119
92
|
def __init__(self, bytes, uart):
|
|
120
93
|
self.bytes = bytes[0:8]
|
|
@@ -125,7 +98,7 @@ class PvBlock(object):
|
|
|
125
98
|
|
|
126
99
|
def open(self):
|
|
127
100
|
self.uart.write(serial.to_bytes([1,
|
|
128
|
-
constants.
|
|
101
|
+
constants.OPEN_MODULE,
|
|
129
102
|
0,
|
|
130
103
|
self.bytes[0],
|
|
131
104
|
self.bytes[1],
|
|
@@ -142,7 +115,7 @@ class PvBlock(object):
|
|
|
142
115
|
|
|
143
116
|
def close(self):
|
|
144
117
|
self.uart.write(serial.to_bytes([1,
|
|
145
|
-
constants.
|
|
118
|
+
constants.CLOSE_MODULE,
|
|
146
119
|
self.bytes[0],
|
|
147
120
|
self.bytes[1],
|
|
148
121
|
self.bytes[2],
|
|
@@ -159,7 +132,7 @@ class PvBlock(object):
|
|
|
159
132
|
|
|
160
133
|
def read_statusbyte(self):
|
|
161
134
|
self.open()
|
|
162
|
-
self.uart.write(serial.to_bytes([2, constants.
|
|
135
|
+
self.uart.write(serial.to_bytes([2, constants.GET_STATUS]))
|
|
163
136
|
sleep(0.5)
|
|
164
137
|
bts = ReadSerial(self.uart)
|
|
165
138
|
self.close()
|
|
@@ -177,7 +150,7 @@ class IvMpp(PvBlock):
|
|
|
177
150
|
def read_ivpoint(self):
|
|
178
151
|
|
|
179
152
|
self.open()
|
|
180
|
-
self.uart.write(serial.to_bytes([2, constants.
|
|
153
|
+
self.uart.write(serial.to_bytes([2, constants.READ_COMMAND]))
|
|
181
154
|
sleep(0.5)
|
|
182
155
|
bts = ReadSerial(self.uart)
|
|
183
156
|
self.close()
|
|
@@ -195,14 +168,14 @@ class IvMpp(PvBlock):
|
|
|
195
168
|
|
|
196
169
|
def ApplyVoc(self):
|
|
197
170
|
self.open()
|
|
198
|
-
self.uart.write(serial.to_bytes([2, constants.
|
|
171
|
+
self.uart.write(serial.to_bytes([2, constants.IDLE_COMMAND]))
|
|
199
172
|
sleep(0.5)
|
|
200
173
|
self.close()
|
|
201
174
|
|
|
202
175
|
|
|
203
176
|
def ApplyMpp(self):
|
|
204
177
|
self.open()
|
|
205
|
-
self.uart.write(serial.to_bytes([2, constants.
|
|
178
|
+
self.uart.write(serial.to_bytes([2, constants.MPP_COMMAND]))
|
|
206
179
|
sleep(0.5)
|
|
207
180
|
self.close()
|
|
208
181
|
|
|
@@ -210,7 +183,7 @@ class IvMpp(PvBlock):
|
|
|
210
183
|
voltage = 0.0;
|
|
211
184
|
self.open()
|
|
212
185
|
bytes = list(((int)(1000 * voltage)).to_bytes(4, "little"))
|
|
213
|
-
self.uart.write(serial.to_bytes([2, constants.
|
|
186
|
+
self.uart.write(serial.to_bytes([2, constants.VOLTAGE_COMMAND, bytes[0], bytes[1], bytes[2], bytes[3]]))
|
|
214
187
|
sleep(0.5)
|
|
215
188
|
self.close()
|
|
216
189
|
|
|
@@ -218,7 +191,7 @@ class IvMpp(PvBlock):
|
|
|
218
191
|
self.open()
|
|
219
192
|
bytes = list(((int)(1000 * voltage)).to_bytes(4, "little"))
|
|
220
193
|
self.uart.write(
|
|
221
|
-
serial.to_bytes([2, constants.
|
|
194
|
+
serial.to_bytes([2, constants.VOLTAGE_COMMAND, bytes[0], bytes[1], bytes[2], bytes[3]]))
|
|
222
195
|
sleep(0.5)
|
|
223
196
|
self.close()
|
|
224
197
|
|
|
@@ -226,12 +199,12 @@ class IvMpp(PvBlock):
|
|
|
226
199
|
self.open()
|
|
227
200
|
|
|
228
201
|
self.uart.write(
|
|
229
|
-
serial.to_bytes([2, constants.
|
|
202
|
+
serial.to_bytes([2, constants.SET_TRIGGER_COMMAND, 0]))
|
|
230
203
|
|
|
231
204
|
sleep(0.5)
|
|
232
205
|
|
|
233
206
|
self.uart.write(
|
|
234
|
-
serial.to_bytes([2, constants.
|
|
207
|
+
serial.to_bytes([2, constants.CURVE_COMMAND, points, delay_ms, 0, 0, 0, 0, sweepstyle]))
|
|
235
208
|
|
|
236
209
|
while self.uart.inWaiting() != 3:
|
|
237
210
|
sleep(0.01)
|
|
@@ -244,7 +217,6 @@ class IvMpp(PvBlock):
|
|
|
244
217
|
status = self.read_statusbyte()
|
|
245
218
|
|
|
246
219
|
self.close()
|
|
247
|
-
|
|
248
220
|
points_measured = status.statusbytes[0]
|
|
249
221
|
curve = self.transfer_curve(points_measured)
|
|
250
222
|
|
|
@@ -252,7 +224,7 @@ class IvMpp(PvBlock):
|
|
|
252
224
|
|
|
253
225
|
def transfer_curve(self, points):
|
|
254
226
|
self.open()
|
|
255
|
-
self.uart.write(serial.to_bytes([2, constants.
|
|
227
|
+
self.uart.write(serial.to_bytes([2, constants.TRANSFER_CURVE_COMMAND]))
|
|
256
228
|
sleep(0.5)
|
|
257
229
|
availablebytes = 8 + (points * 8) + 1
|
|
258
230
|
toread = self.uart.inWaiting()
|
|
@@ -266,8 +238,7 @@ class IvMpp(PvBlock):
|
|
|
266
238
|
voltages = []
|
|
267
239
|
currents = []
|
|
268
240
|
|
|
269
|
-
|
|
270
|
-
for i in range(int((availablebytes - 1)/8)):
|
|
241
|
+
for i in range(1, int((availablebytes - 1)/8)):
|
|
271
242
|
index = (i * 8) + 1
|
|
272
243
|
voltages.append(int.from_bytes(bts[index:(index+4)], "little") / 10000.0)
|
|
273
244
|
index = index + 4
|
|
@@ -289,7 +260,7 @@ class IvMpp(PvBlock):
|
|
|
289
260
|
bts = list(address.to_bytes(2, 'little'))
|
|
290
261
|
self.open()
|
|
291
262
|
self.uart.write(
|
|
292
|
-
serial.to_bytes([2, constants.
|
|
263
|
+
serial.to_bytes([2, constants.READ_EEPROM_COMMAND, length, bts[0], bts[1]]))
|
|
293
264
|
|
|
294
265
|
while self.uart.inWaiting() != length + 3:
|
|
295
266
|
sleep(0.01)
|
|
@@ -303,7 +274,7 @@ class PvIrr(PvBlock):
|
|
|
303
274
|
|
|
304
275
|
def ReadIrradiances(self):
|
|
305
276
|
self.open()
|
|
306
|
-
self.uart.write(serial.to_bytes([2, constants.
|
|
277
|
+
self.uart.write(serial.to_bytes([2, constants.READ_COMMAND]))
|
|
307
278
|
sleep(0.5)
|
|
308
279
|
bts = ReadSerial(self.uart)
|
|
309
280
|
if len(bts) < 10:
|
|
@@ -343,10 +314,3 @@ class IvPoint(object):
|
|
|
343
314
|
def __str__(self):
|
|
344
315
|
return "(%f, %f)" % (self.voltage, self.current)
|
|
345
316
|
|
|
346
|
-
|
|
347
|
-
class SweepStyle(IntEnum):
|
|
348
|
-
ISC_TO_VOC = 0,
|
|
349
|
-
SWEEP_VOC_TO_ISC = 1,
|
|
350
|
-
EXTENT_CURVE_DELAY = 2,
|
|
351
|
-
SWEEP_VOC_ISC_VOC = 4,
|
|
352
|
-
SWEEP_ISC_VOC_ISC = 8
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
pvblocks/__init__.py,sha256=YtH44tlJ8Htst82J4tX1NygWj2MPa2pwXBzp6X-40Ow,42
|
|
2
|
+
pvblocks/__main__.py,sha256=fhvwtf6NzUeUsjP_ARtvxcmYjAvfwqz9_K1bHFwEjUg,84
|
|
3
|
+
pvblocks/constants.py,sha256=MzQ_7Kgmks8F7KqRwEsGIdkFzP5pubjJzfxgbtwFvGk,889
|
|
4
|
+
pvblocks/exceptions.py,sha256=we35JF-svaCDAFYqKFlDCp7ZwbCU0FQe7nksKpUfPnQ,850
|
|
5
|
+
pvblocks/pvblocks_system.py,sha256=bcztbqg8SMSpRbXJu1wQl-s8qIlZWTUktJmcuoZp0n4,9997
|
|
6
|
+
pvblocks-0.1.2.dist-info/licenses/LICENSE,sha256=8xnw0w04bL1ekO1BTZPbMkUbonvCNWVu6G6k4QIFRns,1091
|
|
7
|
+
pvblocks-0.1.2.dist-info/METADATA,sha256=mFqj5WfF_vuEJ3uNFmHcfgtDK8C4B-RlOXiGhMmv7Ew,593
|
|
8
|
+
pvblocks-0.1.2.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
|
9
|
+
pvblocks-0.1.2.dist-info/top_level.txt,sha256=3jm7rpxZDuLfYKWbVj6i1IZJib2hTFVYxbsR68po7O8,9
|
|
10
|
+
pvblocks-0.1.2.dist-info/RECORD,,
|
pvblocks-0.1.0.dist-info/RECORD
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
pvblocks/__init__.py,sha256=S_4OBrHHm52POZt_Qij4obBhCqtqEVwFtZ734fSPZEY,40
|
|
2
|
-
pvblocks/__main__.py,sha256=fhvwtf6NzUeUsjP_ARtvxcmYjAvfwqz9_K1bHFwEjUg,84
|
|
3
|
-
pvblocks/constants.py,sha256=bvvk31fpjKb-oFyuEsq13jUmTc3xJ9OZxqIQ6ek28J8,1022
|
|
4
|
-
pvblocks/exceptions.py,sha256=we35JF-svaCDAFYqKFlDCp7ZwbCU0FQe7nksKpUfPnQ,850
|
|
5
|
-
pvblocks/pvblocks_system.py,sha256=frIG5r0VIUwkYkdhan-GJJWKUqytEfVnP2upbpEdoHE,11218
|
|
6
|
-
pvblocks-0.1.0.dist-info/licenses/LICENSE,sha256=8xnw0w04bL1ekO1BTZPbMkUbonvCNWVu6G6k4QIFRns,1091
|
|
7
|
-
pvblocks-0.1.0.dist-info/METADATA,sha256=WonJgm61yKOhITUDOnp7LYIGt__Kp2HMzDqmThI2hss,593
|
|
8
|
-
pvblocks-0.1.0.dist-info/WHEEL,sha256=0CuiUZ_p9E4cD6NyLD6UG80LBXYyiSYZOKDm5lp32xk,91
|
|
9
|
-
pvblocks-0.1.0.dist-info/top_level.txt,sha256=3jm7rpxZDuLfYKWbVj6i1IZJib2hTFVYxbsR68po7O8,9
|
|
10
|
-
pvblocks-0.1.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|