public override string ToString() { StringBuilder sb = new StringBuilder(); sb.Append('{'); WriteName(sb, "V0"); sb.Append(V0.ToString() + ","); WriteName(sb, "V1"); sb.Append(V1.ToString() + ","); WriteName(sb, "V2"); sb.Append(V2.ToString() + ","); WriteName(sb, "V3"); sb.Append(V3.ToString() + ","); WriteName(sb, "V4"); sb.Append(V4.ToString() + ","); WriteName(sb, "V5"); sb.Append(V5.ToString() + ","); WriteName(sb, "V6"); sb.Append(V6.ToString() + ","); WriteName(sb, "V7"); sb.Append(V7.ToString() + ","); WriteName(sb, "V8"); sb.Append(V8.ToString() + ","); WriteName(sb, "V9"); sb.Append(V9.ToString() + ","); sb.Length--; sb.Append('}'); return(sb.ToString()); }
static void Main(string[] args) { V8.Initialize(); for (int i = 0; i < 10; i++) { JsEngine.EvaluateScript("`${'Hello'} World! ${6*7}`"); } V8.Shutdown(); Console.WriteLine("All Done..."); Console.ReadLine(); }
// Use this for initialization void Start() { if (BuyCarScript.V01A == 0) { BuyCarScript.V01A = 2; } if (BuyCarScript.V01A == 2) { V1.SetActive(true); } if (BuyCarScript.V02A == 2) { V2.SetActive(true); } if (BuyCarScript.V03A == 2) { V3.SetActive(true); } if (BuyCarScript.V04A == 2) { V4.SetActive(true); } if (BuyCarScript.V05A == 2) { V5.SetActive(true); } if (BuyCarScript.V06A == 2) { V6.SetActive(true); } if (BuyCarScript.V07A == 2) { V7.SetActive(true); } if (BuyCarScript.V08A == 2) { V8.SetActive(true); } if (BuyCarScript.V09A == 2) { V9.SetActive(true); } if (BuyCarScript.V10A == 2) { V10.SetActive(true); } car = true; }
public void Left() { if (V2.activeInHierarchy == true) { V1.SetActive(true); V2.SetActive(false); V3.SetActive(false); V4.SetActive(false); V5.SetActive(false); V6.SetActive(false); V7.SetActive(false); V8.SetActive(false); V9.SetActive(false); V10.SetActive(false); } else if (V3.activeInHierarchy == true) { V1.SetActive(false); V2.SetActive(true); V3.SetActive(false); V4.SetActive(false); V5.SetActive(false); V6.SetActive(false); V7.SetActive(false); V8.SetActive(false); V9.SetActive(false); V10.SetActive(false); } else if (V4.activeInHierarchy == true) { V1.SetActive(false); V2.SetActive(false); V3.SetActive(true); V4.SetActive(false); V5.SetActive(false); V6.SetActive(false); V7.SetActive(false); V8.SetActive(false); V9.SetActive(false); V10.SetActive(false); } else if (V5.activeInHierarchy == true) { V1.SetActive(false); V2.SetActive(false); V3.SetActive(false); V4.SetActive(true); V5.SetActive(false); V6.SetActive(false); V7.SetActive(false); V8.SetActive(false); V9.SetActive(false); V10.SetActive(false); } else if (V6.activeInHierarchy == true) { V1.SetActive(false); V2.SetActive(false); V3.SetActive(false); V4.SetActive(false); V5.SetActive(true); V6.SetActive(false); V7.SetActive(false); V8.SetActive(false); V9.SetActive(false); V10.SetActive(false); } else if (V7.activeInHierarchy == true) { V1.SetActive(false); V2.SetActive(false); V3.SetActive(false); V4.SetActive(false); V5.SetActive(false); V6.SetActive(true); V7.SetActive(false); V8.SetActive(false); V9.SetActive(false); V10.SetActive(false); } else if (V8.activeInHierarchy == true) { V1.SetActive(false); V2.SetActive(false); V3.SetActive(false); V4.SetActive(false); V5.SetActive(false); V6.SetActive(false); V7.SetActive(true); V8.SetActive(false); V9.SetActive(false); V10.SetActive(false); } else if (V9.activeInHierarchy == true) { V1.SetActive(false); V2.SetActive(false); V3.SetActive(false); V4.SetActive(false); V5.SetActive(false); V6.SetActive(false); V7.SetActive(false); V8.SetActive(true); V9.SetActive(false); V10.SetActive(false); } else if (V10.activeInHierarchy == true) { V1.SetActive(false); V2.SetActive(false); V3.SetActive(false); V4.SetActive(false); V5.SetActive(false); V6.SetActive(false); V7.SetActive(false); V8.SetActive(false); V9.SetActive(true); V10.SetActive(false); } }
public void CalculatePerformance(double pressure, double temperature, double velocity, double commandedThrottle) { if (Tt7 == 0) { mainThrottle = commandedThrottle; } else { mainThrottle = Math.Min(commandedThrottle * 1.5, 1.0); abThrottle = Math.Max(commandedThrottle - 0.667, 0); } p0 = pressure * 1000; //freestream t0 = temperature; gamma_c = CalculateGamma(t0, 0); Cp_c = CalculateCp(t0, 0); Cv_c = Cp_c / gamma_c; R_c = Cv_c * (gamma_c - 1); M0 = velocity / Math.Sqrt(gamma_c * R_c * t0); T1 = t0 * (1 + 0.5 * (gamma_c - 1) * M0 * M0); //inlet P1 = p0 * Math.Pow(T1 / t0, gamma_c / (gamma_c - 1)) * TPR; double prat3 = CPR; double prat2 = FPR; double k = FPR / CPR; double p = Math.Pow(k, (gamma_c - 1) / eta_c / gamma_c); for (int i = 0; i < 20; i++) //use iteration to calculate CPR { P2 = prat2 * P1; P3 = prat3 * P1; T2 = T1 * Math.Pow(prat2, (gamma_c - 1) / gamma_c / eta_c); //fan T3 = T1 * Math.Pow(prat3, (gamma_c - 1) / gamma_c / eta_c); //compressor T4 = (Tt4 - T3) * mainThrottle + T3; //burner P4 = P3; ff = Cp_c * (T4 - T3) / (Cp_c * (T4 - T3) + h_f); //fuel fraction Cp_t = CalculateCp(T4, ff); T5 = T4 * TTR; //turbine double x = prat3; prat3 = (1 + ff) * Cp_t * (T4 - T5) / T1 / Cp_c + 1 + BPR; prat3 /= 1 + BPR * p; prat3 = Math.Pow(prat3, eta_c * gamma_c / (gamma_c - 1)); prat2 = k * prat3; if (Math.Abs(x - prat3) < 0.01) { break; } } gamma_t = CalculateGamma(T5, ff);//gas parameters Cp_t = CalculateCp(T5, ff); Cv_t = Cp_t / gamma_t; R_t = Cv_t * (gamma_t - 1); P5 = P4 * Math.Pow((1 - 1 / eta_t * (1 - TTR)), gamma_t / (gamma_t - 1)); if (exhaustMixer && BPR > 0) //exhaust mixer { double Cp6 = (Cp_c * BPR + Cp_t) / (1 + BPR); //Cp of mixed flow -- kind of T6 = T5 * Cp_t / Cp6 * (1 + BPR * Cp_c * T2 / Cp_t / T5) / (1 + BPR); P6 = (P5 + BPR * 0.98 * P2) / (1 + BPR); ff /= (1 + ff + BPR); gamma_t = CalculateGamma(T6, ff);//gas parameters Cp_t = CalculateCp(T6, ff); Cv_t = Cp_t / gamma_t; R_t = Cv_t * (gamma_t - 1); } else { T6 = T5; P6 = P5; } if (Tt7 > 0) { T7 = (Tt7 - T6) * abThrottle * 3 + T6;//afterburner } else { T7 = T6; } P7 = P6; //rayleigh loss? ff_ab = ff + Cp_t * (T7 - T6) / (Cp_t * (T7 - T6) + h_f); //fuel fraction gamma_ab = CalculateGamma(T7, ff_ab); //gas parameters Cp_ab = CalculateCp(T7, ff_ab); Cv_ab = Cp_ab / gamma_ab; R_ab = Cv_ab * (gamma_ab - 1); //Nozzle code is from NASA double P8 = P7; double T8 = T7; double p8, V8, A8; double epr = P8 / P1; double etr = T8 / T1; double area8max = .75 * Math.Sqrt(etr) / epr;//ratio of nozzle area to ref area A8 = area8max * Aref; if (exhaustMixer && BPR > 0) { A8 *= (1 + BPR); } double eair = P8 * Math.Sqrt(gamma_ab / R_ab / T8) * Math.Pow((.5 + .5 * gamma_ab), .5 * (1 + gamma_ab) / (1 - gamma_ab));//corrected mass flow per area mdot = eair * A8; double npr = P8 / p0; double fac1 = (gamma_ab - 1.0) / gamma_ab; V8 = Math.Sqrt(2.0 * R_c / fac1 * T8 * eta_n * (1.0 - Math.Pow(1.0 / npr, fac1))); //exit velocity p8 = (npr <= 1.893) ? p0 : .52828 * P8; thrust = V8 * mdot + (p8 - p0) * A8; if (BPR > 0 && FPR > 1 && exhaustMixer == false) { fac1 = (gamma_c - 1) / gamma_c; //fan thrust from NASA double snpr = P2 / p0; double ues = Math.Sqrt(2.0 * R_c / fac1 * T2 * eta_n * (1.0 - Math.Pow(1.0 / snpr, fac1))); double pfexit = (snpr <= 1.893) ? p0 : .52828 * P2; //exit pressure of fan thrust += BPR * ues * mdot / (1 + ff_ab) + (pfexit - p0) * BPR * Aref; } double netthrust = thrust - mdot / (1 + ff_ab) * (1 + (exhaustMixer ? 0 : BPR)) * (velocity);//ram drag Isp = thrust / (mdot * ff_ab * 9.81); debugstring = ""; debugstring += "TTR:\t" + TTR.ToString("F3") + "\r\n"; debugstring += "CPR:\t" + prat3.ToString("F3") + "\r\n"; debugstring += "M0:\t" + M0.ToString("F3") + "\r\n"; debugstring += "p0: " + p0.ToString("F2") + "\tt0: " + t0.ToString("F2") + "\r\n"; debugstring += "P1: " + P1.ToString("F2") + "\tT1: " + T1.ToString("F2") + "\r\n"; debugstring += "P2: " + P2.ToString("F2") + "\tT2: " + T2.ToString("F2") + "\r\n"; debugstring += "P3: " + P3.ToString("F2") + "\tT3: " + T3.ToString("F2") + "\r\n"; debugstring += "P4: " + P4.ToString("F2") + "\tT4: " + T4.ToString("F2") + "\r\n"; debugstring += "P5: " + P5.ToString("F2") + "\tT5: " + T5.ToString("F2") + "\r\n"; debugstring += "P6: " + P6.ToString("F2") + "\tT6: " + T6.ToString("F2") + "\r\n"; debugstring += "P7: " + P7.ToString("F2") + "\tT7: " + T7.ToString("F2") + "\r\n"; debugstring += "EPR: " + epr.ToString("F2") + "\tETR: " + etr.ToString("F2") + "\r\n"; debugstring += "FF: " + ff.ToString("P") + "\t"; debugstring += "FF_AB: " + ff_ab.ToString("P") + "\r\n"; debugstring += "V8: " + V8.ToString("F2") + "\tA8: " + A8.ToString("F2") + "\r\n"; debugstring += "Thrust: " + (thrust / 1000).ToString("F1") + "\tmdot: " + mdot.ToString("F2") + "\r\n"; debugstring += "NetThrust: " + (netthrust / 1000).ToString("F1") + "\tSFC: " + (3600 / Isp).ToString("F3") + "\r\n"; //Debug.Log(debugstring); }
public string IsError() { if (string.IsNullOrWhiteSpace(GrsName)) { return("Укажите наименование ГРС"); } if (string.IsNullOrWhiteSpace(SubGrsName)) { return("Укажите наименование замерной нитки"); } if (Psantimeter > 0) { if (V1 + V2 + V3 + V9 + V10 + V11 > 0) { CalculateSmallK(); } else { K = SmallKConstants.KAll; } } else { if (V1 != 0 && !V1.CheckIntervalParams(90m, 97.9m)) { return("V1 параметр \"Объёмная концентрация метана\" несоответсвует"); } if (V2 != 0 && !V2.CheckIntervalParams(0.75m, 4.75m)) { return("V2 параметр \"Объёмная концентрация этана\" несоответсвует"); } if (V3 != 0 && !V3.CheckIntervalParams(0.30m, 3.5m)) { return("V3 параметр \"Объёмная концентрация пропана\" несоответсвует"); } if (V4 != 0 && !V4.CheckIntervalParams(0.01m, 0.5m)) { return("V4 параметр \"Объёмная концентрация i-бутана\" несоответсвует"); } if (!V5.CheckIntervalParams(0m, 0.4m)) { return("V5 параметр \"Объёмная концентрация n-бутана\" несоответсвует"); } if (!V6.CheckIntervalParams(0m, 0.2m)) { return("V6 параметр \"Объёмная концентрация i-пентана\" несоответсвует"); } if (!V7.CheckIntervalParams(0m, 0.15m)) { return("V7 параметр \"Объёмная концентрация n-пентана\" несоответсвует"); } if (!V8.CheckIntervalParams(0m, 0.3m)) { return("V8 параметр \"Объёмная концентрация гексана\" несоответсвует"); } if (V9 != 0 && !V9.CheckIntervalParams(0.1m, 2.5m)) { return("V9 параметр \"Объёмная концентрация углекислого газа\" несоответсвует"); } if (V10 != 0 && !V10.CheckIntervalParams(0.2m, 1.3m)) { return("V10 параметр \"Объёмная концентрация азота\" несоответсвует"); } if (!V11.CheckIntervalParams(0m, 0.3m)) { return("V11 параметр \"Объёмная концентрация кислорода\" несоответсвует"); } if (K == 0) { CalculateSmallK(); } else if (!K.CheckIntervalParams(1.24m, 2.1m)) { return("k параметр \"Объёмный показатель адиабаты\" несоответсвует"); } else { this.IsCalculateK = false; } } if (Z == 0) { this.Z = 0.882m; } else if (!Z.CheckIntervalParams(0.6m, 0.9999m)) { return("z параметр \"Коэффициент сжимаемости\" несоответсвует"); } if (!Pvxod.CheckIntervalParams(0.01m, 6m)) { return("Pвх параметр \"Давление газа на входе в ДГА\" несоответсвует"); } if (!Pvixod.CheckIntervalParams(0.01m, 4m)) { return("Pвых параметр \"Давление газа на выходе из ДГА\" несоответсвует"); } if (!Q.CheckIntervalParams(100m, 100000000m)) { return("Q параметр \"Расход газа по нитке\" несоответсвует"); } if (!Temperature.CheckIntervalParams(10m, 90m)) { return("t параметр \"Температура\" несоответсвует"); } if ((Nnominal > 0 && EffectProcent == 0) || (Nnominal == 0 && EffectProcent > 0)) { return("Укажите Nnominal и Procent, чтобы узнать эффективность расчета"); } CalculateParams(); return(string.Empty); }