Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions cini/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,7 @@ def __init__(self):
- Móvil = ``M``
"""
self.tipo = None
self.punt_frontera = False # Si True, la 5a posició del CINI es '5' (Punt Frontera)
self.transformadores = [] # Lista de transformadores del CT

@property
Expand Down Expand Up @@ -403,16 +404,19 @@ def cini(self):
if self.tension_s is not None and self.tension_s < 1:
c.positions[4] = '5'

if self.tipo == 'I':
c.positions[5] = '1'
elif self.tipo == 'C':
c.positions[5] = '2'
elif self.tipo == 'L':
c.positions[5] = '3'
elif self.tipo == 'S':
c.positions[5] = '4'
elif self.tipo == 'M':
c.positions[5] = '9'
if self.punt_frontera:
c.positions[5] = '5'
else:
if self.tipo == 'I':
c.positions[5] = '1'
elif self.tipo == 'C':
c.positions[5] = '2'
elif self.tipo == 'L':
c.positions[5] = '3'
elif self.tipo == 'S':
c.positions[5] = '4'
elif self.tipo == 'M':
c.positions[5] = '9'

if self.tension is not None:
if self.tension <= 1:
Expand Down
6 changes: 6 additions & 0 deletions spec/cts_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@
self.ct.tipo = 'M'
cini = self.ct.cini
expect(cini[5]).to(equal('9'))
with context('si es Punt Frontera'):
with it('sobreescriu el tipo i val 5'):
self.ct.punt_frontera = True
self.ct.tipo = 'I'
cini = self.ct.cini
expect(cini[5]).to(equal('5'))

with description('la sexta posicion'):
with before.all:
Expand Down
Loading