Commit b6eadb94 authored by Nicholas Noble's avatar Nicholas Noble
Browse files

added aep component

parent 6cacc0dd
__author__ = 's127504'
# unit aep_unit
from math import pow
import numpy as np
from scipy.optimize import minimize
from openmdao.main.api import Component
from openmdao.lib.datatypes.api import Float, Array, Bool
#--------------------------------------------------------------------------------------------
# Input Parameters
class SEAM_AEP(Component):
NWspPC = Float(iotype = 'in', desc = 'number of sections')
MeanWSP = Float(iotype = 'in', units = 'm/s', desc = 'mean wind speed') # [m/s]
AirDensity = Float(iotype = 'in', units = 'kg/m**3', desc = 'density of air') # [kg / m^3]
TurbulenceInt = Float(iotype = 'in', desc = '') # Fraction
RatedPower = Float(iotype = 'in', units = 'MW', desc = 'rated power') # [MW]
Diameter = Float(iotype = 'in', units = 'm', desc = 'diameter') # [m]
MaxCp = Float(iotype = 'in', desc = 'max CP') # Fraction
GearLossConst = Float(iotype = 'in', desc = '') # Fraction
GearLossVar = Float(iotype = 'in', desc = '') # Fraction
GenLoss = Float(iotype = 'in', desc = '') # Fraction
ConvLoss = Float(iotype = 'in', desc = '') # Fraction
WeibullInput = Float(iotype = 'in', desc = '') # 1(true) or 0 (false) if true WeiA and WeiC overrules MeanWSP. If false MeanWSP is used with Rayleigh distribution
WeiA_input = Float(iotype = 'in', units = 'm/s', desc = '') #[m/s]
WeiC_input = Float(iotype = 'in', desc = '') #[-]
min_wsp = Float(0.0, iotype = 'in', units = 'm/s', desc = 'min wind speed') #[m/s]
max_wsp = Float(iotype = 'in', units = 'm/s', desc = 'max wind speed') #[m/s]
NYears = Float(iotype = 'in', desc = 'Operating years')
AEP = Float(iotype = 'out', desc = 'Anual Electricity Output')
Total_AEP = Float(iotype = 'out', desc = 'AEP for total years of production')
def execute(self):
# Local Variables
# Procedure CalcPowerCurve
wsp = np.linspace(self.min_wsp, self.max_wsp, self.NWspPC)
P_aero = 0.5*self.AirDensity*(np.pi*(self.Diameter/2.)**2)*wsp**3*self.MaxCp/1000. #[kW]
P_gear = (P_aero-self.GearLossConst*self.RatedPower*1000-P_aero*self.GearLossVar)
for i, value in enumerate(P_gear):
if value < 0:
P_gear[i] = 0
P_gen = P_gear*(1-self.GenLoss)
P_conv = P_gen*(1-self.ConvLoss)
P_raw = np.zeros(P_conv.shape[0])
for i, value in enumerate(P_conv):
if value < self.RatedPower*1000:
P_raw[i] = P_conv[i]
else:
P_raw[i] = self.RatedPower*1000
#-------------------------------------------------------------------------------------------
def NDist(x, my, std):
NDist = (1./(np.sqrt(2*np.pi)*std))*np.exp(-(x-my)*(x-my)/(2.*std**2))
return NDist
#-------------------------------------------------------------------------------------------
# TurbulenceCorrection
NormDist = np.zeros((self.NWspPC-1,self.NWspPC))
sigma = wsp*self.TurbulenceInt
ProbSum = np.zeros(P_conv.shape[0])
for i in range(0,int(self.NWspPC)-1):
for j in range(0,int(self.NWspPC)):
NormDist[i][j] = NDist(wsp[j], wsp[i+1], sigma[i+1]) #Hvorfor Sigma med stort?
ProbSum[i] = ProbSum[i]+NormDist[i,j]
P_turb = np.zeros(P_conv.shape[0])
for i in range(0,int(self.NWspPC)):
P_turb[i] = 0
for i in range(1,int(self.NWspPC)):
for j in range(0,int(self.NWspPC)):
P_turb[i]=P_turb[i]+P_raw[j]*NormDist[i-1,j]/ProbSum[i-1]
#-------------------------------------------------------------------------------------------
# IntegratePC
if self.WeibullInput == 0: # False
self.WeibullC = 2.0
self.WeibullA = 1.1284*self.MeanWSP
elif self.WeibullInput == 1: # True
self.WeibullC = self.WeiC_input
self.WeibullA = self.WeiA_input
NHours = np.zeros(P_conv.shape[0])
NHours[0] = 8760*((1-np.exp(-np.exp(self.WeibullC*np.log((wsp[0]+0.5)/self.WeibullA)))))
for i in range(1,int(self.NWspPC)):
NHours[i] = 8760*((1-np.exp(-np.exp(self.WeibullC*np.log((wsp[i]+0.5)/self.WeibullA))))-(1-np.exp(-np.exp(self.WeibullC*np.log((wsp[i]-0.5)/self.WeibullA)))))
AEPprWSP = P_turb * NHours
AEPSum = np.sum(AEPprWSP/1000000.)
print 'AEP', AEPSum
Total_AEP = AEPSum*self.NYears
print 'Total AEP', Total_AEP, 'GWh'
#Just to check if the script worked
# if __name__ == '__main__':
#
# top = SEAM_AEP()
# top.NWspPC = 26
# top.MeanWSP = 6 # [m/s]
# top.AirDensity = 1.225 # [kg / m^3]
# top.TurbulenceInt = 0.1 # Fraction
# top.RatedPower = 3 # [MW]
# top.Diameter = 101 # [m]
# top.MaxCp = 0.49 # Fraction
# top.GearLossConst = 0.01 # Fraction
# top.GearLossVar = 0.014 # Fraction
# top.GenLoss = 0.03 # Fraction
# top.ConvLoss = 0.03 # Fraction
#
# top.WeibullInput = 1 # 1(true) or 0 (false) if true WeiA and WeiC overrules MeanWSP. If false MeanWSP is used with Rayleigh distribution
# top.WeiA_input = 11. #[m/s]
# top.WeiC_input = 2.00 #[-]
#
# top.min_wsp = 0 #[m/s]
# top.max_wsp = 25 #[m/s]
#
# top.NYears = 20
#
# top.execute()
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment