/// <summary>Calculate the average radiation effect to all habitats. returns true if successful.</summary> public bool CalculateRadiationImpact() { if (radiation < 0) { radiation_impact = 1.0; return(true); } if (habitatInfos == null) { BuildHabitatInfos(); } if (habitatInfos == null) { return(false); } radiation_impact = 0.0; int habitatCount = 0; foreach (var hi in habitatInfos) { radiation_impact += Radiation.DistanceRadiation(1.0, hi.distance); habitatCount++; } if (habitatCount > 1) { radiation_impact /= habitatCount; } return(true); }
/// <summary> /// get the total radiation emitted by nearby emitters (used for EVAs). only works for loaded vessels. /// </summary> public static double Nearby(Vessel v) { if (!v.loaded || !v.isEVA) { return(0.0); } var evaPosition = v.rootPart.transform.position; double result = 0.0; foreach (Vessel n in FlightGlobals.VesselsLoaded) { var vd = n.KerbalismData(); if (!vd.IsSimulated) { continue; } foreach (var emitter in Lib.FindModules <Emitter>(n)) { if (emitter.part == null || emitter.part.transform == null) { continue; } if (emitter.radiation <= 0) { continue; // ignore shielding effects here } if (!emitter.running) { continue; } var emitterPosition = emitter.part.transform.position; var vector = evaPosition - emitterPosition; var distance = vector.magnitude; result += Radiation.DistanceRadiation(emitter.radiation, distance); } } return(result); }
public double AverageHabitatRadiation(double radiation) { if (habitatShieldings.Count < 1) { return(radiation); } var result = 0.0; foreach (var shieldingPartsList in habitatShieldings.Values) { var remainingRadiation = radiation; foreach (var shieldingInfo in shieldingPartsList) { // for a 500 keV gamma ray, halfing thickness for aluminium is 3.05cm. But... // Solar energetic particles (SEP) are high-energy particles coming from the Sun. // They consist of protons, electrons and HZE ions with energy ranging from a few tens of keV // to many GeV (the fastest particles can approach the speed of light, as in a // "ground-level event"). This is why they are such a big problem for interplanetary space travel. // Beer-Lambert law: Remaining radiation = radiation * e^-ux. Not exact for SEP, but close enough to loosely fit observed curves. // linear attenuation coefficent u. Asssuming an average CME event energy Al shielding 10 ~= 30 g/cm^2. // Averaged from NASA plots of large CME events vs Al shielding projections. var linearAttenuation = 10; // However, what you lose in particle radiation you gain in gamma radiation (Bremsstrahlung) var incomingRadiation = remainingRadiation; remainingRadiation *= Math.Exp(shieldingInfo.thickness * linearAttenuation * -1); var bremsstrahlung = incomingRadiation - remainingRadiation; result += Radiation.DistanceRadiation(bremsstrahlung, Math.Max(1, shieldingInfo.distance)) / 10; //Gamma radiation has 1/10 the quality factor of SEP } result += remainingRadiation; } return(result / habitatShieldings.Count); }
public double AverageHabitatRadiation(double radiation) { if (habitatShieldings.Count < 1) { return(radiation); } var result = 0.0; foreach (var shieldingPartsList in habitatShieldings.Values) { var remainingRadiation = radiation; foreach (var shieldingInfo in shieldingPartsList) { // for a 500 keV gamma ray, halfing thickness for aluminium is 3.05cm. But... // Solar energetic particles (SEP) are high-energy particles coming from the Sun. // They consist of protons, electrons and HZE ions with energy ranging from a few tens of keV // to many GeV (the fastest particles can approach the speed of light, as in a // "ground-level event"). This is why they are such a big problem for interplanetary space travel. // We just assume a big halfing thickness for that kind of ionized radiation. var halfingThickness = 1.0; // halfing factor h = part thickness / halfing thickness // remaining radiation = radiation / (2^h) // However, what you loose in particle radiation you gain in gamma radiation (Bremsstrahlung) var bremsstrahlung = remainingRadiation / Math.Pow(2, shieldingInfo.thickness / halfingThickness); remainingRadiation -= bremsstrahlung; result += Radiation.DistanceRadiation(bremsstrahlung, shieldingInfo.distance); } result += remainingRadiation; } return(result / habitatShieldings.Count); }