diff --git a/aerodynamic_analysis/src/methods/viscDragRaymer.cpp b/aerodynamic_analysis/src/methods/viscDragRaymer.cpp index 16fd4b188e2938e46b12f8459a6f101d5c0f2460..149118cbb7f7f112a3d0fdf06657c24d3dc28545 100644 --- a/aerodynamic_analysis/src/methods/viscDragRaymer.cpp +++ b/aerodynamic_analysis/src/methods/viscDragRaymer.cpp @@ -409,16 +409,13 @@ double viscDragRaymer::calculateViscDragNacelles(const Polar& aPolar) { // [Ray18] p. 280 ff. (pdf p. 294 ff.) myRuntimeInfo->debug << " - Get viscous drag Nacelles ..." << endl; double CDvisc_Nacelles(0.0); - double reynoldsNumberNacelles = getReynoldsNumber(l_Nacelles, aPolar.altitude, aPolar.MachNumber, delta_isa); - double Cf; - double FF; // Reynolds number of component - reynoldsNumberNacelles = getReynoldsNumber(l_Nacelles, aPolar.altitude, aPolar.MachNumber, delta_isa); + double reynoldsNumberNacelles = getReynoldsNumber(l_Nacelles, aPolar.altitude, aPolar.MachNumber, delta_isa); // Friction Coefficient (turbulent) for nacelles - Cf = getFrictionCoefficient(aPolar.MachNumber, reynoldsNumberNacelles); + double Cf = getFrictionCoefficient(aPolar.MachNumber, reynoldsNumberNacelles); // Form factor for components double f_Nacelles = l_Nacelles / sqrt(maxHeightNacelles * maxWidthNacelles); - FF = 1 + (0.35 / f_Nacelles); + double FF = 1 + (0.35 / f_Nacelles); // Store components CDvisc_Nacelles = theAircraftComponents.myNacelles.size() * Cf * FF * QC_Nacelles * Swet_Nacelles / Sref_Wing; return CDvisc_Nacelles; diff --git a/aerodynamic_analysis/src/taw/tawDefaultStrategy.cpp b/aerodynamic_analysis/src/taw/tawDefaultStrategy.cpp index c639cead9f774061d03a56c852cd1089aba0dcdb..23532b5a6247ae6e09e653f7c6d6e6f86fda6e1f 100644 --- a/aerodynamic_analysis/src/taw/tawDefaultStrategy.cpp +++ b/aerodynamic_analysis/src/taw/tawDefaultStrategy.cpp @@ -129,8 +129,9 @@ void tawDefaultStrategy::createAircraftGeometry(const double stabAngle) { geom2::MultisectionSurface<geom2::AirfoilSection> HTP = HTPFactory.create("empennage/specific/geometry/aerodynamic_surface@1"); offset = htp_position - CGAL::ORIGIN; HTP.origin += offset; - double designStabAngle = HTP.sections.front().get_twist_angle(); - HTP.sections.front().set_twist_angle(designStabAngle + convertUnit(DEGREE, RADIAN, stabAngle)); + for (geom2::AirfoilSection& an_htp_section : HTP.sections) { // add twist angle to every htmp section (for all movable stabilizer) + an_htp_section.set_twist_angle(an_htp_section.get_twist_angle() + convertUnit(DEGREE, RADIAN, stabAngle)); + } liftingSurfaces.push_back(HTP); // create fuselage geom2::FuselageFactory fuselageFactory{AcXML, rtIO_->getGeometryDir()}; @@ -574,6 +575,7 @@ void tawDefaultStrategy::clearDataForNextCalculationRun() { currentPolarSet.cleanPolars.clear(); currentPolarSet.highLiftPolars.clear(); liftingSurfaces.clear(); + nacelles.clear(); } void tawDefaultStrategy::doTrimInterpolation() { diff --git a/performance_assessment/src/taw/defaultMethods/aircraft.cpp b/performance_assessment/src/taw/defaultMethods/aircraft.cpp index 3792ed0ac062c0fb8750a4be666d23c6fcf3c07c..9550370172a72c38e257e98694acab689a971bc3 100644 --- a/performance_assessment/src/taw/defaultMethods/aircraft.cpp +++ b/performance_assessment/src/taw/defaultMethods/aircraft.cpp @@ -63,7 +63,7 @@ aircraft::aircraft(const std::shared_ptr<RuntimeIO>& rtIO, const std::shared_ptr VMO = EndnodeReadOnly<double>( "/aircraft_exchange_file/requirements_and_specifications/requirements/top_level_aircraft_requirements/flight_envelope/maximum_operating_velocity") .read(rtIO->acxml).value(); - MDive = EndnodeReadOnly<double>("/assessment/performance/speed/dive_mach_number", 0.).read(rtIO->acxml).value(); + MDive = EndnodeReadOnly<double>("/aircraft_exchange_file/assessment/performance/speed/dive_mach_number", 0.).read(rtIO->acxml).value(); VDive = EndnodeReadOnly<double>("/aircraft_exchange_file/assessment/performance/speed/dive_velocity", 0.).read(rtIO->acxml).value(); MInitialCruise = EndnodeReadOnly<double>( "/aircraft_exchange_file/requirements_and_specifications/requirements/top_level_aircraft_requirements/design_mission/initial_cruise_mach_number") diff --git a/performance_assessment/src/taw/defaultMethods/enginePerformance/low_fidelity/enginePerformance.cpp b/performance_assessment/src/taw/defaultMethods/enginePerformance/low_fidelity/enginePerformance.cpp index a8731c8eac0900bc15fee28d752e4596e9ce82df..2fbbd44bba8763cc7e816857808d378cb25f9e42 100644 --- a/performance_assessment/src/taw/defaultMethods/enginePerformance/low_fidelity/enginePerformance.cpp +++ b/performance_assessment/src/taw/defaultMethods/enginePerformance/low_fidelity/enginePerformance.cpp @@ -37,10 +37,10 @@ enginePerformance::~enginePerformance() { } void enginePerformance::doEngineCalculation(vector<string> theRating) { - for (unsigned int i(0); i <= theRating.size() - 1; i++) { + for (unsigned int i(0); i < theRating.size(); i++) { theRatingEngine.push_back(dataEnginePerformance()); theRatingEngine.back().Rating = theRating.at(i); - for (double alt = 0.; alt <= 0.3048 * 45000.; alt += 0.3048 * 5000.) { + for (double alt = 0.; alt <= convertUnit(FOOT, METER, 45000); alt += convertUnit(FOOT, METER, 5000)) { theRatingEngine.back().theParameter.push_back(enginePerfParameter()); theRatingEngine.back().theParameter.back().Altitude = alt; for (double mach = 0.0; mach <= theAircraftPt->MMO; mach += 0.05) { diff --git a/performance_assessment/src/taw/defaultMethods/performance_assessment_output.cpp b/performance_assessment/src/taw/defaultMethods/performance_assessment_output.cpp index c7f02fc17e6283425703cdf41969b9ffc87a3e22..93c2bc3a978f12ef38aacee2715b51e420f72128 100644 --- a/performance_assessment/src/taw/defaultMethods/performance_assessment_output.cpp +++ b/performance_assessment/src/taw/defaultMethods/performance_assessment_output.cpp @@ -217,7 +217,7 @@ void performance_assessment_output::writeXmlOutput() { } if (mySettingsPt->mySwitches.doFlightEnvelopePerformance == true) { /* Speeds */ - subPath = "assessment/performance/speed"; + subPath = "aircraft_exchange_file/assessment/performance/speed"; Endnode<double> MMO(subPath + "/maximum_operating_mach_number", "Maximum operating mach number"); MMO.set_value(myAcftPt->MMO); MMO.set_boundaries(0., 1.); @@ -246,7 +246,7 @@ void performance_assessment_output::writeXmlOutput() { } /* Start */ if (mySettingsPt->mySwitches.doTOPerformance == true && mySettingsPt->check_sucessfully_executed.doTOPerformance == true) { - subPath = "assessment/performance/takeoff"; + subPath = "aircraft_exchange_file/assessment/performance/takeoff"; // Endnode<double> todns(subPath + "/takeoff_distance_normal_safety", "Takeoff distance normal safety"); // todns.set_value(abstractTakeOffPerformancePt->myTOFLField.at(0).myTOFL.back().TODR_AEO); // todns.set_lower_boundary(0); @@ -292,7 +292,7 @@ void performance_assessment_output::writeXmlOutput() { } /* BLFL */ if (mySettingsPt->mySwitches.doBLFLPerformance == true && mySettingsPt->check_sucessfully_executed.doBLFLPerformance == true) { - subPath = "assessment/performance/takeoff"; + subPath = "aircraft_exchange_file/assessment/performance/takeoff"; Endnode<double> BLFL(subPath + "/balanced_field_length", "Balanced field length"); BLFL.set_value(abstractTakeOffPerformancePt->myBLFL.BLFL); BLFL.set_boundaries(0, 100000); @@ -301,7 +301,7 @@ void performance_assessment_output::writeXmlOutput() { } /* Landing */ if (mySettingsPt->mySwitches.doLandingPerformance == true && mySettingsPt->check_sucessfully_executed.doLandingPerformance == true) { - subPath = "assessment/performance/landing"; + subPath = "aircraft_exchange_file/assessment/performance/landing"; Endnode<double> needed_runway_length(subPath + "/needed_runway_length", "Needed runway length"); needed_runway_length.set_value(abstractLandingPerformancePt->myLDNField.at(0).myLDN.back().ALD_AEO); needed_runway_length.set_boundaries(0, 100000); @@ -315,7 +315,7 @@ void performance_assessment_output::writeXmlOutput() { } if (mySettingsPt->mySwitches.doPayloadRange == true && mySettingsPt->check_sucessfully_executed.doPayloadRange == true) { /* Ranges */ - subPath = "assessment/performance/range"; + subPath = "aircraft_exchange_file/assessment/performance/range"; Endnode<double> range_max_payload_at_maximum_takeoff_mass(subPath + "/range_max_payload_at_maximum_takeoff_mass", "Range at max payload at maximum take off mass"); Endnode<double> range_max_fuel_at_maximum_takeoff_mass(subPath + "/range_max_fuel_at_maximum_takeoff_mass", "Range at max fuel at maximum take off mass"); Endnode<double> payload_maximum_fuel_at_maximum_takeoff_mass(subPath + "/payload_maximum_fuel_at_maximum_takeoff_mass", "Payload at maximum fuel at maximum takeoff mass"); @@ -349,9 +349,9 @@ void performance_assessment_output::writeXmlOutput() { if (mySettingsPt->mySwitches.doFuelPlanning == true && mySettingsPt->check_sucessfully_executed.doFuelPlanning == true) { /* Mission Fuels */ if (!mySettingsPt->designForMTOM && mySettingsPt->useStudyMissionForAnalysis) { - subPath = "analysis/mission/study_mission"; + subPath = "aircraft_exchange_file/analysis/mission/study_mission"; } else { - subPath = "analysis/mission/design_mission"; + subPath = "aircraft_exchange_file/analysis/mission/design_mission"; } Endnode<double> missionRange(subPath + "/range", "Traveled range from break release to end of taxi at destination"); missionRange.set_value(myAcftPt->myMission.missionRange); @@ -494,7 +494,7 @@ void performance_assessment_output::generatePlotData() { generatePlotDataPayloadRange(); } if (mySettingsPt->mySwitches.doEnginePerformance == true && mySettingsPt->check_sucessfully_executed.doEnginePerformance == true) { - generateEnginePerformanceData(); + generate_engine_performance_data(); } if (mySettingsPt->mySwitches.doClimbPerformance == true && mySettingsPt->check_sucessfully_executed.doClimbPerformance == true) { generateCeilingPlotData(); @@ -628,7 +628,7 @@ std::ofstream csv; } } -void performance_assessment_output::generateEnginePerformanceData() { +void performance_assessment_output::generate_engine_performance_data() { for (unsigned int i(0); i <= abstractEnginePerformancePt->theRatingEngine.size() - 1; i++) { std::ofstream csv; string csvDataFile(mySettingsPt->rtIO->getCsvFilesDirTool() + "/" + theProgramName + "_EnginePerformance_" + @@ -659,6 +659,7 @@ void performance_assessment_output::generateEnginePerformanceData() { csv.close(); } } + void performance_assessment_output::generateCeilingPlotData() { std::ofstream csv; string csvDataFile(mySettingsPt->rtIO->getCsvFilesDirTool() + "/" + theProgramName + "_Ceiling.csv"); @@ -681,6 +682,7 @@ void performance_assessment_output::generateCeilingPlotData() { csv.close(); } } + void performance_assessment_output::generateFlightEnvelopeData() { std::ofstream csv; string csvDataFile(mySettingsPt->rtIO->getCsvFilesDirTool() + "/" + theProgramName + "_FlightEnvelope.csv"); @@ -748,6 +750,7 @@ void performance_assessment_output::generateFlightEnvelopeData() { csv.close(); } } + void performance_assessment_output::generateSARPlotData() { std::ofstream csv; for (unsigned int i(0); i < abstractSARPerformancePt->theSAR.size(); i++) { @@ -777,6 +780,7 @@ void performance_assessment_output::generateSARPlotData() { csv.close(); } } + void performance_assessment_output::generateBestSARAltPlotData() { // TODO(franz#1#): kathi (18.11.2013): Plot seltsam -> reparieren std::ofstream plot; @@ -798,6 +802,7 @@ void performance_assessment_output::generateBestSARAltPlotData() { plot.close(); } } + void performance_assessment_output::generateTOFLPlotData() { std::ofstream csv; string csvDataFile(mySettingsPt->rtIO->getCsvFilesDirTool() + "/" + theProgramName + "_TOFL.csv"); @@ -830,6 +835,7 @@ std::ofstream csv; csv.close(); } } + void performance_assessment_output::generateBLFLPlotData() { std::ofstream csv; string csvDataFile(mySettingsPt->rtIO->getCsvFilesDirTool() + "/" + theProgramName + "_BLFL.csv"); @@ -851,6 +857,7 @@ void performance_assessment_output::generateBLFLPlotData() { csv.close(); } } + void performance_assessment_output::generateLDNPlotData() { std::ofstream plot; string plotDataFile(mySettingsPt->rtIO->getCsvFilesDirTool() + "/" + theProgramName + "_LDN.csv"); @@ -883,6 +890,7 @@ void performance_assessment_output::generateLDNPlotData() { plot.close(); } } + void performance_assessment_output::generateVnPlotData() { std::ofstream plot; string plotDataFile(mySettingsPt->rtIO->getCsvFilesDirTool() + "/" + theProgramName + "_VnDiagram.csv"); @@ -920,7 +928,6 @@ void performance_assessment_output::generateVnPlotData() { } } - void performance_assessment_output::generatePlots() { // if (mySettingsPt->mySwitches.doFuelPlanning == true) { @@ -929,9 +936,9 @@ void performance_assessment_output::generatePlots() { if (mySettingsPt->mySwitches.doPayloadRange == true) { generate_plot_payload_range(); } - // if (mySettingsPt->mySwitches.doEnginePerformance == true) { - // generate_plot_engine_performance(); - // } + if (mySettingsPt->mySwitches.doEnginePerformance == true && mySettingsPt->check_sucessfully_executed.doEnginePerformance == true) { + generate_plot_engine_performance(); + } if (mySettingsPt->mySwitches.doClimbPerformance == true && mySettingsPt->check_sucessfully_executed.doClimbPerformance == true) { generate_plot_ceiling_performance(); } @@ -1302,3 +1309,73 @@ void performance_assessment_output::generate_plot_SAR_performance() { matplot::cla(); } } + +void performance_assessment_output::generate_plot_engine_performance() { + for (unsigned int i(0); i < abstractEnginePerformancePt->theRatingEngine.size(); i++) { // iterates over the ratings + // New figure for thrust over mach at current engine rating + matplot::figure_handle fig1 = matplot::figure(true); + fig1->quiet_mode(true); + fig1->size(600, 500); + matplot::axes_handle ax1 = fig1->current_axes(); + matplot::hold(matplot::on); + matplot::grid(matplot::on); + // New figure for thrust over SFC for current engine rating + matplot::figure_handle fig2 = matplot::figure(true); + fig2->quiet_mode(true); + fig2->size(600, 500); + matplot::axes_handle ax2 = fig2->current_axes(); + matplot::hold(matplot::on); + matplot::grid(matplot::on); + // Gathering data + double current_altitude(0.); + vector<string> curve_names; + std::string current_rating = abstractEnginePerformancePt->theRatingEngine.at(i).Rating; + for (unsigned int j(0); j < abstractEnginePerformancePt->theRatingEngine.at(i).theParameter.size(); j++) { // iterates over the altitudes + vector<double> thrust; + vector<double> mach; + vector<double> sfc; + current_altitude = abstractEnginePerformancePt->theRatingEngine.at(i).theParameter.at(j).Altitude; + for (unsigned int k(0); k < abstractEnginePerformancePt->theRatingEngine.at(i).theParameter.at(j).Thrust.size(); k++) { + thrust.push_back(abstractEnginePerformancePt->theRatingEngine.at(i).theParameter.at(j).Thrust.at(k) / 1000); // [N]->[kN] + mach.push_back(abstractEnginePerformancePt->theRatingEngine.at(i).theParameter.at(j).Mach.at(k)); + sfc.push_back(abstractEnginePerformancePt->theRatingEngine.at(i).theParameter.at(j).SFC.at(k) * 1000 * 1000); // [kg/Ns] -> [mg/Ns] + } + ax1->plot(mach, thrust); + ax2->plot(sfc, thrust); + curve_names.push_back(std::format("{:.0f}", convertUnit(METER, FOOT, current_altitude)) + " ft"); + } + ax1->xlabel("Mach"); + ax1->ylabel("Thrust per Engine [kN]"); + string rating_for_plot; + if (current_rating == "takeoff") { + rating_for_plot = "Takeoff"; + } else if (current_rating == "maximum_continuous") { + rating_for_plot = "Maximum Continuous"; + } else if (current_rating == "cruise") { + rating_for_plot = "Cruise"; + } else if (current_rating == "climb") { + rating_for_plot = "Climb"; + } else { + rating_for_plot = current_rating; + } + ax1->title("Rating: " + rating_for_plot); + matplot::legend_handle lgd1 = ax1->legend(); + ax1->legend(curve_names); + ax1->legend()->location(matplot::legend::general_alignment::topright); + // lgd1->title(std::string("Altitude")); //TODO(hansmann): Not sure about the syntax here. This results in a segmentation fault + + ax2->xlabel("SFC [mg/Ns]"); + ax2->ylabel("Thrust per Engine [kN]"); + ax2->title("Rating: " + rating_for_plot); + matplot::legend_handle lgd2 = ax2->legend(); + ax2->legend(curve_names); + ax2->legend()->location(matplot::legend::general_alignment::topright); + // lgd2->title(std::string("Altitude")); + + // Save figures + std::string plot_file_path_machplot = rtIO->getPlotDir() + "/" + std::string(TOOL_NAME) + "_engine_performance_" + current_rating + "_mach.svg"; + fig1->save(plot_file_path_machplot); + std::string plot_file_path_sfcplot = rtIO->getPlotDir() + "/" + std::string(TOOL_NAME) + "_engine_performance_" + current_rating + "_sfc.svg"; + fig2->save(plot_file_path_sfcplot); + } +} diff --git a/performance_assessment/src/taw/defaultMethods/performance_assessment_output.h b/performance_assessment/src/taw/defaultMethods/performance_assessment_output.h index 5758dcf18da12c05da814f7309132a9fdf9230dd..a3c0f6bc7ecd8c35ce851dffe43500833346a307 100644 --- a/performance_assessment/src/taw/defaultMethods/performance_assessment_output.h +++ b/performance_assessment/src/taw/defaultMethods/performance_assessment_output.h @@ -109,13 +109,13 @@ class performance_assessment_output { */ void generate_plot_payload_range(); - /** \brief Generate the plot of the engine performance + /** \brief Generate a csv file with the engine performance results */ - void generateEnginePerformanceData(); + void generate_engine_performance_data(); - // /** \brief Set the settings for the engine performance plot - // */ - // void generateEnginePerformancePlotScript(); + /** \brief Generate the plot for engine performance + */ + void generate_plot_engine_performance(); /** \brief Generate the plot of the aircraft ceiling */ diff --git a/systems_design/src/standardConfig.h b/systems_design/src/standardConfig.h index 035bbe140838c01dfc78cc1c9c7b0da3946008d1..99280fe6a0f0ff0184b0651e7df9e4720759e1ee 100644 --- a/systems_design/src/standardConfig.h +++ b/systems_design/src/standardConfig.h @@ -198,7 +198,7 @@ class standardConfig { bool designCase = false;/**< Determine whether system architecture is also sized **/ bool reqMission = false;/**< Determining the offtakes for Requirement Mission **/ - double OpItemsFactor;/**< - Factor for Op. Items Masses **/ + double OpItemsFactor;/**< [-] Scaling Factor for Op. Items Masses **/ int numberOfVirtualSystems;/*number of virtual systems*/ int numberOfConductors;/* number of conductor systems*/ diff --git a/systems_design/src/weightsAndCGs.cpp b/systems_design/src/weightsAndCGs.cpp index 6a159c96a4e9980f708af093b3180acd6e079c63..80f6121ad396915ddef127d9fe44825d48a28cde 100644 --- a/systems_design/src/weightsAndCGs.cpp +++ b/systems_design/src/weightsAndCGs.cpp @@ -227,7 +227,10 @@ void weightsAndCGs::getOperatorItems() { waterAndChemicalsMass = 1.36 * data_->data.Accommodation.PAX; } x_cg_waterAndChem = x_wing_midCenterline; - //write to data_->data.Mass + /* add scaling factor for operator items */ + waterAndChemicalsMass *= data_->configuration.OpItemsFactor; + residualFuelMass *= data_->configuration.OpItemsFactor; + //write to data_->data.Mass data_->data.Mass.waterAndChemicalsMass = waterAndChemicalsMass; data_->data.Mass.residualFuelMass = residualFuelMass; //write to data_->data.CofG diff --git a/systems_design/systems_design_conf.xml b/systems_design/systems_design_conf.xml index 7606eccb44201de0e1d4dfb959bc0fe9dde5ac1e..abf7d540426c36c9a1b856cd6757e7f868224db9 100644 --- a/systems_design/systems_design_conf.xml +++ b/systems_design/systems_design_conf.xml @@ -2,10 +2,10 @@ <module_configuration_file name="systems_design_conf.xml"> <control_settings description="General control settings for this tool"> <aircraft_exchange_file_name description="Specify the name of the exchange file"> - <value>csmr-2020.xml</value> + <value>CSMR-2020.xml</value> </aircraft_exchange_file_name> <aircraft_exchange_file_directory description="Specify the direction in which the aircraft exchange file can be found"> - <value>../projects/</value> + <value>X:\04_UNICADO\04_Testing/</value> </aircraft_exchange_file_directory> <own_tool_level description="Specify the tool level of this tool"> <value>1</value> @@ -141,7 +141,7 @@ <default>1</default> </auxiliary_power_unit> <operator_items description="Scaling factor for the operator items."> - <value>1.586</value> + <value>1</value> <unit>1</unit> <lower_boundary>0</lower_boundary> <upper_boundary>inf</upper_boundary>