Code development platform for open source projects from the European Union institutions

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

Merge pull request #721 in VECTO/vecto-sim from...

Merge pull request #721 in VECTO/vecto-sim from ~EMQUARIMA/vecto-sim:bugfix/VECTO-820-distancerun-got-an-unexpected-response-responsespeedlimitexceeded to develop

* commit '2738dbb5':
  removing demo-testcase
  fix for null-reference with AT measured speed simulations
  working on simulation aborts with TC
parents d00bf479 2738dbb5
No related branches found
No related tags found
No related merge requests found
Showing with 571 additions and 459 deletions
......@@ -682,6 +682,48 @@ Global
{33F9848E-9257-4BE2-915F-68E748AEB204}.ReleaseTUG|Any CPU.Build.0 = Release|Any CPU
{33F9848E-9257-4BE2-915F-68E748AEB204}.ReleaseTUG|x64.ActiveCfg = Release|Any CPU
{33F9848E-9257-4BE2-915F-68E748AEB204}.ReleaseTUG|x86.ActiveCfg = Release|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug PerformanceStats|Any CPU.ActiveCfg = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug PerformanceStats|Any CPU.Build.0 = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug PerformanceStats|x64.ActiveCfg = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug PerformanceStats|x64.Build.0 = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug PerformanceStats|x86.ActiveCfg = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug PerformanceStats|x86.Build.0 = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug PerformanceTrace|Any CPU.ActiveCfg = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug PerformanceTrace|Any CPU.Build.0 = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug PerformanceTrace|x64.ActiveCfg = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug PerformanceTrace|x64.Build.0 = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug PerformanceTrace|x86.ActiveCfg = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug PerformanceTrace|x86.Build.0 = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug|x64.ActiveCfg = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug|x64.Build.0 = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug|x86.ActiveCfg = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Debug|x86.Build.0 = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.DebugTUG|Any CPU.ActiveCfg = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.DebugTUG|Any CPU.Build.0 = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.DebugTUG|x64.ActiveCfg = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.DebugTUG|x64.Build.0 = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.DebugTUG|x86.ActiveCfg = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.DebugTUG|x86.Build.0 = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Deploy|Any CPU.ActiveCfg = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Deploy|Any CPU.Build.0 = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Deploy|x64.ActiveCfg = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Deploy|x64.Build.0 = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Deploy|x86.ActiveCfg = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Deploy|x86.Build.0 = Debug|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Release|Any CPU.Build.0 = Release|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Release|x64.ActiveCfg = Release|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Release|x64.Build.0 = Release|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Release|x86.ActiveCfg = Release|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.Release|x86.Build.0 = Release|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.ReleaseTUG|Any CPU.ActiveCfg = Release|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.ReleaseTUG|Any CPU.Build.0 = Release|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.ReleaseTUG|x64.ActiveCfg = Release|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.ReleaseTUG|x64.Build.0 = Release|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.ReleaseTUG|x86.ActiveCfg = Release|Any CPU
{EF99431D-4227-44C3-B2BD-DE8AE3E672CA}.ReleaseTUG|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
......
......@@ -62,7 +62,6 @@
<OptionInfer>On</OptionInfer>
</PropertyGroup>
<ItemGroup>
<Reference Include="DocumentFormat.OpenXml, Version=2.5.5631.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL" />
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="Moq">
<HintPath>..\..\packages\Moq.4.2.1510.2205\lib\net40\Moq.dll</HintPath>
......
......@@ -34,8 +34,6 @@ using System.IO;
using System.Linq;
using System.Text;
using System.Xml;
using System.Xml.Linq;
using System.Xml.Schema;
using System.Xml.XPath;
using NUnit.Framework;
using TUGraz.VectoCommon.Hashing;
......@@ -332,13 +330,13 @@ namespace VectoHashingTest
var input = new XmlDocument();
input.Load(file);
var dateNode = input.SelectSingleNode("//*[local-name()='Date']");
var date = XmlConvert.ToDateTime(dateNode.FirstChild.Value);
var date = XmlConvert.ToDateTime(dateNode.FirstChild.Value, XmlDateTimeSerializationMode.Utc);
var h = VectoHash.Load(input);
var r = h.AddHash();
var newDateNode = r.XPathSelectElement("//*[local-name()='Date']");
var newDate = XmlConvert.ToDateTime(newDateNode.Value);
var newDate = XmlConvert.ToDateTime(newDateNode.Value, XmlDateTimeSerializationMode.Utc);
var now = DateTime.Now;
......
......@@ -99,7 +99,10 @@ namespace TUGraz.VectoCore.Models.Connector.Ports.Impl
/// <summary>
/// Response when the Speed Limit was exceeded.
/// </summary>
public class ResponseSpeedLimitExceeded : AbstractResponse {}
public class ResponseSpeedLimitExceeded : AbstractResponse
{
public ResponseSpeedLimitExceeded() { }
}
/// <summary>
/// Response when the request should have another time interval.
......
......@@ -262,7 +262,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox
var mpEdge = Edge.Create(new Point(segment.Item1.SpeedRatio, segment.Item1.Torque.Value()),
new Point(segment.Item2.SpeedRatio, segment.Item2.Torque.Value()));
// Torque Converter: M_P1000 = k * n_out / n_in + d
// T_out = M_P1000 * (n_in / 1000rpm)^2 = (k * n_out / n_in + d) * (n_in / c)^2
// P_eng_out = P_eng_inertia + P_TC_in_avg
......@@ -277,7 +277,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox
previousPowerTC / 2;
var sol = VectoMath.CubicEquationSolver(a.Value(), b.Value(), c, d.Value());
//============================================================================
/*
// Torque Converter: M_P1000 = k * n_out / n_in + d
......@@ -287,16 +287,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox
// P_TC_in_avg = n_in_2 (T_in_1 * n_in_1 + T_in_2 * n_in_2) / (n_in_1 + n_in_2)
// (index _1: beginning of simulation interval, index _2: end of simulation interval)
// => solve for n_in
*/
//var a = 2 * mpEdge.OffsetXY.SI<NewtonMeter>() * dt / (mpNorm * mpNorm);
//var b = inertia + 2 * dt * nextOutputSpeed * mpEdge.SlopeXY.SI<NewtonMeter>() / (mpNorm * mpNorm);
//var c = prevInputSpeed * inertia;
//var d = 2 * dt * previousPowerTC - inertia * prevInputSpeed * prevInputSpeed - 2 * dt * enginePower;
//var e = - inertia * prevInputSpeed * prevInputSpeed * prevInputSpeed - 2 * dt * prevInputSpeed * enginePower;
var a = 2 * mpEdge.OffsetXY.SI<NewtonMeter>() * dt / (mpNorm * mpNorm);
var b = inertia + 2 * dt * nextOutputSpeed * mpEdge.SlopeXY.SI<NewtonMeter>() / (mpNorm * mpNorm);
var c = prevInputSpeed * inertia;
var d = 2 * dt * previousPowerTC - inertia * prevInputSpeed * prevInputSpeed - 2 * dt * enginePower;
var e = - inertia * prevInputSpeed * prevInputSpeed * prevInputSpeed - 2 * dt * prevInputSpeed * enginePower;
var sol = VectoMath.Polynom4Solver(a.Value(), b.Value(), c.Value(), d.Value(), e.Value());
//var sol = VectoMath.Polynom4Solver(a.Value(), b.Value(), c.Value(), d.Value(), e.Value());
//============================================================================
*/
// T_eng_o_2 + T_eng_I + T_aux - T_max) (n_in_1 + n_in_2) / 2 = 0
//var a = dt * mpEdge.OffsetXY.SI<NewtonMeter>() / (mpNorm * mpNorm);
......
......@@ -57,6 +57,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
protected AbstractGearbox(IVehicleContainer container, VectoRunData runData) : base(container)
{
ModelData = runData.GearboxData;
LastShift = -double.MaxValue.SI<Second>();
}
#region ITnOutPort
......
......@@ -452,6 +452,9 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var second = first;
first.Switch().
Case<ResponseUnderload>(r => {
if (DataBus.GearboxType.AutomaticTransmission() && !DataBus.ClutchClosed(absTime)) {
second = Driver.DrivingActionRoll(absTime, ds, velocity, gradient);
}
if (DataBus.VehicleSpeed.IsGreater(0) && DriverStrategy.OverspeedAllowed(targetVelocity, prohibitOverspeed)) {
second = Driver.DrivingActionCoast(absTime, ds, velocity, gradient);
debug.Add(new { action = "first:(Underload & Overspeed)-> Coast", second });
......
......@@ -98,7 +98,11 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
{
var operatingPoint = FindOperatingPoint(outTorque, outAngularVelocity);
var avgEngineSpeed = (PreviousState.InAngularVelocity + operatingPoint.InAngularVelocity) / 2;
var avgPower = (PreviousState.InAngularVelocity * PreviousState.InTorque +
//var prevInSpeed = PreviousState.OperatingPoint?.InAngularVelocity ?? PreviousState.InAngularVelocity;
//var prevInTorque = PreviousState.OperatingPoint?.InTorque ?? PreviousState.InTorque;
var prevInSpeed = PreviousState.InAngularVelocity;
var prevInTorque = PreviousState.InTorque;
var avgPower = (prevInSpeed * prevInTorque +
operatingPoint.InAngularVelocity * operatingPoint.InTorque) / 2;
var inTorque = avgPower / avgEngineSpeed;
......@@ -127,7 +131,7 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
// check if shift is required
var ratio = Gearbox.GetGearData(Gearbox.Gear).TorqueConverterRatio;
if (retVal is ResponseSuccess &&
if (absTime > DataBus.LastShift && retVal is ResponseSuccess &&
ShiftStrategy.ShiftRequired(absTime, dt, outTorque * ratio, outAngularVelocity / ratio, inTorque,
operatingPoint.InAngularVelocity, Gearbox.Gear, Gearbox.LastShift)) {
return new ResponseGearShift { Source = this };
......@@ -164,10 +168,16 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Impl
var avgOutSpeedMin = (PreviousState.OutAngularVelocity + dryOperatingPointMin.OutAngularVelocity) / 2.0;
var deltaMin = (outTorque - dryOperatingPointMin.OutTorque) * avgOutSpeedMin;
var inTorqueMax =
(PreviousState.InAngularVelocity * PreviousState.InTorque +
dryOperatingPointMax.InAngularVelocity * dryOperatingPointMax.InTorque) /
(PreviousState.InAngularVelocity + dryOperatingPointMax.InAngularVelocity);
var inTorqueMin =
(PreviousState.InAngularVelocity * PreviousState.InTorque +
dryOperatingPointMin.InAngularVelocity * dryOperatingPointMin.InTorque) /
(PreviousState.InAngularVelocity + dryOperatingPointMin.InAngularVelocity);
var engRespMax = (ResponseDryRun)
NextComponent.Request(absTime, dt, inTorqueMax, dryOperatingPointMax.InAngularVelocity, true);
var engRespMin = (ResponseDryRun)
NextComponent.Request(absTime, dt, inTorqueMin, dryOperatingPointMin.InAngularVelocity, true);
......
......@@ -87,7 +87,7 @@ namespace TUGraz.VectoCore.Tests.Utils
throw new System.NotImplementedException();
}
public Second LastShift { get; private set; }
public Second LastShift { get; set; }
public GearData GetGearData(uint gear)
{
......
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