Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS will be completely phased out by mid-2025. To see alternatives please check here

Skip to content
Snippets Groups Projects
Commit 58b926ce authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

in case the interpolate search is not successful (i.e., difference in electric...

in case the interpolate search is not successful (i.e., difference in electric power too high), search again (with interpolate search) and increas y value
parent 0c109f2b
No related branches found
No related tags found
No related merge requests found
......@@ -4,6 +4,7 @@ using Newtonsoft.Json;
using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.Configuration;
using TUGraz.VectoCore.Utils;
namespace TUGraz.VectoCore.Models.SimulationComponent.Data.ElectricMotor
......@@ -148,7 +149,22 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.ElectricMotor
var myX = (EfficiencyResult)x;
return (myX.ElectricalPower - batPower).Value();
});
var tmp = LookupElectricPower(avgSpeed, retVal, true);
if ((tmp.ElectricalPower - batPower).IsGreater(Constants.SimulationSettings.InterpolateSearchTolerance)) {
// searched operating point is not accurate enough...
retVal = SearchAlgorithm.Search(
maxEmTorque, elPowerMaxEM.ElectricalPower - batPower,
-maxEmTorque * 0.1 * (maxEmTorque > 0 ? -1 : 1),
getYValue: x => {
var myX = (EfficiencyResult)x;
return (myX.ElectricalPower - batPower) * 1e3;
},
evaluateFunction: x => LookupElectricPower(avgSpeed, x, true),
criterion: x => {
var myX = (EfficiencyResult)x;
return (myX.ElectricalPower - batPower).Value() * 1e3;
});
}
return retVal;
} catch (VectoSearchFailedException vsfe) {
Log.Error("Failed to find mechanic power for given electric power! n_avg: {0} P_el: {1}; {2}", avgSpeed.AsRPM, batPower, vsfe.Message);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment