Skip to content

Commit

Permalink
Merge pull request #655 from gisce/feature/60172_ADD_new_tensio_field…
Browse files Browse the repository at this point in the history
…_coverage

ADD Cobertura para el nuevo campo de tension entrante en CT en B2
  • Loading branch information
ecarreras authored Jun 14, 2024
2 parents 0d484e3 + be3af59 commit 17ef635
Showing 1 changed file with 18 additions and 9 deletions.
27 changes: 18 additions & 9 deletions libcnmc/cir_8_2021/FB2.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,10 @@ def get_potencia_trafos(self, id_ct):
res += trafo['potencia_nominal']
return res

def get_tensio(self, tensio_id):
o = self.connection
return o.GiscedataTensionsTensio.read(tensio_id, ['tensio'])['tensio']

def consumer(self):
"""
Method that generates the csv file
Expand All @@ -123,10 +127,11 @@ def get_inst_name(element_id):
return vals['name']

fields_to_read = [
'id', 'name', 'cini', 'data_pm', 'tipus_instalacio_cnmc_id', 'tensio_p',
'id_municipi', 'perc_financament', 'descripcio', 'data_baixa', 'tensio_const',
'node_baixa', 'zona_id', 'node_id', 'potencia',
'model', 'punt_frontera', 'id_regulatori', 'perc_financament',
'id', 'name', 'cini', 'data_pm', 'tipus_instalacio_cnmc_id',
'tensio_p', 'id_municipi', 'perc_financament', 'descripcio',
'data_baixa', 'tensio_const', 'node_baixa', 'zona_id', 'node_id',
'potencia', 'model', 'punt_frontera', 'id_regulatori',
'perc_financament', 'tensio_entrant'
]

fields_to_read_obra = [
Expand Down Expand Up @@ -312,11 +317,15 @@ def get_inst_name(element_id):
o_node_baixa = o_node

#TENSIO
try:
o_tensio_p = format_f(
float(ct['tensio_p']) / 1000.0, decimals=3) or ''
except:
o_tensio_p = ''
if ct.get('tensio_entrant'):
o_tensio_p = self.get_tensio(ct['tensio_entrant'][0])
else:
try:

o_tensio_p = format_f(
float(ct['tensio_p']) / 1000.0, decimals=3) or ''
except:
o_tensio_p = ''

#TENSIO_CONST
o_tensio_const = ''
Expand Down

0 comments on commit 17ef635

Please sign in to comment.