MHKiT-Python provides the marine renewable energy (MRE) community tools for data processing, visualization, quality control, resource assessment, and device performance.
Need to add functionality for reading in different types of mooring lines in the io module.
Mooring modular added in #235
# TODO: get rod type property sets
if line.count('---') > 0 and (line.upper().count('ROD DICTIONARY') > 0 or line.upper().count('ROD TYPES') > 0):
# skip this header line, plus channel names and units lines
line = next(f)
# line = next(f)
# line = next(f)
# RodDict = dict()
# while line.count('---') == 0:
# entries = line.split()
# #RodTypesName.append(entries[0]) # name string
# #RodTypesD.append( entries[1]) # diameter
# RodDict[entries[0]] = entries[1] # add dictionary entry with name and diameter
# line = next(f)
# #ds.attrs['ROD_TYPES'] = RodDict
# TODO: get properties of each Body
if line.count('---') > 0 and (line.upper().count('BODIES') > 0 or line.upper().count('BODY LIST') > 0 or line.upper().count('BODY PROPERTIES') > 0):
# skip this header line, plus channel names and units lines
line = next(f)
# line = next(f)
# line = next(f)
# while line.count('---') == 0:
# entries = line.split()
# entry0 = entries[0].lower()
# num = np.int("".join(c for c in entry0 if not c.isalpha())) # remove alpha characters to identify Body #
# if ("fair" in entry0) or ("coupled" in entry0) or ("ves" in entry0): # coupled case
# bodyType = -1
# elif ("con" in entry0) or ("free" in entry0): # free case
# bodyType = 0
# else: # for now assuming unlabeled free case
# bodyType = 0
# # if we detected there were unrecognized chars here, could: raise ValueError(f"Body type not recognized for Body {num}")
# #bodyType = -1 # manually setting the body type as -1 for FAST.Farm SM investigation
# r6 = np.array(entries[1:7], dtype=float) # initial position and orientation [m, rad]
# r6[3:] = r6[3:]*np.pi/180.0 # convert from deg to rad
# rCG = np.array(entries[7:10], dtype=float) # location of body CG in body reference frame [m]
# m = np.float_(entries[10]) # mass, centered at CG [kg]
# v = np.float_(entries[11]) # volume, assumed centered at reference point [m^3]
# #self.bodyList.append( Body(self, num, bodyType, r6, m=m, v=v, rCG=rCG) )
# line = next(f)
# TODO: get properties of each rod
if line.count('---') > 0 and (line.upper().count('RODS') > 0 or line.upper().count('ROD LIST') > 0 or line.upper().count('ROD PROPERTIES') > 0):
# skip this header line, plus channel names and units lines
line = next(f)
# line = next(f)
# line = next(f)
# while line.count('---') == 0:
# entries = line.split()
# entry0 = entries[0].lower()
# num = np.int("".join(c for c in entry0 if not c.isalpha())) # remove alpha characters to identify Rod #
# lUnstr = 0 # not specified directly so skip for now
# #dia = RodDict[entries[2]] # find diameter based on specified rod type string
# nSegs = np.int(entries[9])
# # additional things likely missing here <<<
# #RodList.append( Line(dirName, num, lUnstr, dia, nSegs, isRod=1) )
# line = next(f)
Need to add functionality for reading in different types of mooring lines in the io module. Mooring modular added in #235