Skip to content

Commit 7ab71cc

Browse files
committed
Add interpolation between cable designs to adjust for depth;
- add multiple cable designs for range of depths and FAModel will now determine suitable cable design options and interpolate for new depths more efficient load/sf storage for connectors&sections
1 parent b7aa6a0 commit 7ab71cc

File tree

7 files changed

+360
-142
lines changed

7 files changed

+360
-142
lines changed

famodel/cables/cable.py

Lines changed: 81 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
from famodel.cables.static_cable import StaticCable
1111
from famodel.cables.components import Joint, Jtube
1212
from famodel.famodel_base import Edge
13+
from famodel.helpers import cableDesignInterpolation
1314

1415

1516
class Cable(Edge):
@@ -109,8 +110,7 @@ def __init__(self, id, d=None):
109110
self.r = []
110111

111112
# get cable length
112-
self.getL()
113-
113+
self.getL()
114114

115115
# failure probability
116116
self.failure_probability = {}
@@ -185,14 +185,25 @@ def reposition(self,headings=None,project=None,rad_fair=[]):
185185
if lensub > 1:
186186
for i,sub in enumerate(self.subcomponents):
187187
if i == 0:
188+
oldz = project.getDepthAtLocation(sub.rB[0],
189+
sub.rB[1])
188190
# get depth at location of rB
189191
xy = [sub.rA[0]+np.cos(headingA)*sub.span,
190192
sub.rA[1]+np.sin(headingA)*sub.span]
191193
z = project.getDepthAtLocation(xy[0],xy[1])
194+
# adjust design if applicable
195+
if sub.alternate_designs is not None and oldz!=z:
196+
sub.dd = cableDesignInterpolation(
197+
sub.dd,
198+
sub.alternate_designs,
199+
z)
200+
self.reposition() # recursively call reposition
192201
# set the end B of the first subsection
193202
sub.rB = [xy[0],xy[1],-z]
194203
sub.z_anch = -z
195204
sub.depth = z
205+
206+
196207
# set joint
197208
self.subcomponents[i+1]['r'] = sub.rB
198209
# set rA of next cable section
@@ -201,6 +212,13 @@ def reposition(self,headings=None,project=None,rad_fair=[]):
201212
xy = [sub.rB[0]+np.cos(headingB)*sub.span,
202213
sub.rB[1]+np.sin(headingB)*sub.span]
203214
z = project.getDepthAtLocation(xy[0],xy[1])
215+
# adjust design if applicable
216+
if sub.alternate_designs is not None and oldz!=z:
217+
sub.dd = cableDesignInterpolation(
218+
sub.dd,
219+
sub.alternate_designs,
220+
z)
221+
self.reposition() # re-call reposition
204222
# set the end A of the last subsection
205223
sub.rA = [xy[0],xy[1],-z]
206224
# update z_anch and depth of the subsection
@@ -272,6 +290,67 @@ def makeLine(self,buff_rad=20,include_dc=True):
272290

273291
return(line)
274292

293+
def dynamicCables(self):
294+
""" Return list of dynamic cables in this cable object """
295+
return [a for a in self.subcomponents if isinstance(a, DynamicCable)]
296+
297+
def updateTensions(self, DAF=1):
298+
"""
299+
Update the tensions stored in dynamic cable load dictionaries
300+
301+
Returns
302+
-------
303+
None.
304+
305+
"""
306+
for dc in self.dynamicCables():
307+
if not 'Tmax' in dc.loads:
308+
dc.loads['Tmax'] = 0
309+
if dc.ss:
310+
for line in dc.ss.lineList:
311+
Tmax = max([abs(line.TA), abs(line.TB)])
312+
if Tmax*DAF > dc.loads['Tmax']:
313+
dc.loads['Tmax'] = deepcopy(Tmax)*DAF
314+
return(dc.loads['Tmax'])
315+
316+
# def updateCurvature(self):
317+
# for dc in self.dyamicCables():
318+
# if not dc.curvature:
319+
# dc.curvature = np.inf
320+
# if dc.ss:
321+
# curv = dc.ss.calcCurvature()
322+
# if curv > dc.curvature:
323+
# dc.curvature = curv
324+
# mCSF = dc.ss.getMinCurvSF()
325+
326+
def updateSafetyFactors(self, key='tension', load='Tmax', prop='MBL',
327+
info={}):
328+
"""
329+
Update the safety factor dictionaries stored in dynamic cable objects
330+
331+
Parameters
332+
----------
333+
key : str/int, optional
334+
key in safety factor dictionary of dynamic cables.
335+
The default is 'tension'.
336+
load : str, optional
337+
Key in load dictionary of dynamic cables. The default is 'Tmax'.
338+
prop : str, optional
339+
Key in dynamic cable properties dictionary to compare to load.
340+
The default is 'MBL'.
341+
info : dict, optional
342+
Information dictionary to add in the safety_factors dict for context
343+
344+
Returns
345+
-------
346+
None.
347+
348+
"""
349+
for dc in self.dynamicCables():
350+
dc.safety_factors[key] = dc.dd['type'][prop]/dc.loads[load]
351+
dc.safety_factors['info'] = info
352+
353+
275354
def updateSpan(self,newSpan):
276355
'''
277356
Change the lengths of subcomponents based on the new total span

famodel/cables/dynamic_cable.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,9 @@ def __init__(self, id, dd=None, subsystem=None, rA=[0,0,0], rB=[0,0,0],
110110
self.rho = rho
111111
self.g = g
112112

113+
# alternate designs to interpolate between when depth changes
114+
self.alternate_designs = None
115+
113116
# Dictionaries for addition information
114117
self.loads = {}
115118
self.safety_factors = {} # calculated safety factor

0 commit comments

Comments
 (0)