コード例 #1
0
ファイル: turbfuncs.py プロジェクト: WISDEM/Plant_EnergySE
def owtg_to_wtpc(owtg_file):
    ''' convert OWTG turbine definition file for openWind to FUSED-Wind ExtendedWindTurbinePowerCurveVT '''
    
    wtpc = ExtendedWindTurbinePowerCurveVT()
    tree = rwTurbXML.parseOWTG(owtg_file)
    
    if tree is None:
        sys.stderr.write('\n*** ERROR: could not parse turbine file "{:}"\n\n"'.format(owtg_file))
        return None
    
    vels, pwrs = rwTurbXML.getPwrTbls(tree)
    wtpc.power_curve = np.array([vels, pwrs]).transpose()
    
    vels, thrusts = rwTurbXML.getThrustTbls(tree)
    wtpc.c_t_curve = np.array([vels, thrusts]).transpose()
    
    vels, rpms = rwTurbXML.getRPMTbls(tree)
    wtpc.rpm_curve = np.array([vels, rpms]).transpose()
    
    name, capKW, hubHt, rtrDiam = rwTurbXML.getTurbParams(tree)
    wtpc.hub_height = hubHt
    wtpc.rotor_diameter = rtrDiam
    wtpc.power_rating = 1000.0 * capKW
    
    return wtpc
コード例 #2
0
ファイル: turbfuncs.py プロジェクト: WISDEM/Plant_EnergySE
def findOWTG(path, tname, debug=False):
    # find a *.owtg file in path that matches 'tname'
    # return turbine name, power rating in W
    
    fnames = os.listdir(path)
    for fname in fnames:
        if not fname.lower().endswith('.owtg'):
            continue
        tree = rwTurbXML.parseOWTG(path + '/' + fname)
        if tree is None:
            sys.stderr.write('\n*** ERROR: could not parse turbine file "{:}"\n\n"'.format(owtg_file))
            continue
        name, capKW, hubHt, rtrDiam = rwTurbXML.getTurbParams(tree)
        if name == tname:
            return fname, capKW*1000.0
    
    sys.stderr.write("\nNo OWTG files in {:} match name '{:}'\n".format(path, tname))
    return None, None