public ReadFleetShares ( string DataPath, System.Helpers Helper ) : bool | ||
DataPath | string | |
Helper | System.Helpers | |
return | bool |
//******************* Parameters of Array or Single calculation ******************* //********************************* INPUT ****************************************** //*** DATATYP | UNIT | VARIBLE | Description *** //List<string> | [-] | DataFiles (VEH, FC, EMI)| Name of file (e.g. "PC_D_EU4" path neede if not in "Default Vehicles") or aggregated name (PC, HDV, BUS, TW) by FleetMix calculation //List<double> / double | [s] | Time | Time signal //List<double> / double | [m/s] | Velocity | Velocity signal //double | [m/s^2]| acc | Acceleration (ONLY NEDDED BY SINGLE CALCULATION) //List<double> / double | [%] | Gradient | Gradient of the route //out List<VehicleResult> | [-] | VehicleResultsOrg | Returned result list //bool | [-] | fleetMix = false | Optional parameter if fleetMix should be calculate //string | [-] | CommentPref = "c" | Optional parameter for comment prefix //********************************* OUPUT: VehicleResultsOrg ********************** //*** DATATYP | UNIT | VARIBLE | Description *** //double | [s] | time | Time //double | [m/s] | speed | Velocity //double | [kW] | power | Calculated power at the engine (ICE for conventional and HEV vehicles, electric engine for BEVs) including engine inertia and auxiliaries; not limited for engine fullload and braking limitations //double | [kW] | P_pos | Positive engine power limited with engine rated power //double | [-] | pNormRated | Engine power normalised with rated engine power and limited with the power range (fullload and drag) as specified in the characteristic curve for fuel consumption //double | [-] | pNormDrive | Engine power normalised with "P_drive" and limited with the power range (fullload and drag) as specified in the characteristic curve for emissions //double | [m/s^2]| acc | Caclulated/given acceleration //double | [g/h] | fc | Calculated fuel consumption (Different unit for BEV vehicles) // | [kWh/h]| | //double | [g/h] | cO2 | Calculated CO2 emissions //double | [g/h] | NOx | Calculated NOx emissions //double | [g/h] | HC | Calculated HC emissions //double | [g/h] | PM | Calculated PM emissions //double | [g/h] | CO | Calculated CO emissions #region calculate //Calculate data from array public bool CALC_Array(List <string> DataFiles, List <double> Time, List <double> Velocity, List <double> Gradient, out List <VehicleResult> VehicleResultsOrg, bool fleetMix = false, string CommentPref = "c") { //Declaration int i; double acc; List <VehicleResult> _VehicleResult = new List <VehicleResult>(); //Initialisation Helper.ErrMsg = null; //Borrow Helper.CommentPrefix = CommentPref; _DataPath = new List <string>(); //Set path by normal calculation (on given) and set path by fleetmix (on Default Vehicles) calculation for (i = 0; i < DataFiles.Count; i++) { if ((DataFiles[i].LastIndexOf(@"\")) >= 0) { _DataPath.Add(DataFiles[i]); } else { //_DataPath.Add(Assembly.GetExecutingAssembly().Location.Substring(0, Assembly.GetExecutingAssembly().Location.LastIndexOf(@"\")) + @"\Default Vehicles\" + Helper.PHEMDataV); _DataPath.Add(DataFiles[i + 1].Substring(0, DataFiles[i + 1].LastIndexOf(@"\"))); _DataPath.Add(DataFiles[i + 1].Substring(0, DataFiles[i + 1].LastIndexOf(@"\"))); _DataPath.Add(DataFiles[i + 1].Substring(0, DataFiles[i + 1].LastIndexOf(@"\"))); i += 1; } } //Read the vehicle and emission data #if FLEET if (fleetMix) { //Set the vehicle class Helper.gClass = _DataPath[0]; //Generate the class DataInput = new CEPHandler(); //Read the FleetShares if (!DataInput.ReadFleetShares(DataFiles[1], Helper)) { VehicleResultsOrg = null; return(false); } //Read the vehicle and emission data if (!DataInput.GetFleetCEP(_DataPath, DataFiles[0], Helper)) { VehicleResultsOrg = null; return(false); } } else #endif { //Get vehicle string if (!Helper.setclass(DataFiles[0])) { VehicleResultsOrg = null; return(false); } //Generate the class DataInput = new CEPHandler(); //Read the vehicle and emission data if (!DataInput.GetCEP(_DataPath, Helper)) { VehicleResultsOrg = null; return(false); } } //Calculate emissions per second for (i = 1; i <= Time.Count - 1; i++) { //Calculate the acceleration acc = (Velocity[i] - Velocity[i - 1]) / (Time[i] - Time[i - 1]); //Calculate and save the data in the List _VehicleResult.Add(PHEMLight.CreateVehicleStateData(Helper, DataInput.CEPS[Helper.gClass], Time[i - 1], Velocity[i - 1], acc, Gradient[i - 1])); if (Helper.ErrMsg != null) { VehicleResultsOrg = null; return(false); } } VehicleResultsOrg = _VehicleResult; return(true); }
//Calculate single data public bool CALC_Single(List <string> DataFiles, double Time, double Velocity, double acc, double Gradient, out List <VehicleResult> VehicleResultsOrg, bool fleetMix = false, string CommentPref = "c") { //Declaration List <VehicleResult> _VehicleResult = new List <VehicleResult>(); VehicleResultsOrg = _VehicleResult; //Borrow Helper.CommentPrefix = CommentPref; _DataPath = new List <string>(); //Set path by normal calculation (on given) and set path by fleetmix (on Fleetshare file) calculation for (int i = 0; i < DataFiles.Count; i++) { if ((DataFiles[i].LastIndexOf(@"\")) >= 0) { _DataPath.Add(DataFiles[i]); } else { //_DataPath.Add(Assembly.GetExecutingAssembly().Location.Substring(0, Assembly.GetExecutingAssembly().Location.LastIndexOf(@"\")) + @"\Default Vehicles\" + Helper.PHEMDataV); _DataPath.Add(DataFiles[i + 1].Substring(0, DataFiles[i + 1].LastIndexOf(@"\"))); _DataPath.Add(DataFiles[i + 1].Substring(0, DataFiles[i + 1].LastIndexOf(@"\"))); _DataPath.Add(DataFiles[i + 1].Substring(0, DataFiles[i + 1].LastIndexOf(@"\"))); i += 1; } } //Read the vehicle and emission data #if FLEET if (fleetMix) { //Set the vehicle class Helper.gClass = "AggClass_" + DataFiles[0]; //Generate the class DataInput = new CEPHandler(); //Read the FleetShares if (!DataInput.ReadFleetShares(DataFiles[1], Helper)) { VehicleResultsOrg = null; return(false); } //Read the vehicle and emission data if (!DataInput.GetFleetCEP(_DataPath, DataFiles[0], Helper)) { VehicleResultsOrg = null; return(false); } } else #endif { //Get vehicle string if (!Helper.setclass(DataFiles[0])) { VehicleResultsOrg = null; return(false); } //Generate the class DataInput = new CEPHandler(); //Read the vehicle and emission data if (!DataInput.GetCEP(_DataPath, Helper)) { VehicleResultsOrg = null; return(false); } } //Calculate and save the data in the List _VehicleResult.Add(PHEMLight.CreateVehicleStateData(Helper, DataInput.CEPS[Helper.gClass], Time, Velocity, acc, Gradient)); VehicleResultsOrg = _VehicleResult; return(true); }
//******************* Parameters of Array or Single calculation ******************* //********************************* INPUT ****************************************** //*** DATATYP | UNIT | VARIBLE | Description *** //string | [-] | VEH | Name of vehicle file (e.g. "PC_D_EU4" path neede if not in "Default Vehicles") or aggregated name (PC, HDV, BUS, TW) by FleetMix calculation //List<double> / double | [s] | Time | Time signal //List<double> / double | [m/s] | Velocity | Velocity signal //double | [m/s^2]| acc | Acceleration (ONLY NEDDED BY SINGLE CALCULATION) //List<double> / double | [%] | Gradient | Gradient of the route //out List<VehicleResult> | [-] | VehicleResultsOrg | Returned result list //bool | [-] | fleetMix = false | Optional parameter if fleetMix should be calculate //string | [-] | PHEMDataV = "V4" | Optional parameter for "Default Vehicles" //string | [-] | CommentPref = "c" | Optional parameter for comment prefix //********************************* OUPUT: VehicleResultsOrg ********************** //*** DATATYP | UNIT | VARIBLE | Description *** //double | [s] | time | Time //double | [m/s] | speed | Velocity //double | [kW] | power | Calculated power at the engine (ICE for conventional and HEV vehicles, electric engine for BEVs) including engine inertia and auxiliaries; not limited for engine fullload and braking limitations //double | [kW] | P_pos | Positive engine power limited with engine rated power //double | [-] | pNormRated | Engine power normalised with rated engine power and limited with the power range (fullload and drag) as specified in the characteristic curve for fuel consumption //double | [-] | pNormDrive | Engine power normalised with "P_drive" and limited with the power range (fullload and drag) as specified in the characteristic curve for emissions //double | [m/s^2]| acc | Caclulated/given acceleration //double | [g/h] | fc | Calculated fuel consumption (Different unit for BEV vehicles) // | [kWh/h]| | //double | [g/h] | cO2 | Calculated CO2 emissions //double | [g/h] | NOx | Calculated NOx emissions //double | [g/h] | HC | Calculated HC emissions //double | [g/h] | PM | Calculated PM emissions //double | [g/h] | CO | Calculated CO emissions #region calculate //Calculate data from array public bool CALC_Array(string VEH, List<double> Time, List<double> Velocity, List<double> Gradient, out List<VehicleResult> VehicleResultsOrg, bool fleetMix = false, string PHEMDataV = "V4", string CommentPref = "c") { //Declaration int i; double acc; List<VehicleResult> _VehicleResult = new List<VehicleResult>(); //Initialisation Helper.ErrMsg = null; //Borrow Helper.CommentPrefix = CommentPref; Helper.PHEMDataV = PHEMDataV; if ((VEH.LastIndexOf(@"\")) >= 0) _DataPath = VEH.Substring(0, VEH.LastIndexOf(@"\")); else _DataPath = Assembly.GetExecutingAssembly().Location.Substring(0, Assembly.GetExecutingAssembly().Location.LastIndexOf(@"\")) + @"\Default Vehicles\" + Helper.PHEMDataV; //Read the vehicle and emission data #if FLEET if (fleetMix) { //Set the vehicle class Helper.gClass = VEH; //Generate the class DataInput = new CEPHandler(); //Read the FleetShares if (!DataInput.ReadFleetShares(_DataPath, Helper)) { VehicleResultsOrg = null; return false; } //Read the vehicle and emission data if (!DataInput.GetFleetCEP(_DataPath, VEH, Helper)) { VehicleResultsOrg = null; return false; } } else #endif { //Get vehicle string if (!Helper.setclass(VEH)) { VehicleResultsOrg = null; return false; } //Generate the class DataInput = new CEPHandler(); //Read the vehicle and emission data if (!DataInput.GetCEP(_DataPath, Helper)) { VehicleResultsOrg = null; return false; } } //Calculate emissions per second for (i = 1; i <= Time.Count - 1; i++) { //Calculate the acceleration acc = (Velocity[i] - Velocity[i - 1]) / (Time[i] - Time[i - 1]); //Calculate and save the data in the List _VehicleResult.Add(PHEMLight.CreateVehicleStateData(Helper, DataInput.CEPS[Helper.gClass], Time[i - 1], Velocity[i - 1], acc, Gradient[i - 1])); if (Helper.ErrMsg != null) { VehicleResultsOrg = null; return false; } } VehicleResultsOrg = _VehicleResult; return true; }
//Calculate single data public bool CALC_Single(string VEH, double Time, double Velocity, double acc, double Gradient, out List <VehicleResult> VehicleResultsOrg, bool fleetMix = false, string PHEMDataV = "V4", string CommentPref = "c") { //Declaration List <VehicleResult> _VehicleResult = new List <VehicleResult>(); VehicleResultsOrg = _VehicleResult; //Borrow Helper.CommentPrefix = CommentPref; Helper.PHEMDataV = PHEMDataV; if ((VEH.LastIndexOf(@"\")) >= 0) { _DataPath = VEH.Substring(0, VEH.LastIndexOf(@"\")); } else { _DataPath = Assembly.GetExecutingAssembly().Location.Substring(0, Assembly.GetExecutingAssembly().Location.LastIndexOf(@"\")) + @"\Default Vehicles\" + Helper.PHEMDataV; } //Read the vehicle and emission data #if FLEET if (fleetMix) { //Set the vehicle class Helper.gClass = "AggClass_" + VEH; //Generate the class DataInput = new CEPHandler(); //Read the FleetShares if (!DataInput.ReadFleetShares(_DataPath, Helper)) { VehicleResultsOrg = null; return(false); } //Read the vehicle and emission data if (!DataInput.GetFleetCEP(_DataPath, VEH, Helper)) { VehicleResultsOrg = null; return(false); } } else #endif { //Get vehicle string if (!Helper.setclass(VEH)) { VehicleResultsOrg = null; return(false); } //Generate the class DataInput = new CEPHandler(); //Read the vehicle and emission data if (!DataInput.GetCEP(_DataPath, Helper)) { VehicleResultsOrg = null; return(false); } } //Calculate and save the data in the List _VehicleResult.Add(PHEMLight.CreateVehicleStateData(Helper, DataInput.CEPS[Helper.gClass], Time, Velocity, acc, Gradient)); VehicleResultsOrg = _VehicleResult; return(true); }
//Calculate single data public bool CALC_Single(string VEH, double Time, double Velocity, double acc, double Gradient, out List<VehicleResult> VehicleResultsOrg, bool fleetMix = false, string PHEMDataV = "V4", string CommentPref = "c") { //Declaration List<VehicleResult> _VehicleResult = new List<VehicleResult>(); VehicleResultsOrg = _VehicleResult; //Borrow Helper.CommentPrefix = CommentPref; Helper.PHEMDataV = PHEMDataV; if ((VEH.LastIndexOf(@"\")) >= 0) _DataPath = VEH.Substring(0, VEH.LastIndexOf(@"\")); else _DataPath = Assembly.GetExecutingAssembly().Location.Substring(0, Assembly.GetExecutingAssembly().Location.LastIndexOf(@"\")) + @"\Default Vehicles\" + Helper.PHEMDataV; //Read the vehicle and emission data #if FLEET if (fleetMix) { //Set the vehicle class Helper.gClass = "AggClass_" + VEH; //Generate the class DataInput = new CEPHandler(); //Read the FleetShares if (!DataInput.ReadFleetShares(_DataPath, Helper)) { VehicleResultsOrg = null; return false; } //Read the vehicle and emission data if (!DataInput.GetFleetCEP(_DataPath, VEH, Helper)) { VehicleResultsOrg = null; return false; } } else #endif { //Get vehicle string if (!Helper.setclass(VEH)) { VehicleResultsOrg = null; return false; } //Generate the class DataInput = new CEPHandler(); //Read the vehicle and emission data if (!DataInput.GetCEP(_DataPath, Helper)) { VehicleResultsOrg = null; return false; } } //Calculate and save the data in the List _VehicleResult.Add(PHEMLight.CreateVehicleStateData(Helper, DataInput.CEPS[Helper.gClass], Time, Velocity, acc, Gradient)); VehicleResultsOrg = _VehicleResult; return true; }