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

more robust way of comparing result cards

parent 3113f39b
No related branches found
No related tags found
No related merge requests found
......@@ -24,5 +24,7 @@ namespace TUGraz.VectoCommon.BusAuxiliaries
/// <returns></returns>
/// <remarks>Defaults to 10 Amps if no readings present</remarks>
Ampere GetSmartCurrentResult(Ampere amps);
Dictionary<Ampere, Ampere> Entries { get; }
}
}
......@@ -309,13 +309,13 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
{
var onVehicle = new List<SSMTechnology>();
foreach (var item in DeclarationData.BusAuxiliaries.SSMTechnologyList) {
if (item.BenefitName.Equals("Adjustable coolant thermostat", StringComparison.InvariantCultureIgnoreCase) &&
inputData.HVACAux.AdjustableCoolantThermostat) {
if ("Adjustable coolant thermostat".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) &&
(inputData?.HVACAux.AdjustableCoolantThermostat ?? false)) {
onVehicle.Add(item);
}
if (item.BenefitName.Equals("Engine waste gas heat exchanger", StringComparison.InvariantCultureIgnoreCase) &&
inputData.HVACAux.EngineWasteGasHeatExchanger) {
if ("Engine waste gas heat exchanger".Equals(item.BenefitName, StringComparison.InvariantCultureIgnoreCase) &&
(inputData?.HVACAux.EngineWasteGasHeatExchanger ?? false)) {
onVehicle.Add(item);
}
}
......
......@@ -10,17 +10,18 @@
// See the LICENSE.txt for the specific language governing permissions and limitations.
using System;
using System.Linq;
using Newtonsoft.Json;
using TUGraz.VectoCommon.BusAuxiliaries;
using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Utils;
namespace TUGraz.VectoCore.Models.BusAuxiliaries {
namespace TUGraz.VectoCore.Models.BusAuxiliaries
{
public class AuxiliaryConfig : IAuxiliaryConfig
{
public IBusAuxiliariesDeclarationData InputData { get; internal set; }
// Electrical
public IElectricsUserInputsConfig ElectricalUserInputsConfig { get; internal set; }
......@@ -34,21 +35,22 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries {
//public IActuationsMap ActuationsMap { get; internal set; }
public IActuations Actuations { get; internal set; }
public IVehicleData VehicleData { get; internal set; }
public IFuelConsumptionMap FuelMap { get; internal set; }
// Vecto Signals
public ISignals Signals { get; internal set; }
// Constructors
private bool CompareElectricalConfiguration(IAuxiliaryConfig other)
{
// AlternatorGearEfficiency
if (ElectricalUserInputsConfig.AlternatorGearEfficiency != other.ElectricalUserInputsConfig.AlternatorGearEfficiency) {
if (ElectricalUserInputsConfig.AlternatorGearEfficiency !=
other.ElectricalUserInputsConfig.AlternatorGearEfficiency) {
return false;
}
......@@ -77,18 +79,29 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries {
return false;
}
// ResultCardIdle
if (!ElectricalUserInputsConfig.ResultCardIdle.Equals(other.ElectricalUserInputsConfig.ResultCardIdle)) {
return false;
}
try {
// ResultCardIdle
if (ElectricalUserInputsConfig.ResultCardIdle.Entries
.ZipAll(other.ElectricalUserInputsConfig.ResultCardIdle.Entries, Tuple.Create).Any(
t => !t.Item1.Key.IsEqual(t.Item2.Key) || !t.Item1.Value.IsEqual(t.Item2.Value))) {
return false;
}
// ResultCardOverrun
if (!ElectricalUserInputsConfig.ResultCardOverrun.Equals(other.ElectricalUserInputsConfig.ResultCardOverrun)) {
return false;
}
// ResultCardOverrun
if (ElectricalUserInputsConfig.ResultCardOverrun.Entries
.ZipAll(other.ElectricalUserInputsConfig.ResultCardOverrun.Entries, Tuple.Create).Any(
t => !t.Item1.Key.IsEqual(t.Item2.Key) || !t.Item1.Value.IsEqual(t.Item2.Value))) {
return false;
}
// ResultCardTraction
if (!ElectricalUserInputsConfig.ResultCardTraction.Equals(other.ElectricalUserInputsConfig.ResultCardTraction)) {
// ResultCardTraction
if (ElectricalUserInputsConfig.ResultCardTraction.Entries
.ZipAll(other.ElectricalUserInputsConfig.ResultCardTraction.Entries, Tuple.Create).Any(
t => !t.Item1.Key.IsEqual(t.Item2.Key) || !t.Item1.Value.IsEqual(t.Item2.Value))) {
return false;
}
} catch (Exception) {
// zipall may throw an exeption...
return false;
}
......@@ -112,6 +125,7 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries {
if (PneumaticAuxillariesConfig.Braking != other.PneumaticAuxillariesConfig.Braking) {
return false;
}
//if (PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG !=
// other.PneumaticAuxillariesConfig.BrakingWithRetarderNIperKG) {
// return false;
......@@ -222,8 +236,5 @@ namespace TUGraz.VectoCore.Models.BusAuxiliaries {
{
return base.GetHashCode();
}
}
}
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