Skip to content

Commit 154a7f3

Browse files
committed
Unload fairleads/jtubes bug fix
1 parent 8fb1ad1 commit 154a7f3

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

famodel/helpers.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1417,6 +1417,8 @@ def compareDicts(d1, d2):
14171417
if type(d1[key]) is dict:
14181418
compareDicts(d1[key],d2[key])
14191419
elif isinstance(d1[key],(list, np.ndarray)):
1420+
if len(d1[key])!=len(d2[key]):
1421+
return(False)
14201422
for i,ix in enumerate(d1[key]):
14211423
if type(d1[key][i]) is dict:
14221424
compareDicts(ix,d2[key][i])

famodel/project.py

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4385,7 +4385,7 @@ def unload(self,file='project.yaml'):
43854385
for pt in self.platformTypes:
43864386
if 'fairleads' in pt:
43874387
for f,fl in enumerate(pt['fairleads']):
4388-
if 'headings' in pt['fairleads']:
4388+
if 'headings' in fl:
43894389
for head in fl['headings']:
43904390
# get rotation matrix of heading
43914391
R = rotationMatrix(0,0,np.radians(90-head))
@@ -4398,7 +4398,7 @@ def unload(self,file='project.yaml'):
43984398
pt['fairleads'] = []
43994399
if 'JTubes' in pt:
44004400
for f,fl in enumerate(pt['JTubes']):
4401-
if 'headings' in pt['JTubes']:
4401+
if 'headings' in fl:
44024402
for head in fl['headings']:
44034403
# get rotation matrix of heading
44044404
R = rotationMatrix(0,0,np.radians(90-head))
@@ -4425,11 +4425,12 @@ def unload(self,file='project.yaml'):
44254425
# for att in pf.attachments.values()
44264426
# if isinstance(att['obj'], Fairlead)
44274427
# ]
4428-
pf_info = {'rFair': pf.rFair,
4429-
'zFair': pf.zFair,
4430-
'type': pf.entity,
4428+
pf_info = {'type': pf.entity,
44314429
'fairleads':fairleads,
44324430
'JTubes':jtubes}
4431+
if not fairleads:
4432+
pf_info['rFair'] = pf.rFair
4433+
pf_info['zFair'] = pf.zFair
44334434

44344435
# update the platform type/add to platform types list if
44354436
# no type providd or pf_info different from any platformTypes
@@ -4719,8 +4720,8 @@ def unload(self,file='project.yaml'):
47194720
burial = None
47204721
jA = None
47214722
jB = None
4722-
jtubesA = [att['obj'].id for att in endA.attachments.values() if isinstance(att['obj'], Jtube)]
4723-
jtubesB = [att['obj'].id for att in endB.attachments.values() if isinstance(att['obj'], Jtube)]
4723+
jtubesA = [att['obj'] for att in endA.attachments.values() if isinstance(att['obj'], Jtube)]
4724+
jtubesB = [att['obj'] for att in endB.attachments.values() if isinstance(att['obj'], Jtube)]
47244725

47254726
for kk,sub in enumerate(cab.subcomponents):
47264727
currentConfig = {}
@@ -4764,7 +4765,7 @@ def unload(self,file='project.yaml'):
47644765

47654766

47664767
elif isinstance(sub,DynamicCable):
4767-
jtube = [att.id for att in sub.attached_to if isinstance(att,Jtube)]
4768+
jtube = [att for att in sub.attached_to if isinstance(att,Jtube)]
47684769
# grab index of fairlead list from end B
47694770

47704771
for jj in jtube:

0 commit comments

Comments
 (0)