mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-20 23:14:59 +01:00
Merge remote-tracking branch 'origin/master' into feat/mains-before-pantographs
This commit is contained in:
@@ -18,6 +18,7 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "world/mtable.h"
|
||||
#include "utilities/translation.h"
|
||||
#include "application/driverhints.h"
|
||||
#include "vehicle/blackbox.h"
|
||||
|
||||
auto const EU07_AI_ACCELERATION = 0.05;
|
||||
auto const EU07_AI_NOACCELERATION = -0.05;
|
||||
@@ -145,7 +146,10 @@ enum TSpeedPosFlag
|
||||
spSemaphor = 0x4000, // semafor pociągowy
|
||||
spRoadVel = 0x8000, // zadanie prędkości drogowej
|
||||
spSectionVel = 0x20000, // odcinek z ograniczeniem
|
||||
spProximityVelocity = 0x40000 // odcinek z ograniczeniem i podaną jego długościa
|
||||
spProximityVelocity = 0x40000, // odcinek z ograniczeniem i podaną jego długościa
|
||||
spPointVelocity = 0x80000, // ograniczenie dla czoła w punkcie fPointDist za wpisem (PointVelocity)
|
||||
spRoadVelHeld = 0x100000, // a road speed sign passed by the head, handled, kept until the rear is past it
|
||||
spSignalAreaEnd = 0x200000 // end of the interlocking area of the signal passed last
|
||||
// spDontApplySpeedLimit = 0x10000 // this point won't apply its speed limit. potentially set by the scanning vehicle
|
||||
};
|
||||
|
||||
@@ -155,6 +159,7 @@ class TSpeedPos
|
||||
double fDist{ 0.0 }; // aktualna odległość (ujemna gdy minięte)
|
||||
double fVelNext{ -1.0 }; // prędkość obowiązująca od tego miejsca
|
||||
double fSectionVelocityDist{ 0.0 }; // długość ograniczenia prędkości
|
||||
double fPointDist{ 0.0 }; // PointVelocity: o ile dalej od wpisu leży punkt, w którym czoło ma mieć fVelNext
|
||||
int iFlags{ spNone }; // flagi typu wpisu do tabelki
|
||||
bool bMoved{ false }; // czy przesunięty (dotyczy punktu zatrzymania w peronie)
|
||||
double fMoved{ 0.0 }; // ile przesunięty (dotyczy punktu zatrzymania w peronie)
|
||||
@@ -267,7 +272,18 @@ public:
|
||||
return mvControlling->EngineType == TEngineType::DieselElectric || mvControlling->EngineType == TEngineType::DieselEngine;
|
||||
}
|
||||
TBrakeSystem consist_brake_system() const;
|
||||
// the next change of the speed limit ahead, as the driving aid tells it: the speed and the distance to it.
|
||||
// the speed is the present limit (VelDesired) when nothing worth telling changes within the scan range
|
||||
std::pair<int, double> next_speed_limit() const;
|
||||
// what the AI would do at this place and speed, worked out also while a human drives, for the black box
|
||||
blackbox::ai_reference ai_reference() const;
|
||||
// the light pattern the timetable or the scenery asks for at an end of the train, -1 the usual one
|
||||
int light_hint( int const End ) const { return m_lighthints[ End ]; }
|
||||
// the order the driver goes by now: a train run, shunting and the like
|
||||
TOrders order_current() const { return OrderCurrentGet(); }
|
||||
private:
|
||||
// tells the black box of the train at the station of its timetable it makes for, at the stop point given
|
||||
void record_station( TSpeedPos const &Point, std::uint8_t Kind ) const;
|
||||
void Activation(); // umieszczenie obsady w odpowiednim członie
|
||||
void ControllingSet(); // znajduje człon do sterowania
|
||||
void SetDriverPsyche();
|
||||
@@ -434,6 +450,7 @@ private:
|
||||
double ActualProximityDist = 1.0; // odległość brana pod uwagę przy wyliczaniu prędkości i przyspieszenia
|
||||
std::pair<double, double> VelLimitLastDist { 0.0, 0.0 }; // distance to velocity change point
|
||||
double SwitchClearDist { 0.0 }; // distance to point after farthest detected switch
|
||||
double SignalAreaEndDist { -1.0 }; // distance the train has to go to be past the nearest end of an interlocking area, -1 when none is in the scan
|
||||
int iDirection = 0; // kierunek jazdy względem sprzęgów pojazdu, w którym siedzi AI (1=przód,-1=tył)
|
||||
int iDirectionOrder = 0; //żadany kierunek jazdy (służy do zmiany kierunku)
|
||||
std::optional<int> iDirectionBackup; // consist direction to be restored after coupling/uncoupling and similar direction-changing operations
|
||||
@@ -548,11 +565,30 @@ private:
|
||||
void TableTraceRoute( double fDistance, TDynamicObject *pVehicle );
|
||||
void TableCheck( double fDistance );
|
||||
// called after TSpeedPos::Update() of a position of the speed table, with its spElapsed flag from before it:
|
||||
// reports the head of the train going past it, if it's a signal showing stop
|
||||
void CheckSignalPassedAtDanger( TSpeedPos const &Point, bool Passedbefore ) const;
|
||||
// reports the head of the train going past it, if it's a signal: to the black box, and to the test mode if it showed stop
|
||||
void CheckSignalPassed( TSpeedPos const &Point, bool Passedbefore ) const;
|
||||
TCommandType TableUpdate( double &fVelDes, double &fDist, double &fNext, double &fAcc );
|
||||
bool TableUpdateStopPoint( TCommandType &Command, TSpeedPos &Point, double const Signaldistance );
|
||||
bool TableUpdateEvent( double &Velocity, TCommandType &Command, TSpeedPos &Point, double &Signaldistance, int const Pointindex );
|
||||
bool TableUpdateRoadVelocity( TSpeedPos &Point );
|
||||
double held_road_velocity_beyond( TSpeedPos const &Point ) const;
|
||||
bool is_road_velocity_held( TSpeedPos const &Point ) const;
|
||||
void TableDropPassedEvent( TSpeedPos &Point ) const;
|
||||
void TableUpdateSignalAreaEnd( TSpeedPos &Point );
|
||||
// keeps the PointVelocity limit of a speed table entry whose cell the head has just passed
|
||||
void latch_point_limit( TSpeedPos const &Point );
|
||||
// moves the latched point limits by the movement of the consist, drops those passed and those read anew
|
||||
void update_point_limits();
|
||||
// the latched point limits ahead in the direction of travel, taken as the points of the speed table are
|
||||
void apply_point_limits( double &Velocity, double &Distance, double &Next, double &Acceleration );
|
||||
// the way the consist runs, along the track under the vehicle whose movement is measured; zero when it isn't known
|
||||
glm::dvec3 travel_direction() const;
|
||||
// how far the end of the consist lying the farthest along the heading is ahead of the measured vehicle
|
||||
double point_limit_end( glm::dvec3 const &Heading ) const;
|
||||
// whether the state of the cell is latched already
|
||||
bool point_limit_latched( basic_event const *Cell ) const;
|
||||
// how far before a point limit the speed is held down to it
|
||||
double point_limit_approach() const;
|
||||
// returns most recently calculated distance to potential obstacle ahead
|
||||
double TrackObstacle() const;
|
||||
void TablePurger();
|
||||
@@ -587,6 +623,23 @@ private:
|
||||
std::size_t SemNextIndex{ npos };
|
||||
std::size_t SemNextStopIndex{ npos };
|
||||
double dMoveLen = 0.0; // odległość przejechana od ostatniego sprawdzenia tabelki
|
||||
// a PointVelocity limit latched when the head passed its cell. kept apart from the speed table, which is built
|
||||
// anew on a change of direction, a change of the consist or a takeover, and measured by the movement in the world,
|
||||
// so stopping, backing up and going on between the cell and the point keeps it
|
||||
struct point_limit {
|
||||
basic_event const *source { nullptr }; // the cell, as the head passed it
|
||||
double velocity { -1.0 }; // what the cell said then
|
||||
double distance { 0.0 }; // left for the head to the point, along the line
|
||||
double celldistance { 0.0 }; // from the cell to the point; the head farther than that from the point is behind the cell
|
||||
glm::dvec3 heading { 0.0 }; // the way towards the point, in the world
|
||||
double end { 0.0 }; // point_limit_end() at the last update, to follow vehicles coupled or uncoupled at that end
|
||||
bool endknown { false };
|
||||
};
|
||||
std::vector<point_limit> m_pointlimits;
|
||||
TDynamicObject const *m_pointlimitsvehicle { nullptr }; // the vehicle whose movement moves the points
|
||||
glm::dvec3 m_pointlimitsposition { 0.0 }; // where it was at the last update
|
||||
TDynamicObject const *m_pointlimitsends[ 2 ] { nullptr, nullptr }; // the end vehicles of the consist at the last update
|
||||
double m_pointlimitslength { 0.0 }; // and its length
|
||||
basic_event *eSignNext = nullptr; // sygnał zmieniający prędkość, do pokazania na [F2]
|
||||
neighbour_data Obstacle; // nearest vehicle detected ahead on current route
|
||||
|
||||
@@ -630,6 +683,8 @@ private:
|
||||
bool doors_open() const;
|
||||
bool doors_permit_active() const;
|
||||
void AutoRewident(); // ustawia hamulce w składzie
|
||||
void reinspect_brakes(); // AutoRewident() again once the train stands, when it left a brake to cut out on the run
|
||||
bool BrakeReinspectionPending{ false }; // AutoRewident() left a brake to cut out (Cw-1 §19.9) for the next standstill
|
||||
void announce( announcement_t const Announcement );
|
||||
// members
|
||||
double fLength = 0.0; // długość składu (do wyciągania z ograniczeń)
|
||||
|
||||
Reference in New Issue
Block a user