Skip to content

Commit

Permalink
Merge pull request #639 from gisce/56784/a1-improve-pod-adscrita
Browse files Browse the repository at this point in the history
A1: Millorem el càlcul de la potencia adscrita
  • Loading branch information
ecarreras authored Apr 4, 2024
2 parents 2055251 + 295ee4a commit fd2c6fe
Showing 1 changed file with 17 additions and 1 deletion.
18 changes: 17 additions & 1 deletion libcnmc/cir_8_2021/FA1.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,8 +712,24 @@ def consumer(self):

# potencia adscrita
o_pot_ads = 0
if cups.get('potencia_adscrita', False):

if cups['force_potencia_adscrita']:
o_pot_ads = cups['potencia_adscrita']
else:
# Buscar butlletins vigents en data circular i agafgar el màxim
current_date = '{}-01-01'.format(self.year)
but_ids = self.connection.GiscedataButlleti.search([
('cups_id', '=', cups['id']),
'|', '|', '|',
'&', ('data', '=', False), ('data_vigencia', '=', False),
'&', ('data', '<=', current_date), ('data_vigencia', '=', False),
'&', ('data', '=', False), ('data_vigencia', '>=', current_date),
'&', ('data', '<=', current_date), ('data_vigencia', '>=', current_date),
], 0, 0, False, {'active_test': False})
o_pot_ads = max(
b['pot_max_admisible']
for b in self.connection.GiscedataButlleti.read(but_ids, ['pot_max_admisible'])
)
if o_pot_ads < o_potencia:
o_pot_ads = o_potencia

Expand Down

0 comments on commit fd2c6fe

Please sign in to comment.