The programming language is C++ All the information needed is provided below Pro
ID: 3747752 • Letter: T
Question
The programming language is C++
All the information needed is provided below
Problem 1. Compute the power outputs from three aligned wind turbines. In wind plants, wind turbines are grouped together to generate electricity. A wind turbine extracting energy from the incoming wind leaves a wake in its downwind, which reduces the available energy for the downwind turbines and the performance of the whole wind farm. In this problem, we compute the power from three wind turbines shown in figure 1. The wind blows in the positive r direction. The undisturbed incoming wind speed is uco The power generated by a turbine can be calculated by where p is the air density, To is the rotor radius, uin is the incoming wind speed of this turbine, Cp is the power coefficient computed by Cp = 4a(1-a)2 T1 T2 T3 x2 x3 Figure 1: Schematic of three aligned turbines.Explanation / Answer
As i am from Computer Science Background, i dont have any idea about this turbine design.
From the problem i am not even sure about xt and how to calculate r or wake radius.
But, as far as i understand, you need help in formulating the c++ code using all the classes and methods. I am providing that. If any modification is required due to misunderstanding of the formula, please update accordingly.
#include <iostream>
#include<bits/stdc++.h>
using namespace std;
//this is the turbine class
class turbine {
//public is the access specifier for the class
public :
//creating private variables
private: float alpha;
private: int r0;
private:int u;
private: float a; // 0.1 ~ 0.3
private: double power;
//x1,x2,x3 are the coordinates of the turbine in the positive direction
private: int x1;
private: int x2;
private: int x3;
//v is the new velocity after the air leaves the turbine
private: float v;
private: float r;
//r is the wake radius
//xt1,xt2,xt3 all are turbine downwind coordinates(as far as i understood)
private: int xt1;
private: int xt2;
private: int xt3;
private: float Cp;
private: float ro;
//default constructor
public : turbine() {
alpha = 0.1;
r0 = 50;
u = 10;
}
//because we used private variables we will need getter and setter method to update and access those variables
public: void set_variables(int i, int j, int k, int l, int m, int n) {
x1 = i;
x2 = j;
x3 = k;
xt1 = l;
xt2 = m;
xt3 = n;
}
public: float getCp() {
return Cp;
}
public: float getalpha() {
return alpha;
}
public: int getr0() {
return r0;
}
public: int getu(){
return u;
}
public: void setv(int i) {
v = i;
}
public: float getv() {
return v;
}
public: float getr() {
return r;
}
public: int getx1(){
return x1;
}
public: int getx2(){
return x2;
}
public: int getx3(){
return x3;
}
public: int getxt3(){
return xt3;
}
public: int getxt1(){
return xt1;
}
public: int getxt2(){
return xt2;
}
public: void setro(float i) {
ro = ro;
}
public: float getro() {
return ro;
}
public: void seta(float i) {
a = i;
Cp = 4 * a * (1 - a)*(1 - a);
}
public: float geta() {
return a;
}
public : void setpower(double j) {
power = j;
}
public : double getpower() {
return power;
}
public : float computewake_radius(int i, float j, int k, int l);
public : float computespeed(float i, float j);
public : float computepower(int i, float j, float k, float l);
public : void printpower(double i);
};
float turbine :: computewake_radius(int r0, float alpha, int x1, int xt1) {
return r0 + alpha* (x1 - xt1);
}
float turbine :: computespeed (float a, float newratio) {
return (1 - 2 * a * newratio * newratio);
}
float turbine :: computepower(int r0, float ro, float Cp, float v) {
return 0.5 * Cp * ro * r0 * r0 * v * v * v;
}
void turbine :: printpower(double power){
cout << "Final Power is" << " " << power << endl;
}
int main ()
{
turbine t;
int a;
int b;
int c;
int d;
int e;
int f;
scanf("%d %d %d %d %d %d",&a,&b,&c,&d,&e,&f);
// scanning x1, x2, x3, xt1,xt2,xt3 from user
//scanning the parameter ro
float ro;
scanf("%f",&ro);
int g;
scanf("%d",&g);
//scanning induction parameter
t.set_variables(a,b,c,d,e,f);
t.setro(ro);
t.seta(g);
double power = 0;
float v = (float)t.getu();
ro = t.getro();
float Cp = t.getCp();
float r0 = t.getr0();
power += t.computepower(r0, ro, Cp,v);//power output from first turbine
printf("Output after first turbine : %lf ",power);
float newr = t.computewake_radius(t.getr0() , t.getalpha() ,t.getx1(),t.getxt1());
float newratio = t.getr0() / newr;
float newv = t.computespeed(t.geta() , newratio);
newv *= v;
t.setv(newv);
v = t.getv();
power += t.computepower(r0, ro, Cp,v);//power output after second turbine
printf("Output after Second turbine : %lf ",power);
newr = t.computewake_radius(t.getr0() , t.getalpha() ,t.getx1(),t.getxt1());
newratio = t.getr0() / newr;
newv = t.computespeed(t.geta() , newratio);
newv *= v;
t.setv(newv);
v = t.getv();
power += t.computepower(r0, ro, Cp,v);;//power output after third turbine
t.setpower(power);
printf("Output after Third turbine : %lf ",power);
power = t.getpower();
t.printpower(power);
}
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.