Skip to content

Commit 857bd41

Browse files
committed
Update to platform to have an option to not rotate attached objects
- Added an optional input to update_moorings or not, which, when platform.setPosition is run, will not also rotate the positions of moorings and anchors - Also updated layout_helpers adjustSS4Pretension function to better work with Project Moorings rather than project.ms. subsystems
1 parent e4dc36f commit 857bd41

File tree

2 files changed

+29
-27
lines changed

2 files changed

+29
-27
lines changed

famodel/design/layout_helpers.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from famodel.mooring.mooring import Mooring
1212
from famodel.seabed.seabed_tools import getDepthFromBathymetry
1313
from famodel.project import Project
14-
from fadesign.fadsolvers import dsolve2
14+
from famodel.design.fadsolvers import dsolve2
1515

1616

1717
def create_initial_layout(lease_xs, lease_ys, ms, grid_x, grid_y, grid_depth, update_ms=True, display=0):
@@ -818,7 +818,7 @@ def eval_func(X, args):
818818
return ms
819819

820820

821-
def adjustSS4Pretension(ssin, i_line=0, T_init=None, horizontal=False, display=0, tol=0.01):
821+
def adjustSS4Pretension(ssin, i_line=0, T_init=None, horizontal=False, display=0, stepfac=10, tol=0.01):
822822

823823
ss = deepcopy(ssin)
824824

@@ -855,15 +855,16 @@ def eval_func(X, args):
855855
L_final, T_final, _ = dsolve2(eval_func, X0, Ytarget=[T_init],
856856
Xmin=[1], Xmax=[1.1*np.linalg.norm(ss.rB-ss.rA)],
857857
dX_last=[1], tol=[tol],
858-
maxIter=200, stepfac=100, display=display)
858+
maxIter=200, stepfac=stepfac, display=display)
859859

860-
ss.lineList[i_line].setL(L_final[0]) # assign the solved_for length
860+
#ss.lineList[i_line].setL(L_final[0]) # assign the solved_for length
861861
if display > 0: print(f' L_init = {L_init:6.1f}, LF = {L_final[0]:6.1f}')
862862
if display > 0: print(f' T_init = {T_init:8.2e}, TF = {T_final[0]:8.2e}')
863863

864-
ss.staticSolve() # reset the subsystem
864+
#ss.staticSolve() # reset the subsystem
865865

866866
return L_final[0]
867+
#return ss
867868

868869

869870

famodel/platform/platform.py

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ def __init__(self, id, r=[0,0,0], heading=0, mooring_headings=[60,180,300],rFair
6363
self.raftResults = {}
6464

6565

66-
def setPosition(self, r, heading=None, degrees=False,project=None):
66+
def setPosition(self, r, heading=None, degrees=False,project=None, update_moorings=True):
6767
'''
6868
Set the position/orientation of the platform as well as the associated
6969
anchor points.
@@ -93,27 +93,28 @@ def setPosition(self, r, heading=None, degrees=False,project=None):
9393

9494
# Update the position of any Moorings
9595
count = 0 # mooring counter (there are some attachments that aren't moorings)
96-
for i, att in enumerate(self.attachments):
97-
if isinstance(self.attachments[att]['obj'], Mooring):
98-
99-
# Heading of the mooring line
100-
heading_i = self.mooring_headings[count] + self.phi
101-
# Reposition the whole Mooring if it is an anchored line
102-
if not self.attachments[att]['obj'].shared:
103-
self.attachments[att]['obj'].reposition(r_center=self.r, heading=heading_i,project=project)
104-
105-
count += 1
106-
107-
if isinstance(self.attachments[att]['obj'], Cable):
108-
109-
cab = self.attachments[att]['obj']
110-
111-
# update heading stored in subcomponent for attached end
112-
# pf_phis = [cab.attached_to[0].phi, cab.attached_to[1].phi]
113-
# headings = [cab.subcomponents[0].headingA + pf_phis[0], cab.subcomponents[-1].headingB + pf_phis[1]]
114-
115-
# reposition the cable
116-
cab.reposition(project=project)
96+
if update_moorings:
97+
for i, att in enumerate(self.attachments):
98+
if isinstance(self.attachments[att]['obj'], Mooring):
99+
100+
# Heading of the mooring line
101+
heading_i = self.mooring_headings[count] + self.phi
102+
# Reposition the whole Mooring if it is an anchored line
103+
if not self.attachments[att]['obj'].shared:
104+
self.attachments[att]['obj'].reposition(r_center=self.r, heading=heading_i,project=project)
105+
106+
count += 1
107+
108+
if isinstance(self.attachments[att]['obj'], Cable):
109+
110+
cab = self.attachments[att]['obj']
111+
112+
# update heading stored in subcomponent for attached end
113+
# pf_phis = [cab.attached_to[0].phi, cab.attached_to[1].phi]
114+
# headings = [cab.subcomponents[0].headingA + pf_phis[0], cab.subcomponents[-1].headingB + pf_phis[1]]
115+
116+
# reposition the cable
117+
cab.reposition(project=project)
117118

118119

119120
def mooringSystem(self,rotateBool=0,mList=None,bodyInfo=None, project=None):

0 commit comments

Comments
 (0)