Wind Turbine Capacitor
This script will calculate the amount of watts of energy an object can store based on certain variables.
Variables:
Variable Type | Variable Type |
Air Density | Air Pressure |
Coefficient of Perfomance | Cloud Cover |
Curent Position | Gas Constant |
Gearbox/Bearings Efficiency | Generator Efficiency |
Rotor Size | Rotor Swept Area |
Sea Level | Sun Angle |
Temperature | Wind Speed |
Capacitor Script:
float Area;
float base;
float Capacitor;
float GasConstant;
float pascal;
float Power;
float sealevel = 101.32500;
float temperatureF;
float temperatureK;
float WindSpeed;
vector Scale;
vector sun;
vector pos;
default
{
state_entry()
{
llSetTimerEvent(1);
}
timer()
{
//Get Sun Angle
sun = llGetSunDirection();
//Calculate Rotor Size
Scale = llGetScale();
//Get Current Position
pos = llGetPos();
//Air Pressure Non Relative To Sea Level
base = llLog10(5- ((pos.z - llWater(ZERO_VECTOR))/15500));
//Calculate Air Pressure In KiloPascal
pascal = (sealevel + base);
//Calculate Wind Speed
WindSpeed = llVecMag(llWind(<0.0, 0.0, 0.0>));
//Calculate Gas Constant
GasConstant = ((200 * llCloud(<0.0, 0.0, 0.0>)) + 280);
//Calculate Temperature In Degrees Fahrenheit
temperatureF = ((((pascal * (2 * llPow(10,22)))/ (1.8311*llPow(10,20))/ 8.314472)/19.85553747) + (sun.z * 10));
//Convert Termperature To Kelvin
temperatureK = ((temperatureF + 459.67) * 5/9);
//Calculate Rotor Swept Area
Area = (2 * PI * (Scale.x * Scale.x)) + (2 * PI * Scale.x * Scale.y);
//Calculate Power Output
Power = 0.5 * (pascal / (GasConstant * temperatureK)) * Area * 0.35 * WindSpeed * 0.75 * .95;
Capacitor += Power;
llSetText((string)Capacitor + " watts stored",<1,1,1>,1);
}
}
Formulas:
Wind Turbine Power:
P = 0.5 x rho x A x Cp x V3 x Ng x Nb
where:
P = power in watts (746 watts = 1 hp) (1,000 watts = 1 kilowatt)
rho = air density (about 1.225 kg/m3 at sea level, less higher up)
A = rotor swept area, exposed to the wind (m2)
Cp = Coefficient of performance (.59 {Betz limit} is the maximum thoretically possible, .35 for a good design)
V = wind speed in meters/sec (20 mph = 9 m/s)
Ng = generator efficiency (50% for car alternator, 80% or possibly more for a permanent magnet generator or grid-connected induction generator)
Nb = gearbox/bearings efficiency (depends, could be as high as 95% if good)
D = P / (R * T)
where: D = density, kg/m3
P = pressure, Pascals ( multiply mb by 100 to get Pascals)
R = gas constant , J/(kg*degK) = 287.05 for dry air
T = temperature, degK = deg C + 273.15
Dry air = 280
Wet air = 480
Area = (2 * PI * x^2) + (2 * Pi * x * z)