FGTurboProp::FGTurboProp(FGFDMExec* exec, Element *el, int engine_number, struct Inputs& input) : FGEngine(exec, el, engine_number, input), ITT_N1(NULL), EnginePowerRPM_N1(NULL), EnginePowerVC(NULL), CombustionEfficiency_N1(NULL) { SetDefaults(); thrusterType = Thruster->GetType(); Load(exec, el); bindmodel(); Debug(0); }
FGRocket::FGRocket(FGFDMExec* exec, Element *el, int engine_number) : FGEngine(exec, el, engine_number) { Element* thrust_table_element = 0; ThrustTable = 0L; BurnTime = 0.0; previousFuelNeedPerTank = 0.0; previousOxiNeedPerTank = 0.0; PropellantFlowRate = 0.0; FuelFlowRate = 0.0; OxidizerFlowRate = 0.0; SLOxiFlowMax = 0.0; It = 0.0; // Defaults MinThrottle = 0.0; MaxThrottle = 1.0; if (el->FindElement("isp")) Isp = el->FindElementValueAsNumber("isp"); if (el->FindElement("maxthrottle")) MaxThrottle = el->FindElementValueAsNumber("maxthrottle"); if (el->FindElement("minthrottle")) MinThrottle = el->FindElementValueAsNumber("minthrottle"); if (el->FindElement("slfuelflowmax")) SLFuelFlowMax = el->FindElementValueAsNumberConvertTo("slfuelflowmax", "LBS/SEC"); if (el->FindElement("sloxiflowmax")) SLOxiFlowMax = el->FindElementValueAsNumberConvertTo("sloxiflowmax", "LBS/SEC"); thrust_table_element = el->FindElement("thrust_table"); if (thrust_table_element) { ThrustTable = new FGTable(PropertyManager, thrust_table_element); } bindmodel(); Debug(0); Type = etRocket; Flameout = false; }
FGRocket::FGRocket(FGFDMExec* exec, Element *el, int engine_number, struct Inputs& input) : FGEngine(exec, el, engine_number, input), isp_function(0L) { Type = etRocket; Element* thrust_table_element = 0; ThrustTable = 0L; BurnTime = 0.0; previousFuelNeedPerTank = 0.0; previousOxiNeedPerTank = 0.0; PropellantFlowRate = 0.0; TotalPropellantExpended = 0.0; FuelFlowRate = FuelExpended = 0.0; OxidizerFlowRate = OxidizerExpended = 0.0; SLOxiFlowMax = SLFuelFlowMax = PropFlowMax = 0.0; MxR = 0.0; BuildupTime = 0.0; It = ItVac = 0.0; ThrustVariation = 0.0; TotalIspVariation = 0.0; VacThrust = 0.0; Flameout = false; // Defaults MinThrottle = 0.0; MaxThrottle = 1.0; string base_property_name = CreateIndexedPropertyName("propulsion/engine", EngineNumber); std::stringstream strEngineNumber; strEngineNumber << EngineNumber; Element* isp_el = el->FindElement("isp"); Element* isp_func_el=0; bindmodel(); // Bind model properties first, since they might be needed in functions. // Specific impulse may be specified as a constant value or as a function - perhaps as a function of mixture ratio. if (isp_el) { isp_func_el = isp_el->FindElement("function"); if (isp_func_el) { isp_function = new FGFunction(exec->GetPropertyManager(),isp_func_el, strEngineNumber.str()); } else { Isp = el->FindElementValueAsNumber("isp"); } } else { throw("Specific Impulse <isp> must be specified for a rocket engine"); } if (el->FindElement("builduptime")) BuildupTime = el->FindElementValueAsNumber("builduptime"); if (el->FindElement("maxthrottle")) MaxThrottle = el->FindElementValueAsNumber("maxthrottle"); if (el->FindElement("minthrottle")) MinThrottle = el->FindElementValueAsNumber("minthrottle"); if (el->FindElement("slfuelflowmax")) { SLFuelFlowMax = el->FindElementValueAsNumberConvertTo("slfuelflowmax", "LBS/SEC"); if (el->FindElement("sloxiflowmax")) { SLOxiFlowMax = el->FindElementValueAsNumberConvertTo("sloxiflowmax", "LBS/SEC"); } PropFlowMax = SLOxiFlowMax + SLFuelFlowMax; MxR = SLOxiFlowMax/SLFuelFlowMax; } else if (el->FindElement("propflowmax")) { PropFlowMax = el->FindElementValueAsNumberConvertTo("propflowmax", "LBS/SEC"); // Mixture ratio may be specified here, but it can also be specified as a function or via property if (el->FindElement("mixtureratio")) { MxR = el->FindElementValueAsNumber("mixtureratio"); } } if (isp_function) Isp = isp_function->GetValue(); // cause Isp function to be executed if present. // If there is a thrust table element, this is a solid propellant engine. thrust_table_element = el->FindElement("thrust_table"); if (thrust_table_element) { ThrustTable = new FGTable(PropertyManager, thrust_table_element); Element* variation_element = el->FindElement("variation"); if (variation_element) { if (variation_element->FindElement("thrust")) { ThrustVariation = variation_element->FindElementValueAsNumber("thrust"); } if (variation_element->FindElement("total_isp")) { TotalIspVariation = variation_element->FindElementValueAsNumber("total_isp"); } } } Debug(0); }
bool FGTurbine::Load(FGFDMExec* exec, Element *el) { Element* function_element = el->FindElement("function"); while(function_element) { string name = function_element->GetAttributeValue("name"); if (name == "IdleThrust" || name == "MilThrust" || name == "AugThrust" || name == "Injection") function_element->SetAttributeValue("name", string("propulsion/engine[#]/") + name); function_element = el->FindNextElement("function"); } FGEngine::Load(exec, el); ResetToIC(); if (el->FindElement("milthrust")) MilThrust = el->FindElementValueAsNumberConvertTo("milthrust","LBS"); if (el->FindElement("maxthrust")) MaxThrust = el->FindElementValueAsNumberConvertTo("maxthrust","LBS"); if (el->FindElement("bypassratio")) BypassRatio = el->FindElementValueAsNumber("bypassratio"); if (el->FindElement("bleed")) BleedDemand = el->FindElementValueAsNumber("bleed"); if (el->FindElement("tsfc")) TSFC = el->FindElementValueAsNumber("tsfc"); if (el->FindElement("atsfc")) ATSFC = el->FindElementValueAsNumber("atsfc"); if (el->FindElement("idlen1")) IdleN1 = el->FindElementValueAsNumber("idlen1"); if (el->FindElement("idlen2")) IdleN2 = el->FindElementValueAsNumber("idlen2"); if (el->FindElement("maxn1")) MaxN1 = el->FindElementValueAsNumber("maxn1"); if (el->FindElement("maxn2")) MaxN2 = el->FindElementValueAsNumber("maxn2"); if (el->FindElement("n1spinup")) N1_spinup = el->FindElementValueAsNumber("n1spinup"); if (el->FindElement("n2spinup")) N2_spinup = el->FindElementValueAsNumber("n2spinup"); if (el->FindElement("augmented")) Augmented = (int)el->FindElementValueAsNumber("augmented"); if (el->FindElement("augmethod")) AugMethod = (int)el->FindElementValueAsNumber("augmethod"); if (el->FindElement("injected")) Injected = (int)el->FindElementValueAsNumber("injected"); if (el->FindElement("injection-time")){ InjectionTime = el->FindElementValueAsNumber("injection-time"); InjWaterNorm =1.0; } if (el->FindElement("injection-N1-inc")) InjN1increment = el->FindElementValueAsNumber("injection-N1-inc"); if (el->FindElement("injection-N2-inc")) InjN2increment = el->FindElementValueAsNumber("injection-N2-inc"); string property_prefix = CreateIndexedPropertyName("propulsion/engine", EngineNumber); IdleThrustLookup = GetPreFunction(property_prefix+"/IdleThrust"); MilThrustLookup = GetPreFunction(property_prefix+"/MilThrust"); MaxThrustLookup = GetPreFunction(property_prefix+"/AugThrust"); InjectionLookup = GetPreFunction(property_prefix+"/Injection"); // Pre-calculations and initializations delay = 90.0 / (BypassRatio + 3.0); N1_factor = MaxN1 - IdleN1; N2_factor = MaxN2 - IdleN2; OilTemp_degK = in.TAT_c + 273.0; IdleFF = pow(MilThrust, 0.2) * 107.0; // just an estimate bindmodel(exec->GetPropertyManager()); return true; }