private decimal CalculateRapport1erVitesse(Calculator calculator, ChartValuesViewModel cvvm, int ibvc, int nv) { var ip = calculator.CalculateRapportPont(cvvm.Data.Rk, nv, cvvm.Data.Vmax, ibvc); var first = calculator.CalculateRapportPremiereVitesse(cvvm.Data.mo * 9.81M, cvvm.Data.Ψmax, cvvm.Data.Rk, cvvm.Data.Mkmax, ibvc, ip, cvvm.Data.nt, calculator.GetCoefficientCorrection()); return(first); }
public void Calculate_CoefficientAdaptabilite() { Calculator calculator = new Calculator(); ChartValuesViewModel cvvm = this.GetVM(); var ko = calculator.CalculateCoefficientAdaptabiliteRegime(cvvm.Data.nN, cvvm.Data.nMkmax); this.AssertAccurateEnough(ko, 1.5M, 0.3F); }
public void Calculate_CentreMasse() { Calculator calculator = new Calculator(); ChartValuesViewModel cvvm = this.GetVM(); var Hg = calculator.CalculateCentreMasse(cvvm.Data.H); this.AssertAccurateEnough(Hg, 0.569M); }
public void Calculate_CoefficientResistanceTotal() { Calculator calculator = new Calculator(); ChartValuesViewModel cvvm = this.GetVM(); var ov = calculator.CalculateCoefficientResistanceTotalDeplacement(calculator.GetCoefficientResistanceRoulement(), cvvm.Data.α); this.AssertAccurateEnough(ov, 0.02M); }
public void Calculate_SurfaceFrontale() { Calculator calculator = new Calculator(); ChartValuesViewModel cvvm = this.GetVM(); var F = calculator.CalculateSurfaceFrontale(cvvm.Data.B, cvvm.Data.H); this.AssertAccurateEnough(F, 1.94M); }
//11: Calculate iti //[TestMethod] public void CalculateRapportGlobauxTransmission() { Calculator calculator = new Calculator(); ChartValuesViewModel cvvm = this.GetVM(); var ibvc = 1; var nv = 5750; decimal[] iti = this.GetIti(calculator, cvvm, ibvc, nv); }
public void Calculate_CoupleRegimeNominal() { Calculator calculator = new Calculator(); ChartValuesViewModel cvvm = this.GetVM(); var regime = calculator.CalculateCoupleRegimeNominal(cvvm.Data.Nmax, cvvm.Data.nN); this.AssertAccurateEnough(regime, 166.6M); }
protected override void OnInitialized() { this.TransmissionTypes = this.EnumToDictionary <TransmissionType>(); this.MotorTypes = this.EnumToDictionary <MotorType>(); this.VehicleTypes = this.EnumToDictionary <VehicleType>(); this.Datas = new List <KeyValuePair <string, ChartValuesViewModel> >(); this.VM = this.Service.CurrentViewModel = this.GetVM(); this.Service.OnDataSaved += this.Service_OnDataSaved; }
public void Calculate_ReserveCouple() { Calculator calculator = new Calculator(); ChartValuesViewModel cvvm = this.GetVM(); var Mkn = calculator.CalculateCoupleRegimeNominal(cvvm.Data.Nmax, cvvm.Data.nN); var Mr = calculator.CalculateReserveCouple(Mkn, cvvm.Data.Mkmax); this.AssertAccurateEnough(Mr, 6.8M); }
public void Calculate_CoefficientAdaptabiliteCouple() { Calculator calculator = new Calculator(); ChartValuesViewModel cvvm = this.GetVM(); var Mkn = calculator.CalculateCoupleRegimeNominal(cvvm.Data.Nmax, cvvm.Data.nN); var km = calculator.CalculateCoefficientAdaptabiliteCouple(Mkn, cvvm.Data.Mkmax); this.AssertAccurateEnough(km, 1.06M); }
async void Reset() { this.InitializeChart(); await this.lineChart.Update(); this.Validations.ClearAll(); this.ValueNV = 0; this.State.SetD(null); this.VM = this.Service.CurrentViewModel = new ChartValuesViewModel(); }
private List <Tuple <decimal, decimal> >[] GetPw(Calculator calculator, ChartValuesViewModel cvvm, decimal[][] velocities) { List <Tuple <decimal, decimal> >[] matrix = new List <Tuple <decimal, decimal> > [velocities.Length]; for (int i = 0; i < velocities.Length; i++) { matrix[i] = calculator.GetDatasetForceAerodynamiqueResistance(cvvm.Data.H, cvvm.Data.B, cvvm.Data.Cf, cvvm.Data.Kv, velocities[i]); } return(matrix); }
public void CalculateRapportPremiereVitesse() { Calculator calculator = new Calculator(); ChartValuesViewModel cvvm = this.GetVM(); var ibvc = 1; var nv = 5750; var ip = calculator.CalculateRapportPont(cvvm.Data.Rk, nv, cvvm.Data.Vmax, ibvc); var first = calculator.CalculateRapportPremiereVitesse(cvvm.Data.mo * 9.81M, cvvm.Data.Ψmax, cvvm.Data.Rk, cvvm.Data.Mkmax, ibvc, ip, cvvm.Data.nt, calculator.GetCoefficientCorrection()); this.AssertAccurateEnough(first, 2.68M); }
public void GenerateMatrixForPw() { Calculator calculator = new Calculator(); ChartValuesViewModel cvvm = this.GetVM(); decimal[][] velocities = this.GetVelocities(); //Pw var matrix = GetPw(calculator, cvvm, velocities); // TODO: Assert }
public void GenerateDataSetForMk() { Calculator calculator = new Calculator(); ChartValuesViewModel cvvm = this.GetVM(); decimal[] valuesOfN = new decimal[] { 500, 1300, 2100, 2900, 2700, 4400, 5200, 5400 }; decimal[][] velocities = this.GetVelocities(); var ibvc = 1; var nv = 5750; List <Tuple <decimal, decimal> >[] matrix = GetMk(calculator, cvvm, velocities, ibvc, nv); }
protected override Task OnAfterRenderAsync(bool firstRender) { if (firstRender) { this.InitializeChart(); Service.GetAll().ContinueWith(res => { this.Datas = res.Result; }); this.LoadItem = EventCallback.Factory.Create(this, (obj) => this.VM = this.Service.CurrentViewModel = obj as ChartValuesViewModel); } return(base.OnAfterRenderAsync(firstRender)); }
private List <Tuple <decimal, decimal> >[] GetMk(Calculator calculator, ChartValuesViewModel cvvm, decimal[][] velocities, int ibvc, int nv) { decimal[] iti = this.GetIti(calculator, cvvm, ibvc, nv); List <Tuple <decimal, decimal> >[] nei = GetNei(calculator, cvvm, velocities, iti); //MK List <Tuple <decimal, decimal> >[] matrix = new List <Tuple <decimal, decimal> > [velocities.Length]; for (int i = 0; i < velocities.Length; i++) { matrix[i] = calculator.GetDatasetCourbeCoupleMoteur(cvvm.Data.Mkmax, cvvm.Data.nN, cvvm.EmpiricCoefficient.An, cvvm.EmpiricCoefficient.Bn, cvvm.EmpiricCoefficient.Cn, nei[i]); } return(matrix); }
public void GenerateDataSetForNe() { Calculator calculator = new Calculator(); ChartValuesViewModel cvvm = this.GetVM(); decimal[] valuesOfN = new decimal[] { 500, 1300, 2100, 2900, 2700, 4400, 5200, 5400 }; //normally An, Bn and Cn are calculated, but for clients convenience they will be static var dataSet = calculator.GetDatasetCourbePuissanceMoteur(cvvm.Data.Nmax, cvvm.Data.nN, cvvm.EmpiricCoefficient.An, cvvm.EmpiricCoefficient.Bn, cvvm.EmpiricCoefficient.Cn, valuesOfN); Assert.AreEqual(dataSet[0].Item1, 500); this.AssertAccurateEnough(dataSet[0].Item2, 5.801145214M); Assert.AreEqual(dataSet[dataSet.Count - 2].Item1, 5200); this.AssertAccurateEnough(dataSet[dataSet.Count - 1].Item2, 94.2M); }
public void GenerateMatrixForPT() { Calculator calculator = new Calculator(); ChartValuesViewModel cvvm = this.GetVM(); var ibvc = 1; var nv = 5750; decimal[] valuesOfN = new decimal[] { 500, 1300, 2100, 2900, 2700, 4400, 5200, 5400 }; List <Tuple <decimal, decimal> >[] matrix = GetPt(calculator, cvvm, ibvc, nv, valuesOfN); Assert.AreEqual(matrix[0][0].Item1, 2); this.AssertAccurateEnough(matrix[0][0].Item2, 534.573M, 0.5F); Assert.AreEqual(matrix[4][6].Item1, 33); this.AssertAccurateEnough(matrix[4][6].Item2, 3949.910M); Assert.AreEqual(matrix[5][6].Item1, 35); this.AssertAccurateEnough(matrix[5][6].Item2, 3491.082M); }
private List <Tuple <decimal, decimal> >[] GetPt(Calculator calculator, ChartValuesViewModel cvvm, int ibvc, int nv, decimal[] valuesOfN) { // TODO: Come back here to verify MK; From document Mk needs to change according to velocity // and rapport de vitesse but it is not changing thus values cannot be used effectively on formula var Mki = GetMk(calculator, cvvm, this.GetVelocities(), ibvc, nv); decimal[] iti = this.GetIti(calculator, cvvm, ibvc, nv); //Mki List <Tuple <decimal, decimal> >[] matrix = new List <Tuple <decimal, decimal> > [Mki.Length]; for (int i = 0; i < Mki.Length; i++) { matrix[i] = calculator.GetDatasetForceTractionMoteur(iti[i], cvvm.Data.Rk, cvvm.Data.nt, Mki[i]); } return(matrix); }
private decimal[] GetIti(Calculator calculator, ChartValuesViewModel cvvm, int ibvc, int nv) { var ip = calculator.CalculateRapportPont(cvvm.Data.Rk, nv, cvvm.Data.Vmax, ibvc); decimal first = this.CalculateRapport1erVitesse(calculator, cvvm, ibvc, nv); decimal second = calculator.CalculateRapportAutreVitesse(6, 2, first); decimal third = calculator.CalculateRapportAutreVitesse(6, 3, first); decimal fourth = calculator.CalculateRapportAutreVitesse(6, 4, first); decimal fifth = calculator.CalculateRapportAutreVitesse(6, 5, first); decimal sixth = calculator.CalculateRapportAutreVitesse(6, 6, first); decimal it1 = calculator.CalculateRapportGlobauxTransmission(first, ip); decimal it2 = calculator.CalculateRapportGlobauxTransmission(second, ip); decimal it3 = calculator.CalculateRapportGlobauxTransmission(third, ip); decimal it4 = calculator.CalculateRapportGlobauxTransmission(fourth, ip); decimal it5 = calculator.CalculateRapportGlobauxTransmission(fifth, ip); decimal it6 = calculator.CalculateRapportGlobauxTransmission(sixth, ip); return(new decimal[] { it1, it2, it3, it4, it5, it6 }); }
public void CalculateRapportAutreVitesse() { Calculator calculator = new Calculator(); ChartValuesViewModel cvvm = this.GetVM(); var ibvc = 1; var nv = 5750; decimal first = this.CalculateRapport1erVitesse(calculator, cvvm, ibvc, nv); decimal second = calculator.CalculateRapportAutreVitesse(6, 2, first); decimal third = calculator.CalculateRapportAutreVitesse(6, 3, first); decimal fourth = calculator.CalculateRapportAutreVitesse(6, 4, first); decimal fifth = calculator.CalculateRapportAutreVitesse(6, 5, first); decimal sixth = calculator.CalculateRapportAutreVitesse(6, 6, first); this.AssertAccurateEnough(second, 2.2M); this.AssertAccurateEnough(third, 1.8M); this.AssertAccurateEnough(fourth, 1.48M); this.AssertAccurateEnough(fifth, 1.2M); this.AssertAccurateEnough(sixth, 1M); }
public void GenerateMatrixForNei() { Calculator calculator = new Calculator(); ChartValuesViewModel cvvm = this.GetVM(); decimal[][] velocities = this.GetVelocities(); var ibvc = 1; var nv = 5750; decimal[] iti = this.GetIti(calculator, cvvm, ibvc, nv); List <Tuple <decimal, decimal> >[] matrix = GetNei(calculator, cvvm, velocities, iti); Assert.AreEqual(matrix[0][0].Item1, 2); this.AssertAccurateEnough(matrix[0][0].Item2, 534.573M, 0.5F); Assert.AreEqual(matrix[4][6].Item1, 33); this.AssertAccurateEnough(matrix[4][6].Item2, 3949.910M); Assert.AreEqual(matrix[5][6].Item1, 35); this.AssertAccurateEnough(matrix[5][6].Item2, 3491.082M); }
private bool Test(ChartValuesViewModel VM) { bool isVT = VM.Data.Rk >= 0.25M && VM.Data.Rk <= 0.39M && VM.VehicleXtics.TypeVehicule == (int)VehicleType.Tourisme && VM.Data.B <= 2 && VM.Data.H <= 2.45M && //VM.Data.Kv >= 0.2M && //VM.Data.Kv <= 0.35M && VM.Data.mo <= 1750; bool isVU = VM.Data.Rk >= 0.39M && VM.Data.Rk <= 0.57M && VM.VehicleXtics.TypeVehicule == (int)VehicleType.PoidsLourd && VM.Data.B <= 2.35M && VM.Data.H <= 4 && //VM.Data.Kv >= 0.6M && //VM.Data.Kv <= 0.7M && VM.Data.mo <= 17000; Debug.WriteLine("isVT : " + isVT); Debug.WriteLine("isVU : " + isVU); return(isVT || isVU); }
public void GenerateMatrixForD() { Calculator calculator = new Calculator(); ChartValuesViewModel cvvm = this.GetVM(); decimal[][] velocities = this.GetVelocities(); var ibvc = 1; var nv = 5750; decimal[] valuesOfN = new decimal[] { 500, 1300, 2100, 2900, 2700, 4400, 5200, 5400 }; List <Tuple <decimal, decimal> >[] matrix = new List <Tuple <decimal, decimal> > [velocities.Length]; List <Tuple <decimal, decimal> >[] Pt = GetPt(calculator, cvvm, ibvc, nv, valuesOfN); List <Tuple <decimal, decimal> >[] Pw = GetPw(calculator, cvvm, velocities); for (int i = 0; i < velocities.Length; i++) { matrix[i] = calculator.GetDatasetFacteurDynamique(Pt[i], Pw[i], cvvm.Data.mo); } // TODO: Assert }
private void BeginCalculations(ChartValuesViewModel VM, Action <List <Tuple <decimal, decimal> >[]> onCalculationsEnd) { Calculator calculator = new Calculator(); ChartValuesViewModel cvvm = VM; decimal ibvc = calculator.GetRapportVitesseComplementaire(); decimal[][] velocities = this.GetVelocities(); decimal[] valuesOfN = new decimal[] { 500, 1300, 2100, 2900, 2700, 4400, 5200, 5400 }; //1: Calculate Mk (Couple au regime nominal) decimal Mkn = calculator.CalculateCoupleRegimeNominal(cvvm.Data.Nmax, cvvm.Data.nN); //2: Calculate Mr (Reserve du couple) decimal Mr = calculator.CalculateReserveCouple(Mkn, cvvm.Data.Mkmax); //3: Calculate k-omega (Coefficient d'adaptabilité) decimal ko = calculator.CalculateCoefficientAdaptabiliteRegime(cvvm.Data.nN, cvvm.Data.nMkmax); //4: Calculate km (Coefficient d'adaptabilité par rapport au couple) decimal km = calculator.CalculateCoefficientAdaptabiliteCouple(Mkn, cvvm.Data.Mkmax); //5: Calculate Hg (Centre de masse) decimal Hg = calculator.CalculateCentreMasse(cvvm.Data.H); //6: Calculate Omega-v (Coefficient de resistance total) decimal ov = calculator.CalculateCoefficientResistanceTotalDeplacement(calculator.GetCoefficientResistanceRoulement(), cvvm.Data.α); //7: Calculate F (Surface Frontal) decimal F = calculator.CalculateSurfaceFrontale(cvvm.Data.B, cvvm.Data.H); //8: Generate dataset for Ne and draw graph for user to determine nv //normally An, Bn and Cn are calculated, but for clients convenience they will be static List <Tuple <decimal, decimal> > Ne = calculator.GetDatasetCourbePuissanceMoteur(cvvm.Data.Nmax, cvvm.Data.nN, cvvm.EmpiricCoefficient.An, cvvm.EmpiricCoefficient.Bn, cvvm.EmpiricCoefficient.Cn, valuesOfN); this.ShowModal(Ne, (nv) => { //10: Calculate ibv1 (rapport 1er vitesse) decimal ip = calculator.CalculateRapportPont(cvvm.Data.Rk, nv, cvvm.Data.Vmax, ibvc); decimal first = calculator.CalculateRapportPremiereVitesse(cvvm.Data.mo * 9.81M, cvvm.Data.Ψmax, cvvm.Data.Rk, cvvm.Data.Mkmax, ibvc, ip, cvvm.Data.nt, calculator.GetCoefficientCorrection()); //11: Calculate ibvi (rapport autre vitesse) decimal second = calculator.CalculateRapportAutreVitesse(6, 2, first); decimal third = calculator.CalculateRapportAutreVitesse(6, 3, first); decimal fourth = calculator.CalculateRapportAutreVitesse(6, 4, first); decimal fifth = calculator.CalculateRapportAutreVitesse(6, 5, first); decimal sixth = calculator.CalculateRapportAutreVitesse(6, 6, first); //12: Calculate iti decimal[] iti = new decimal[] { calculator.CalculateRapportGlobauxTransmission(first, ip), calculator.CalculateRapportGlobauxTransmission(second, ip), calculator.CalculateRapportGlobauxTransmission(third, ip), calculator.CalculateRapportGlobauxTransmission(fourth, ip), calculator.CalculateRapportGlobauxTransmission(fifth, ip), calculator.CalculateRapportGlobauxTransmission(sixth, ip), }; //13: Generate matrix for Nei List <Tuple <decimal, decimal> >[] Nei = new List <Tuple <decimal, decimal> > [velocities.Length]; for (int i = 0; i < velocities.Length; i++) { Nei[i] = calculator.GetDatasetRegimeMoteurChaqueRapport(iti[i], cvvm.Data.Rk, velocities[i]); } //9: Generate dataset for Mk List <Tuple <decimal, decimal> >[] Mk = new List <Tuple <decimal, decimal> > [Nei.Length]; for (int i = 0; i < velocities.Length; i++) { Mk[i] = calculator.GetDatasetCourbeCoupleMoteur(cvvm.Data.Mkmax, cvvm.Data.nN, cvvm.EmpiricCoefficient.An, cvvm.EmpiricCoefficient.Bn, cvvm.EmpiricCoefficient.Cn, Nei[i]); } //14: Generate matrix for PT // TODO: Come back here to verify MK; From document Mk needs to change according to velocity // and rapport de vitesse but it is not changing thus values cannot be used effectively on formula //Mki List <Tuple <decimal, decimal> >[] Pt = new List <Tuple <decimal, decimal> > [Mk.Length]; for (int i = 0; i < Mk.Length; i++) { Pt[i] = calculator.GetDatasetForceTractionMoteur(iti[i], cvvm.Data.Rk, cvvm.Data.nt, Mk[i]); } //15: Generate matrix for Pw List <Tuple <decimal, decimal> >[] Pw = new List <Tuple <decimal, decimal> > [velocities.Length]; for (int i = 0; i < velocities.Length; i++) { Pw[i] = calculator.GetDatasetForceAerodynamiqueResistance(cvvm.Data.H, cvvm.Data.B, cvvm.Data.Cf, cvvm.Data.Kv, velocities[i]); } //15: Generate matrix for D List <Tuple <decimal, decimal> >[] D = new List <Tuple <decimal, decimal> > [velocities.Length]; for (int i = 0; i < velocities.Length; i++) { D[i] = calculator.GetDatasetFacteurDynamique(Pt[i], Pw[i], cvvm.Data.mo); } onCalculationsEnd(D); }); }
private static List <Tuple <decimal, decimal> >[] GetNei(Calculator calculator, ChartValuesViewModel cvvm, decimal[][] velocities, decimal[] iti) { //NEI List <Tuple <decimal, decimal> >[] matrix = new List <Tuple <decimal, decimal> > [velocities.Length]; for (int i = 0; i < velocities.Length; i++) { matrix[i] = calculator.GetDatasetRegimeMoteurChaqueRapport(iti[i], cvvm.Data.Rk, velocities[i]); } return(matrix); }