def getEC(workbook, owexe, delFiles=True):
    # get default energy capture for a workbook
    
    rpath = 'gtpReport.txt'
    scriptname = 'gtpScript.xml'
    
    # Write script with: load workbook, energy capture, exit
    
    scripttree, ops = rwScriptXML.newScriptTree(rpath)
    rwScriptXML.makeChWkbkOp(ops,workbook)       # change workbook
    rwScriptXML.makeEnCapOp(ops, wm = "DAWM Eddy-Viscosity" ) # energy capture
    rwScriptXML.makeExitOp(ops)                 # exit
    rwScriptXML.wrtScript(scripttree, scriptname, addCols=True)
    
    # Run openwind script
    
    retcode = subprocess.call([owexe, scriptname])
    
    # Parse output and return
    
    gross_aep, array_aep, net_aep, owTrbs = openWindUtils.rdReport(rpath)
    
    if delFiles:
        try:
            os.remove(scriptname)
            os.remove(rpath)
        except:
            sys.stderr.write('\nERROR *** could not delete {:} or {:}\n\n'.format(scriptname, rpath))
        
    return gross_aep, array_aep, net_aep
Beispiel #2
0
def getEC(workbook, owexe, delFiles=True):
    # get default energy capture for a workbook

    rpath = 'gtpReport.txt'
    scriptname = 'gtpScript.xml'

    # Write script with: load workbook, energy capture, exit

    scripttree, ops = rwScriptXML.newScriptTree(rpath)
    rwScriptXML.makeChWkbkOp(ops, workbook)  # change workbook
    rwScriptXML.makeEnCapOp(ops, wm="DAWM Eddy-Viscosity")  # energy capture
    rwScriptXML.makeExitOp(ops)  # exit
    rwScriptXML.wrtScript(scripttree, scriptname, addCols=True)

    # Run openwind script

    retcode = subprocess.call([owexe, scriptname])

    # Parse output and return

    gross_aep, array_aep, net_aep, owTrbs = openWindUtils.rdReport(rpath)

    if delFiles:
        try:
            os.remove(scriptname)
            os.remove(rpath)
        except:
            sys.stderr.write(
                '\nERROR *** could not delete {:} or {:}\n\n'.format(
                    scriptname, rpath))

    return gross_aep, array_aep, net_aep
Beispiel #3
0
def getTurbPos(workbook, owexe, delFiles=True):
    '''
      Run openWind executable 'owexe' 
        - do an energy capture on 'workbook'
        - return xy[nturb][2] with coordinates of turbines
    '''

    rpath = 'gtpReport.txt'
    scriptname = 'gtpScript.xml'

    # Write script with: load workbook, energy capture, exit

    scripttree, ops = rwScriptXML.newScriptTree(rpath)
    scripttree.find('TurbineXField').set('value', 'true')
    scripttree.find('TurbineYField').set('value', 'true')

    scripttree.find('TurbineTypeField').set('value',
                                            'true')  # added 2014 09 29

    rwScriptXML.makeChWkbkOp(ops, workbook)  # change workbook
    rwScriptXML.makeEnCapOp(ops, wm="DAWM Eddy-Viscosity")  # energy capture
    rwScriptXML.makeExitOp(ops)  # exit
    rwScriptXML.wrtScript(scripttree, scriptname, addCols=True)

    # Run openwind script

    retcode = subprocess.call([owexe, scriptname])

    # Parse output and return

    gross_aep, array_aep, net_aep, owTrbs = openWindUtils.rdReport(rpath)
    nturb = len(owTrbs)
    xy = [[0, 0] for i in range(nturb)]
    ttypes = ['none' for i in range(nturb)]
    for i in range(nturb):
        xy[i][0] = owTrbs[i].x
        xy[i][1] = owTrbs[i].y
        ttypes[i] = owTrbs[i].ttype

    if delFiles:
        try:
            os.remove(scriptname)
            os.remove(rpath)
        except:
            sys.stderr.write(
                '\nERROR *** could not delete {:} or {:}\n\n'.format(
                    scriptname, rpath))

    return xy, ttypes
def getTurbPos(workbook, owexe, delFiles=True):
    '''
      Run openWind executable 'owexe' 
        - do an energy capture on 'workbook'
        - return xy[nturb][2] with coordinates of turbines
    '''
    
    rpath = 'gtpReport.txt'
    scriptname = 'gtpScript.xml'
    
    # Write script with: load workbook, energy capture, exit
    
    scripttree, ops = rwScriptXML.newScriptTree(rpath)
    scripttree.find('TurbineXField').set('value','true')
    scripttree.find('TurbineYField').set('value','true')
    
    scripttree.find('TurbineTypeField').set('value','true') # added 2014 09 29
    
    rwScriptXML.makeChWkbkOp(ops,workbook)       # change workbook
    rwScriptXML.makeEnCapOp(ops, wm = "DAWM Eddy-Viscosity" ) # energy capture
    rwScriptXML.makeExitOp(ops)                 # exit
    rwScriptXML.wrtScript(scripttree, scriptname, addCols=True)
    
    # Run openwind script
    
    retcode = subprocess.call([owexe, scriptname])
    
    # Parse output and return
    
    gross_aep, array_aep, net_aep, owTrbs = openWindUtils.rdReport(rpath)
    nturb = len(owTrbs)
    xy = [[0,0] for i in range(nturb)]
    ttypes = ['none' for i in range(nturb)]
    for i in range(nturb):
        xy[i][0] = owTrbs[i].x
        xy[i][1] = owTrbs[i].y
        ttypes[i] = owTrbs[i].ttype

    if delFiles:
        try:
            os.remove(scriptname)
            os.remove(rpath)
        except:
            sys.stderr.write('\nERROR *** could not delete {:} or {:}\n\n'.format(scriptname, rpath))
        
    return xy, ttypes