diff --git a/moorpy/helpers.py b/moorpy/helpers.py index 3289557..ffbc887 100644 --- a/moorpy/helpers.py +++ b/moorpy/helpers.py @@ -714,7 +714,8 @@ def getLineProps(dnommm, material, lineProps=None, source=None, name="", rho=102 lineType = dict(name=typestring, d_vol=d_vol, m=mass, EA=EA, w=w, MBL=MBL, EAd=EAd, EAd_Lm=EAd_Lm, input_d=d, - cost=cost, notes=notes, material=material, Cdn=Cd, Cdt=CdAx,Can=Ca,Cat=CaAx) + cost=cost, notes=notes, material=material, + Cd=Cd, CdAx=CdAx, Ca=Ca, CaAx=CaAx) lineType.update(kwargs) # add any custom arguments provided in the call to the lineType's dictionary @@ -776,9 +777,9 @@ def loadLineProps(source): output[mat]['EAd_MBL' ] = getFromDict(props, 'EAd_MBL' , default=0.0) output[mat]['EAd_MBL_Lm']= getFromDict(props, 'EAd_MBL_Lm',default=0.0) output[mat]['Cd' ] = getFromDict(props, 'Cd' , default=0.0) - output[mat]['CdAx' ] = getFromDict(props, 'Cd_ax' , default=0.0) + output[mat]['Cd_ax' ] = getFromDict(props, 'Cd_ax' , default=0.0) output[mat]['Ca' ] = getFromDict(props, 'Ca' , default=0.0) - output[mat]['CaAx' ] = getFromDict(props, 'Ca_ax' , default=0.0) + output[mat]['Ca_ax' ] = getFromDict(props, 'Ca_ax' , default=0.0) output[mat]['MBL_0' ] = getFromDict(props, 'MBL_0' , default=0.0) output[mat]['MBL_d' ] = getFromDict(props, 'MBL_d' , default=0.0) diff --git a/moorpy/line.py b/moorpy/line.py index ffa8f8d..0120e96 100644 --- a/moorpy/line.py +++ b/moorpy/line.py @@ -977,10 +977,10 @@ def attachLine(self, lineID, endB): def activateDynamicStiffness(self, display=0): - '''Switch mooring line model to dynamic line stiffness - value, including potential unstretched line length - adjustment. This only works when dynamic line properties - are used.''' + '''Switch mooring line model to dynamic line stiffness value, + including potential unstretched line length adjustment, taking the + current state as the mean/static offset position to work from. + This only works when dynamic line properties are used.''' if self.type['EAd'] > 0: # switch to dynamic stiffness value diff --git a/moorpy/subsystem.py b/moorpy/subsystem.py index c940021..dd7cf86 100644 --- a/moorpy/subsystem.py +++ b/moorpy/subsystem.py @@ -472,7 +472,8 @@ def setDynamicOffset(self, offset, z=0): Optional argument z can be added for a z offset. ''' - self.activateDynamicStiffness() # use dynamic EA values + if not self.dynamic_stiffness_activated: # if not already using them, + System.activateDynamicStiffness(self) # switch to dynamic EA values # adjust end B to the absolute offsets specified self.rB = np.array([-self.rad_fair + offset, 0, self.z_fair+z]) @@ -486,16 +487,12 @@ def setDynamicOffset(self, offset, z=0): def activateDynamicStiffness(self, display=0): - '''Switch mooring system model to dynamic line stiffness - values and adjust the unstretched line lengths to maintain the - same tensions. This only has an effect when dynamic line properties - are used.''' + '''Calls the dynamic stiffness method from System rather than from Line.''' System.activateDynamicStiffness(self, display=display) def revertToStaticStiffness(self): - '''Revert mooring system model back to the static stiffness - values and the original unstretched lenths.''' + '''Calls the static stiffness method from System rather than from Line.''' System.revertToStaticStiffness(self) diff --git a/moorpy/system.py b/moorpy/system.py index 9a5178c..91867ad 100644 --- a/moorpy/system.py +++ b/moorpy/system.py @@ -107,6 +107,7 @@ def __init__(self, file="", dirname="", rootname="", depth=0, rho=1025, g=9.81, self.MDoptions = {} # dictionary that can hold any MoorDyn options read in from an input file, so they can be saved in a new MD file if need be + self.dynamic_stiffness_activated = False # flag turned on when dynamic EA values are activate # read in data from an input file if a filename was provided if len(file) > 0: @@ -1046,7 +1047,7 @@ def unload(self, fileName, MDversion=2, line_dL=0, rod_dL=0, flag='p', # Some default settings to fill in if coefficients aren't set #lineTypeDefaults = dict(BA=-1.0, EI=0.0, Cd=1.2, Ca=1.0, CdAx=0.2, CaAx=0.0) - lineTypeDefaults = dict(BA=-1.0, cIntDamp=-0.8, EI=0.0, Can=1.0, Cat=1.0, Cdn=1.0, Cdt=0.5) + lineTypeDefaults = dict(BA=-1.0, EI=0.0, Ca=1.0, CaAx=1.0, Cd=1.0, CdAx=0.5) rodTypeDefaults = dict(Cd=1.2, Ca=1.0, CdEnd=1.0, CaEnd=1.0) # bodyDefaults = dict(IX=0, IY=0, IZ=0, CdA_xyz=[0,0,0], Ca_xyz=[0,0,0]) @@ -3045,13 +3046,16 @@ def checkTensions(self, N = None): def activateDynamicStiffness(self, display=0): - '''Switch mooring system model to dynamic line stiffness - values and adjust the unstretched line lengths to maintain the - same tensions. This only has an effect when dynamic line properties - are used.''' + '''Switch mooring system model to dynamic line stiffness values and + adjust the unstretched line lengths to maintain the same tensions. + If dynamic stiffnesses are already activated, it does nothing. + This only has an effect when dynamic line properties are used. ''' - for line in self.lineList: - line.activateDynamicStiffness(display=display) + if not self.dynamic_stiffness_activated: + for line in self.lineList: + line.activateDynamicStiffness(display=display) + + self.dynamic_stiffness_activated = True def revertToStaticStiffness(self): @@ -3060,6 +3064,8 @@ def revertToStaticStiffness(self): for line in self.lineList: line.revertToStaticStiffness() + + self.dynamic_stiffness_activated = False def setBathymetry(self, x, y, depth):