Skip to content

Commit 72b08dc

Browse files
committed
cable route adjustment add direction
1 parent 2a8a873 commit 72b08dc

File tree

2 files changed

+21
-6
lines changed

2 files changed

+21
-6
lines changed

famodel/helpers.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ def check_headings(m_headings,c_heading,rad_buff):
223223
return([])
224224

225225

226-
def head_adjust(att,heading,rad_buff=np.radians(30),endA_dir=1):
226+
def head_adjust(att,heading,rad_buff=np.radians(30),endA_dir=1, adj_dir=1):
227227
'''
228228
function to adjust heading of cable based on angle buffer from mooring lines
229229
@@ -264,11 +264,12 @@ def head_adjust(att,heading,rad_buff=np.radians(30),endA_dir=1):
264264
#attheadings.extend(atmh)
265265
attheadings.extend(np.pi/2 - atmh) # convert to 0 rad at East going CCW
266266
flipheads = True
267+
267268
interfere_h = check_headings(attheadings,headnew,rad_buff)
268269
# if the headings interfere, adjust them by angle buffer
269270
for mhead in interfere_h:
270271
ang_diff_dir = np.sign(headnew - mhead) if headnew != mhead else 1
271-
headnew = mhead - rad_buff*endA_dir*ang_diff_dir #headnew + np.sign(ang_diff)*(rad_buff - abs(ang_diff))*endA_dir
272+
headnew = mhead - adj_dir*rad_buff*endA_dir*ang_diff_dir #headnew + np.sign(ang_diff)*(rad_buff - abs(ang_diff))*endA_dir
272273
interfere_hi = check_headings(attheadings,headnew,rad_buff)
273274
for i in interfere_hi:
274275
# try rotating other way
@@ -282,6 +283,7 @@ def head_adjust(att,heading,rad_buff=np.radians(30),endA_dir=1):
282283
newbuff = rad_buff/2
283284
headnew = mhead + newbuff*endA_dir*ang_diff_dir
284285
return(headnew)
286+
285287
return(headnew)
286288

287289
def getCableDD(dd,selected_cable,cableConfig,cableType_def,connVal):

famodel/project.py

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1900,11 +1900,24 @@ def addCablesConnections(self,connDict,cableType_def='dynamic_cable_66',oss=Fals
19001900
# consider mooring headings from both ends if close enough
19011901
pfsp = np.linalg.norm(attA.r-attB.r)
19021902
if consider_alternate_side and pfsp-2*attA.rFair < msp+dc0s:
1903-
headingA = head_adjust([attA,attB],headingA,rad_buff=rad_buff)
1904-
headingB = head_adjust([attB,attA],headingB,rad_buff=rad_buff,endA_dir=-1)
1903+
headingA = head_adjust([attA,attB],
1904+
headingA,
1905+
rad_buff=rad_buff,
1906+
adj_dir=adj_dir)
1907+
headingB = head_adjust([attB,attA],
1908+
headingB,
1909+
rad_buff=rad_buff,
1910+
endA_dir=-1,
1911+
adj_dir=adj_dir)
19051912
else:
1906-
headingA = head_adjust([attA],headingA,rad_buff=rad_buff)
1907-
headingB = head_adjust([attB],headingB,rad_buff=rad_buff)
1913+
headingA = head_adjust([attA],
1914+
headingA,
1915+
rad_buff=rad_buff,
1916+
adj_dir=adj_dir)
1917+
headingB = head_adjust([attB],
1918+
headingB,
1919+
rad_buff=rad_buff,
1920+
adj_dir=adj_dir)
19081921

19091922
heads = [headingA,headingB]
19101923
# reposition cable

0 commit comments

Comments
 (0)