Skip to content

Commit 9d492ce

Browse files
committed
switchStiffnessBounds can differentiate if a lower bound or upper bound is passed to it and removes the suffix if present
1 parent 7e84738 commit 9d492ce

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

famodel/mooring/mooring.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,13 +1193,15 @@ def addCreep(self, lineProps, design_life=28, creep_percent=None):
11931193

11941194
def switchStiffnessBounds(self, lineProps, lower=False):
11951195
'''
1196-
Switches the line stiffnesses to either the lower or upper bounds defined in the MoorProps yaml
1196+
Switches the line stiffnesses to either the lower or upper bounds defined in the MoorProps yaml.
11971197
11981198
Parameters
11991199
----------
12001200
lineProps : dict
1201-
Dictionary of line properties from MoorProps yaml
1202-
1201+
Dictionary of line properties from MoorProps yaml. The keys in this dictionary must include
1202+
material names with suffixes `_LB` (lower bound) or `_UB` (upper bound) to define the stiffness bounds.
1203+
These suffixes are used to distinguish between the two sets of stiffness properties.
1204+
12031205
lower : bool, optional
12041206
Whether to switch to lower bound (True) or upper bound (False). The default is False.
12051207
'''
@@ -1210,9 +1212,14 @@ def switchStiffnessBounds(self, lineProps, lower=False):
12101212
if self.ss:
12111213
for i, line in enumerate(self.ss.lineList):
12121214
mat = line.type['material']
1215+
1216+
# Remove existing suffix if present
1217+
if mat.endswith('_LB') or mat.endswith('_UB'):
1218+
mat = mat[:-3] # Remove the last 3 characters (_LB or _UB)
1219+
12131220
mat_suffix = mat + suffix
12141221
if mat_suffix in lineProps:
1215-
lineType = getLineProps(line.type['d_nom']*1e3, mat_suffix, lineProps) # convert to mm for getLineProps
1222+
lineType = getLineProps(line.type['d_nom']*1e3, mat_suffix, lineProps) # convert to mm for getLineProps
12161223
line.type = lineType # update line type with new stiffness
12171224

12181225
def getEnvelope(self,ang_spacing=45,SFs=True):

0 commit comments

Comments
 (0)