Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
soiling_losses = Float(0.0, iotype='in', desc = 'energy losses due to blade soiling for the wind plant - average across turbines', group='Plant_AEP')
array_losses = Float(0.06, iotype='in', desc = 'energy losses due to turbine interactions - across entire plant', group='Plant_AEP')
availability = Float(0.94287630736, iotype='in', desc = 'average annual availbility of wind turbines at plant', group='Plant_AEP')
thrust_coefficient = Float(0.50, iotype='in', desc='thrust coefficient at rated power', group='Plant_AEP')
max_efficiency = Float(0.90, iotype='in', desc = 'maximum efficiency of rotor and drivetrain - at rated power', group='Plant_AEP') # TODO: should come from drivetrain
# Extra TCC parameters
blade_number = Int(3, iotype='in', desc = 'number of rotor blades', group='Turbine_Cost')
offshore = Bool(True, iotype='in', desc = 'boolean for offshore', group='Global')
advanced_blade = Bool(False, iotype='in', desc = 'boolean for use of advanced blade curve', group='Turbine_Cost')
crane = Bool(True, iotype='in', desc = 'boolean for presence of a service crane up tower', group='Turbine_Cost')
advanced_bedplate = Int(0, iotype='in', desc= 'indicator for drivetrain bedplate design 0 - conventional', group='Turbine_Cost')
advanced_tower = Bool(False, iotype='in', desc = 'advanced tower configuration', group='Turbine_Cost')
# Extra Finance parameters
fixed_charge_rate = Float(0.12, iotype = 'in', desc = 'fixed charge rate for coe calculation', group='Plant_Finance')
construction_finance_rate = Float(0.00, iotype='in', desc = 'construction financing rate applied to overnight capital costs', group='Plant_Finance')
tax_rate = Float(0.4, iotype = 'in', desc = 'tax rate applied to operations', group='Plant_Finance')
discount_rate = Float(0.07, iotype = 'in', desc = 'applicable project discount rate', group='Plant_Finance')
construction_time = Float(1.0, iotype = 'in', desc = 'number of years to complete project construction', group='Plant_Finance')
project_lifetime = Float(20.0, iotype = 'in', desc = 'project lifetime for LCOE calculation', group='Plant_Finance')
#Outputs
turbine_cost = Float(iotype='out', desc = 'A Wind Turbine Capital _cost')
bos_costs = Float(iotype='out', desc='A Wind Plant Balance of Station _cost Model')
avg_annual_opex = Float(iotype='out', desc='A Wind Plant Operations Expenditures Model')
net_aep = Float(iotype='out', desc='A Wind Plant Annual Energy Production Model', units='kW*h')
coe = Float(iotype='out', desc='Levelized cost of energy for the wind plant')
opex_breakdown = VarTree(OPEXVarTree(),iotype='out')
bos_breakdown = VarTree(BOSVarTree(), iotype='out', desc='BOS cost breakdown')
#AEP outputs
rated_wind_speed = Float(11.506, units = 'm / s', iotype='out', desc='wind speed for rated power')
rated_rotor_speed = Float(12.126, units = 'rpm', iotype='out', desc = 'rotor speed at rated power')
rotor_thrust = Float(iotype='out', units='N', desc='maximum thrust from rotor')
----------
assembly : Assembly
an openmdao assembly to be configured
with_new_nacelle : bool
False uses the default implementation, True uses an experimental implementation designed
to smooth out discontinities making in amenable for gradient-based optimization
flexible_blade : bool
if True, internally solves the coupled aero/structural deflection using fixed point iteration.
Note that the coupling is currently only in the flapwise deflection, and is primarily
only important for highly flexible blades. If False, the aero loads are passed
to the structure but there is no further iteration.
"""
#SEAM variables ----------------------------------
#d2e = Float(0.73, iotype='in', desc='Dollars to Euro ratio'
assembly.add('rated_power',Float(3000., iotype='in', units='kW', desc='Turbine rated power', group='Global'))
assembly.add('hub_height', Float(100., iotype='in', units='m', desc='Hub height', group='Global'))
assembly.add('rotor_diameter', Float(110., iotype='in', units='m', desc='Rotor diameter', group='Global'))
# assembly.add('site_type',Enum('onshore', values=('onshore', 'offshore'), iotype='in', desc='Site type', group='Global'))
assembly.add('tower_bottom_diameter', Float(4., iotype='in', desc='Tower bottom diameter', group='Global'))
assembly.add('tower_top_diameter', Float(2., iotype='in', desc='Tower top diameter', group='Global'))
assembly.add('project_lifetime', Float(iotype = 'in', desc='Operating years', group='Global'))
assembly.add('rho_steel', Float(7.8e3, iotype='in', desc='density of steel', group='Tower'))
assembly.add('lifetime_cycles', Float(1.e7, iotype='in', desc='Equivalent lifetime cycles', group='Rotor'))
assembly.add('stress_limit_extreme_tower', Float(iotype='in', units='MPa', desc='Tower ultimate strength', group='Tower'))
assembly.add('stress_limit_fatigue_tower', Float(iotype='in', units='MPa', desc='Tower fatigue strength', group='Tower'))
assembly.add('safety_factor_tower', Float(iotype='in', desc='Tower loads safety factor', group='Tower'))
assembly.add('PMtarget_tower', Float(1., iotype='in', desc='', group='Tower'))
assembly.add('wohler_exponent_tower', Float(4., iotype='in', desc='Tower fatigue Wohler exponent', group='Tower'))
# Simulation inputs:
#RPM = 1000.0 # RPM
#throttle = 1.0 # Throttle Position
#thetastep = 1.0 # Sim time stepsize (crank angle deg)
# Outputs:
#power # Power at engine output (KW)
#torque # Torque at engine output (N*m)
#fuel_burn # Fuel burn rate (liters/sec)
#engine_weight # Engine weight estimation (kg)
# set up interface to the framework
# pylint: disable-msg=E1101
# "Instance of has no member"
stroke = Float(78.8, iotype='in', units='mm',
desc='Cylinder Stroke')
bore = Float(82.0, iotype='in', units='mm',
desc='Cylinder Bore')
conrod = Float(115.0, iotype='in', units='mm',
desc='Connecting Rod Length')
comp_ratio = Float(9.3, iotype='in',
desc='Compression Ratio')
spark_angle = Float(-37.0, iotype='in', units='deg',
desc = 'Spark Angle with respect to TDC (Top Dead Center)')
n_cyl = Int(6, iotype='in', desc = 'Number of Cylinders')
IVO = Float(11.0, iotype='in', units='deg',
desc = 'Intake Valve Open before TDC (Top Dead Center)')
IVC = Float(53.0, iotype='in', units='deg',
descc = 'Intake Valve Open after BDC (Bottom Dead Center)')
L_v = Float(8.0, iotype='in', units='mm',
desc='Maximum Valve Lift')
class TowerStruc(TowerStrucBase):
# geometry
z = Array(iotype='in', units='m', desc='locations along tower, linear lofting between')
d = Array(iotype='in', units='m', desc='tower diameter at corresponding locations')
t = Array(iotype='in', units='m', desc='shell thickness at corresponding locations')
n = Array(iotype='in', dtype=np.int, desc='number of finite elements between sections. array length should be one less than ``z``')
L_reinforced = Float(iotype='in', units='m', desc='reinforcement length for buckling')
soil = VarTree(SoilProperties(), iotype='in', desc='stiffness properties at base of foundation')
# material properties
E = Float(210e9, iotype='in', units='N/m**2', desc='material modulus of elasticity')
G = Float(80.8e9, iotype='in', units='N/m**2', desc='material shear modulus')
rho = Float(8500.0, iotype='in', units='kg/m**3', desc='material density')
sigma_y = Float(450.0e6, iotype='in', units='N/m**2', desc='yield stress')
# safety factors
gamma_f = Float(1.35, iotype='in', desc='safety factor on loads')
gamma_m = Float(1.1, iotype='in', desc='safety factor on materials')
gamma_n = Float(1.0, iotype='in', desc='safety factor on consequence of failure')
# outputs
f1 = Float(iotype='out', units='Hz', desc='first natural frequency')
f2 = Float(iotype='out', units='Hz', desc='second natural frequency')
tip_deflection = Float(iotype='out', units='m', desc='deflection of tower top in yaw-aligned +x direction')
z_stress = Array(iotype='out', units='m', desc='z-locations along tower where stress is evaluted')
stress = Array(iotype='out', units='N/m**2', desc='von Mises stress along tower on downwind side (yaw-aligned +x). normalized by yield stress. includes safety factors.')
z_buckling = Array(iotype='out', units='m', desc='z-locations along tower where shell buckling is evaluted')
buckling = Array(iotype='out', desc='a shell buckling constraint. should be <= 0 for feasibility. includes safety factors')
towerBottomDiameter = Float(6.0, units= 'm', iotype='in', desc= 'tower bottom diameter in m')
towerTopThickness = Float(0.0247, units= 'm', iotype='in', desc= 'tower top thickness in m')
towerBottomThickness = Float(0.0351, units= 'm', iotype='in', desc= 'tower bottom diameter in m')
# Plant configuration
# climate
shear_exponent = Float(0.1, iotype='in', desc= 'shear exponent for wind plant') #TODO - could use wind model here
shear_exponent = Float(9.52, units = 'm/s', iotype='in', desc='mean annual wind speed at 50 m height')
weibull_k= Float(2.10, iotype='in', desc = 'weibull shape factor for annual wind speed distribution')
altitude = Float(0.0, units = 'm', iotype='in', desc= 'altitude of wind plant')
air_density = Float(0.0, units = 'kg / (m * m * m)', iotype='in', desc= 'air density at wind plant site') # default air density value is 0.0 - forces aero csm to calculate air density in model
sea_depth = Float(20.0, units = 'm', iotype='in', desc = 'sea depth for offshore wind project')
distance_from_shore = Float(30.0, units = 'km', iotype='in', desc = 'distance of plant from shore')
soil_type = Str("Sand", iotype='in', desc = 'soil type at plant site')
# plant operation
soiling_losses = Float(0.0, iotype='in', desc = 'energy losses due to blade soiling for the wind plant - average across turbines')
array_losses = Float(0.10, iotype='in', desc = 'energy losses due to turbine interactions - across entire plant')
turbine_number = Int(100, iotype='in', desc = 'total number of wind turbines at the plant')
# financial
year = Int(2009, units = 'yr', iotype='in', desc = 'year of project start')
month = Int(12, units = 'mon', iotype='in', desc = 'month of project start')
fixedChargeRate = Float(0.12, iotype = 'in', desc = 'fixed charge rate for coe calculation')
constructionFinancingRate = Float(0.03, iotype = 'in', desc = 'financing construction rate')
taxRate = Float(0.4, iotype = 'in', desc = 'tax rate applied to operations')
discountRate = Float(0.07, iotype = 'in', desc = 'applicable project discount rate')
constructionTime = Float(1.0, iotype = 'in', desc = 'number of years to complete project construction')
project_lifetime = Float(20.0, iotype = 'in', desc = 'project lifetime for LCOE calculation')
# ------------- Outputs --------------
# See passthrough variables below
def __init__(self,inputs=None):
"""
tcc_a inputs:
advanced_blade = Bool
offshore = Bool
assemblyCostMultiplier = Float
overheadCostMultiplier = Float
profitMultiplier = Float
transportMultiplier = Float
"""
#assembly.replace('tcc_a', Turbine_CostsSE())
assembly.add('advanced_blade', Bool(True, iotype='in', desc='advanced (True) or traditional (False) blade design'))
assembly.add('offshore', Bool(iotype='in', desc='flag for offshore site'))
assembly.add('assemblyCostMultiplier',Float(0.0, iotype='in', desc='multiplier for assembly cost in manufacturing'))
assembly.add('overheadCostMultiplier', Float(0.0, iotype='in', desc='multiplier for overhead'))
assembly.add('profitMultiplier', Float(0.0, iotype='in', desc='multiplier for profit markup'))
assembly.add('transportMultiplier', Float(0.0, iotype='in', desc='multiplier for transport costs'))
# connections to turbine costs
assembly.connect('rotor.mass_one_blade', 'tcc_a.blade_mass')
assembly.connect('hub.hub_mass', 'tcc_a.hub_mass')
assembly.connect('hub.pitch_system_mass', 'tcc_a.pitch_system_mass')
assembly.connect('hub.spinner_mass', 'tcc_a.spinner_mass')
assembly.connect('nacelle.low_speed_shaft_mass', 'tcc_a.low_speed_shaft_mass')
assembly.connect('nacelle.main_bearing_mass', 'tcc_a.main_bearing_mass')
assembly.connect('nacelle.second_bearing_mass', 'tcc_a.second_bearing_mass')
assembly.connect('nacelle.gearbox_mass', 'tcc_a.gearbox_mass')
assembly.connect('nacelle.high_speed_side_mass', 'tcc_a.high_speed_side_mass')
assembly.connect('nacelle.generator_mass', 'tcc_a.generator_mass')
assembly.connect('nacelle.bedplate_mass', 'tcc_a.bedplate_mass')
assembly.connect('nacelle.yaw_system_mass', 'tcc_a.yaw_system_mass')
'information during CONMIN solution. Higher values are '
'more verbose. 0 suppresses all output.')
itmax = Int(10, iotype='in', desc='Maximum number of iterations before '
'termination.')
fdch = Float(.01, iotype='in', desc='Relative change in parameters '
'when calculating finite difference gradients'
' (only when CONMIN calculates gradient).')
fdchm = Float(.01, iotype='in', desc='Minimum absolute step in finite '
'difference gradient calculations'
' (only when CONMIN calculates gradient).')
icndir = Float(0, iotype='in', desc='Conjugate gradient restart. '
'parameter.')
ct = Float(-0.1, iotype='in', desc='Constraint thickness parameter.')
ctmin = Float(0.004, iotype='in', desc='Minimum absolute value of ct '
'used in optimization.')
ctl = Float(-0.01, iotype='in', desc='Constraint thickness parameter for '
'linear and side constraints.')
ctlmin = Float(0.001, iotype='in', desc='Minimum absolute value of ctl '
'used in optimization.')
theta = Float(1.0, iotype='in', desc='Mean value of the push-off factor '
'in the method of feasible directions.')
phi = Float(5.0, iotype='in', desc='Participation coefficient - penalty '
'parameter that pushes designs towards the feasible '
'region.')
delfun = Float(0.001, iotype='in', low=0.0,
desc='Relative convergence tolerance.')
dabfun = Float(0.001, iotype='in', low=1.0e-10,
desc='Absolute convergence tolerance.')
linobj = Bool(False, iotype='in', desc='Linear objective function flag. '
'Set to True if objective is linear.')
conmin_diff = Bool(False, iotype='in', desc='Set to True to let CONMIN'
'calculate the gradient.')
----------
assembly : Assembly
an openmdao assembly to be configured
with_new_nacelle : bool
False uses the default implementation, True uses an experimental implementation designed
to smooth out discontinities making in amenable for gradient-based optimization
flexible_blade : bool
if True, internally solves the coupled aero/structural deflection using fixed point iteration.
Note that the coupling is currently only in the flapwise deflection, and is primarily
only important for highly flexible blades. If False, the aero loads are passed
to the structure but there is no further iteration.
"""
# --- general turbine configuration inputs---
assembly.add('rho', Float(1.225, iotype='in', units='kg/m**3', desc='density of air', deriv_ignore=True))
assembly.add('mu', Float(1.81206e-5, iotype='in', units='kg/m/s', desc='dynamic viscosity of air', deriv_ignore=True))
assembly.add('shear_exponent', Float(0.2, iotype='in', desc='shear exponent', deriv_ignore=True))
assembly.add('hub_height', Float(90.0, iotype='in', units='m', desc='hub height'))
assembly.add('turbine_class', Enum('I', ('I', 'II', 'III'), iotype='in', desc='IEC turbine class'))
assembly.add('turbulence_class', Enum('B', ('A', 'B', 'C'), iotype='in', desc='IEC turbulence class class'))
assembly.add('g', Float(9.81, iotype='in', units='m/s**2', desc='acceleration of gravity', deriv_ignore=True))
assembly.add('cdf_reference_height_wind_speed', Float(90.0, iotype='in', desc='reference hub height for IEC wind speed (used in CDF calculation)'))
assembly.add('downwind', Bool(False, iotype='in', desc='flag if rotor is downwind'))
assembly.add('tower_dt', Float(iotype='in', units='m', desc='tower top diameter')) # update for jacket
assembly.add('generator_speed', Float(iotype='in', units='rpm', desc='generator speed'))
assembly.add('machine_rating', Float(5000.0, units='kW', iotype='in', desc='machine rated power'))
assembly.add('rna_weightM', Bool(True, iotype='in', desc='flag to consider or not the RNA weight effect on Moment'))
assembly.add('rotor', RotorSE())
if with_new_nacelle:
assembly.add('hub',HubSE())
if with_3pt_drive:
towerTopThickness = Float(0.0247, units= 'm', iotype='in', desc= 'tower top thickness in m')
towerBottomThickness = Float(0.0351, units= 'm', iotype='in', desc= 'tower bottom diameter in m')
# Plant configuration
# climate
shear_exponent = Float(0.1, iotype='in', desc= 'shear exponent for wind plant') #TODO - could use wind model here
shear_exponent = Float(9.52, units = 'm/s', iotype='in', desc='mean annual wind speed at 50 m height')
weibull_k= Float(2.10, iotype='in', desc = 'weibull shape factor for annual wind speed distribution')
altitude = Float(0.0, units = 'm', iotype='in', desc= 'altitude of wind plant')
air_density = Float(0.0, units = 'kg / (m * m * m)', iotype='in', desc= 'air density at wind plant site') # default air density value is 0.0 - forces aero csm to calculate air density in model
sea_depth = Float(20.0, units = 'm', iotype='in', desc = 'sea depth for offshore wind project')
distance_from_shore = Float(30.0, units = 'km', iotype='in', desc = 'distance of plant from shore')
soil_type = Str("Sand", iotype='in', desc = 'soil type at plant site')
# plant operation
soiling_losses = Float(0.0, iotype='in', desc = 'energy losses due to blade soiling for the wind plant - average across turbines')
array_losses = Float(0.10, iotype='in', desc = 'energy losses due to turbine interactions - across entire plant')
turbine_number = Int(100, iotype='in', desc = 'total number of wind turbines at the plant')
# financial
year = Int(2009, units = 'yr', iotype='in', desc = 'year of project start')
month = Int(12, units = 'mon', iotype='in', desc = 'month of project start')
fixedChargeRate = Float(0.12, iotype = 'in', desc = 'fixed charge rate for coe calculation')
constructionFinancingRate = Float(0.03, iotype = 'in', desc = 'financing construction rate')
taxRate = Float(0.4, iotype = 'in', desc = 'tax rate applied to operations')
discountRate = Float(0.07, iotype = 'in', desc = 'applicable project discount rate')
constructionTime = Float(1.0, iotype = 'in', desc = 'number of years to complete project construction')
project_lifetime = Float(20.0, iotype = 'in', desc = 'project lifetime for LCOE calculation')
# ------------- Outputs --------------
# See passthrough variables below
def __init__(self,inputs=None):
""" Creates a new LCOE Assembly object """
from openmdao.util.dotgraph import plot_graph
from jinja2 import Template
class Tree2(VariableTree):
d1 = Array(zeros((1, 2)))
class Tree1(VariableTree):
a1 = Float(3.)
vt1 = VarTree(Tree2())
class MyComp(Component):
x1 = Float(0.0, iotype='in')
x2 = Float(0.0, iotype='in')
x3 = Array(zeros((2, 1)), iotype='in')
x4 = Array(zeros((2, 2)), iotype='in')
vt = VarTree(Tree1(), iotype='in')
xx1 = Float(0.0, iotype='out')
xx2 = Float(0.0, iotype='out')
xx3 = Array(zeros((2, 1)), iotype='out')
xx4 = Array(zeros((2, 2)), iotype='out')
vvt = VarTree(Tree1(), iotype='out')
def execute(self):
""" doubler """
pass
def provideJ(self):