private void Form1_Load(object sender, EventArgs e) { //Setup chart Series torque_time_series = new Series("Torque vs Time"); torque_time_series.ChartType = SeriesChartType.FastLine; torque_time_chart.Series.Add(torque_time_series); torque_time_chart.ChartAreas[0].AxisX.LabelStyle.Enabled = false; torque_time_chart.ChartAreas[0].AxisX.Minimum = 0; torque_time_chart.ChartAreas[0].AxisX.Interval = 1; torque_time_chart.ChartAreas[0].AxisY.Maximum = 300; torque_time_chart.ChartAreas[0].AxisY.Minimum = 0; //Setup chart Series torque_crank_angle_series = new Series("Torque vs Crank Angle"); torque_crank_angle_series.ChartType = SeriesChartType.Point; torque_crank_angle_chart.Series.Add(torque_crank_angle_series); torque_crank_angle_chart.ChartAreas[0].AxisX.Minimum = 0; torque_crank_angle_chart.ChartAreas[0].AxisX.Maximum = 360; torque_crank_angle_chart.ChartAreas[0].AxisX.Interval = 45; torque_crank_angle_chart.ChartAreas[0].AxisY.Maximum = 300; torque_crank_angle_chart.ChartAreas[0].AxisY.Minimum = 0; engine = Program.physics.engine; stopwatch = new Stopwatch(); stopwatch.Start(); Timer timer = new Timer(); timer.Interval = 1000 / 100; timer.Tick += new EventHandler(UpdateForm); timer.Start(); }
public Physics() { engine.EngineSpecs es = new engine.EngineSpecs { //diameter of cylinder bore = 0.086f, //height of cylinder stroke = 0.086f, num_of_cylinders = 4, piston_connecting_rod_length = 0.139f, //inertia = 10f * 0.08f * 0.08f, inertia = 1000f * 0.08f * 0.08f, efficiency = 0.33f }; engine = new engine.Engine(es); }