@@ -334,7 +334,6 @@ def cableDesignInterpolation(dd, cables, depth):
334334 Depth (abs val) of cable to interpolate design for
335335 '''
336336 # grab list of values for all cables
337-
338337 n_bs = len (dd ['buoyancy_sections' ])
339338 cabdesign = {'n_buoys' :[[] for _ in range (n_bs )],
340339 'spacings' :[[] for _ in range (n_bs )],
@@ -343,16 +342,20 @@ def cableDesignInterpolation(dd, cables, depth):
343342 'L' : []}
344343 depths = []
345344 for cab in cables :
346- if len (cab ['buoyancy_sections' ])== n_bs :
347- for ii in range (n_bs ):
348- cabdesign ['n_buoys' ][ii ].append (
349- cab ['buoyancy_sections' ][ii ]['N_modules' ])
350- cabdesign ['spacings' ][ii ].append (
351- cab ['buoyancy_sections' ][ii ]['spacing' ])
352- cabdesign ['L_mids' ][ii ].append (
353- cab ['buoyancy_sections' ][ii ]['L_mid' ])
354-
355- cabdesign ['L' ].append (cab ['L' ])
345+ buoy_sec_idx = [i for i in range (len (cab ['sections' ]))
346+ if 'N_modules' in cab ['sections' ][i ]
347+ ]
348+ if len (buoy_sec_idx )== n_bs :
349+ ci = 0
350+ for ii in buoy_sec_idx :
351+ cabdesign ['n_buoys' ][ci ].append (
352+ cab ['sections' ][ii ]['N_modules' ])
353+ cabdesign ['spacings' ][ci ].append (
354+ cab ['sections' ][ii ]['spacing' ])
355+ cabdesign ['L_mids' ][ci ].append (
356+ cab ['sections' ][ii ]['L_mid' ])
357+ ci += 1
358+ cabdesign ['L' ].append (cab ['length' ])
356359 depths .append (cab ['depth' ])
357360 cabdesign ['span' ].append (cab ['span' ])
358361
@@ -414,8 +417,8 @@ def getCableDD(dd,selected_cable,cableConfig,cableType_def,connVal):
414417 dd ['joints' ] = []
415418
416419 # get connector and joint costs if they were given
417- dd ['connector_cost' ] = getFromDict (selected_cable ,'connector_cost' ,default = 0 )
418- joint_cost = getFromDict (selected_cable ,'joint_cost' ,default = 0 )
420+ # dd['connector_cost'] = getFromDict(selected_cable,'connector_cost',default=0)
421+ # joint_cost = getFromDict(selected_cable,'joint_cost',default=0)
419422 depth = cableConfig ['cableTypes' ][selected_cable ['sections' ][0 ]]['depth' ]
420423 for j in range (len (selected_cable ['sections' ])):
421424 dd ['cables' ].append (deepcopy (cableConfig ['cableTypes' ][selected_cable ['sections' ][j ]]))
@@ -426,9 +429,6 @@ def getCableDD(dd,selected_cable,cableConfig,cableType_def,connVal):
426429 cd ['voltage' ] = cableType_def [- 2 :]
427430
428431
429- # add joints as needed (empty for now)
430- if j < len (selected_cable ['sections' ])- 1 :
431- dd ['joints' ].append ({'cost' :joint_cost }) # default 0
432432
433433 # add routing if necessary
434434 if 'static' in dd ['cables' ][j ]['cable_type' ]:
@@ -444,6 +444,9 @@ def getCableDD(dd,selected_cable,cableConfig,cableType_def,connVal):
444444 cableConfig ['cableAppendages' ],
445445 depth
446446 )
447+ # add joints as needed (empty for now)
448+ if len (selected_cable ['sections' ])> 1 :
449+ dd ['joints' ].append (jAcondd )
447450 cd .update (Acondd )
448451 cd ['rJTube' ] = 5
449452 # for now reset these back
@@ -584,7 +587,7 @@ def getCableDesign(connVal, cableType_def, cableConfig, configType, depth=None):
584587 # else:
585588 # raise Exception(f"No cable matching the selection criteria found for cable {connVal['cable_id']}")
586589 dd = getCableDD (dd ,selected_cable ,cableConfig ,cableType_def ,connVal )
587- i_dc = [i for i ,sec in enumerate (dd ['cables' ]) if 'dynamic' in sec ['cable_type ' ]]
590+ i_dc = [i for i ,sec in enumerate (dd ['cables' ]) if 'dynamic' in sec ['type ' ]]
588591 dd ['name' ] = cableType_def
589592 dc_cands = []
590593 # pull out the dc definitions of candidate cables
0 commit comments