NeTrainSim 0.1.1 beta
The Open-Source Network Trains Simulator
 
Loading...
Searching...
No Matches
car.h
Go to the documentation of this file.
1
7#ifndef CAR_H
8#define CAR_H
9
10#include <string>
11#include <iostream>
12#include "traintypes.h"
13#include "energyconsumption.h"
14#include "traincomponent.h"
15#include <memory>
16
29class Car : public TrainComponent {
30 /***********************************************
31 * Variables Declaration *
32 ************************************************/
33
34private:
36 inline static const std::string DefaultCarName = "Railcar";
37
38public:
41
42public:
60 Car(double carLength_m, double carDragCoef, double carFrontalArea_sqm,
61 double carEmptyWeight_t, double carCurrentWeight_t, int carNoOfAxles,
62 int carType, double auxiliaryPower_kw = EC::DefaultCarAuxiliaryPower,
63 double batteryMaxCapacity_kWh = EC::DefaultCarBatteryMaxCapacity,
64 double batteryInitialCharge_perc = EC::DefaultCarBatteryInitialCharge,
65 double tenderMaxCapacity_kg_l = EC::DefaultCarTenderMaxCapacity,
66 double tenderInitialCapacity_perc = EC::DefaultCarTenderInitialCapacity,
67 std::string carName = DefaultCarName);
68
74 double getCargoNetWeight();
75
81 void setCarCurrentWeight(double newCurrentWeight);
82
89 double getResistance(double trainSpeed) override;
90
97 double getEnergyConsumption(double& timeStep);
98
114 std::pair<bool, double> consumeFuel(double timeStep, double trainSpeed, double EC_kwh,
115 double carVirtualTractivePower = std::numeric_limits<double>::quiet_NaN(),
116 double dieselConversionFactor = EC::DefaultDieselConversionFactor,
117 double biodieselConversionFactor = EC::DefaultBiodieselConversionFactor,
118 double hydrogenConversionFactor = EC::DefaultHydrogenConversionFactor,
119 double dieselDensity = EC::DefaultDieselDensity,
120 double biodieselDensity = EC::DefaultBioDieselDensity,
121 double hydrogenDensity = EC::DefaultHydrogenDensity) override;
122
129 double getMaxProvidedEnergy(double& timeStep);
130
138 bool canProvideEnergy(double& EC, double& timeStep);
139
147 friend std::ostream& operator<<(std::ostream& ostr, Car& stud);
148};
149
150#endif // CAR_H
A rail car.
Definition car.h:29
void setCarCurrentWeight(double newCurrentWeight)
Sets the car's current weight.
Definition car.cpp:74
std::pair< bool, double > consumeFuel(double timeStep, double trainSpeed, double EC_kwh, double carVirtualTractivePower=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) override
Consumes fuel from the tender.
Definition car.cpp:113
double getResistance(double trainSpeed) override
Gets the resistance contributed by this car to the whole train.
Definition car.cpp:92
TrainTypes::CarType carType
The type of the car.
Definition car.h:40
double getCargoNetWeight()
Gets the cargo net weight.
Definition car.cpp:81
double getEnergyConsumption(double &timeStep)
Gets the energy consumption of the car (in case there is auxiliary power).
Definition car.cpp:107
double getMaxProvidedEnergy(double &timeStep)
Gets the maximum energy provided by the car.
Definition car.cpp:146
bool canProvideEnergy(double &EC, double &timeStep)
Checks if the car can provide energy.
Definition car.cpp:161
friend std::ostream & operator<<(std::ostream &ostr, Car &stud)
Stream insertion operator.
Defines a train component base class.
Definition traincomponent.h:24
Definition energyconsumption.cpp:6
_CarType
Values that represent car types.
Definition traintypes.h:23