Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cmath>
- using namespace std;
- double UsableSteamEnergy (int BladeSurfaceArea, double SteamIn)
- {
- if (1.5*25*BladeSurfaceArea > SteamIn)
- return 10*SteamIn;
- else
- return 10*floor(1.5*25.0*BladeSurfaceArea);
- }
- double LiftTorque (int BladeSurfaceArea, double SteamIn)
- {
- double USE = UsableSteamEnergy(BladeSurfaceArea, SteamIn);
- return ((BladeSurfaceArea*(10*SteamIn-USE))/floor(SteamIn/25)+USE);
- }
- double InductionTorque (int CoilSize, double InductorDrag, int BladeSurfaceArea, int RotorMass)
- {
- return ((1.5*CoilSize*InductorDrag)/(BladeSurfaceArea*RotorMass));
- }
- double RotorEnergy (int CoilSize, double InductorDrag, int BladeSurfaceArea, int RotorMass, double SteamIn)
- {
- double LT = LiftTorque(BladeSurfaceArea, SteamIn);
- double IT = InductionTorque(CoilSize, InductorDrag, BladeSurfaceArea, RotorMass);
- return ((LT-RotorMass/10.0)/(IT+1/(4000.0*RotorMass)));
- }
- double RotorSpeed(int CoilSize, double InductorDrag, int BladeSurfaceArea, int RotorMass, double SteamIn)
- {
- double Energy = RotorEnergy(CoilSize, InductorDrag, BladeSurfaceArea, RotorMass, SteamIn);
- return Energy/(BladeSurfaceArea*RotorMass);
- }
- double TurbineEfficiency (double RotorSpeed)
- {
- if (RotorSpeed < 500)
- return 0.5;
- else
- return 0.25*(cos(RotorSpeed/(45.5*M_PI))+3);
- }
- double GeneratedEnergy(double InductorEfficiency, int CoilSize, double InductorDrag, int BladeSurfaceArea, int RotorMass, double SteamIn, double InductorBonus)
- {
- double RotorSpd = RotorSpeed(CoilSize, InductorDrag, BladeSurfaceArea, RotorMass, SteamIn);
- double TE = TurbineEfficiency(RotorSpd);
- double GeneratedEnergy = InductorEfficiency*TE*powf(1.5*CoilSize*InductorDrag*RotorSpd, InductorBonus);
- return GeneratedEnergy;
- }
- int binMax(double* arr, int start, int end)
- {
- if (start == end)
- return start;
- else
- {
- int a = binMax(arr, start, (end+start)/2);
- int b = binMax(arr, (end+start)/2+1, end);
- if (arr[a] > arr[b])
- return a;
- else
- return b;
- }
- }
- int main()
- {
- double InductorEfficiency;
- double InductorDrag;
- double InductorBonus;
- double SteamIn;
- int BladesPerLevel;
- cout<<"Inductor efficiency: ";
- cin>>InductorEfficiency;
- cout<<"\nInductor drag: ";
- cin>>InductorDrag;
- cout<<"\nInductor bonus: ";
- cin>>InductorBonus;
- cout<<"\nSteam in: ";
- cin>>SteamIn;
- cout<<"\nBlades per level: ";
- cin>>BladesPerLevel;
- double output[1000][1000];
- for (int i = 0; i < 1000; i++)
- for (int j = 0; j<1000; j++)
- output[i][j] = 0;
- int height = 2;
- int MaxCoilSize = 0;
- for (int CoilSize = 1; height <= 14; CoilSize++)
- {
- for (int BladeCount = 1; height <=14; BladeCount++)
- {
- height = (CoilSize+7)/8 + (BladeCount+BladesPerLevel-1)/BladesPerLevel;
- double out = GeneratedEnergy(InductorEfficiency, CoilSize, InductorDrag, BladeCount, 10*(height+BladeCount), SteamIn, InductorBonus);
- output[CoilSize][BladeCount] = out;
- }
- height = (CoilSize+7)/8 + 1;
- MaxCoilSize = CoilSize;
- }
- MaxCoilSize++;
- for (int CoilSize = 1; CoilSize < MaxCoilSize ; CoilSize++)
- {
- int BladeCount = binMax(output[CoilSize], 0, 999);
- cout<<"\n\n\nCoils:\t"<<CoilSize<<"\nBlades:\t"<<BladeCount<<"\nRF/t:\t"<<output[CoilSize][BladeCount]<<"\nRPM:\t"<<RotorSpeed(CoilSize, InductorDrag, BladeCount, 10*(((CoilSize+7)/8 + (BladeCount+BladesPerLevel-1)/BladesPerLevel)+BladeCount) , SteamIn);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement