18#ifndef NeTrainSim_NetLink_h
19#define NeTrainSim_NetLink_h
24#include "../util/vector.h"
38 static unsigned int NumberOfLinksInSimulator;
80 NetLink(
int simulatorID,
int linkID, std::shared_ptr<NetNode> fromNode,
81 std::shared_ptr<NetNode> toNode,
double maxSpeed,
82 int trafficSignalID,
string signalAtEnd,
double linkGrade,
83 double linkCurvature,
int linkNoOfDirections,
84 double speedVariationfactor,
bool isCatenaryAvailable,
85 string linkInRegion,
double maxSpeedScale);
130 std::pair<std::pair<double, double>, std::pair<double, double>>
vectorizeLinkOfOneSegment(std::shared_ptr <NetNode> startNode);
132 pair<double, double>
findPositionOnLink(
double travelledLength, std::shared_ptr<NetNode> startNode);
158 std::pair<double, double> getPositionOnVector(std::pair<std::pair<double, double>, std::pair<double, double>>vector,
159 double travelledDistanceOnXAxis);
191 std::pair<double, double> projectLengthonPathVector(std::pair<double, double>& vectorEndpoints,
double length);
The NetLink class represents a network link in a simulation.
Definition netlink.h:36
bool hasCatenary
Indicates whether the link has catenary.
Definition netlink.h:57
double curvature
The curvature of the link.
Definition netlink.h:50
double catenaryCumConsumedEnergy
The amount of energy consumed by all trains on the network.
Definition netlink.h:59
double getCost()
Gets the cost associated with the link.
Definition netlink.cpp:85
std::shared_ptr< NetNode > fromLoc
The starting node of the link.
Definition netlink.h:43
double linksScaleFreeSpeed
The free speed scale of the links.
Definition netlink.h:54
std::string region
The region in which the link is located.
Definition netlink.h:53
double freeFlowSpeed
The free flow speed of the link.
Definition netlink.h:47
Vector< std::shared_ptr< NetNode > > intermediatePoints
Definition netlink.h:45
void updateLinksScaleFreeSpeed(double newScale)
Updates the links scale free speed.
Definition netlink.cpp:72
map< int, double > setGrade(double grade)
Sets the grade of the link.
Definition netlink.cpp:78
Vector< int > trafficSignalAtEnd
Definition netlink.h:60
std::shared_ptr< NetNode > toLoc
The end node of the link.
Definition netlink.h:44
double length
This extends the line link to a polyline link.
Definition netlink.h:46
pair< double, double > findPositionOnLink(double travelledLength, std::shared_ptr< NetNode > startNode)
Definition netlink.cpp:129
double speedVariation
The speed variation of the link.
Definition netlink.h:52
Vector< std::shared_ptr< Train > > currentTrains
A vector of pointers to trains currently on this link.
Definition netlink.h:55
double catenaryCumRegeneratedEnergy
The amount of energy regenerated by all trains on the network.
Definition netlink.h:58
void setLinkSimulatorID(int newID)
Sets the simulator identifier of the link.
Definition netlink.cpp:62
int userID
The user identifier of the link.
Definition netlink.h:42
int id
The identifier of the link.
Definition netlink.h:41
~NetLink()
Destructor.
Definition netlink.cpp:58
int direction
The direction of the link.
Definition netlink.h:51
double cost
The cost associated with this link.
Definition netlink.h:56
map< int, double > grade
The grade of the link.
Definition netlink.h:49
std::pair< std::pair< double, double >, std::pair< double, double > > vectorizeLinkOfOneSegment(std::shared_ptr< NetNode > startNode)
Creates a vector representation of a link with respect to a given start node.
Definition netlink.cpp:275
static unsigned int getNumberOfLinks()
Gets the number of links in the simulator.
Definition netlink.cpp:67
int trafficSignalNo
The traffic network signal number of the link.
Definition netlink.h:48
The NetNode class represents a network node in a simulation.
Definition netnode.h:35
A train.
Definition train.h:42
A vector.
Definition vector.h:24
ostream & operator<<(ostream &ostr, const NetLink &link)
Overloaded ostream operator for printing the NetLink object.
Definition netlink.cpp:327