Closed pgebraad closed 9 years ago
Could you put this code in a gist instead, since its now a mix of markdown formatted text and code
Frederik and Pierre suggested to use an approach with a case iterator and a aggregator. I will try that - with that. I am closing the issue.
I have a working code of a coupling of RotorSE/CCBlade with my FLORIS wake mode. I have tried to use some FUSED-wind standards. It is illustrated in attached figure. The code is below.
RotorSE/CCBlade computes the axial induction and C_P of each rotor, and feeds those factors into the FLORIS wake model, which calculates effective wind speeds and powers at each turbine. Depending on thpse effective wind speeds, the C_P and axial induction may change -- this feedback of wind speeds is not implemented yet however. Now, it works for below-rated only (constant TSR).
The code is very 'awkward' and messy I think. Mainly because of three reasons:
If you could give me some feedback on how I could create a better implementation of this idea, that would be great!
The code consists of three files: ExampleCall_florisRotorSE.py - Builds and runs an assembly of CCBladed models (one for each turbine), defines all the turbine properties, and runs the FLORIS wake model. floris.py - contains the FLORIS wake model florisRotorSE.py - contains some building blocks needed for the coupling
============== ExampleCall_florisRotorSE.py =================================
Builds and runs an assembly of CCBladed models and FLORIS wake model
from openmdao.main.api import Assembly from floris import FLORIS from florisRotorSE import AeroelasticHAWTVT_CCBlade, CCBladeAeroelasticHAWTVT, CCBladeCoefficients, AeroelasticHAWTVT_floris import os import numpy as np
Define flow properties
freestream_wind_speed = 8.0 # m/s air_density = 1.1716 # kg/m^3 wind_direction = 30 # deg viscosity = 1.81206e-5
define turbine positions
turbineX = np.array([1164.7, 947.2, 1682.4, 1464.9, 1982.6, 2200.1]) turbineY = np.array([1024.7, 1335.3, 1387.2, 1697.8, 2060.3, 1749.7])
create wind plant consisting of AeroelasticHAWTVT_floris turbines
florisWindPlant = FLORIS() for turbI in range(0,turbineX.size): wt = AeroelasticHAWTVT_floris()
create wind plant consisting of AeroelasticHAWTVT_floris turbines
FLORISplusCCBlade = Assembly() FLORISplusCCBlade.add('floris',florisWindPlant)
add CCBlade model for each turbine, and define workflow (first all CCBlade runs, then FLORIS)
workflow = [] for turbineI in range(0,turbineX.size): ccbladeName = 'CCblade%s' % turbineI FLORISplusCCBlade.add(ccbladeName,CCBladeCoefficients()) workflow.append(ccbladeName) workflow.append('floris') print workflow
FLORISplusCCBlade.driver.workflow.add(workflow)
for turbineI in range(0,turbineX.size):
Define flow properties in FLORIS
FLORISplusCCBlade.floris.wind_speed = freestream_wind_speed # m/s FLORISplusCCBlade.floris.air_density = air_density # kg/m^3 FLORISplusCCBlade.floris.wind_direction = wind_direction # deg
FLORISplusCCBlade.run()
print the CP and axial induction of each turbine
for turbineI in range(0,turbineX.size): florisTurbine = "turbine%s" % turbineI print getattr(FLORISplusCCBlade.floris.wt_layout,florisTurbine).axial_induction print getattr(FLORISplusCCBlade.floris.wt_layout,florisTurbine).CP
============= floris.py ====================== from fusedwind.plant_flow.comp import GenericWindFarm, GenericFlowModel from openmdao.lib.datatypes.api import Array, Float, VarTree from openmdao.main.api import VariableTree
import numpy as np
class FLORISParameters(VariableTree): """Container of FLORIS wake parameters"""
class FLORIS(GenericWindFarm, GenericFlowModel): """Evaluates the FLORIS model and gives the FLORIS-predicted powers of the turbines at locations turbineX, turbineY, and, optionally, the FLORIS-predicted velocities at locations (velX,velY)"""
def calcOverlapAreas(turbineX,turbineY,rotorDiameter,wakeDiameters,wakeCenters): """calculate overlap of rotors and wake zones (wake zone location defined by wake center and wake diameter) turbineX,turbineY is x,y-location of center of rotor
================= florisRotorSE.py ==================== from openmdao.main.api import Assembly, Component from openmdao.lib.datatypes.api import Array, Float, Bool, Int, List, Str, VarTree
from rotorse.rotoraerodefaults import CCBlade from rotorse.rotoraero import Coefficients from floris import FLORIS from fusedwind.turbine.turbine_vt import AeroelasticHAWTVT from fusedwind.plant_flow.comp import GenericWindFarm from floris import FLORIS
import os import numpy as np
class AeroelasticHAWTVT_floris(AeroelasticHAWTVT):
inherits from AeroelasticHAWTVT:
class AeroelasticHAWTVT_CCBlade(AeroelasticHAWTVT): """ AeroelasticHAWTVT with extra CCblade inputs and control inputs"""
class CCBladeAeroelasticHAWTVT(Assembly): """ CCBlade that takes AeroelasticHAWTVT_CCBlade as input """
class CCBladeCoefficients(Assembly): """ Couples components with CCBlade so that it outputs CP and CT coefficients and axial-induction factor takes AeroelasticHAWTVT_CCBlade as input """
class CTtoAxialInd(Component): """Convert thrust coefficient to axial induction factor"""