pvblocks 0.1.0__tar.gz → 0.1.1__tar.gz
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-0.1.0 → pvblocks-0.1.1}/PKG-INFO +1 -1
- {pvblocks-0.1.0 → pvblocks-0.1.1}/pyproject.toml +1 -1
- pvblocks-0.1.1/src/pvblocks/__init__.py +2 -0
- pvblocks-0.1.1/src/pvblocks/constants.py +43 -0
- {pvblocks-0.1.0 → pvblocks-0.1.1}/src/pvblocks/pvblocks_system.py +18 -52
- {pvblocks-0.1.0 → pvblocks-0.1.1}/src/pvblocks.egg-info/PKG-INFO +1 -1
- {pvblocks-0.1.0 → pvblocks-0.1.1}/tests/test.py +2 -2
- pvblocks-0.1.0/src/pvblocks/__init__.py +0 -2
- pvblocks-0.1.0/src/pvblocks/constants.py +0 -42
- {pvblocks-0.1.0 → pvblocks-0.1.1}/LICENSE +0 -0
- {pvblocks-0.1.0 → pvblocks-0.1.1}/README.md +0 -0
- {pvblocks-0.1.0 → pvblocks-0.1.1}/setup.cfg +0 -0
- {pvblocks-0.1.0 → pvblocks-0.1.1}/src/pvblocks/__main__.py +0 -0
- {pvblocks-0.1.0 → pvblocks-0.1.1}/src/pvblocks/exceptions.py +0 -0
- {pvblocks-0.1.0 → pvblocks-0.1.1}/src/pvblocks.egg-info/SOURCES.txt +0 -0
- {pvblocks-0.1.0 → pvblocks-0.1.1}/src/pvblocks.egg-info/dependency_links.txt +0 -0
- {pvblocks-0.1.0 → pvblocks-0.1.1}/src/pvblocks.egg-info/top_level.txt +0 -0
|
@@ -0,0 +1,43 @@
|
|
|
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
|
|
29
|
+
|
|
30
|
+
IVMPP_READ_IVPOINT = 20
|
|
31
|
+
IVMPP_APPLY_STATE = 21
|
|
32
|
+
PV_IRR_READ_IRRADIANCES = 30
|
|
33
|
+
|
|
34
|
+
VOC = 0
|
|
35
|
+
ISC = 1
|
|
36
|
+
MPP = 2
|
|
37
|
+
VOLTAGE_BIAS = 3
|
|
38
|
+
|
|
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
|
|
@@ -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
|
|
|
@@ -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)
|
|
@@ -252,7 +225,7 @@ class IvMpp(PvBlock):
|
|
|
252
225
|
|
|
253
226
|
def transfer_curve(self, points):
|
|
254
227
|
self.open()
|
|
255
|
-
self.uart.write(serial.to_bytes([2, constants.
|
|
228
|
+
self.uart.write(serial.to_bytes([2, constants.TRANSFER_CURVE_COMMAND]))
|
|
256
229
|
sleep(0.5)
|
|
257
230
|
availablebytes = 8 + (points * 8) + 1
|
|
258
231
|
toread = self.uart.inWaiting()
|
|
@@ -266,8 +239,8 @@ class IvMpp(PvBlock):
|
|
|
266
239
|
voltages = []
|
|
267
240
|
currents = []
|
|
268
241
|
|
|
269
|
-
|
|
270
|
-
for i in range(int((availablebytes - 1)/8)):
|
|
242
|
+
print(availablebytes)
|
|
243
|
+
for i in range(1, int((availablebytes - 1)/8)):
|
|
271
244
|
index = (i * 8) + 1
|
|
272
245
|
voltages.append(int.from_bytes(bts[index:(index+4)], "little") / 10000.0)
|
|
273
246
|
index = index + 4
|
|
@@ -289,7 +262,7 @@ class IvMpp(PvBlock):
|
|
|
289
262
|
bts = list(address.to_bytes(2, 'little'))
|
|
290
263
|
self.open()
|
|
291
264
|
self.uart.write(
|
|
292
|
-
serial.to_bytes([2, constants.
|
|
265
|
+
serial.to_bytes([2, constants.READ_EEPROM_COMMAND, length, bts[0], bts[1]]))
|
|
293
266
|
|
|
294
267
|
while self.uart.inWaiting() != length + 3:
|
|
295
268
|
sleep(0.01)
|
|
@@ -303,7 +276,7 @@ class PvIrr(PvBlock):
|
|
|
303
276
|
|
|
304
277
|
def ReadIrradiances(self):
|
|
305
278
|
self.open()
|
|
306
|
-
self.uart.write(serial.to_bytes([2, constants.
|
|
279
|
+
self.uart.write(serial.to_bytes([2, constants.READ_COMMAND]))
|
|
307
280
|
sleep(0.5)
|
|
308
281
|
bts = ReadSerial(self.uart)
|
|
309
282
|
if len(bts) < 10:
|
|
@@ -343,10 +316,3 @@ class IvPoint(object):
|
|
|
343
316
|
def __str__(self):
|
|
344
317
|
return "(%f, %f)" % (self.voltage, self.current)
|
|
345
318
|
|
|
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
|
|
@@ -37,6 +37,6 @@ if len(pvblocks.IvMppBlocks) > 0:
|
|
|
37
37
|
#print(iv_mpp.get_info())
|
|
38
38
|
ivpoint = iv_mpp.read_ivpoint()
|
|
39
39
|
print(ivpoint)
|
|
40
|
-
|
|
40
|
+
curve = iv_mpp.measure_ivcurve(100, 20, 0)
|
|
41
41
|
|
|
42
|
-
|
|
42
|
+
pvblocks.close_system()
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
from enum import IntEnum
|
|
2
|
-
|
|
3
|
-
class Rr1700Command(IntEnum):
|
|
4
|
-
IdleCommand = 0,
|
|
5
|
-
BlinkCommand = 1,
|
|
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
|
|
32
|
-
|
|
33
|
-
class Rr1700Function(IntEnum):
|
|
34
|
-
IvMppReadIVPoint = 20,
|
|
35
|
-
IvMppApplyState = 21,
|
|
36
|
-
PvIrrReadIrradiances = 30
|
|
37
|
-
|
|
38
|
-
class IvMppState(IntEnum):
|
|
39
|
-
Voc = 0,
|
|
40
|
-
Isc = 1,
|
|
41
|
-
Mpp = 2,
|
|
42
|
-
VoltageBias = 3
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|