NeTrainSim 0.1.1 beta
The Open-Source Network Trains Simulator
 
Loading...
Searching...
No Matches
Tank Class Reference

#include <tank.h>

Inheritance diagram for Tank:
TrainComponent Car Locomotive

Public Member Functions

void SetTank (double maxCapacity, double initialCapacityPercentage, double depthOfDischarge)
 Set the main properties of the tank (initialize the tank)
 
double getTankMaxCapacity () const
 Gets the maximum capacity of the tank.
 
void setTankMaxCapacity (double newMaxCapacity)
 Sets the maximum capacity of the tank.
 
double getTankInitialCapacity () const
 Gets the initial capacity of the tank.
 
void setTankInitialCapacity (double newInitialCapacityPercentage)
 Sets the initial capacity of the tank.
 
double getTankCurrentCapacity () const
 Gets the current capacity of the tank.
 
double consumeTank (double consumedAmount)
 Consumes fuel from the tank.
 
double getTankStateOfCapacity () const
 Gets the state of capacity of the tank.
 
bool isTankDrainable (double consumedAmount)
 Checks if the specified amount of fuel is drainable from the tank.
 
double getTankDOD () const
 Gets the depth of discharge of the tank.
 
void setTankDOD (double newTankDOD)
 Sets the depth of discharge of the tank.
 
bool tankHasFuel ()
 Checks if the tank has fuel (current capacity > 0)
 
double getTankCumConsumedFuel () const
 Gets the total amount of fuel consumed from the tank.
 

Member Function Documentation

◆ consumeTank()

double Tank::consumeTank ( double  consumedAmount)

Consumes fuel from the tank.

Parameters
consumedAmountThe amount of fuel to consume from the tank in liters.
Returns
The actual amount of fuel consumed from the tank in liters.

◆ getTankCumConsumedFuel()

double Tank::getTankCumConsumedFuel ( ) const

Gets the total amount of fuel consumed from the tank.

Returns
The cumulative consumed fuel from the tank in liters.

◆ getTankCurrentCapacity()

double Tank::getTankCurrentCapacity ( ) const

Gets the current capacity of the tank.

Returns
The tank's current capacity in liters.

◆ getTankDOD()

double Tank::getTankDOD ( ) const

Gets the depth of discharge of the tank.

Returns
The tank's depth of discharge.

◆ getTankInitialCapacity()

double Tank::getTankInitialCapacity ( ) const

Gets the initial capacity of the tank.

Returns
The tank's initial capacity in liters.

◆ getTankMaxCapacity()

double Tank::getTankMaxCapacity ( ) const

Gets the maximum capacity of the tank.

Returns
The tank's maximum capacity in liters.

◆ getTankStateOfCapacity()

double Tank::getTankStateOfCapacity ( ) const

Gets the state of capacity of the tank.

Returns
The tank's state of capacity.

◆ isTankDrainable()

bool Tank::isTankDrainable ( double  consumedAmount)

Checks if the specified amount of fuel is drainable from the tank.

Parameters
consumedAmountThe amount of fuel to be drained from the tank in liters.
Returns
True if the tank is drainable (has enough fuel), false otherwise.

◆ SetTank()

void Tank::SetTank ( double  maxCapacity,
double  initialCapacityPercentage,
double  depthOfDischarge 
)

Set the main properties of the tank (initialize the tank)

Parameters
maxCapacityThe maximum capacity the tank can hold in liters
initialCapacityPercentageThe initial capacity percentage that the tank holds once the train is loaded onto the network.
depthOfDischargeThe allowable depth of discharge, the tank can drain to.

◆ setTankDOD()

void Tank::setTankDOD ( double  newTankDOD)

Sets the depth of discharge of the tank.

Parameters
newTankDODThe new depth of discharge of the tank.

◆ setTankInitialCapacity()

void Tank::setTankInitialCapacity ( double  newInitialCapacityPercentage)

Sets the initial capacity of the tank.

Parameters
newInitialCapacityPercentageThe new initial capacity percentage of the tank.

◆ setTankMaxCapacity()

void Tank::setTankMaxCapacity ( double  newMaxCapacity)

Sets the maximum capacity of the tank.

Parameters
newMaxCapacityThe new maximum capacity of the tank in liters.

◆ tankHasFuel()

bool Tank::tankHasFuel ( )

Checks if the tank has fuel (current capacity > 0)

Returns
True if the tank has fuel, false otherwise.