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 e3f8a384 authored by Markus Quaritsch's avatar Markus Quaritsch
Browse files

get rid of warnings when intersecting full-load curves: replace findIndex method by search loop

parent 55357127
No related branches found
No related tags found
No related merge requests found
......@@ -151,7 +151,6 @@ Examples:
f =>
Path.GetExtension(f) == Constants.FileExtensions.VectoJobFile ||
Path.GetExtension(f) == Constants.FileExtensions.VectoXMLDeclarationFile).ToList();
//var xmlFiles = fileList.Where(f => );
// if no other arguments given: display usage and terminate
if (!args.Any()) {
......
......@@ -212,15 +212,24 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
}
/// <summary>
/// Get item index for angularVelocity.
/// Get item index for the segment of the full-load curve where the angularVelocity lies within.
/// </summary>
protected int FindIndex(PerSecond angularVelocity)
{
int index;
FullLoadEntries.GetSection(x => x.EngineSpeed < angularVelocity, out index,
string.Format("requested rpm outside of FLD curve - extrapolating. rpm: {0}",
angularVelocity.ConvertTo().Rounds.Per.Minute));
return index + 1;
if (angularVelocity < FullLoadEntries.First().EngineSpeed) {
return 1;
}
if (angularVelocity > FullLoadEntries.Last().EngineSpeed) {
return FullLoadEntries.Count - 1;
}
for (var index = 1; index < FullLoadEntries.Count; index++) {
if (angularVelocity >= FullLoadEntries[index - 1].EngineSpeed &&
angularVelocity <= FullLoadEntries[index].EngineSpeed) {
return index;
}
}
throw new VectoException("angular velocity {0} exceeds full load curve: min: {1} max: {2}", angularVelocity,
FullLoadEntries.First().EngineSpeed, FullLoadEntries.Last().EngineSpeed);
}
[DebuggerDisplay("n: {EngineSpeed}, fullTorque: {TorqueFullLoad}, dragTorque: {TorqueDrag}")]
......
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