@@ -579,7 +579,7 @@ def updateSafetyFactors(self,key='tension',load='Tmax', prop='MBL',
579579
580580
581581
582- def createSubsystem (self , case = 0 , dd = None , ms = None ):
582+ def createSubsystem (self , case = 0 , dd = None , ms = None , ss_number = None ):
583583 ''' Create a subsystem for a line configuration from the design dictionary
584584
585585 Parameters
@@ -664,9 +664,15 @@ def createSubsystem(self, case=0, dd=None, ms=None):
664664
665665
666666 # add to the parent mooring system if applicable
667- if ms :
667+ if ms and ss_number is None :
668668 ms .lineList .append (ss )
669669 ss .number = len (ms .lineList )
670+ # assign in to correct entry in ms if ss number provided
671+ elif ms and ss_number :
672+ ms .lineList [ss_number - 1 ] = ss
673+ ss .number = ss_number
674+ elif ss_number :
675+ ss .number = ss_number
670676
671677 # save to ss
672678 self .ss = ss
@@ -871,7 +877,7 @@ def ddSave(self):
871877 return self.dd
872878 """
873879
874- def updateState (self , stateDict ):
880+ def updateState (self , stateDict , ms = None ):
875881 '''
876882 Updates the state of the mooring system based on the provided state dictionary.
877883
@@ -906,11 +912,12 @@ def updateState(self, stateDict):
906912 # 4. Apply marine growth if specified
907913 if 'marineGrowth' in stateDict :
908914 mgDict = stateDict ['marineGrowth' ]
909- self .addMarineGrowth (mgDict )
915+ self .addMarineGrowth (mgDict , ms = ms )
910916
911917
912918 def addMarineGrowth (self , mgDict , starting_ss = None ,
913- updateDepths = True , tol = 2 , display = False ):
919+ updateDepths = True , tol = 2 , display = False ,
920+ ms = None ):
914921 '''Re-creates sections part of design dictionary to account for marine
915922 growth on the subystem, then calls createSubsystem() to recreate the line
916923
@@ -932,7 +939,7 @@ def addMarineGrowth(self, mgDict, starting_ss=None,
932939
933940 '''
934941
935- def getMG (mgDict , oldLine = None ):
942+ def getMG (mgDict , oldLine = None , ms = None , ss_number = None ):
936943 # set location of reference mooring object
937944 # if project: # use pristine line
938945 # oldLine = project.mooringListPristine[idx]
@@ -942,7 +949,13 @@ def getMG(mgDict, oldLine=None):
942949 raise Exception ('addMarineGrowth not set up to work with parallels at this time' )
943950 # create a reference subsystem if it doesn't already exist
944951 if not oldLine :
945- oldLine = self .createSubsystem ()
952+ if self .shared :
953+ oldLine = self .createSubsystem (case = 1 ,
954+ ms = ms ,
955+ ss_number = ss_number )
956+ else :
957+ oldLine = self .createSubsystem (ms = ms ,
958+ ss_number = ss_number )
946959
947960 # set up variables
948961 LTypes = [] # list of line types for new lines (types listed are from reference object)
@@ -1167,7 +1180,7 @@ def getMG(mgDict, oldLine=None):
11671180
11681181 # add line details to dictionary
11691182 ndt ['material' ] = Mats [j ]
1170- ndt ['name' ] = str (j )
1183+ ndt ['name' ] = str (j )+ ndt [ 'material' ] + '_' + str ( ndt [ 'd_nom' ]) + '_mg'
11711184 if 'MBL' in oldLine .lineTypes [ltyp ]:
11721185 ndt ['MBL' ] = oldLine .lineTypes [ltyp ]['MBL' ]
11731186 if 'cost' in oldLine .lineTypes [ltyp ]:
@@ -1196,9 +1209,14 @@ def getMG(mgDict, oldLine=None):
11961209
11971210 # call createSubsystem() to make moorpy subsystem with marine growth
11981211 if self .shared :
1199- self .createSubsystem (case = 1 ,dd = nd1 )
1212+ self .createSubsystem (case = 1 ,
1213+ dd = nd1 ,
1214+ ms = ms ,
1215+ ss_number = ss_number )
12001216 else :
1201- self .createSubsystem (dd = nd1 )
1217+ self .createSubsystem (dd = nd1 ,
1218+ ms = ms ,
1219+ ss_number = ss_number )
12021220
12031221 return (changeDepths ,changePoints )
12041222 #####################################################################
@@ -1207,13 +1225,18 @@ def getMG(mgDict, oldLine=None):
12071225 ss = deepcopy (starting_ss )
12081226 else :
12091227 ss = deepcopy (self .ss )
1228+ ss_number = ss .number
12101229
12111230 if updateDepths :
1231+ # call getMG in a while loop until the settled depth matches the required change depth
12121232 mgDict1 = deepcopy (mgDict )
12131233 cEq = tol + 1
12141234 ct = 0
12151235 while (cEq > tol ):
1216- changeDepths ,changePoints = getMG (mgDict1 , oldLine = ss )
1236+ changeDepths ,changePoints = getMG (mgDict1 ,
1237+ oldLine = ss ,
1238+ ms = ms ,
1239+ ss_number = ss_number )
12171240 D = []
12181241 for d in range (0 ,len (changeDepths )):
12191242 diff = mgDict [changeDepths [d ][0 ]][changeDepths [d ][1 ]] - self .ss .pointList [changePoints [d ]].r [2 ]
0 commit comments