Skip to content

Commit af0eaf0

Browse files
committed
switch between lower and upper bounds:
- ability in mooring.py to switch between lower and upper bounds if the material + suffix (suffix being LB for lower and UB for upper bound) exists in the LineProps. - fixed the line nominal diameter's unit to mm when creating a line type using getLineProps.
1 parent a4ab5f6 commit af0eaf0

File tree

1 file changed

+25
-1
lines changed

1 file changed

+25
-1
lines changed

famodel/mooring/mooring.py

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1149,11 +1149,35 @@ def addCreep(self, lineProps, creep_percent=None):
11491149
# Change the diameter size to account for creep thinning
11501150

11511151
d_nom_creep = line.type['d_nom'] / np.sqrt(1 + creep_percent)
1152-
lineType_creep = getLineProps(d_nom_creep, mat, lineProps)
1152+
lineType_creep = getLineProps(d_nom_creep*1e3, mat, lineProps) # convert to mm for getLineProps
11531153
line.type = lineType_creep # update line type with new diameter [not sure if that's what we need to do.]
11541154
else:
11551155
raise ValueError('Mooring subsystem must be created before adding creep.')
1156+
1157+
def switchStiffnessBounds(self, lineProps, lower=False):
1158+
'''
1159+
Switches the line stiffnesses to either the lower or upper bounds defined in the MoorProps yaml
1160+
1161+
Parameters
1162+
----------
1163+
lineProps : dict
1164+
Dictionary of line properties from MoorProps yaml
11561165
1166+
lower : bool, optional
1167+
Whether to switch to lower bound (True) or upper bound (False). The default is False.
1168+
'''
1169+
1170+
suffix = '_LB' if lower else '_UB'
1171+
1172+
from moorpy.helpers import getLineProps
1173+
if self.ss:
1174+
for i, line in enumerate(self.ss.lineList):
1175+
mat = line.type['material']
1176+
mat_suffix = mat + suffix
1177+
if mat_suffix in lineProps:
1178+
lineType = getLineProps(line.type['d_nom']*1e3, mat_suffix, lineProps) # convert to mm for getLineProps
1179+
line.type = lineType # update line type with new stiffness
1180+
11571181
def getEnvelope(self,ang_spacing=45,SFs=True):
11581182
'''Computes the motion envelope of the Mooring based on the watch
11591183
circle(s) of what it's attached to. If those aren't already

0 commit comments

Comments
 (0)