NeTrainSim 0.1.1 beta
The Open-Source Network Trains Simulator
 
Loading...
Searching...
No Matches
traincomponent.h
Go to the documentation of this file.
1//
2// Created by Ahmed Aredah
3// Version 0.1.
4//
5
6#ifndef NeTrainSim_TrainComponent_h
7#define NeTrainSim_TrainComponent_h
8
9#include <string>
10#include <iostream>
11#include "../network/netlink.h"
12#include "battery.h"
13#include "tank.h"
14#include "energyconsumption.h"
15#include <memory>
16using namespace std;
17
24class TrainComponent : public Battery, public Tank{
25public:
26
27 /***********************************************
28 * variables declaration *
29 ************************************************/
31 std::string name;
33 double length;
37 double trackGrade;
39 double dragCoef;
50
52 double energyConsumed = 0.0;
54 double cumEnergyConsumed = 0.0;
56 double energyRegenerated = 0.0;
59
61 std::shared_ptr<NetLink> hostLink;
62
63
64 /***********************************************
65 * Methods *
66 ************************************************/
67 // no need for a constructor or deconstractor
68
69
89 virtual double getResistance(double trainSpeed);
90
97 virtual void resetTimeStepConsumptions();
98
99
108 virtual void setCurrentWeight(double newCurrentWeight);
109
121 virtual std::pair<bool, double> consumeFuelDiesel(double EC_kwh,
122 double dieselConversionFactor,
123 double dieselDensity);
124
136 virtual std::pair<bool, double> consumeFuelBioDiesel(double EC_kwh,
137 double bioDieselConversionFactor,
138 double bioDieselDensity);
139
162 virtual std::pair<bool, double> consumeElectricity(double timeStep, double EC_kwh);
163
174 virtual std::pair<bool, double> consumeFuelHydrogen(double EC_kwh,
175 double hydrogenConversionFactor,
176 double hydrogenDensity);
187 virtual double refillBattery(double timeStep, double EC_kwh);
188
198 virtual bool rechargeCatenary(double EC_kwh);
199
200
246 virtual std::pair<bool,double> consumeFuel(double timeStep, double trainSpeed,
247 double EC_kwh,
248 double LocomotiveVirtualTractivePower = std::numeric_limits<double>::quiet_NaN(),
249 double dieselConversionFactor = EC::DefaultDieselConversionFactor,
250 double biodieselConversionFactor = EC::DefaultBiodieselConversionFactor,
251 double hydrogenConversionFactor = EC::DefaultHydrogenConversionFactor,
252 double dieselDensity = EC::DefaultDieselDensity,
253 double biodieselDensity = EC::DefaultBioDieselDensity,
254 double hydrogenDensity = EC::DefaultHydrogenDensity);
255
267 friend ostream& operator<<(ostream& ostr, TrainComponent& stud);
268
269private:
270};
271
275#endif // !NeTrainSim_TrainComponent_h
This file declares the Battery class.
Definition battery.h:21
Definition tank.h:19
Defines a train component base class.
Definition traincomponent.h:24
virtual std::pair< bool, double > consumeFuelHydrogen(double EC_kwh, double hydrogenConversionFactor, double hydrogenDensity)
consume the locomotive hydrogen fuel.
Definition traincomponent.cpp:108
virtual std::pair< bool, double > consumeFuel(double timeStep, double trainSpeed, double EC_kwh, double LocomotiveVirtualTractivePower=std::numeric_limits< double >::quiet_NaN(), double dieselConversionFactor=EC::DefaultDieselConversionFactor, double biodieselConversionFactor=EC::DefaultBiodieselConversionFactor, double hydrogenConversionFactor=EC::DefaultHydrogenConversionFactor, double dieselDensity=EC::DefaultDieselDensity, double biodieselDensity=EC::DefaultBioDieselDensity, double hydrogenDensity=EC::DefaultHydrogenDensity)
Consume fuel or battery from the vehicle.
Definition traincomponent.cpp:26
virtual std::pair< bool, double > consumeElectricity(double timeStep, double EC_kwh)
consume any source of electricity in the locomotive; either the catenary or the batteries.
Definition traincomponent.cpp:76
double energyConsumed
The amount of energy consumed in kwh.
Definition traincomponent.h:52
double length
Length of the vehicle in meter.
Definition traincomponent.h:33
std::shared_ptr< NetLink > hostLink
Holds the current link this vehicle is on.
Definition traincomponent.h:61
double trackCurvature
The current curvature the vehicle is experiencing.
Definition traincomponent.h:35
virtual std::pair< bool, double > consumeFuelBioDiesel(double EC_kwh, double bioDieselConversionFactor, double bioDieselDensity)
consume the locomotive bio diesel fuel.
Definition traincomponent.cpp:58
double currentWeight
The gross weight of the vehicle when the train is travelling.
Definition traincomponent.h:43
double energyRegenerated
The amount of energy regenerated in kwh.
Definition traincomponent.h:56
virtual double refillBattery(double timeStep, double EC_kwh)
refill the locomtoive battery
Definition traincomponent.cpp:127
virtual double getResistance(double trainSpeed)
Gets the resistance applied on only this vehicle.
Definition traincomponent.cpp:5
friend ostream & operator<<(ostream &ostr, TrainComponent &stud)
Stream insertion operator.
Definition traincomponent.cpp:152
double frontalArea
The total frontal area of the vehicle for the aerodynamics resistance.
Definition traincomponent.h:41
virtual void resetTimeStepConsumptions()
Resets the energy consumptions data for the current time step.
Definition traincomponent.cpp:9
double trackGrade
The current grade the vehicle is experiencing.
Definition traincomponent.h:37
virtual void setCurrentWeight(double newCurrentWeight)
sets the current weight of the vehicle
Definition traincomponent.cpp:17
int noOfAxiles
The number of axiles the car has.
Definition traincomponent.h:47
double dragCoef
The air drag factor for aerodynamics resistance.
Definition traincomponent.h:39
virtual bool rechargeCatenary(double EC_kwh)
Rechage catenary and grid system if they are available.
Definition traincomponent.cpp:138
double cumEnergyRegenerated
The amount of cummulative energy regenerated in kwh.
Definition traincomponent.h:58
std::string name
The name of the vehicle.
Definition traincomponent.h:31
double emptyWeight
The light weight of the vehicle when the train is travelling.
Definition traincomponent.h:45
double auxiliaryPower
Auxiliary power.
Definition traincomponent.h:49
virtual std::pair< bool, double > consumeFuelDiesel(double EC_kwh, double dieselConversionFactor, double dieselDensity)
consume the locomotive diesel fuel.
Definition traincomponent.cpp:40
double cumEnergyConsumed
The amount of cummulative energy consumed in kwh.
Definition traincomponent.h:54
This file declares the Tank class.