/* * [PartMessageListener(typeof(PartResourceInitialAmountChanged), scenes: GameSceneFilter.Flight)] * public void ChangeInitResource(PartResource resource, double amount) * { * Log.post("Envelope changed init resource " + resource.resourceName + " to " + amount); * } */ private void loadLiftingGasOptions() { liftingGasOptions = new List <LiftingGas>(); ConfigNode[] nodes = GameDatabase.Instance.GetConfigNodes("LIFTING_GAS_OPTIONS"); if (nodes.GetLength(0) == 0) { Log.post("ConfigNode 'LIFTING_GAS_OPTIONS' not found", LogLevel.LOG_ERROR); return; } else { foreach (ConfigNode optionsNode in nodes) { foreach (ConfigNode liftingGasNode in optionsNode.GetNodes("LIFTING_GAS")) { LiftingGas liftingGas = new LiftingGas(); liftingGas.Load(liftingGasNode); liftingGasOptions.Add(liftingGas); Log.post("Added lifting gas option: " + liftingGas.displayName, LogLevel.LOG_INFORMATION); } } } }
double getAbsolutePressure() { LiftingGas gas = getCurrentLiftingGas(); double n = liftingGasAmount / (gas.molarMass / 1000.0d); double R = util.GasConstant; double T = util.celsiusToKelvin(getTemperature()); double V = envelopeVolumeNet; double p = (n * R * T) / V; return(util.pascalToBar(p)); }
double getGasAmount(double pressure) // returns the gas amount thats needed to achieve a given pressure value in this envelope { LiftingGas gas = getCurrentLiftingGas(); double m; double p = pressure * 1000.0d * 101.325d; double M = gas.molarMass / 1000.0d; double V = envelopeVolumeNet; double T = util.celsiusToKelvin(getTemperature()); double R = util.GasConstant; m = M * ((p * V) / (R * T)); return(m); }