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
  • a9c4ed013d38f07515b7dd1f39c1119c7c120f24
  • tug-dev default
  • amdm3/develop
  • fix/scripts1
  • amdm2/develop
  • amdm2/main
  • playground
  • feat/changelog
  • fix/solution_tests
  • test/full_release_process
  • test/art10_test_execution
  • test/gitlab_files_api
  • test/multiplatform_david
  • trgbot
  • set-sast-config-3
  • set-sast-config-2
  • set-secret-detection-config-2
  • set-secret-detection-config-1
  • set-sast-config-1
  • test-linux-fixes
  • tug-stable
  • Release/v4.3.2
  • v1.0.1
  • v1.0.0
  • Build/v0.7.10.2996
  • v0.7.5b0+2524.multistep
  • Release/v3.3.14.2981-RC
  • Build/v0.7.9.2975
  • Release/v3.3.13.2924
  • Release/v3.3.13.2891-RC
  • Build/0.7.9.2890
  • Build/v0.7.9.2864
  • Build/v0.7.9.2849
  • Build/v0.7.9.2836
  • Release/TrailerTool_V0.9.0.2759
  • Release/TrailerTool_V0.9.0.2735
  • Release/TrailerTool_V0.9.0.2799
  • Release/v3.3.12.2800
  • Release/v3.3.12.2769-RC
  • Build/v0.7.9.2741
  • Build/v0.5.0.1812_VectoFF
41 results

MockupNinjectModule.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.
    GearboxPowertrainTest.cs 4.69 KiB
    /*
    * This file is part of VECTO.
    *
    * Copyright © 2012-2016 European Union
    *
    * Developed by Graz University of Technology,
    *              Institute of Internal Combustion Engines and Thermodynamics,
    *              Institute of Technical Informatics
    *
    * VECTO is licensed under the EUPL, Version 1.1 or - as soon they will be approved
    * by the European Commission - subsequent versions of the EUPL (the "Licence");
    * You may not use VECTO except in compliance with the Licence.
    * You may obtain a copy of the Licence at:
    *
    * https://joinup.ec.europa.eu/community/eupl/og_page/eupl
    *
    * Unless required by applicable law or agreed to in writing, VECTO
    * distributed under the Licence is distributed on an "AS IS" basis,
    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    * See the Licence for the specific language governing permissions and
    * limitations under the Licence.
    *
    * Authors:
    *   Stefan Hausberger, hausberger@ivt.tugraz.at, IVT, Graz University of Technology
    *   Christian Kreiner, christian.kreiner@tugraz.at, ITI, Graz University of Technology
    *   Michael Krisper, michael.krisper@tugraz.at, ITI, Graz University of Technology
    *   Raphael Luz, luz@ivt.tugraz.at, IVT, Graz University of Technology
    *   Markus Quaritsch, markus.quaritsch@tugraz.at, IVT, Graz University of Technology
    *   Martin Rexeis, rexeis@ivt.tugraz.at, IVT, Graz University of Technology
    */
    
    using Microsoft.VisualStudio.TestTools.UnitTesting;
    using TUGraz.VectoCommon.Utils;
    using TUGraz.VectoCore.Models.Connector.Ports.Impl;
    using TUGraz.VectoCore.Tests.Integration;
    using TUGraz.VectoCore.Tests.Utils;
    
    namespace TUGraz.VectoCore.Tests.Models.SimulationComponent
    {
    	[TestClass]
    	public class GearboxPowertrainTest
    	{
    		[TestMethod]
    		public void Gearbox_Initialize_Empty()
    		{
    			var cycle = SimpleDrivingCycles.CreateCycleData(new[] {
    				// <s>, <v>, <grad>,           <stop>
    				"  0,    0,  2.95016969027809, 1",
    				"1000,  60,  2.95016969027809, 0",
    			});
    			var container = Truck40tPowerTrain.CreatePowerTrain(cycle, "Gearbox_Initialize", 7500.0.SI<Kilogram>(),
    				0.SI<Kilogram>());
    			var retVal = container.Cycle.Initialize();
    			Assert.AreEqual(5u, container.Gear);
    			Assert.IsInstanceOfType(retVal, typeof(ResponseSuccess));
    
    			AssertHelper.AreRelativeEqual(560.RPMtoRad(), container.EngineSpeed);
    
    			var absTime = 0.SI<Second>();
    			var ds = 1.SI<Meter>();
    
    			retVal = container.Cycle.Request(absTime, ds);
    			container.CommitSimulationStep(absTime, retVal.SimulationInterval);
    			absTime += retVal.SimulationInterval;
    
    			AssertHelper.AreRelativeEqual(560.RPMtoRad(), container.EngineSpeed);
    
    			container.Cycle.Request(absTime, ds);
    			container.CommitSimulationStep(absTime, retVal.SimulationInterval);
    			Assert.AreEqual(3u, container.Gear);
    			AssertHelper.AreRelativeEqual(67.6649, container.EngineSpeed);
    		}
    
    		[TestMethod]
    		public void Gearbox_Initialize_RefLoad()
    		{
    			var cycle = SimpleDrivingCycles.CreateCycleData(new[] {
    				// <s>, <v>,           <grad>, <stop>
    				"    0,   0, 2.95016969027809,      1",
    				" 1000,  60, 2.95016969027809,      0",
    			});
    			var container = Truck40tPowerTrain.CreatePowerTrain(cycle, "Gearbox_Initialize", 7500.0.SI<Kilogram>(),
    				19300.SI<Kilogram>());
    			var retVal = container.Cycle.Initialize();
    			Assert.AreEqual(4u, container.Gear);
    			Assert.IsInstanceOfType(retVal, typeof(ResponseSuccess));
    
    			AssertHelper.AreRelativeEqual(560.RPMtoRad(), container.EngineSpeed);
    
    			var absTime = 0.SI<Second>();
    			var ds = 1.SI<Meter>();
    
    			retVal = container.Cycle.Request(absTime, ds);
    			container.CommitSimulationStep(absTime, retVal.SimulationInterval);
    			absTime += retVal.SimulationInterval;
    
    			AssertHelper.AreRelativeEqual(560.RPMtoRad(), container.EngineSpeed);
    
    			container.Cycle.Request(absTime, ds);
    			container.CommitSimulationStep(absTime, retVal.SimulationInterval);
    
    			AssertHelper.AreRelativeEqual(87.3192, container.EngineSpeed);
    		}
    
    		[TestMethod]
    		public void Gearbox_Initialize_85_RefLoad()
    		{
    			var cycle = SimpleDrivingCycles.CreateCycleData(new[] {
    				// <s>,<v>,<grad>,<stop>
    				"  0,  85, 2.95016969027809,     0",
    				" 100, 85, 2.95016969027809,     0",
    			});
    			var container = Truck40tPowerTrain.CreatePowerTrain(cycle, "Gearbox_Initialize", 7500.0.SI<Kilogram>(),
    				19300.SI<Kilogram>());
    			var retVal = container.Cycle.Initialize();
    			Assert.AreEqual(12u, container.Gear);
    			Assert.IsInstanceOfType(retVal, typeof(ResponseSuccess));
    
    			AssertHelper.AreRelativeEqual(1195.996.RPMtoRad(), container.EngineSpeed, toleranceFactor: 1e-3);
    
    			var absTime = 0.SI<Second>();
    			var ds = 1.SI<Meter>();
    
    			retVal = container.Cycle.Request(absTime, ds);
    			container.CommitSimulationStep(absTime, retVal.SimulationInterval);
    			absTime += retVal.SimulationInterval;
    		}
    	}
    }