Skip to content

Commit

Permalink
Created Subsystem.loadData class to facilitate loading MoorDyn
Browse files Browse the repository at this point in the history
results into a subsystem. It has a line_IDs argument to specify
the MoorDyn line numbers that correspond to the lineList.
  • Loading branch information
mattEhall committed Dec 15, 2023
1 parent ef5f643 commit 273937e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 4 deletions.
9 changes: 6 additions & 3 deletions moorpy/line.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def __init__(self, mooringSys, num, L, lineType, nSegs=100, cb=0, isRod=0, attac
self.fCurrent = np.zeros(3) # total current force vector on the line [N]


def loadData(self, dirname, rootname, sep='.MD.'):
def loadData(self, dirname, rootname, sep='.MD.', id=0):
'''Loads line-specific time series data from a MoorDyn output file'''

self.qs = 0 # signals time series data
Expand All @@ -86,8 +86,11 @@ def loadData(self, dirname, rootname, sep='.MD.'):
strtype='Rod'
elif self.isRod==0:
strtype='Line'

filename = dirname+rootname+sep+strtype+str(self.number)+'.out'

if id==0:
id = self.number

filename = dirname+rootname+sep+strtype+str(id)+'.out'

if path.exists(filename):

Expand Down
21 changes: 20 additions & 1 deletion moorpy/subsystem.py
Original file line number Diff line number Diff line change
Expand Up @@ -570,4 +570,23 @@ def calcCurvature(self):
self.Ks = curvature

return curvature



def loadData(self, dirname, rootname, line_IDs):
'''Load data from MoorDyn into the Subsystem lineList.
dirname
folder where output files are located
rootname
root name of the OpenFAST primary file (.fst)
line_IDs : list
list of the line numbers (of MoorDyn) that correspond to the
lineList. These are the numbers of the line.out file to load.
'''

self.qs = 0 # indicate this Subsystem is reading in MoorDyn data

for i, line in enumerate(self.lineList):
line.loadData(dirname, rootname, line_IDs[i])

0 comments on commit 273937e

Please sign in to comment.