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

add type information to enum instantiation

parent ad93a38f
No related branches found
No related tags found
No related merge requests found
using System;
using System.Data;
using System.Reflection;
namespace TUGraz.VectoCore.Models.SimulationComponent.Data
{
......@@ -17,49 +18,69 @@ namespace TUGraz.VectoCore.Models.SimulationComponent.Data
/// </summary>
public enum ModalResult
{
time, // [s] Time step.
dist, // [km] Travelled distance.
v_act, // [km/h] Actual vehicle speed.
v_targ, // [km/h] Target vehicle speed.
acc, // [m/s2] Vehicle acceleration.
grad, // [%] Road gradient.
n, // [1/min] Engine speed.
Tq_eng, // [Nm] Engine torque.
Tq_clutch, // [Nm] Torque at clutch (before clutch, engine-side)
Tq_full, // [Nm] Full load torque
Tq_drag, // [Nm] Motoring torque
Pe_eng, // [kW] Engine power.
Pe_full, // [kW] Engine full load power.
Pe_drag, // [kW] Engine drag power.
Pe_clutch, // [kW] Engine power at clutch (equals Pe minus loss due to rotational inertia Pa Eng).
Gear, // [-] Gear. "0" = clutch opened / neutral. "0.5" = lock-up clutch is open (AT with torque converter only, see Gearbox)
PlossGB, // [kW] Gearbox losses.
PlossDiff, // [kW] Losses in differential / axle transmission.
PlossRetarder, // [kW] Retarder losses.
PaEng, // [kW] Rotational acceleration power: Engine.
PaGB, // [kW] Rotational acceleration power: Gearbox.
PaVeh, // [kW] Vehicle acceleration power.
Proll, // [kW] Rolling resistance power demand.
Pair, // [kW] Air resistance power demand.
Pgrad, // [kW] Power demand due to road gradient.
Paux, // [kW] Total auxiliary power demand .
Pwheel, // [kW] Total power demand at wheel = sum of rolling, air, acceleration and road gradient resistance.
Pbrake, // [kW] Brake power. Drag power is included in Pe.
Paux_xxx, // [kW] Power demand of Auxiliary with ID xxx. See also Aux Dialog and Driving Cycle.
FC, // [g/h] Fuel consumption from FC map..
FC_AUXc, // [g/h] Fuel consumption after Auxiliary-Start/Stop Correction. (Based on FC.)
FC_WHTCc, // [g/h] Fuel consumption after WHTC Correction. (Based on FC-AUXc.)
TCν, // [-] Torque converter speed ratio
TCmu, // [-] Torque converter torque ratio
TC_M_Out, // [Nm] Torque converter output torque
TC_n_Out, // [1/min] Torque converter output speed
[ModalResultFieldAttr(typeof(double))] time, // [s] Time step.
[ModalResultFieldAttr(typeof(double))] dist, // [km] Travelled distance.
[ModalResultFieldAttr(typeof(double))] v_act, // [km/h] Actual vehicle speed.
[ModalResultFieldAttr(typeof(double))] v_targ, // [km/h] Target vehicle speed.
[ModalResultFieldAttr(typeof(double))] acc, // [m/s2] Vehicle acceleration.
[ModalResultFieldAttr(typeof(double))] grad, // [%] Road gradient.
[ModalResultFieldAttr(typeof(double))] n, // [1/min] Engine speed.
[ModalResultFieldAttr(typeof(double))] Tq_eng, // [Nm] Engine torque.
[ModalResultFieldAttr(typeof(double))] Tq_clutch, // [Nm] Torque at clutch (before clutch, engine-side)
[ModalResultFieldAttr(typeof(double))] Tq_full, // [Nm] Full load torque
[ModalResultFieldAttr(typeof(double))] Tq_drag, // [Nm] Motoring torque
[ModalResultFieldAttr(typeof(double))] Pe_eng, // [kW] Engine power.
[ModalResultFieldAttr(typeof(double))] Pe_full, // [kW] Engine full load power.
[ModalResultFieldAttr(typeof(double))] Pe_drag, // [kW] Engine drag power.
[ModalResultFieldAttr(typeof(double))] Pe_clutch, // [kW] Engine power at clutch (equals Pe minus loss due to rotational inertia Pa Eng).
[ModalResultFieldAttr(typeof(double))] Gear, // [-] Gear. "0" = clutch opened / neutral. "0.5" = lock-up clutch is open (AT with torque converter only, see Gearbox)
[ModalResultFieldAttr(typeof(double))] PlossGB, // [kW] Gearbox losses.
[ModalResultFieldAttr(typeof(double))] PlossDiff, // [kW] Losses in differential / axle transmission.
[ModalResultFieldAttr(typeof(double))] PlossRetarder, // [kW] Retarder losses.
[ModalResultFieldAttr(typeof(double))] PaEng, // [kW] Rotational acceleration power: Engine.
[ModalResultFieldAttr(typeof(double))] PaGB, // [kW] Rotational acceleration power: Gearbox.
[ModalResultFieldAttr(typeof(double))] PaVeh, // [kW] Vehicle acceleration power.
[ModalResultFieldAttr(typeof(double))] Proll, // [kW] Rolling resistance power demand.
[ModalResultFieldAttr(typeof(double))] Pair, // [kW] Air resistance power demand.
[ModalResultFieldAttr(typeof(double))] Pgrad, // [kW] Power demand due to road gradient.
[ModalResultFieldAttr(typeof(double))] Paux, // [kW] Total auxiliary power demand .
[ModalResultFieldAttr(typeof(double))] Pwheel, // [kW] Total power demand at wheel = sum of rolling, air, acceleration and road gradient resistance.
[ModalResultFieldAttr(typeof(double))] Pbrake, // [kW] Brake power. Drag power is included in Pe.
[ModalResultFieldAttr(typeof(double))] Paux_xxx, // [kW] Power demand of Auxiliary with ID xxx. See also Aux Dialog and Driving Cycle.
[ModalResultFieldAttr(typeof(double))] FC, // [g/h] Fuel consumption from FC map..
[ModalResultFieldAttr(typeof(double))] FC_AUXc, // [g/h] Fuel consumption after Auxiliary-Start/Stop Correction. (Based on FC.)
[ModalResultFieldAttr(typeof(double))] FC_WHTCc, // [g/h] Fuel consumption after WHTC Correction. (Based on FC-AUXc.)
[ModalResultFieldAttr(typeof(double))] TCν, // [-] Torque converter speed ratio
[ModalResultFieldAttr(typeof(double))] TCmu, // [-] Torque converter torque ratio
[ModalResultFieldAttr(typeof(double))] TC_M_Out, // [Nm] Torque converter output torque
[ModalResultFieldAttr(typeof(double))] TC_n_Out, // [1/min] Torque converter output speed
}
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false, Inherited = true)]
class ModalResultFieldAttr : Attribute
{
internal ModalResultFieldAttr(Type fieldType)
{
this.FieldType = fieldType;
}
public Type FieldType { get; private set; }
}
public static class ModalResultFieldExtensions
{
public static Type GetDataType(this ModalResult field)
{
return typeof(double);
}
private static ModalResultFieldAttr GetAttr(ModalResult field)
{
return (ModalResultFieldAttr)Attribute.GetCustomAttribute(ForValue(field), typeof (ModalResultFieldAttr));
}
private static MemberInfo ForValue(ModalResult field)
{
return typeof (ModalResult).GetField(Enum.GetName(typeof (ModalResult), field));
}
}
}
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