@@ -321,18 +321,21 @@ def set_refrig(self, value):
321
321
raise NotImplementedError
322
322
323
323
@exclusive
324
- def get_loop_sp (self , N ):
324
+ def get_loop_sp (self , N , range_restrict = True ):
325
325
self .__range_check (N , 1 , self .loops + self .cascades )
326
326
minsp = self .client .read_holding_signed ([602 , 612 ][N - 1 ])[0 ] * self .__get_scalar (N )
327
327
const = self .client .read_holding_signed ([300 , 319 ][N - 1 ])[0 ] * self .__get_scalar (N )
328
328
if self .client .read_holding (200 )[0 ] in [2 , 3 ]: #running or holding profile
329
329
cur = self .client .read_holding_signed ([4122 , 4123 ][N - 1 ])[0 ] * self .__get_scalar (N )
330
330
else :
331
331
cur = const
332
- return {
333
- 'constant' : const if const > minsp else minsp ,
334
- 'current' : cur if cur > minsp else minsp
335
- }
332
+ if range_restrict :
333
+ return {
334
+ 'constant' : const if const > minsp else minsp ,
335
+ 'current' : cur if cur > minsp else minsp
336
+ }
337
+ else :
338
+ return {'constant' : const , 'current' : cur }
336
339
337
340
@exclusive
338
341
def set_loop_sp (self , N , value ):
@@ -365,7 +368,9 @@ def get_loop_en(self, N):
365
368
self .__range_check (N , 1 , self .loops + self .cascades )
366
369
lrange = self .get_loop_range (N , exclusive = False )
367
370
profile = self .client .read_holding (200 )[0 ] in [2 , 3 ]
368
- cmd = self .get_loop_sp (N , exclusive = False )['constant' ] >= lrange ['min' ]
371
+ cmd = self .get_loop_sp (N , False , exclusive = False )['current' ] >= lrange ['min' ]
372
+ print 'loop_sp=%r, range=%r' % (self .get_loop_sp (N , False , exclusive = False ), lrange )
373
+ print 'N=%r, combined_event=%r, cmd=%r' % (N , self .combined_event , cmd )
369
374
if self .combined_event [N - 1 ] > 0 :
370
375
eve = self .get_event (self .combined_event [N - 1 ], exclusive = False )['constant' ]
371
376
running = self .get_event (self .cond_event , exclusive = False ) if self .cond_event else True
0 commit comments