private void printAblators() { for (int i = 0; i < 7; i++) { if (ablators.Count > i) { Part part = ablators[i]; string name = Helper.prtlen(part.Title, 35, Helper.Align.CENTER).ToUpper(); string temp = Helper.prtlen(Helper.toFixed(part.Temperature, 1), 6, Helper.Align.RIGHT); string star = " "; Resources r = part.Resources; float a = r.Amount("Ablator"); string abl = Helper.prtlen(Helper.toFixed(a, 1), 6, Helper.Align.RIGHT); if (part.Temperature > part.MaxTemperature * 0.9f) { star = "*"; } screenLabels[40 + (i * 2)].Text = name; screenLabels[41 + (i * 2)].Text = " TEMP: " + temp + star + " ABL: " + abl; } else { screenLabels[40 + (i * 2)].Text = ""; screenLabels[41 + (i * 2)].Text = ""; } } }
private void printHotParts() { for (int i = 0; i < 29; i++) { if (hotParts.Count > i) { Part part = hotParts[i]; string name = Helper.prtlen(part.Title, 26).ToUpper(); double temp = part.Temperature; double maxTemp = part.MaxTemperature; double skinTemp = part.SkinTemperature; double maxSkinTemp = part.MaxSkinTemperature; if (skinTemp > temp) { temp = skinTemp; maxTemp = maxSkinTemp; } string tempS = Helper.prtlen(Helper.toFixed(temp, 1), 7, Helper.Align.RIGHT); string star = " "; if (temp > maxTemp * 0.5f) { star = "*"; } screenLabels[10 + i].Text = name + tempS + star; } else { screenLabels[10 + i].Text = ""; } } }
public override void updateLocalElements(object sender, EventArgs e) { screenLabels[2].Text = "LT: " + Helper.timeString(DateTime.Now.TimeOfDay.TotalSeconds); if (form.form.connected && form.form.krpc.CurrentGameScene == GameScene.Flight) { MET = screenStreams.GetData(DataType.vessel_MET); UT = screenStreams.GetData(DataType.spacecenter_universial_time); nodes = screenStreams.GetData(DataType.control_nodes); frame = screenStreams.GetData(DataType.body_nonRotatingReferenceFrame); vesselFrame = screenStreams.GetData(DataType.vessel_referenceFrame); screenLabels[3].Text = "MET: " + Helper.timeString(MET, 3); for (int i = 1; i <= 2; i++) { if (nodes != null && nodes.Count >= i) { string metS = Helper.timeString(nodes[i - 1].UT - UT + MET, true, 3); string remS = Helper.timeString(nodes[i - 1].TimeTo, true, 3); screenLabels[(i * 20) + 0].Text = "────────────── NODE " + (i - 1).ToString() + " ─────────────"; screenLabels[(i * 20) + 1].Text = " MET: " + metS; screenLabels[(i * 20) + 2].Text = " TIME TO: " + remS; screenLabels[(i * 20) + 4].Text = " PROGRADE: " + Helper.prtlen(Helper.toFixed(nodes[i - 1].Prograde, 2), 10); screenLabels[(i * 20) + 5].Text = " NORMAL: " + Helper.prtlen(Helper.toFixed(nodes[i - 1].Normal, 2), 10); screenLabels[(i * 20) + 6].Text = " RADIAL: " + Helper.prtlen(Helper.toFixed(nodes[i - 1].Radial, 2), 10); screenLabels[(i * 20) + 8].Text = " TOTAL ΔV: " + Helper.prtlen(Helper.toFixed(nodes[i - 1].DeltaV, 2), 10); screenLabels[(i * 20) + 9].Text = " REM. ΔV: " + Helper.prtlen(Helper.toFixed(nodes[i - 1].RemainingDeltaV, 2), 10); Tuple <double, double, double> rot = Helper.RPYfromVector(nodes[i - 1].Direction(frame), vesselFrame, frame, "INER"); screenLabels[(i * 20) + 11].Text = " ┌──────── INER ────────┐"; screenLabels[(i * 20) + 12].Text = " ROLL PITCH YAW"; screenLabels[(i * 20) + 13].Text = " ROT: " + Helper.prtlen(Helper.toFixed(Helper.rad2deg(rot.Item1), 2), 7) + " " + Helper.prtlen(Helper.toFixed(Helper.rad2deg(rot.Item2), 2), 7) + " " + Helper.prtlen(Helper.toFixed(Helper.rad2deg(rot.Item3), 2), 7); Tuple <double, double, double> dir = nodes[i - 1].BurnVector(frame); Tuple <double, double, double> rem = nodes[i - 1].RemainingBurnVector(frame); screenLabels[(i * 20) + 15].Text = " ┌──────── INER ────────┐"; screenLabels[(i * 20) + 16].Text = " Vx Vy Vz"; screenLabels[(i * 20) + 17].Text = " VECTOR: " + Helper.prtlen(Helper.toFixed(dir.Item1, 2), 7) + " " + Helper.prtlen(Helper.toFixed(dir.Item3, 2), 7) + " " + Helper.prtlen(Helper.toFixed(dir.Item2, 2), 7); screenLabels[(i * 20) + 18].Text = " REM VECT: " + Helper.prtlen(Helper.toFixed(rem.Item1, 2), 7) + " " + Helper.prtlen(Helper.toFixed(rem.Item3, 2), 7) + " " + Helper.prtlen(Helper.toFixed(rem.Item2, 2), 7); } else { screenLabels[(i * 20) + 0].Text = "───────────────────────────────────"; for (int n = 1; n <= 9; n++) { screenLabels[(i * 20) + n].Text = ""; } } } } }
private String getOrbitsData(Orbit orbit) { String output = "=== ORBIT ==="; output += "\nBody: " + orbit.Body.Name; output += "\n Apo: " + Math.Round(orbit.ApoapsisAltitude).ToString(); output += "\n Per: " + Math.Round(orbit.PeriapsisAltitude).ToString(); output += "\n Inc: " + Helper.toFixed(orbit.Inclination, 3); output += "\nTTSC: " + Helper.timeString(orbit.TimeToSOIChange, 3); return(output); }
private void updateOrbit(int c, Orbit orbit, double met, string title) { int b = (c * 20) + 10; if (title != "") { screenLabels[b + 0].Text = title; } else { screenLabels[b + 0].Text = "───────────────────────────────────"; } if (met != 0) { screenLabels[b + 2].Text = " MET: " + Helper.prtlen(Helper.timeString(met), 12, Helper.Align.RIGHT); } else { screenLabels[b + 2].Text = ""; } if (orbit != null) { screenLabels[b + 4].Text = " BODY: " + Helper.prtlen(orbit.Body.Name.ToUpper(), 12, Helper.Align.RIGHT); screenLabels[b + 6].Text = " APOAPSIS: " + Helper.prtlen(Math.Round(orbit.ApoapsisAltitude).ToString(), 12, Helper.Align.RIGHT); screenLabels[b + 7].Text = " PERIAPSIS: " + Helper.prtlen(Math.Round(orbit.PeriapsisAltitude).ToString(), 12, Helper.Align.RIGHT); if (double.IsInfinity(orbit.Period)) { screenLabels[b + 9].Text = " PERIOD: ESCAPE"; } else { screenLabels[b + 9].Text = " PERIOD: " + Helper.prtlen(Helper.timeString(orbit.Period, 2), 12, Helper.Align.RIGHT); } screenLabels[b + 11].Text = " ECCENTRICITY: " + Helper.prtlen(Helper.toFixed(orbit.Eccentricity, 5), 12, Helper.Align.RIGHT); screenLabels[b + 12].Text = " INCLINATION: " + Helper.prtlen(Helper.toFixed(Helper.rad2deg(orbit.Inclination), 3), 12, Helper.Align.RIGHT); screenLabels[b + 13].Text = " LONG OF ASC NODE: " + Helper.prtlen(Helper.toFixed(Helper.rad2deg(orbit.LongitudeOfAscendingNode), 3), 12, Helper.Align.RIGHT); screenLabels[b + 14].Text = " ARG OF PERIAPSIS: " + Helper.prtlen(Helper.toFixed(Helper.rad2deg(orbit.ArgumentOfPeriapsis), 2), 12, Helper.Align.RIGHT); } else { for (int i = 4; i < 15; i++) { screenLabels[b + i].Text = ""; } } }
public override void updateLocalElements(object sender, EventArgs e) { screenLabels[2].Text = "LT: " + Helper.timeString(DateTime.Now.TimeOfDay.TotalSeconds); if (form.form.connected && form.form.krpc.CurrentGameScene == GameScene.Flight) { MET = screenStreams.GetData(DataType.vessel_MET); UT = screenStreams.GetData(DataType.spacecenter_universial_time); frame = screenStreams.GetData(DataType.body_nonRotatingReferenceFrame); RCS = screenStreams.GetData(DataType.control_RCS); autoPilot = screenStreams.GetData(DataType.vessel_autoPilot); screenLabels[3].Text = "MET: " + Helper.timeString(MET, 3); if (autoPilotState) { screenButtons[0].setLitState(true); } else { screenButtons[0].setLitState(false); } if (autoPilot.SAS) { screenButtons[1].setLitState(true); } else { screenButtons[1].setLitState(false); } if (RCS) { screenButtons[2].setLitState(true); } else { screenButtons[2].setLitState(false); } Tuple <double, double, double> dir = screenStreams.GetData(DataType.flight_direction); Tuple <double, double, double> idir = screenStreams.GetData(DataType.flight_inertial_direction); string dirs = "SURF: "; dirs += Helper.toFixed(dir.Item1, 3).ToString(); dirs += " :: " + Helper.toFixed(dir.Item2, 3).ToString(); dirs += " :: " + Helper.toFixed(dir.Item3, 3).ToString(); dirs += "\nINER: " + Helper.toFixed(idir.Item1, 3).ToString(); dirs += " :: " + Helper.toFixed(idir.Item2, 3).ToString(); dirs += " :: " + Helper.toFixed(idir.Item3, 3).ToString(); Tuple <double, double, double, double> rot = screenStreams.GetData(DataType.flight_rotation); Tuple <double, double, double, double> irot = screenStreams.GetData(DataType.flight_inertial_rotation); dirs += "\n\nSURF: "; dirs += Helper.toFixed(rot.Item1, 3).ToString(); dirs += " :: " + Helper.toFixed(rot.Item2, 3).ToString(); dirs += " :: " + Helper.toFixed(rot.Item3, 3).ToString(); dirs += " :: " + Helper.toFixed(rot.Item4, 3).ToString(); dirs += "\nINER: "; dirs += Helper.toFixed(irot.Item1, 3).ToString(); dirs += " :: " + Helper.toFixed(irot.Item2, 3).ToString(); dirs += " :: " + Helper.toFixed(irot.Item3, 3).ToString(); dirs += " :: " + Helper.toFixed(irot.Item4, 3).ToString(); screenLabels[10].Text = dirs; } }
public override void updateLocalElements(object sender, EventArgs e) { // Re-usable data variable for graph data List <List <KeyValuePair <double, double?> > > data = new List <List <KeyValuePair <double, double?> > >(); List <Plot.Type> types = new List <Plot.Type>(); if (form.form.connected && form.form.krpc.CurrentGameScene == GameScene.Flight) { inertRotation = screenStreams.GetData(DataType.flight_inertial_rotation); MET = screenStreams.GetData(DataType.vessel_MET); MeanAltitude = screenStreams.GetData(DataType.flight_meanAltitude); SurfaceAltitude = screenStreams.GetData(DataType.flight_surfaceAltitude); ApoapsisAltitude = screenStreams.GetData(DataType.orbit_apoapsisAltitude); PeriapsisAltitude = screenStreams.GetData(DataType.orbit_periapsisAltitude); TimeToApoapsis = screenStreams.GetData(DataType.orbit_timeToApoapsis); TimeToPeriapsis = screenStreams.GetData(DataType.orbit_timeToPeriapsis); Inclination = screenStreams.GetData(DataType.orbit_inclination); Eccentricity = screenStreams.GetData(DataType.orbit_eccentricity); OrbSpeed = screenStreams.GetData(DataType.orbit_speed); Speed = screenStreams.GetData(DataType.flight_speed); EquatorialRadius = screenStreams.GetData(DataType.body_radius); GravitationalParameter = screenStreams.GetData(DataType.body_gravityParameter); Roll = screenStreams.GetData(DataType.flight_roll); Pitch = screenStreams.GetData(DataType.flight_pitch); Yaw = screenStreams.GetData(DataType.flight_heading); BodyName = screenStreams.GetData(DataType.body_name); lat = screenStreams.GetData(DataType.flight_latitude); lon = screenStreams.GetData(DataType.flight_longitude); AtmosphereDensity = screenStreams.GetData(DataType.flight_atmosphereDensity); StaticPressure = screenStreams.GetData(DataType.flight_staticPressure); DynamicPressure = screenStreams.GetData(DataType.flight_dynamicPressure); LiquidFuelMax = screenStreams.GetData(DataType.resource_stage_max_liquidFuel); LiquidFuelAmount = screenStreams.GetData(DataType.resource_stage_amount_liquidFuel); OxidizerMax = screenStreams.GetData(DataType.resource_stage_max_oxidizer); OxidizerAmount = screenStreams.GetData(DataType.resource_stage_amount_oxidizer); MonoPropellantMax = screenStreams.GetData(DataType.resource_stage_max_monoPropellant); MonoPropellantAmount = screenStreams.GetData(DataType.resource_stage_amount_monoPropellant); ElectricChargeMax = screenStreams.GetData(DataType.resource_stage_max_electricCharge); ElectricChargeAmount = screenStreams.GetData(DataType.resource_stage_amount_electricCharge); SAS = screenStreams.GetData(DataType.control_SAS); RCS = screenStreams.GetData(DataType.control_RCS); Gear = screenStreams.GetData(DataType.control_gear); Brakes = screenStreams.GetData(DataType.control_brakes); Lights = screenStreams.GetData(DataType.control_lights); Abort = screenStreams.GetData(DataType.control_abort); GForce = screenStreams.GetData(DataType.flight_gForce); screenLabels[0].Text = " LT: " + Helper.timeString(DateTime.Now.TimeOfDay.TotalSeconds); screenLabels[1].Text = "MET: " + Helper.timeString(MET, 3); // Orbit info screenLabels[30].Text = " Alt: " + Helper.prtlen(Math.Round(MeanAltitude).ToString(), 9, Helper.Align.RIGHT); // Altitude screenLabels[31].Text = " Apoapsis: " + Helper.prtlen(Math.Round(ApoapsisAltitude).ToString(), 9, Helper.Align.RIGHT); // Apoapsis screenLabels[32].Text = "Periapsis: " + Helper.prtlen(Math.Round(PeriapsisAltitude).ToString(), 9, Helper.Align.RIGHT); // Periapasis screenLabels[33].Text = " TtA: " + Helper.prtlen(Helper.timeString(TimeToApoapsis), 9, Helper.Align.RIGHT); // Time to Apoapsis screenLabels[34].Text = " TtP: " + Helper.prtlen(Helper.timeString(TimeToPeriapsis), 9, Helper.Align.RIGHT); // Time to Periapsis screenLabels[35].Text = " Inc: " + Helper.prtlen(Helper.toFixed(Helper.rad2deg(Inclination), 3), 9, Helper.Align.RIGHT); // Inclination screenLabels[36].Text = " Ecc: " + Helper.prtlen(Helper.toFixed(Eccentricity, 3), 9, Helper.Align.RIGHT); // Eccentricity screenLabels[37].Text = " Orb. Vel: " + Helper.prtlen(Helper.toFixed(OrbSpeed, 1), 9, Helper.Align.RIGHT); // Orbit Velocity screenLabels[38].Text = " Sur. Vel: " + Helper.prtlen(Helper.toFixed(Speed, 1), 9, Helper.Align.RIGHT); // Surface Velocity // Orbit Targets and Deltas double tgtA = 0, tgtP = 0; if (double.TryParse(screenInputs[0].Text, out tgtA) && double.TryParse(screenInputs[1].Text, out tgtP)) { double sMa = (tgtA + tgtP + (EquatorialRadius * 2)) / 2; double tgtEcc = (sMa - (tgtP + EquatorialRadius)) / sMa; screenLabels[60].Text = Helper.prtlen(Helper.toFixed(tgtEcc, 3), 8, Helper.Align.RIGHT); // Target Eccentricity screenLabels[67].Text = Helper.prtlen(Helper.toFixed(Eccentricity - tgtEcc, 3), 8, Helper.Align.RIGHT); // Delta Eccentricity } if (double.TryParse(screenInputs[0].Text, out tgtA)) { screenLabels[65].Text = Helper.prtlen(Math.Round(tgtA - ApoapsisAltitude).ToString(), 8, Helper.Align.RIGHT); } // Delta Apoapsis if (double.TryParse(screenInputs[1].Text, out tgtP)) { screenLabels[66].Text = Helper.prtlen(Math.Round(tgtP - PeriapsisAltitude).ToString(), 8, Helper.Align.RIGHT); } // Delta Periapsis double u = GravitationalParameter; double a = EquatorialRadius + tgtA; double r = EquatorialRadius + tgtA; double v = Math.Sqrt(u * ((2 / r) - (1 / a))); screenLabels[61].Text = Helper.prtlen(Helper.toFixed(v, 1), 8, Helper.Align.RIGHT); // Target Obital Velocity at Apoapsis // POSITION AND ROTATION INFO Tuple <double, double, double> iRPY = Helper.RPYFromQuaternion(inertRotation, "INER"); inertRoll = (float)iRPY.Item1; inertPitch = (float)iRPY.Item2; inertYaw = (float)iRPY.Item3; screenLabels[46].Text = "R: " + Helper.prtlen(Helper.toFixed(Roll, 2), 7, Helper.Align.RIGHT) + " " + Helper.prtlen(Helper.toFixed(inertRoll, 2), 7, Helper.Align.RIGHT); screenLabels[47].Text = "P: " + Helper.prtlen(Helper.toFixed(Pitch, 2), 7, Helper.Align.RIGHT) + " " + Helper.prtlen(Helper.toFixed(inertPitch, 2), 7, Helper.Align.RIGHT); screenLabels[48].Text = "Y: " + Helper.prtlen(Helper.toFixed(Yaw, 2), 7, Helper.Align.RIGHT) + " " + Helper.prtlen(Helper.toFixed(inertYaw, 2), 7, Helper.Align.RIGHT); screenLabels[40].Text = " Body: " + Helper.prtlen(BodyName, 9, Helper.Align.RIGHT); screenLabels[41].Text = " Lat: " + Helper.prtlen(Helper.toFixed(lat, 5), 9, Helper.Align.RIGHT); screenLabels[42].Text = " Lon: " + Helper.prtlen(Helper.toFixed(lon, 5), 9, Helper.Align.RIGHT); screenLabels[43].Text = " Atm.Den: " + Helper.prtlen(Helper.toFixed(AtmosphereDensity, 1), 9, Helper.Align.RIGHT) + " Radar Alt: " + Helper.prtlen(Math.Round(SurfaceAltitude).ToString(), 7, Helper.Align.RIGHT); screenLabels[44].Text = " Atm.Pre: " + Helper.prtlen(Math.Round(StaticPressure).ToString(), 9, Helper.Align.RIGHT); screenLabels[45].Text = " Dyn.Pre: " + Helper.prtlen(Math.Round(DynamicPressure).ToString(), 9, Helper.Align.RIGHT) + " G-Force: " + Helper.prtlen(Helper.toFixed(GForce, 2), 7, Helper.Align.RIGHT); // Supplies double mF = LiquidFuelMax; double cF = LiquidFuelAmount; double mO = OxidizerMax; double cO = OxidizerAmount; double mM = MonoPropellantMax; double cM = MonoPropellantAmount; double mE = ElectricChargeMax; double cE = ElectricChargeAmount; screenLabels[50].Text = " LF LO MP EC"; screenLabels[51].Text = "STAGE:" + Helper.prtlen(Math.Round(cF).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Math.Round(cO).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Helper.toFixed(cM, 2), 7, Helper.Align.RIGHT) + Helper.prtlen(Math.Round(cE).ToString(), 7, Helper.Align.RIGHT); screenLabels[52].Text = " %:" + Helper.prtlen(Math.Round((cF / mF) * 100).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Math.Round((cO / mO) * 100).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Math.Round((cM / mM) * 100).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Math.Round((cE / mE) * 100).ToString(), 7, Helper.Align.RIGHT); mF = screenStreams.GetData(DataType.resource_total_max_liquidFuel); cF = screenStreams.GetData(DataType.resource_total_amount_liquidFuel); mO = screenStreams.GetData(DataType.resource_total_max_oxidizer); cO = screenStreams.GetData(DataType.resource_total_amount_oxidizer); mM = screenStreams.GetData(DataType.resource_total_max_monoPropellant); cM = screenStreams.GetData(DataType.resource_total_amount_monoPropellant); mE = screenStreams.GetData(DataType.resource_total_max_electricCharge); cE = screenStreams.GetData(DataType.resource_total_amount_electricCharge); screenLabels[54].Text = " TOT:" + Helper.prtlen(Math.Round(cF).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Math.Round(cO).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Helper.toFixed(cM, 2), 7, Helper.Align.RIGHT) + Helper.prtlen(Math.Round(cE).ToString(), 7, Helper.Align.RIGHT); screenLabels[55].Text = " %:" + Helper.prtlen(Math.Round((cF / mF) * 100).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Math.Round((cO / mO) * 100).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Math.Round((cM / mM) * 100).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Math.Round((cE / mE) * 100).ToString(), 7, Helper.Align.RIGHT); // Status if (SAS) { screenIndicators[0].setStatus(Indicator.status.GREEN); } else { screenIndicators[0].setStatus(Indicator.status.OFF); } // SAS if (RCS) { screenIndicators[1].setStatus(Indicator.status.GREEN); } else { screenIndicators[1].setStatus(Indicator.status.OFF); } // RCS if (Gear) { screenIndicators[2].setStatus(Indicator.status.GREEN); } else { screenIndicators[2].setStatus(Indicator.status.OFF); } // GEAR if (Brakes) { screenIndicators[3].setStatus(Indicator.status.RED); } else { screenIndicators[3].setStatus(Indicator.status.OFF); } // Break if (Lights) { screenIndicators[4].setStatus(Indicator.status.AMBER); } else { screenIndicators[4].setStatus(Indicator.status.OFF); } // Lights if (Abort) { screenIndicators[5].setStatus(Indicator.status.RED); } else { screenIndicators[5].setStatus(Indicator.status.OFF); } // Abort if (GForce > 4) { screenIndicators[7].setStatus(Indicator.status.AMBER); } else { screenIndicators[7].setStatus(Indicator.status.OFF); } // G High double maxR = mE; double curR = cE; if (curR / maxR > 0.95) { screenIndicators[6].setStatus(Indicator.status.GREEN); } else { screenIndicators[6].setStatus(Indicator.status.OFF); } // Power High if (curR / maxR < 0.1) { screenIndicators[9].setStatus(Indicator.status.RED); } else { screenIndicators[9].setStatus(Indicator.status.OFF); } // Power Low maxR = mM; curR = cM; if (curR / maxR < 0.1) { screenIndicators[10].setStatus(Indicator.status.RED); } else { screenIndicators[10].setStatus(Indicator.status.OFF); } // Monopropellant Low maxR = mF; curR = cF; if (curR / maxR < 0.1) { screenIndicators[11].setStatus(Indicator.status.RED); } else { screenIndicators[11].setStatus(Indicator.status.OFF); } // Fuel Low maxR = mO; curR = cO; if (curR / maxR < 0.1) { screenIndicators[8].setStatus(Indicator.status.RED); } else { screenIndicators[8].setStatus(Indicator.status.OFF); } // LOW Low // Graphs int xMin = screenCharts[0].findMinX(chartData["altitudeTime"]); int xMax = screenCharts[0].findMaxX(chartData["altitudeTime"]); List <KeyValuePair <double, double?> > targetA = new List <KeyValuePair <double, double?> >(); targetA.Add(new KeyValuePair <double, double?>(xMin, tgtA)); targetA.Add(new KeyValuePair <double, double?>(xMax, tgtA)); List <KeyValuePair <double, double?> > targetP = new List <KeyValuePair <double, double?> >(); targetP.Add(new KeyValuePair <double, double?>(xMin, tgtP)); targetP.Add(new KeyValuePair <double, double?>(xMax, tgtP)); data = new List <List <KeyValuePair <double, double?> > >(); types = new List <Plot.Type>(); data.Add(targetA); types.Add(Plot.Type.LINE); data.Add(targetP); types.Add(Plot.Type.LINE); data.Add(chartData["apoapsisTime"]); types.Add(Plot.Type.LINE); data.Add(chartData["periapsisTime"]); types.Add(Plot.Type.LINE); data.Add(chartData["altitudeTime"]); types.Add(Plot.Type.LINE); screenCharts[0].setData(data, types, false); data = new List <List <KeyValuePair <double, double?> > >(); types = new List <Plot.Type>(); data.Add(chartData["geeTime"]); types.Add(Plot.Type.LINE); data.Add(chartData["dynPresTime"]); types.Add(Plot.Type.LINE); screenCharts[1].setData(data, types, true); } }
public override void updateLocalElements(object sender, EventArgs e) { screenLabels[2].Text = "LT: " + Helper.timeString(DateTime.Now.TimeOfDay.TotalSeconds); if (form.form.connected && form.form.krpc.CurrentGameScene == GameScene.Flight) { MET = screenStreams.GetData(DataType.vessel_MET); parts = screenStreams.GetData(DataType.vessel_parts); screenLabels[3].Text = "MET: " + Helper.timeString(MET, 3); // FIND SOURCES, DRAINS, AND STORAGE if (parts != null) { Dictionary <ulong, string> storage = new Dictionary <ulong, string>(); List <string> source = new List <string>(); double solarGenSum = 0; double solarSunSum = 0; double storageCapSum = 0; double storageLvlSum = 0; double storageFlwSum = 0; IList <Part> partList = parts.All; /*Console.WriteLine("*************"); * Console.WriteLine("* PART LIST *"); * Console.WriteLine("*************"); */ foreach (Part p in partList) { Resources r = p.Resources; /*Console.WriteLine(""); * Console.WriteLine(" === " + p.Title + " ==="); * Console.WriteLine(" STAGE : " + p.Stage.ToString()); * * Console.WriteLine(" == MODULES =="); * IList<Module> m = p.Modules; * foreach(Module mod in m) * { * Console.WriteLine(" " + mod.Name); * IDictionary<string, string> f = mod.Fields; * foreach(KeyValuePair<string, string> kvp in f) * { * Console.WriteLine(" " + kvp.Key + ": " + kvp.Value); * } * } * * Console.WriteLine(" == RESOURCES =="); * * IList<Resource> ra = r.All; * foreach (Resource res in ra) * { * Console.WriteLine(" " + res.Name); * } */ if (r.HasResource("ElectricCharge")) { ulong id = p.id; double flow = 0; float curAmount = r.Amount("ElectricCharge"); float maxAmount = r.Max("ElectricCharge"); // FIND FLOW AND STORE CURRENT LEVEL if (storagePrevLvl.ContainsKey(id)) { flow = curAmount - storagePrevLvl[id]; storagePrevLvl[id] = curAmount; } else { storagePrevLvl.Add(id, curAmount); } // Add to totalt storageCapSum += maxAmount; storageLvlSum += curAmount; storageFlwSum += flow; string s = ""; s += Helper.prtlen(p.Title.ToUpper(), 35, Helper.Align.RIGHT); s += Helper.prtlen(Helper.toFixed(maxAmount, 2), 10, Helper.Align.RIGHT); s += Helper.prtlen(Helper.toFixed(curAmount, 2), 10, Helper.Align.RIGHT); s += Helper.prtlen(Helper.toFixed(flow, 2), 10, Helper.Align.RIGHT); storage.Add(id, s); } SolarPanel panel = p.SolarPanel; if (panel != null) { float flow = panel.EnergyFlow; float sun = panel.SunExposure; // Add to totalt solarGenSum += flow; solarSunSum += sun; string s = ""; s += Helper.prtlen(p.Title.ToUpper(), 18, Helper.Align.RIGHT); s += Helper.prtlen(Helper.toFixed(flow, 2), 8, Helper.Align.RIGHT); s += Helper.prtlen(Helper.toFixed(sun, 2), 8, Helper.Align.RIGHT); source.Add(s); } } // PRINT FIRST 13 OF EACH for (int i = 0; i < 13; i++) { if (source.Count > i) { screenLabels[10 + i].Text = source[i]; } else { screenLabels[10 + i].Text = ""; } } for (int i = 0; i < 13; i++) { if (storage.Count > i) { KeyValuePair <ulong, string> kvp = storage.ElementAt(i); screenLabels[30 + i].Text = kvp.Value; } else { screenLabels[30 + i].Text = ""; } } // PRINT TOTALS screenLabels[7].Text = " SOLAR: " + Helper.prtlen(Helper.toFixed(solarGenSum, 2), 8, Helper.Align.RIGHT) + Helper.prtlen(Helper.toFixed(solarSunSum, 2), 8, Helper.Align.RIGHT); string storSums = " STORAGE: "; storSums += Helper.prtlen(Helper.toFixed(storageCapSum, 2), 8, Helper.Align.RIGHT); storSums += Helper.prtlen(Helper.toFixed(storageLvlSum, 2), 8, Helper.Align.RIGHT); storSums += Helper.prtlen(Helper.toFixed(storageFlwSum, 2), 8, Helper.Align.RIGHT); screenLabels[9].Text = storSums; } } }
public override void updateLocalElements(object sender, EventArgs e) { // Re-usable data variable for graph data List <List <KeyValuePair <double, double?> > > data = new List <List <KeyValuePair <double, double?> > >(); List <Plot.Type> types = new List <Plot.Type>(); // Calculate trajectory bounds int steps = 50; string tgtapo = form.dataStorage.getData("TGTAPO"); if (tgtapo == "") { tgtapo = "120000"; form.dataStorage.setData("TGTAPO", "120000"); } int.TryParse(tgtapo, out int apo); List <KeyValuePair <double, double?> > middle = new List <KeyValuePair <double, double?> >(); List <KeyValuePair <double, double?> > upper = new List <KeyValuePair <double, double?> >(); List <KeyValuePair <double, double?> > lower = new List <KeyValuePair <double, double?> >(); //Dictionary<int, double?> lower = new Dictionary<int, double?>(); for (int i = 0; i <= steps; i++) { int x = (int)Math.Round(i * (range / steps)); double?y = Math.Sqrt(Math.Pow(apo, 2) * (1 - (Math.Pow(x - range, 2) / Math.Pow(range, 2)))); middle.Add(new KeyValuePair <double, double?>(x, y)); double c = range / 2.5f; y = Math.Sqrt(Math.Pow(apo, 2) * (1 - (Math.Pow(x - range, 2) / Math.Pow(range * 0.8, 2)))); if (!double.IsNaN((double)y)) { lower.Add(new KeyValuePair <double, double?>(x, y)); } y = Math.Sqrt(Math.Pow(apo, 2) * (1 - (Math.Pow(x - range, 2) / Math.Pow(range * 1.2, 2)))); upper.Add(new KeyValuePair <double, double?>(x, y)); } data = new List <List <KeyValuePair <double, double?> > >(); types = new List <Plot.Type>(); data.Add(middle); types.Add(Plot.Type.LINE); data.Add(lower); types.Add(Plot.Type.LINE); data.Add(upper); types.Add(Plot.Type.LINE); if (form.form.connected && form.form.krpc.CurrentGameScene == GameScene.Flight) { data.Add(chartData["altitudeRange"]); types.Add(Plot.Type.CROSS); } screenCharts[0].setData(data, types, false); if (form.form.originLat != null) { string lat = Helper.toFixed(form.form.originLat, 4); string lon = Helper.toFixed(form.form.originLon, 4); screenLabels[1].Text = "ORIGIN: " + lat + " " + lon; } }
private void updateDeltaVStats(int currentStage, Parts parts) { double[] stageWetMass = new double[currentStage + 1]; double[] stageDryMass = new double[currentStage + 1]; double[] stageISP = new double[currentStage + 1]; double[] stageDV = new double[currentStage + 1]; double[] stageThrust = new double[currentStage + 1]; // Iterate all (remaining) stages if (parts != null) { for (int i = currentStage; i >= 0; i--) { IList <Part> stageParts = parts.InDecoupleStage(i); double wetMass = 0; double dryMass = 0; List <double> engineThrust = new List <double>(); List <double> engineISP = new List <double>(); // Iterate all parts foreach (Part part in stageParts) { wetMass += part.Mass; dryMass += part.DryMass; Engine engine = part.Engine; if (engine != null) { engineThrust.Add(engine.MaxThrust); engineISP.Add(engine.VacuumSpecificImpulse); } } stageWetMass[i] = wetMass; stageDryMass[i] = dryMass; // Sum the engines double totalThrust = 0; double totalDivisor = 0; for (int j = 0; j < engineThrust.Count; j++) { totalThrust += engineThrust[j]; totalDivisor += engineThrust[j] / engineISP[j]; } stageThrust[i] = totalThrust; stageISP[i] = totalThrust / totalDivisor; } } // Go through and calulate stage Delta-V String stageDeltas = ""; bool curStage = false; for (int i = stageISP.Length - 1; i >= 0; i--) { double totalDryMass = stageDryMass[i]; double totalWetMass = stageWetMass[i]; for (int j = i - 1; j >= 0; j--) { totalDryMass += stageWetMass[j]; totalWetMass += stageWetMass[j]; } stageDV[i] = Math.Log(totalWetMass / totalDryMass) * stageISP[i] * g; if (curStage == false && !double.IsNaN(stageDV[i])) { stageDeltas += Helper.prtlen(Helper.toFixed(stageDV[i], 2), 9, Helper.Align.RIGHT); curStage = true; } } screenLabels[81].Text = "STG: " + stageDeltas + " m/s"; // SUM TOTAL double totalDV = 0; foreach (double dv in stageDV) { if (!double.IsNaN(dv)) { totalDV += dv; } } screenLabels[82].Text = "TOT: " + Helper.prtlen(Helper.toFixed(totalDV, 2), 9, Helper.Align.RIGHT) + " m/s"; // CALCULATE BURN TIME double sDv = 0; double sTh = 0; for (int i = stageDV.Length - 1; i >= 0; i--) { if (!double.IsNaN(stageDV[i])) { sDv = stageDV[i]; sTh = stageThrust[i]; break; } } double deltaV; try { deltaV = double.Parse(screenInputs[1].Text); } catch (Exception) { deltaV = 0; } double burnSecs = burnTime(deltaV, sDv, sTh); screenLabels[84].Text = "BURN TIME: " + Helper.timeString(burnSecs, false); }
public override void updateLocalElements(object sender, EventArgs e) { // Re-usable data variable for graph data List <List <KeyValuePair <double, double?> > > data = new List <List <KeyValuePair <double, double?> > >(); List <Plot.Type> types = new List <Plot.Type>(); if (form.form.connected && form.form.krpc.CurrentGameScene == GameScene.Flight) { currentStage = screenStreams.GetData(DataType.control_currentStage); MET = screenStreams.GetData(DataType.vessel_MET); parts = screenStreams.GetData(DataType.vessel_parts); vesselReferenceFrame = screenStreams.GetData(DataType.vessel_referenceFrame); bool force = false; if (currentStage != oldStage) { force = true; screenStreams.setStage(currentStage); Console.WriteLine(DateTime.Now.ToString() + "." + DateTime.Now.Millisecond.ToString() + " NEW STAGE: " + currentStage.ToString()); } getStageSupplies(force); if (LiquidFuelMax == 0) { // TRY TO WALK TROUGH THE STAGES UNTIL FUEL IS FOUND OR STAGES RUN OUT for (int s = currentStage - 1; s >= 0; s--) { screenStreams.setStage(s); Console.WriteLine(DateTime.Now.ToString() + "." + DateTime.Now.Millisecond.ToString() + " SET STREAM STAGE: " + s.ToString()); getStageSupplies(true); if (LiquidFuelMax != 0) { oldStage = currentStage; break; } } } TotLiquidFuelMax = screenStreams.GetData(DataType.resource_total_max_liquidFuel); TotLiquidFuelAmount = screenStreams.GetData(DataType.resource_total_amount_liquidFuel); TotOxidizerMax = screenStreams.GetData(DataType.resource_total_max_oxidizer); TotOxidizerAmount = screenStreams.GetData(DataType.resource_total_amount_oxidizer); TotMonoPropellantMax = screenStreams.GetData(DataType.resource_total_max_monoPropellant); TotMonoPropellantAmount = screenStreams.GetData(DataType.resource_total_amount_monoPropellant); mass = screenStreams.GetData(DataType.vessel_mass); screenLabels[2].Text = "LT: " + Helper.timeString(DateTime.Now.TimeOfDay.TotalSeconds); screenLabels[3].Text = "MET: " + Helper.timeString(MET, 3); // 0 RPC /** * Engines **/ // Get parts in current stage screenLabels[6].Text = "STAGE: " + currentStage.ToString(); // 0 RPC bool foundEngine = false; double multiplier = 91; double maxDev = 0; double stageCurThr = 0; double stageMaxThr = 0; int n = 0; if (parts != null) { // CLEAR OLD ENGINES foreach (EngineIndicator ei in screenEngines) { ei.display(false); } for (int i = currentStage; i >= 0; i--) { IList <Part> stageParts = parts.InStage(i); foreach (Part part in stageParts) { Engine eng = part.Engine; if (eng != null) { foundEngine = true; Tuple <double, double, double> pos = part.Position(vesselReferenceFrame); double left = pos.Item1; double top = pos.Item3; double devX = Math.Abs(left); if (devX > maxDev) { maxDev = devX; } double devY = Math.Abs(top); if (devY > maxDev) { maxDev = devY; } if (screenEngines.Count < (n + 1)) { screenEngines.Add(null); screenEngines[n] = Helper.CreateEngine(0, 0, (n + 1).ToString(), eng.MaxVacuumThrust); } screenEngines[n].display(true); screenEngines[n].setThrust(eng.MaxVacuumThrust); screenEngines[n].offsetX = left; screenEngines[n].offsetY = top; if (eng.Thrust > 0) { screenEngines[n].setStatus(true); } else { screenEngines[n].setStatus(false); } // Engine data screenLabels[41 + n].Text = Helper.prtlen((n + 1).ToString(), 4, Helper.Align.RIGHT) + ":" + "" + Helper.prtlen(Helper.toFixed(eng.Thrust / 1000, 1), 7, Helper.Align.RIGHT) + " " + Helper.prtlen(Helper.toFixed(eng.MaxThrust / 1000, 1), 7, Helper.Align.RIGHT) + " " + Helper.prtlen(Helper.toFixed(eng.VacuumSpecificImpulse, 1), 5, Helper.Align.RIGHT); stageCurThr += eng.Thrust; stageMaxThr += eng.MaxThrust; n++; } } if (foundEngine) { int engNum = n; // TOTAL THUST AND STUFF screenLabels[41 + n].Text = "─────────────────────────────────"; n++; screenLabels[41 + n].Text = " TOT:" + "" + Helper.prtlen(Helper.toFixed(stageCurThr / 1000, 1), 7, Helper.Align.RIGHT) + " " + Helper.prtlen(Helper.toFixed(stageMaxThr / 1000, 1), 7, Helper.Align.RIGHT); n++; // CLEAR OUT OLD LABLED while (n < 20) { screenLabels[41 + n].Text = ""; n++; } int maxSpread = 96; multiplier = maxSpread / maxDev; if (engNum == 1) { multiplier = 0; } // CENTER POINT int centerX = 184; int centerY = 214; // position indicators for (int j = 0; j < engNum; j++) { int x = (int)Math.Round(centerX + (screenEngines[j].offsetX * multiplier)); int y = (int)Math.Round(centerY + (screenEngines[j].offsetY * multiplier)); screenEngines[j].setCenterPoint(x, y); } break; } } } // Disable other engineIndicators while (n < screenEngines.Count) { screenEngines[n].Dispose(); screenEngines.RemoveAt(n); screenLabels[41 + n].Text = ""; n++; } screenEngines.TrimExcess(); // Weight and TWR double weight = mass / 1000; double TWRc = (stageCurThr / 1000) / (weight * 9.81); double TWRm = (stageMaxThr / 1000) / (weight * 9.81);; screenLabels[62].Text = " MASS: " + Helper.prtlen(Helper.toFixed(weight, 1), 5, Helper.Align.RIGHT) + "t"; screenLabels[64].Text = " TWR: " + Helper.prtlen(Helper.toFixed(TWRc, 2), 4, Helper.Align.RIGHT) + " " + Helper.prtlen(Helper.toFixed(TWRm, 2), 4, Helper.Align.RIGHT); // Supplies double mF = LiquidFuelMax; double cF = LiquidFuelAmount; double mO = OxidizerMax; double cO = OxidizerAmount; double mM = MonoPropellantMax; double cM = MonoPropellantAmount; screenLabels[70].Text = " LF LO MP"; screenLabels[71].Text = "STAGE:" + Helper.prtlen(Math.Round(cF).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Math.Round(cO).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Helper.toFixed(cM, 2), 7, Helper.Align.RIGHT); screenLabels[72].Text = " %:" + Helper.prtlen(Math.Round((cF / mF) * 100).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Math.Round((cO / mO) * 100).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Math.Round((cM / mM) * 100).ToString(), 7, Helper.Align.RIGHT); mF = TotLiquidFuelMax; cF = TotLiquidFuelAmount; mO = TotOxidizerMax; cO = TotOxidizerAmount; mM = TotMonoPropellantMax; cM = TotMonoPropellantAmount; screenLabels[74].Text = " TOT:" + Helper.prtlen(Math.Round(cF).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Math.Round(cO).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Helper.toFixed(cM, 2), 7, Helper.Align.RIGHT); screenLabels[75].Text = " %:" + Helper.prtlen(Math.Round((cF / mF) * 100).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Math.Round((cO / mO) * 100).ToString(), 7, Helper.Align.RIGHT) + Helper.prtlen(Math.Round((cM / mM) * 100).ToString(), 7, Helper.Align.RIGHT); // Delta V // TOTO: Maybe buttonifize this, so the calculations are not done every refresh. updateDeltaVStats(currentStage, parts); } }
public override void updateLocalElements(object sender, EventArgs e) { screenLabels[2].Text = "LT: " + Helper.timeString(DateTime.Now.TimeOfDay.TotalSeconds); if (form.form.connected && form.form.krpc.CurrentGameScene == GameScene.Flight) { double MET = screenStreams.GetData(DataType.vessel_MET); screenLabels[3].Text = "MET: " + Helper.timeString(MET, 3); parts = screenStreams.GetData(DataType.vessel_parts); partStrings.Clear(); double totFuel = 0; double totLox = 0; double totMono = 0; if (parts != null) { IList <Part> partList = parts.All; foreach (Part p in partList) { Resources r = p.Resources; if (r.HasResource("MonoPropellant") || r.HasResource("LiquidFuel") || r.HasResource("Oxidizer")) { float fuelA = r.Amount("LiquidFuel"); float loxA = r.Amount("Oxidizer"); float monoA = r.Amount("MonoPropellant"); totFuel += fuelA; totLox += loxA; totMono += monoA; float fuelM = r.Max("LiquidFuel"); float loxM = r.Max("Oxidizer"); float monoM = r.Max("MonoPropellant"); string name = Helper.prtlen(p.Title, 40).ToUpper(); int stage = p.DecoupleStage; string stageStr = Helper.prtlen(stage.ToString(), 3, Helper.Align.RIGHT); string fuel = Helper.prtlen(Helper.toFixed(fuelA, 1), 8, Helper.Align.RIGHT); string lox = Helper.prtlen(Helper.toFixed(loxA, 1), 8, Helper.Align.RIGHT); string mono = Helper.prtlen(Helper.toFixed(monoA, 2), 7, Helper.Align.RIGHT); float fuelP = (fuelA / fuelM) * 100f; if (fuelM == 0) { fuelP = 0; } float loxP = (loxA / loxM) * 100f; if (loxM == 0) { loxP = 0; } float monoP = (monoA / monoM) * 100f; if (monoM == 0) { monoP = 0; } string fuelS = Helper.prtlen(Helper.toFixed(fuelP, 2), 7, Helper.Align.RIGHT) + "%"; string loxS = Helper.prtlen(Helper.toFixed(loxP, 2), 7, Helper.Align.RIGHT) + "%"; string monoS = Helper.prtlen(Helper.toFixed(monoP, 2), 7, Helper.Align.RIGHT) + "%"; partStrings.Add(new Tuple <int, string>(stage, stageStr + " " + name + fuel + fuelS + lox + loxS + mono + monoS)); } } } // SORT THE LIST partStrings.Sort((x, y) => y.Item1.CompareTo(x.Item1)); for (int i = 5; i < 31; i++) { if (partStrings.Count > i - 5) { screenLabels[i].Text = partStrings[i - 5].Item2; } else { screenLabels[i].Text = ""; } } // PRINT TOTALS (123456.0 123456.0 12345.00) string totF = Helper.prtlen(Helper.toFixed(totFuel, 1), 11, Helper.Align.RIGHT); string totL = Helper.prtlen(Helper.toFixed(totLox, 1), 11, Helper.Align.RIGHT); string totM = Helper.prtlen(Helper.toFixed(totMono, 2), 11, Helper.Align.RIGHT); screenLabels[52].Text = totF + totL + totM; screenLabels[55].Text = "CURRENT STAGE: " + screenStreams.GetData(DataType.control_currentStage).ToString(); } }
public override void updateLocalElements(object sender, EventArgs e) { // Always update Local Time screenLabels[1].Text = " LT: " + Helper.timeString(DateTime.Now.TimeOfDay.TotalSeconds); if (form.form.connected && form.form.krpc.CurrentGameScene == GameScene.Flight) { period = screenStreams.GetData(DataType.orbit_period); apopapsis = screenStreams.GetData(DataType.orbit_apoapsis); periapsis = screenStreams.GetData(DataType.orbit_periapsis); sMa = screenStreams.GetData(DataType.orbit_semiMajorAxis); sma = screenStreams.GetData(DataType.orbit_semiMinorAxis); argOP = screenStreams.GetData(DataType.orbit_argumentOfPeriapsis); lOAN = screenStreams.GetData(DataType.orbit_longitudeOfAscendingNode); eccentricity = screenStreams.GetData(DataType.orbit_eccentricity); inclination = screenStreams.GetData(DataType.orbit_inclination); radius = screenStreams.GetData(DataType.orbit_radius); trueAnomaly = screenStreams.GetData(DataType.orbit_trueAnomaly); timeToPe = screenStreams.GetData(DataType.orbit_timeToPeriapsis); timeToAp = screenStreams.GetData(DataType.orbit_timeToApoapsis); MET = screenStreams.GetData(DataType.vessel_MET); UT = screenStreams.GetData(DataType.spacecenter_universial_time); screenLabels[2].Text = "MET: " + Helper.timeString(MET, 3); screenLabels[3].Text = "UT: " + Helper.timeString(UT, 5); // ORBIT DATA DATA AND LABELS double nextAp = MET + timeToAp; double nextPe = MET + timeToPe; screenLabels[30].Text = "NEXT PER: " + Helper.timeString(nextPe, 4); screenLabels[31].Text = "NEXT APO: " + Helper.timeString(nextAp, 4); // BURN-RESULTANT ORBIT double TIG = -1; try { if (screenInputs[0].Text != "") { TIG += int.Parse(screenInputs[0].Text) * 3600; } if (screenInputs[1].Text != "") { TIG += int.Parse(screenInputs[1].Text) * 60; } if (screenInputs[2].Text != "") { TIG += double.Parse(screenInputs[2].Text, format); } TIG += (UT - MET); } catch (Exception) { //MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } double TAAUT = form.connection.SpaceCenter().ActiveVessel.Orbit.TrueAnomalyAtUT(TIG); my = form.connection.SpaceCenter().ActiveVessel.Orbit.Body.GravitationalParameter; // Make orbital plane vectors Tuple <double, double, double> velocityVectorInPlane = getVelocityVector(sMa, TAAUT, eccentricity, my); Tuple <double, double, double> positionVectorInPlane = getPositionVector(sMa, TAAUT, eccentricity); referencePlane = getGeocentricReferenceFrame(lOAN, inclination, argOP); double alpha = Math.Acos(velocityVectorInPlane.Item1 / Math.Sqrt(Math.Pow(velocityVectorInPlane.Item1, 2) + Math.Pow(velocityVectorInPlane.Item2, 2))); if (velocityVectorInPlane.Item1 > 0) { if (velocityVectorInPlane.Item2 > 0) { // Leave alpha as is } else { alpha = -alpha; } } else { if (velocityVectorInPlane.Item2 > 0) { alpha = Math.PI - alpha; } else { alpha = -(Math.PI - alpha); } } String totalV = "N.A."; Tuple <double, double, double> burnVector = new Tuple <double, double, double>(0, 0, 0); try { double bX = 0; double bY = 0; double bZ = 0; if (screenInputs[3].Text != "") { bX = double.Parse(screenInputs[3].Text, format); } // Pro/retro if (screenInputs[4].Text != "") { bY = double.Parse(screenInputs[4].Text, format); } // Radial in/out if (screenInputs[5].Text != "") { bZ = double.Parse(screenInputs[5].Text, format); } // Normal / AntiNormal totalV = Helper.toFixed(Math.Sqrt((bX * bX) + (bY * bY) + (bZ * bZ)), 3); burnVector = new Tuple <double, double, double>(bX, bY, bZ); velocityVectorInPlane = vectorChangeMagnitude(velocityVectorInPlane, bX); velocityVectorInPlane = vectorAddLeftMagnitude(velocityVectorInPlane, bY); velocityVectorInPlane = vectorAddUpMagnitude(velocityVectorInPlane, bZ); } catch (Exception) { //MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error); } // Tranform vectors Tuple <double, double, double> burnVectorInPlane = rotateVectorAroundZ(burnVector, alpha); velocityVector = transform(velocityVectorInPlane, referencePlane); positionVector = transform(positionVectorInPlane, referencePlane); Tuple <double, double, double> inertialBurnVector = transform(burnVectorInPlane, referencePlane); screenLabels[20].Text = "│ Total ΔV: " + totalV; // BURN ANGLES //Console.WriteLine(inertialBurnVector); double yaw = Helper.rad2deg(Math.Atan(inertialBurnVector.Item2 / inertialBurnVector.Item1)); if (inertialBurnVector.Item1 > 0) { if (inertialBurnVector.Item2 > 0) { // Kepp yaw as is } else { yaw = 360 + yaw; } } else { yaw = 180 + yaw; } double pitch = Helper.rad2deg(Math.Asin(inertialBurnVector.Item3 / vectorMagnitude(inertialBurnVector))); screenLabels[21].Text = "│ BURN ANGLES: " + Helper.prtlen(Helper.toFixed(0, 2), 6) + " " + Helper.prtlen(Helper.toFixed(pitch, 2), 6) + " " + Helper.prtlen(Helper.toFixed(yaw, 2), 6); double yawOffset = 0; if (yaw >= 180) { yawOffset = 360 - yaw; } else { yawOffset = -yaw; } screenLabels[22].Text = "│ FDAI OFFSET: " + Helper.prtlen(Helper.toFixed(0, 2), 6) + " " + Helper.prtlen(Helper.toFixed(-pitch, 2), 6) + " " + Helper.prtlen(Helper.toFixed(yawOffset, 2), 6); //screenOrbit.setBurnData(TAAUT, velocityVector,positionVector,my); //screenOrbit.setOrbit(apopapsis, periapsis, sMa, sma, argOP, lOAN, radius, trueAnomaly, inclination); // Make positionalBurnData List <Tuple <List <Tuple <double?, double?> >, Color> > burnPos = new List <Tuple <List <Tuple <double?, double?> >, Color> >(); burnPos.Add(new Tuple <List <Tuple <double?, double?> >, Color>(posB, Color.FromArgb(255, 0, 0, 255))); burnPos.Add(new Tuple <List <Tuple <double?, double?> >, Color>(posC, Color.FromArgb(255, 0, 255, 0))); screenOrbit.positionalData = burnPos; screenOrbit.Invalidate(); // ZOOM screenLabels[23].Text = "ZOOM: " + Helper.toFixed(screenOrbit.getZoom(), 1); // ITERATE THROUGH ORBITS AND PATCHES String orbitsData = ""; Orbit orbit = form.connection.SpaceCenter().ActiveVessel.Orbit; for (int i = 0; i < 4; i++) { orbitsData += getOrbitsData(orbit) + "\n\n"; if (orbit.NextOrbit == null) { break; } else { orbit = orbit.NextOrbit; } } screenLabels[32].Text = orbitsData; // TARGET DATA double vesselX = positionVector.Item1; double vesselY = positionVector.Item2; double vesselZ = positionVector.Item3; double satX = 0; // = satPositionVector.Item1; double satY = 0; double satZ = 0; CelestialBody sat; Orbit satOrbit; if (screenDropdowns[0].SelectedItem != null) { sat = (CelestialBody)screenDropdowns[0].SelectedItem; satOrbit = sat.Orbit; double satSMA = satOrbit.SemiMajorAxis; double satTA = satOrbit.TrueAnomaly; double satEcc = satOrbit.Eccentricity; Tuple <double, double, double> satPositionVectorInPlane = getPositionVector(satSMA, satTA, satEcc); Tuple <double, double, double> satPositionVector = transform(satPositionVectorInPlane, referencePlane); satX = satPositionVector.Item1; satY = satPositionVector.Item2; satZ = satPositionVector.Item3; } double deltaX = vesselX - satX; double deltaY = vesselY - satY; double deltaZ = vesselZ - satZ; double total = Math.Sqrt((deltaX * deltaX) + (deltaY * deltaY) + (deltaZ * deltaZ)); screenLabels[45].Text = "│ X: " + Helper.prtlen(Math.Round(vesselX).ToString(), 8) + " " + Helper.prtlen(Math.Round(satX).ToString(), 8) + " " + Helper.prtlen(Math.Round(deltaX).ToString(), 8) + " │"; screenLabels[46].Text = "│ Y: " + Helper.prtlen(Math.Round(vesselY).ToString(), 8) + " " + Helper.prtlen(Math.Round(satY).ToString(), 8) + " " + Helper.prtlen(Math.Round(deltaY).ToString(), 8) + " │"; screenLabels[47].Text = "│ Z: " + Helper.prtlen(Math.Round(vesselZ).ToString(), 8) + " " + Helper.prtlen(Math.Round(satZ).ToString(), 8) + " " + Helper.prtlen(Math.Round(deltaZ).ToString(), 8) + " │"; screenLabels[49].Text = "│CURRENT TOTAL DISTANCE: " + Helper.prtlen(Math.Round(total).ToString(), 8) + " │"; screenLabels[52].Text = "┘ MET: " + Helper.timeString(minDistMETB, 3) + " DIST: " + Helper.prtlen(Math.Round(minDistB).ToString(), 8) + " │"; // GRAPH IT List <Dictionary <double, double?> > data = new List <Dictionary <double, double?> >(); List <Plot.Type> types = new List <Plot.Type>(); data = new List <Dictionary <double, double?> >(); types = new List <Plot.Type>(); data.Add(distancesB); types.Add(Plot.Type.LINE); data.Add(distancesC); types.Add(Plot.Type.LINE); screenCharts[0].setData(data, types, false); data = new List <Dictionary <double, double?> >(); types = new List <Plot.Type>(); data.Add(zedB); types.Add(Plot.Type.LINE); data.Add(zedC); types.Add(Plot.Type.LINE); screenCharts[1].setData(data, types, false); } }
public override void updateLocalElements(object sender, EventArgs e) { screenLabels[2].Text = "LT: " + Helper.timeString(DateTime.Now.TimeOfDay.TotalSeconds, 2); if (form.form.connected && form.form.krpc.CurrentGameScene == GameScene.Flight) { // GET DATA screenLabels[3].Text = "MET: " + Helper.timeString(screenStreams.GetData(DataType.vessel_MET), 3); //surfaceRefsmmat = form.connection.SpaceCenter().ActiveVessel.SurfaceReferenceFrame; //inertialRefsmmat = form.connection.SpaceCenter().ActiveVessel.Orbit.Body.NonRotatingReferenceFrame; positionVector = screenStreams.GetData(DataType.vessel_position); velocityVector = screenStreams.GetData(DataType.vessel_velocity); vesselSurfDirection = screenStreams.GetData(DataType.flight_direction); vesselInerDirection = screenStreams.GetData(DataType.flight_inertial_direction); vesselInerRotation = screenStreams.GetData(DataType.flight_inertial_rotation); surfaceRefsmmat = screenStreams.GetData(DataType.vessel_surfaceReferenceFrame); vesselRefsmmat = screenStreams.GetData(DataType.vessel_referenceFrame); inertialRefsmmat = screenStreams.GetData(DataType.body_nonRotatingReferenceFrame); // ROTATION // Ref (AGC NOUN 20) double ds; if (double.TryParse(dataStorage.getData("AGC_N20R1"), out ds)) { rR = ds / 100d; } else { rR = 0; } if (double.TryParse(dataStorage.getData("AGC_N20R2"), out ds)) { rP = ds / 100d; } else { rP = 0; } if (double.TryParse(dataStorage.getData("AGC_N20R3"), out ds)) { rY = ds / 100d; } else { rY = 0; } Tuple <double, double, double> iRPY = Helper.RPYFromQuaternion(vesselInerRotation, "INER"); iR = iRPY.Item1; iP = iRPY.Item2; iY = iRPY.Item3; bR = 0; bP = 0; bY = 0; sR = screenStreams.GetData(DataType.flight_roll); sP = screenStreams.GetData(DataType.flight_pitch); sY = screenStreams.GetData(DataType.flight_heading); // DIRECTION VECTORS inerPrograde = screenStreams.GetData(DataType.flight_inertial_prograde); inerRetrograde = screenStreams.GetData(DataType.flight_inertial_retrograde); inerNormal = screenStreams.GetData(DataType.flight_inertial_normal); inerAntiNormal = screenStreams.GetData(DataType.flight_inertial_antiNormal); inerRadial = screenStreams.GetData(DataType.flight_inertial_radial); inerAntiRadial = screenStreams.GetData(DataType.flight_inertial_antiRadial); surfPrograde = screenStreams.GetData(DataType.flight_prograde); surfRetrograde = screenStreams.GetData(DataType.flight_retrograde); surfNormal = screenStreams.GetData(DataType.flight_normal); surfAntiNormal = screenStreams.GetData(DataType.flight_antiNormal); surfRadial = screenStreams.GetData(DataType.flight_radial); surfAntiRadial = screenStreams.GetData(DataType.flight_antiRadial); // ORBIT ELEMENTS eccentricity = screenStreams.GetData(DataType.orbit_eccentricity); semiMajorAxis = screenStreams.GetData(DataType.orbit_semiMajorAxis); Inclination = screenStreams.GetData(DataType.orbit_inclination); LongitudeOfNode = screenStreams.GetData(DataType.orbit_longitudeOfAscendingNode); ArgumentOfPeriapsis = screenStreams.GetData(DataType.orbit_argumentOfPeriapsis); TrueAnomaly = screenStreams.GetData(DataType.orbit_trueAnomaly); OrbitPeriod = screenStreams.GetData(DataType.orbit_period); SOIChange = screenStreams.GetData(DataType.orbit_timeToSOIChange); OrbitalSpeed = screenStreams.GetData(DataType.orbit_speed); // FLIGHT ELEMENTS altitude = screenStreams.GetData(DataType.flight_meanAltitude); apoapsis = screenStreams.GetData(DataType.orbit_apoapsisAltitude); periapsis = screenStreams.GetData(DataType.orbit_periapsisAltitude); timeToPeriapsis = screenStreams.GetData(DataType.orbit_timeToPeriapsis); timeToApoapsis = screenStreams.GetData(DataType.orbit_timeToApoapsis); // STATE VECTORS screenLabels[32].Text = "Px: " + Helper.prtlen(Helper.toFixed(positionVector.Item1 / 1000d, 3, true), 9, Helper.Align.RIGHT); screenLabels[33].Text = "Py: " + Helper.prtlen(Helper.toFixed(positionVector.Item2 / 1000d, 3, true), 9, Helper.Align.RIGHT); screenLabels[34].Text = "Pz: " + Helper.prtlen(Helper.toFixed(positionVector.Item3 / 1000d, 3, true), 9, Helper.Align.RIGHT); // SPEED VECTORS screenLabels[41].Text = "Vx: " + Helper.prtlen(Helper.toFixed(velocityVector.Item1, 3, true), 9, Helper.Align.RIGHT); screenLabels[42].Text = "Vy: " + Helper.prtlen(Helper.toFixed(velocityVector.Item2, 3, true), 9, Helper.Align.RIGHT); screenLabels[43].Text = "Vz: " + Helper.prtlen(Helper.toFixed(velocityVector.Item3, 3, true), 9, Helper.Align.RIGHT); // ROTATION string iRs = Helper.prtlen(Helper.toFixed(iR, 2), 7, Helper.Align.RIGHT); string iPs = Helper.prtlen(Helper.toFixed(iP, 2), 7, Helper.Align.RIGHT); string iYs = Helper.prtlen(Helper.toFixed(iY, 2), 7, Helper.Align.RIGHT); string bRs = Helper.prtlen(Helper.toFixed(bR, 2), 7, Helper.Align.RIGHT); string bPs = Helper.prtlen(Helper.toFixed(bP, 2), 7, Helper.Align.RIGHT); string bYs = Helper.prtlen(Helper.toFixed(bY, 2), 7, Helper.Align.RIGHT); string sRs = Helper.prtlen(Helper.toFixed(sR, 2), 7, Helper.Align.RIGHT); string sPs = Helper.prtlen(Helper.toFixed(sP, 2), 7, Helper.Align.RIGHT); string sYs = Helper.prtlen(Helper.toFixed(sY, 2), 7, Helper.Align.RIGHT); string rRs = Helper.prtlen(Helper.toFixed(rR, 2), 7, Helper.Align.RIGHT); string rPs = Helper.prtlen(Helper.toFixed(rP, 2), 7, Helper.Align.RIGHT); string rYs = Helper.prtlen(Helper.toFixed(rY, 2), 7, Helper.Align.RIGHT); ifR = normalize(iR + rR, -180, 180); ifP = normalize(iP + rP, -90, 90); ifY = normalize(iY + rY, 0, 360); sfR = normalize(sR + rR, -180, 180); sfP = normalize(sP + rP, -90, 90); sfY = normalize(sY + rY, 0, 360); string ifRs = Helper.prtlen(Helper.toFixed(ifR, 2), 7, Helper.Align.RIGHT); string ifPs = Helper.prtlen(Helper.toFixed(ifP, 2), 7, Helper.Align.RIGHT); string ifYs = Helper.prtlen(Helper.toFixed(ifY, 2), 7, Helper.Align.RIGHT); string sfRs = Helper.prtlen(Helper.toFixed(sfR, 2), 7, Helper.Align.RIGHT); string sfPs = Helper.prtlen(Helper.toFixed(sfP, 2), 7, Helper.Align.RIGHT); string sfYs = Helper.prtlen(Helper.toFixed(sfY, 2), 7, Helper.Align.RIGHT); screenLabels[52].Text = "│ INER ATT:" + iRs + " " + iPs + " " + iYs + " │"; screenLabels[53].Text = "│ BURN :" + bRs + " " + bPs + " " + bYs + " │"; screenLabels[54].Text = "│ REF :" + rRs + " " + rPs + " " + rYs + " │"; screenLabels[55].Text = "│ FDAI :" + ifRs + " " + ifPs + " " + ifYs + " │"; screenLabels[57].Text = "│ SURF ATT:" + sRs + " " + sPs + " " + sYs + " │"; screenLabels[58].Text = "│ REF :" + rRs + " " + rPs + " " + rYs + " │"; screenLabels[59].Text = "│ FDAI :" + sfRs + " " + sfPs + " " + sfYs + " │"; // ORBITAL ELEMENTS screenLabels[10].Text = " ECCENTRICITY: " + Helper.prtlen(Helper.toFixed(eccentricity, 5), 11, Helper.Align.RIGHT); screenLabels[11].Text = " SEMIMAJOR AXIS: " + Helper.prtlen(Helper.toFixed(semiMajorAxis, 3), 11, Helper.Align.RIGHT); screenLabels[12].Text = " INCLINATION: " + Helper.prtlen(Helper.toFixed(Helper.rad2deg(Inclination), 3), 11, Helper.Align.RIGHT); screenLabels[13].Text = "LONGITUDE OF NODE: " + Helper.prtlen(Helper.toFixed(Helper.rad2deg(LongitudeOfNode), 3), 11, Helper.Align.RIGHT); screenLabels[14].Text = "ARG. OF PERIAPSIS: " + Helper.prtlen(Helper.toFixed(Helper.rad2deg(ArgumentOfPeriapsis), 3), 11, Helper.Align.RIGHT); screenLabels[15].Text = " TRUE ANOMALY: " + Helper.prtlen(Helper.toFixed(Helper.rad2deg(TrueAnomaly), 3), 11, Helper.Align.RIGHT); screenLabels[16].Text = " ORB PERIOD: " + Helper.prtlen(Helper.timeString(OrbitPeriod, true, 2), 11, Helper.Align.RIGHT); screenLabels[17].Text = " SOI CHANGE: " + Helper.prtlen(Helper.timeString(SOIChange, true, 2), 11, Helper.Align.RIGHT); screenLabels[18].Text = " ORB SPEED: " + Helper.prtlen(Helper.toFixed(OrbitalSpeed, 3), 11, Helper.Align.RIGHT); // FLIGHT ELEMENTS screenLabels[21].Text = " ALTITUDE: " + Helper.prtlen(Helper.toFixed(altitude, 3), 11, Helper.Align.RIGHT); screenLabels[22].Text = " APOAPSIS: " + Helper.prtlen(Helper.toFixed(apoapsis, 3), 11, Helper.Align.RIGHT); screenLabels[23].Text = " PERIAPSIS: " + Helper.prtlen(Helper.toFixed(periapsis, 3), 11, Helper.Align.RIGHT); screenLabels[24].Text = " TIME TO APOAPSIS: " + Helper.prtlen(Helper.timeString(timeToApoapsis, true, 2), 11, Helper.Align.RIGHT); screenLabels[25].Text = "TIME TO PERIAPSIS: " + Helper.prtlen(Helper.timeString(timeToPeriapsis, true, 2), 11, Helper.Align.RIGHT); // DIRECTION VECTORS Tuple <double, double, double> inerProgradeRPY = inerVectorToRPY(inerPrograde); Tuple <double, double, double> inerRetrogradeRPY = inerVectorToRPY(inerRetrograde); Tuple <double, double, double> inerNormalRPY = inerVectorToRPY(inerNormal); Tuple <double, double, double> inerAntiNormalRPY = inerVectorToRPY(inerAntiNormal); Tuple <double, double, double> inerRadialRPY = inerVectorToRPY(inerRadial); Tuple <double, double, double> inerAntiRadialRPY = inerVectorToRPY(inerAntiRadial); Tuple <double, double, double> surfProgradeRPY = surfVectorToRPY(surfPrograde); Tuple <double, double, double> surfRetrogradeRPY = surfVectorToRPY(surfRetrograde); Tuple <double, double, double> surfNormalRPY = surfVectorToRPY(surfNormal); Tuple <double, double, double> surfAntiNormalRPY = surfVectorToRPY(surfAntiNormal); Tuple <double, double, double> surfRadialRPY = surfVectorToRPY(surfRadial); Tuple <double, double, double> surfAntiRadialRPY = surfVectorToRPY(surfAntiRadial); // INERTIAL REFERENCE DIRECTIONS string prR = Helper.prtlen(Helper.toFixed(inerProgradeRPY.Item1, 2), 8, Helper.Align.RIGHT); string prP = Helper.prtlen(Helper.toFixed(inerProgradeRPY.Item2, 2), 10, Helper.Align.RIGHT); string prY = Helper.prtlen(Helper.toFixed(inerProgradeRPY.Item3, 2), 10, Helper.Align.RIGHT); screenLabels[82].Text = prR + prP + prY; prR = Helper.prtlen(Helper.toFixed(inerRetrogradeRPY.Item1, 2), 8, Helper.Align.RIGHT); prP = Helper.prtlen(Helper.toFixed(inerRetrogradeRPY.Item2, 2), 10, Helper.Align.RIGHT); prY = Helper.prtlen(Helper.toFixed(inerRetrogradeRPY.Item3, 2), 10, Helper.Align.RIGHT); screenLabels[83].Text = prR + prP + prY; prR = Helper.prtlen(Helper.toFixed(inerNormalRPY.Item1, 2), 8, Helper.Align.RIGHT); prP = Helper.prtlen(Helper.toFixed(inerNormalRPY.Item2, 2), 10, Helper.Align.RIGHT); prY = Helper.prtlen(Helper.toFixed(inerNormalRPY.Item3, 2), 10, Helper.Align.RIGHT); screenLabels[84].Text = prR + prP + prY; prR = Helper.prtlen(Helper.toFixed(inerAntiNormalRPY.Item1, 2), 8, Helper.Align.RIGHT); prP = Helper.prtlen(Helper.toFixed(inerAntiNormalRPY.Item2, 2), 10, Helper.Align.RIGHT); prY = Helper.prtlen(Helper.toFixed(inerAntiNormalRPY.Item3, 2), 10, Helper.Align.RIGHT); screenLabels[85].Text = prR + prP + prY; prR = Helper.prtlen(Helper.toFixed(inerRadialRPY.Item1, 2), 8, Helper.Align.RIGHT); prP = Helper.prtlen(Helper.toFixed(inerRadialRPY.Item2, 2), 10, Helper.Align.RIGHT); prY = Helper.prtlen(Helper.toFixed(inerRadialRPY.Item3, 2), 10, Helper.Align.RIGHT); screenLabels[86].Text = prR + prP + prY; prR = Helper.prtlen(Helper.toFixed(inerAntiRadialRPY.Item1, 2), 8, Helper.Align.RIGHT); prP = Helper.prtlen(Helper.toFixed(inerAntiRadialRPY.Item2, 2), 10, Helper.Align.RIGHT); prY = Helper.prtlen(Helper.toFixed(inerAntiRadialRPY.Item3, 2), 10, Helper.Align.RIGHT); screenLabels[87].Text = prR + prP + prY; // SURFACE REFERENCE DIRECTIONS prR = Helper.prtlen(Helper.toFixed(surfProgradeRPY.Item1, 2), 8, Helper.Align.RIGHT); prP = Helper.prtlen(Helper.toFixed(surfProgradeRPY.Item2, 2), 10, Helper.Align.RIGHT); prY = Helper.prtlen(Helper.toFixed(surfProgradeRPY.Item3, 2), 10, Helper.Align.RIGHT); screenLabels[92].Text = prR + prP + prY; prR = Helper.prtlen(Helper.toFixed(surfRetrogradeRPY.Item1, 2), 8, Helper.Align.RIGHT); prP = Helper.prtlen(Helper.toFixed(surfRetrogradeRPY.Item2, 2), 10, Helper.Align.RIGHT); prY = Helper.prtlen(Helper.toFixed(surfRetrogradeRPY.Item3, 2), 10, Helper.Align.RIGHT); screenLabels[93].Text = prR + prP + prY; prR = Helper.prtlen(Helper.toFixed(surfNormalRPY.Item1, 2), 8, Helper.Align.RIGHT); prP = Helper.prtlen(Helper.toFixed(surfNormalRPY.Item2, 2), 10, Helper.Align.RIGHT); prY = Helper.prtlen(Helper.toFixed(surfNormalRPY.Item3, 2), 10, Helper.Align.RIGHT); screenLabels[94].Text = prR + prP + prY; prR = Helper.prtlen(Helper.toFixed(surfAntiNormalRPY.Item1, 2), 8, Helper.Align.RIGHT); prP = Helper.prtlen(Helper.toFixed(surfAntiNormalRPY.Item2, 2), 10, Helper.Align.RIGHT); prY = Helper.prtlen(Helper.toFixed(surfAntiNormalRPY.Item3, 2), 10, Helper.Align.RIGHT); screenLabels[95].Text = prR + prP + prY; prR = Helper.prtlen(Helper.toFixed(surfRadialRPY.Item1, 2), 8, Helper.Align.RIGHT); prP = Helper.prtlen(Helper.toFixed(surfRadialRPY.Item2, 2), 10, Helper.Align.RIGHT); prY = Helper.prtlen(Helper.toFixed(surfRadialRPY.Item3, 2), 10, Helper.Align.RIGHT); screenLabels[96].Text = prR + prP + prY; prR = Helper.prtlen(Helper.toFixed(surfAntiRadialRPY.Item1, 2), 8, Helper.Align.RIGHT); prP = Helper.prtlen(Helper.toFixed(surfAntiRadialRPY.Item2, 2), 10, Helper.Align.RIGHT); prY = Helper.prtlen(Helper.toFixed(surfAntiRadialRPY.Item3, 2), 10, Helper.Align.RIGHT); screenLabels[97].Text = prR + prP + prY; } }