Code development platform for open source projects from the European Union institutions :large_blue_circle: EU Login authentication by SMS has been phased out. To see alternatives please check here

Skip to content
Snippets Groups Projects
Select Git revision
  • d0e084662f7d61acb8c5d701555c53ae0379b0c5
  • stable default
  • feat-fchv-bus
  • fix-h2-ice-bus
  • powertrains-multiple-axles
  • amdm3/develop
  • issue-1039
  • amdm3/main
  • test/nuget_publish
  • IEPC-experiments
  • amdm2/main
  • amdm2/develop
  • aptngearbox-not-auto
  • playground
  • official/main
  • official/develop
  • issue-templates
  • pdf-reports
  • HEV-timeruns-dev
  • timerun-empower-hybrids
  • timerun-pwheel-hybrids
  • Release/v5.0.3
  • Release/v5.0.1
  • Release/5.0.0-RC
  • Nuget/v0.11.4-DEV
  • Release/v0.11.4-DEV
  • Release/4.3.4-DEV
  • Release/4.3.3
  • Release/4.3.2-RC
  • Release/v4.3.0-DEV
  • Release/4.2.7
  • XMLConverterTool/4.2.6.0
  • Release/4.2.6-RC
  • Release/v4.2.5
  • Release/v4.2.3
  • Release/v4.2.2.3539-RC
  • Release/v4.2.1.3469
  • Release/v0.11.2.3456-DEV
  • Release/v4.2.0.3448-RC
  • Release/v4.1.3.3415
  • Release/v4.1.1.3413
41 results

EngineFLDTest.cs

Blame
  • Forked from VECTO / VECTO Sim
    Source project has a limited visibility.
    Code owners
    Assign users and groups as approvers for specific file changes. Learn more.
    EngineFLDTest.cs 1.74 KiB
    using System;
    using System.Diagnostics;
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using TUGraz.VectoCommon.Utils;
    using TUGraz.VectoCore.Models.SimulationComponent.Data.Engine;
    
    namespace TUGraz.VectoCore.Tests.Dummy
    {
    	[TestClass]
    	public class EngineFLDTest
    	{
    		[TestMethod]
    		public void CompareFLDLookupPerformance()
    		{
    			var engineFile1 = @"TestData\Components\40t_Long_Haul_Truck.vfld";
    			var engineFile2 = @"E:\QUAM\Downloads\EngineFLD\Map_375c_BB1390_modTUG_R49_375c_BB1386.vfld";
    
    			var map1 = EngineFullLoadCurve.ReadFromFile(engineFile1, true);
    			var map2 = EngineFullLoadCurve.ReadFromFile(engineFile2, true);
    
    			map1.FullLoadStationaryTorque(1000.RPMtoRad());
    			map2.FullLoadStationaryTorque(1000.RPMtoRad());
    
    			foreach (var map in new[] { map1, map2 }) {
    				var rand = new Random();
    				var stopWatch = Stopwatch.StartNew();
    
    
    				for (var i = 0; i < 500000; i++) {
    					var angularVelocity = rand.Next(1000, 1400).RPMtoRad();
    
    					var tqMax = map.FullLoadStationaryTorque(angularVelocity);
    				}
    
    				stopWatch.Stop();
    				Debug.Print("{0}", stopWatch.ElapsedMilliseconds);
    			}
    		}
    
    		[TestMethod]
    		public void LookupTest()
    		{
    			var engineFile2 = @"E:\QUAM\Downloads\EngineFLD\Map_375c_BB1390_modTUG_R49_375c_BB1386.vfld";
    
    			var map = EngineFullLoadCurve.ReadFromFile(engineFile2, true);
    
    			Assert.AreEqual(1208, map.FullLoadStationaryTorque(500.RPMtoRad()).Value(), 1e-3);
    
    			Assert.AreEqual(27, map.FullLoadStationaryTorque(2202.RPMtoRad()).Value(), 1e-3);
    
    			Assert.AreEqual(2341.5714, map.FullLoadStationaryTorque(1500.RPMtoRad()).Value(), 1e-3);
    			Assert.AreEqual(376.7142, map.FullLoadStationaryTorque(2175.RPMtoRad()).Value(), 1e-3);
    
    			Assert.AreEqual(1544, map.FullLoadStationaryTorque(628.RPMtoRad()).Value(), 1e-3);
    		}
    	}
    }