Skip to content

Commit 4dc83df

Browse files
committed
updates for mooring adjuster function
-project.addMooring now inputs adjuster function, method, target, and i_line -if target is not provided, the pretension or horizontal force will be calculated based on the mooring dd and base depth -slope is calculated based on mooring span and base depth (only used for pretension option) -mooring.reposition function updated to work with lasted adjustMooring helper function -if slope is not provided, defaults to the 'horizontal' method and keeps same anchor spacing -if slope is provided, the pretension method is used -helper adjustMooring updated to use 'horizontal' as the default (requires less inputs)
1 parent 047b2a1 commit 4dc83df

File tree

3 files changed

+64
-4
lines changed

3 files changed

+64
-4
lines changed

famodel/helpers.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -776,7 +776,7 @@ def getAnchors(lineAnch, arrayAnchor, proj):
776776

777777
return(ad, mass)
778778

779-
def adjustMooring(mooring, method = 'pretension', r=[0,0,0], project=None, target=1e6,
779+
def adjustMooring(mooring, method = 'horizontal', r=[0,0,0], project=None, target=1e6,
780780
i_line = 0, slope = 0.58 ):
781781
'''Custom function to adjust a mooring, called by
782782
Mooring.adjust. Fairlead point should have already

famodel/mooring/mooring.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,27 @@ def reposition(self, r_center=None, heading=None, project=None,
251251
# Run custom function to update the mooring design (and anchor position)
252252
# this would also szie the anchor maybe?
253253
if self.adjuster:
254-
self.adjuster(self, r_centerB, u, project=project, **kwargs)
254+
255+
#if i_line is not defined, assumed segment 0 will be adjusted
256+
if not hasattr(self,'i_line'):
257+
self.i_line = 0
258+
259+
260+
if hasattr(self,'slope'):
261+
self.adjuster(self, method = 'pretension', r=r_centerB, project=project, target = self.target, i_line = self.i_line, slope = self.slope)
262+
263+
else:
264+
265+
#move anchor based on set spacing then adjust line length
266+
xy_loc = r_centerB[:2] + (self.span + rad_fair[1])*u
267+
if project:
268+
self.dd['zAnchor'] = -project.getDepthAtLocation(xy_loc[0],xy_loc[1])
269+
self.z_anch = self.dd['zAnchor']
270+
else:
271+
print('Warning: depth of mooring line, anchor, and subsystem must be updated manually.')
272+
self.setEndPosition(np.hstack([r_centerB[:2] + (self.span + rad_fair[1])*u, self.z_anch]), 'a', sink=True)
273+
274+
self.adjuster(self, method = 'horizontal', r=r_centerB, project=project, target = self.target, i_line = self.i_line)
255275

256276
elif self.shared == 1: # set position of end A at platform end A
257277
self.setEndPosition(np.hstack([r_centerA[:2] - rad_fair[0]*u, z_fair[0] + r_centerA[2]]),'a')

famodel/project.py

Lines changed: 42 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1484,7 +1484,8 @@ def addPlatform(self,r=[0,0,0], id=None, phi=0, entity='',
14841484

14851485
def addMooring(self, id=None, endA=None, endB=None, heading=0, dd={},
14861486
section_types=[], section_lengths=[],
1487-
connectors=[], span=0, shared=0, reposition=False):
1487+
connectors=[], span=0, shared=0, reposition=False, adjuster=None,
1488+
method = 'horizontal', target = None, i_line = 0):
14881489
'''
14891490
Function to create a mooring object and save in mooringList
14901491
Optionally does the following:
@@ -1521,7 +1522,14 @@ def addMooring(self, id=None, endA=None, endB=None, heading=0, dd={},
15211522
The default is 0. Used to develop a dd, unused if dd provided.
15221523
shared : int, optional
15231524
Describes if a mooring line is shared (1), sahred half line (2) or anchored (0). The default is 0.
1524-
1525+
adjuster : Function, optional
1526+
Function to adjust mooring lines for different depths. The default is none
1527+
method : str, optional
1528+
Method 'horizontal' or 'pretension' for adjuster function
1529+
target : float, optional
1530+
Target pretension or horizontal tension for adjuster function. if none, will calculate
1531+
i_line: int, optional
1532+
The index of the line segment to adjust. default is 0
15251533
Returns
15261534
-------
15271535
mooring : mooring object
@@ -1556,6 +1564,20 @@ def addMooring(self, id=None, endA=None, endB=None, heading=0, dd={},
15561564
'z_fair':self.platformList[id_part[0]].zFair if id_part else 0}
15571565

15581566
mooring = Mooring(dd=dd, id=id) # create mooring object
1567+
1568+
#calculate target pretension or horizontal tension if none provided
1569+
if adjuster != None and target == None:
1570+
targetdd = deepcopy(dd)
1571+
targetdd['zAnchor'] = self.depth
1572+
mooring.createSubsystem(dd)
1573+
1574+
if method == 'horizontal':
1575+
mooring.target = np.linalg.norm(mooring.ss.fB_L[:2])
1576+
elif method =='pretension':
1577+
mooring.target = np.linalg.norm(mooring.ss.fB_L)
1578+
else:
1579+
raise Exception('Invalid adjustment method. Must be pretension or horizontal')
1580+
15591581
# update shared prop if needed
15601582
if len(id_part)==2 and shared<1:
15611583
shared = 1
@@ -1582,7 +1604,25 @@ def addMooring(self, id=None, endA=None, endB=None, heading=0, dd={},
15821604
mooring.z_anch = -zAnew
15831605
else:
15841606
mooring.heading = np.degrees(heading)
1607+
1608+
#add mooring adjuster if porivded
1609+
if adjuster!= None:
1610+
mooring.adjuster = adjuster
1611+
mooring.i_line = i_line
1612+
1613+
# check if method is 'pretension' then save slope
1614+
if method == 'pretension':
15851615

1616+
if dd:
1617+
1618+
#calculate mooring slope using base depth
1619+
#**** this assumes that the mooring system is designed for the base depth*****
1620+
mooring.slope = self.depth / dd['span']
1621+
1622+
else:
1623+
1624+
mooring.slope = self.depth / span
1625+
15861626
self.mooringList[id] = mooring
15871627

15881628
return(mooring)

0 commit comments

Comments
 (0)