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

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

create aux component for constant aux demand

parent a084b46e
No related branches found
No related tags found
No related merge requests found
...@@ -36,6 +36,7 @@ using TUGraz.VectoCommon.Exceptions; ...@@ -36,6 +36,7 @@ using TUGraz.VectoCommon.Exceptions;
using TUGraz.VectoCommon.InputData; using TUGraz.VectoCommon.InputData;
using TUGraz.VectoCommon.Models; using TUGraz.VectoCommon.Models;
using TUGraz.VectoCommon.Utils; using TUGraz.VectoCommon.Utils;
using TUGraz.VectoCore.InputData.Reader.DataObjectAdaper;
using TUGraz.VectoCore.Models.Declaration; using TUGraz.VectoCore.Models.Declaration;
using TUGraz.VectoCore.Models.Simulation.Data; using TUGraz.VectoCore.Models.Simulation.Data;
using TUGraz.VectoCore.Models.SimulationComponent.Data; using TUGraz.VectoCore.Models.SimulationComponent.Data;
...@@ -44,7 +45,7 @@ using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox; ...@@ -44,7 +45,7 @@ using TUGraz.VectoCore.Models.SimulationComponent.Data.Gearbox;
using TUGraz.VectoCore.OutputData; using TUGraz.VectoCore.OutputData;
using DriverData = TUGraz.VectoCore.Models.SimulationComponent.Data.DriverData; using DriverData = TUGraz.VectoCore.Models.SimulationComponent.Data.DriverData;
namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdaper namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdapter
{ {
public class EngineeringDataAdapter : AbstractSimulationDataAdapter public class EngineeringDataAdapter : AbstractSimulationDataAdapter
{ {
...@@ -180,25 +181,45 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdaper ...@@ -180,25 +181,45 @@ namespace TUGraz.VectoCore.InputData.Reader.DataObjectAdaper
if (auxInputData.SavedInDeclarationMode) { if (auxInputData.SavedInDeclarationMode) {
WarnEngineeringMode("AuxData"); WarnEngineeringMode("AuxData");
} }
return auxInputData.Auxiliaries.Select(a => { return auxInputData.Auxiliaries.Select(a => {
if (a.DemandMap == null) { switch (a.AuxiliaryType) {
throw new VectoSimulationException("Demand Map for auxiliary {0} {1} required", a.ID, a.Technology); case AuxiliaryDemandType.Mapping:
} return CreateMappingAuxiliary(a);
if (a.DemandMap.Columns.Count != 3 || a.DemandMap.Rows.Count < 4) { case AuxiliaryDemandType.Constant:
throw new VectoSimulationException( return CreateConstantAuxiliary(a);
"Demand Map for auxiliary {0} {1} has to contain exactly 3 columns and at least 4 rows", a.ID, a.Technology); default:
throw new VectoException("Auxiliary type {0} not supported!", a.AuxiliaryType);
} }
return new VectoRunData.AuxData {
ID = a.ID,
Technology = a.Technology,
TechList = a.TechList.DefaultIfNull(Enumerable.Empty<string>()).ToArray(),
DemandType = AuxiliaryDemandType.Mapping,
Data = new AuxiliaryData(a, a.ID) //AuxiliaryData.Create(a.DemandMap)
};
}).Concat(new VectoRunData.AuxData { ID = "", DemandType = AuxiliaryDemandType.Direct }.ToEnumerable()).ToList(); }).Concat(new VectoRunData.AuxData { ID = "", DemandType = AuxiliaryDemandType.Direct }.ToEnumerable()).ToList();
} }
private static VectoRunData.AuxData CreateMappingAuxiliary(IAuxiliaryEngineeringInputData a)
{
if (a.DemandMap == null) {
throw new VectoSimulationException("Demand Map for auxiliary {0} {1} required", a.ID, a.Technology);
}
if (a.DemandMap.Columns.Count != 3 || a.DemandMap.Rows.Count < 4) {
throw new VectoSimulationException(
"Demand Map for auxiliary {0} {1} has to contain exactly 3 columns and at least 4 rows", a.ID, a.Technology);
}
return new VectoRunData.AuxData {
ID = a.ID,
Technology = a.Technology,
TechList = a.TechList.DefaultIfNull(Enumerable.Empty<string>()).ToArray(),
DemandType = AuxiliaryDemandType.Mapping,
Data = new AuxiliaryData(a, a.ID) //AuxiliaryData.Create(a.DemandMap)
};
}
private static VectoRunData.AuxData CreateConstantAuxiliary(IAuxiliaryEngineeringInputData a)
{
return new VectoRunData.AuxData {
ID = a.ID,
DemandType = AuxiliaryDemandType.Constant,
PowerDemand = a.ConstantPowerDemand
};
}
internal DriverData CreateDriverData(IDriverEngineeringInputData driver) internal DriverData CreateDriverData(IDriverEngineeringInputData driver)
{ {
if (driver.SavedInDeclarationMode) { if (driver.SavedInDeclarationMode) {
......
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