private void ApplyPartialSonicBoomInputDataButton_Click(object sender, EventArgs e) { Func <Part, GeometricalParameters> GetGeometricalParameters = Part => { TextBox Length, CharacteristicLength, MaximalArea, CharactericticArea; if (Part == Part.Rocket) { GetTextBoxes(Part.Rocket, out Length, out CharacteristicLength, out MaximalArea, out CharactericticArea); } else { GetTextBoxes(Part.Vehicle, out Length, out CharacteristicLength, out MaximalArea, out CharactericticArea); } return(new GeometricalParameters( Convert.ToDouble(Length.Text), Convert.ToDouble(CharacteristicLength.Text), Convert.ToDouble(MaximalArea.Text), Convert.ToDouble(CharactericticArea.Text))); }; if (sender == ApplyRocketSonicBoomInputDataButton) { RocketGeometricalParameters = GetGeometricalParameters(Part.Rocket); RocketSonicBoomBallistics = RocketSonicBoomBallisticsForm.Ballistics; } else { VehicleGeometricalParameters = GetGeometricalParameters(Part.Vehicle); VehicleSonicBoomBallistics = VehicleSonicBoomBallisticsForm.Ballistics; } }
private void SetSonicBoomInputData(SonicBoomInputData id) { Action <Part, GeometricalParameters, SonicBoomBallistics> SetPartialInputData = (part, GeometricalParameters, Ballistics) => { TextBox Length, CharacteristicLength, MaximalArea, CharactericticArea; if (part == Part.Rocket) { GetTextBoxes(Part.Rocket, out Length, out CharacteristicLength, out MaximalArea, out CharactericticArea); RocketSonicBoomBallisticsForm.Ballistics = Ballistics; RocketSonicBoomBallistics = Ballistics; RocketGeometricalParameters = GeometricalParameters; } else { GetTextBoxes(Part.Vehicle, out Length, out CharacteristicLength, out MaximalArea, out CharactericticArea); VehicleSonicBoomBallisticsForm.Ballistics = Ballistics; VehicleSonicBoomBallistics = Ballistics; VehicleGeometricalParameters = GeometricalParameters; } Length.Text = GeometricalParameters.Length.ToString(); CharacteristicLength.Text = GeometricalParameters.CharacteristicLength.ToString(); MaximalArea.Text = GeometricalParameters.MaximalArea.ToString(); CharactericticArea.Text = GeometricalParameters.CharacteristicLength.ToString(); }; SetPartialInputData(Part.Rocket, id.RocketGeometricalParameters, id.RocketBallistics); SetPartialInputData(Part.Vehicle, id.VehicleGeometricalParameters, id.VehicleBallistics); SonicBoomWeatherParametersContainer.WeatherParameters = id.WeatherParameters; SonicBoomWeatherParameters = id.WeatherParameters; }
public ApplySonicBoomPartialInputDataEventArgs( Part Part, SonicBoomBallistics Ballistics, GeometricalParameters GeometricalParameters) { this.Part = Part; this.Ballistics = Ballistics; this.GeometricalParameters = GeometricalParameters; }
public CalculateSonicBoomEventArgs( GeometricalParameters RocketGeometricalParameters, GeometricalParameters VehicleGeometricalParameters, SonicBoomBallistics RocketBallistics, SonicBoomBallistics VehicleBallistics, List <WeatherParameters> WeatherParameters) { this.RocketGeometricalParameters = RocketGeometricalParameters; this.VehicleGeometricalParameters = VehicleGeometricalParameters; this.RocketBallistics = RocketBallistics; this.VehicleBallistics = VehicleBallistics; this.WeatherParameters = WeatherParameters; }
public SaveSonicBoomInputDataEventArgs( string FileName, SonicBoomBallistics RocketBallistics, SonicBoomBallistics VehicleBallistics, GeometricalParameters RocketGeometricalParameters, GeometricalParameters VehicleGeometricalParameters, List <WeatherParameters> WeatherParameters) { this.FileName = FileName; this.RocketBallistics = RocketBallistics; this.VehicleBallistics = VehicleBallistics; this.RocketGeometricalParameters = RocketGeometricalParameters; this.VehicleGeometricalParameters = VehicleGeometricalParameters; this.WeatherParameters = WeatherParameters; }
} // Геометрические параметры СЧ МСРКН (МСРН или МСКА) public SonicBoomCalculationInputData(SonicBoomBallistics Ballistics, GeometricalParameters GeometricalParameters) : this() { this.Ballistics = Ballistics; this.GeometricalParameters = GeometricalParameters; }
List <SonicBoomParameters> Calculate( SonicBoomBallistics Ballistics, GeometricalParameters GeometricalParameters, List <WeatherParameters> WeatherParameters, Action <int> ProgressChanged) { List <SonicBoomParameters> SonicBoom = new List <SonicBoomParameters>(); var K_s = K_s_Int.Interpolate(GeometricalParameters.CharacteristicArea / GeometricalParameters.MaximalArea) * Math.Sqrt(GeometricalParameters.MaximalArea) / (Math.Pow(GeometricalParameters.Length, 3.0 / 4) * Math.Pow(GeometricalParameters.CharacteristicLength, 1.0 / 4)); var StartTime = Ballistics.Height.X[0]; var EndTime = Ballistics.Height.X.Last(); var TimeStep = 1; var TimeList = new List <double>(); while (StartTime < EndTime) { TimeList.Add(StartTime); StartTime += TimeStep; } int n = 0; object Locker = new object(); Parallel.ForEach(TimeList, Time => { var height = Ballistics.Height.Interpolate(Time); var machNumber = Ballistics.MachNumber.Interpolate(Time); var OverPressure = WeatherParameters.Select(weather => { double p = 0; try { p = Delta_p( height, machNumber, GeometricalParameters.Length, K_s, weather); } catch { } return(new { Pressure = p, Weather = weather }); }).MaxElemet(x => x.Pressure); lock (Locker) { if (OverPressure.Pressure > 0) { SonicBoom.Add(new SonicBoomParameters( Time, height, machNumber, OverPressure.Pressure, 20 * Math.Log10(OverPressure.Pressure / 2E-5), d_x(height, machNumber) + Ballistics.Distance.Interpolate(Time), Delta_t(height, machNumber, GeometricalParameters.Length, K_s, OverPressure.Weather), OverPressure.Weather.Mounth)); } n++; ProgressChanged((int)(100.0 * n / TimeList.Count)); } }); return(SonicBoom.OrderBy(x => x.Time).ToList()); }