mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-18 19:19:19 +02:00
Rework of speed control algorithm for DieselEngine - functions for PESA-DMU
This commit is contained in:
committed by
tmj-fstate
parent
936e537a7a
commit
e43ea7fcfe
67
Driver.cpp
67
Driver.cpp
@@ -3170,10 +3170,24 @@ bool TController::IncSpeed()
|
|||||||
{ // dla 2Ls150 można zmienić tryb pracy, jeśli jest w liniowym i nie daje rady (wymaga zerowania kierunku)
|
{ // dla 2Ls150 można zmienić tryb pracy, jeśli jest w liniowym i nie daje rady (wymaga zerowania kierunku)
|
||||||
// mvControlling->ShuntMode=(OrderList[OrderPos]&Shunt)||(fMass>224000.0);
|
// mvControlling->ShuntMode=(OrderList[OrderPos]&Shunt)||(fMass>224000.0);
|
||||||
}
|
}
|
||||||
|
if ((mvControlling->SpeedCtrl)&&(mvControlling->Mains)) {// cruise control
|
||||||
|
auto const SpeedCntrlVel{ (
|
||||||
|
(ActualProximityDist > std::max(50.0, fMaxProximityDist)) ?
|
||||||
|
VelDesired :
|
||||||
|
min_speed(VelDesired, VelNext)) };
|
||||||
|
if (SpeedCntrlVel >= mvControlling->SpeedCtrlUnit.MinVelocity) {
|
||||||
|
SpeedCntrl(SpeedCntrlVel);
|
||||||
|
}
|
||||||
|
else if (SpeedCntrlVel > 0.1) {
|
||||||
|
SpeedCntrl(0.0);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (mvControlling->EIMCtrlType > 0) {
|
if (mvControlling->EIMCtrlType > 0) {
|
||||||
if (true == Ready)
|
if (true == Ready)
|
||||||
{
|
{
|
||||||
DizelPercentage = (mvControlling->Vel > mvControlling->dizel_minVelfullengage ? 100 : 1);
|
bool max = (mvControlling->Vel > mvControlling->dizel_minVelfullengage)
|
||||||
|
|| (mvControlling->SpeedCtrl && mvControlling->ScndCtrlPos > 0);
|
||||||
|
DizelPercentage = (max ? 100 : 1);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -3188,11 +3202,12 @@ bool TController::IncSpeed()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if( false == mvControlling->Mains ) {
|
if( false == mvControlling->Mains ) {
|
||||||
|
SpeedCntrl(0.0);
|
||||||
mvControlling->MainSwitch( true );
|
mvControlling->MainSwitch( true );
|
||||||
mvControlling->ConverterSwitch( true );
|
mvControlling->ConverterSwitch( true );
|
||||||
mvControlling->CompressorSwitch( true );
|
mvControlling->CompressorSwitch( true );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
}
|
}
|
||||||
@@ -3243,6 +3258,14 @@ bool TController::DecSpeed(bool force)
|
|||||||
if (mvControlling->EIMCtrlType > 0)
|
if (mvControlling->EIMCtrlType > 0)
|
||||||
{
|
{
|
||||||
DizelPercentage = 0;
|
DizelPercentage = 0;
|
||||||
|
if (force) {
|
||||||
|
SpeedCntrl(0.0); //wylacz od razu tempomat
|
||||||
|
mvControlling->DecScndCtrl(2);
|
||||||
|
}
|
||||||
|
if ((VelDesired > 0.1) && (mvControlling->SpeedCtrlUnit.MinVelocity > VelDesired)) {
|
||||||
|
SpeedCntrl(0.0); //wylacz od razu tempomat
|
||||||
|
mvControlling->DecScndCtrl(2);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -3257,8 +3280,11 @@ bool TController::DecSpeed(bool force)
|
|||||||
OK = mvControlling->DecMainCtrl( 1 );
|
OK = mvControlling->DecMainCtrl( 1 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (force) // przy aktywacji kabiny jest potrzeba natychmiastowego wyzerowania
|
if (force) { // przy aktywacji kabiny jest potrzeba natychmiastowego wyzerowania
|
||||||
OK = mvControlling->DecMainCtrl((mvControlling->MainCtrlPowerPos() > 2 ? 2 : 1));
|
OK = mvControlling->DecMainCtrl((mvControlling->MainCtrlPowerPos() > 2 ? 2 : 1));
|
||||||
|
SpeedCntrl(0.0); //wylacz od razu tempomat
|
||||||
|
mvControlling->DecScndCtrl( 2 );
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return OK;
|
return OK;
|
||||||
@@ -3495,6 +3521,22 @@ void TController::SpeedSet()
|
|||||||
|
|
||||||
void TController::SpeedCntrl(double DesiredSpeed)
|
void TController::SpeedCntrl(double DesiredSpeed)
|
||||||
{
|
{
|
||||||
|
while (mvControlling->SpeedCtrlUnit.DesiredPower < mvControlling->SpeedCtrlUnit.MaxPower)
|
||||||
|
{
|
||||||
|
mvControlling->SpeedCtrlPowerInc();
|
||||||
|
}
|
||||||
|
if (mvControlling->EngineType == TEngineType::DieselEngine)
|
||||||
|
{
|
||||||
|
if (DesiredSpeed < 0.1) {
|
||||||
|
mvControlling->DecScndCtrl(2);
|
||||||
|
DesiredSpeed = 0;
|
||||||
|
}
|
||||||
|
else if (mvControlling->ScndCtrlPos < 1) {
|
||||||
|
mvControlling->IncScndCtrl(1);
|
||||||
|
}
|
||||||
|
mvControlling->RunCommand("SpeedCntrl", DesiredSpeed, mvControlling->CabNo);
|
||||||
|
}
|
||||||
|
else
|
||||||
if (mvControlling->ScndCtrlPosNo == 1)
|
if (mvControlling->ScndCtrlPosNo == 1)
|
||||||
{
|
{
|
||||||
mvControlling->IncScndCtrl(1);
|
mvControlling->IncScndCtrl(1);
|
||||||
@@ -3580,7 +3622,12 @@ void TController::SetTimeControllers()
|
|||||||
|
|
||||||
DizelPercentage_Speed = DizelPercentage; //wstepnie procenty
|
DizelPercentage_Speed = DizelPercentage; //wstepnie procenty
|
||||||
auto MinVel{ std::min(mvControlling->hydro_TC_LockupSpeed, mvControlling->Vmax / 6) }; //minimal velocity
|
auto MinVel{ std::min(mvControlling->hydro_TC_LockupSpeed, mvControlling->Vmax / 6) }; //minimal velocity
|
||||||
if (VelDesired > MinVel) //more power for faster ride
|
//when speed controll unit is active - start with the procedure
|
||||||
|
if ((mvControlling->SpeedCtrl) && (mvControlling->ScndCtrlPos > 0)) {
|
||||||
|
if ((mvControlling->ScndCtrlPos > 0) && (mvControlling->Vel < 1 + mvControlling->SpeedCtrlUnit.StartVelocity) && (DizelPercentage > 0))
|
||||||
|
DizelPercentage_Speed = 101; //keep last position to start
|
||||||
|
}
|
||||||
|
else if (VelDesired > MinVel) //more power for faster ride
|
||||||
{
|
{
|
||||||
auto const Factor{ 10 * (mvControlling->Vmax) / (mvControlling->Vmax + 3 * mvControlling->Vel) };
|
auto const Factor{ 10 * (mvControlling->Vmax) / (mvControlling->Vmax + 3 * mvControlling->Vel) };
|
||||||
auto DesiredPercentage{ clamp(
|
auto DesiredPercentage{ clamp(
|
||||||
@@ -3594,7 +3641,7 @@ void TController::SetTimeControllers()
|
|||||||
}
|
}
|
||||||
DizelPercentage_Speed = std::round(DesiredPercentage * DizelPercentage);
|
DizelPercentage_Speed = std::round(DesiredPercentage * DizelPercentage);
|
||||||
}
|
}
|
||||||
else
|
else //slow acceleration during shunting wth minimal velocity
|
||||||
{
|
{
|
||||||
DizelPercentage_Speed = std::min(DizelPercentage, mvControlling->Vel < 0.99 * VelDesired ? 1 : 0);
|
DizelPercentage_Speed = std::min(DizelPercentage, mvControlling->Vel < 0.99 * VelDesired ? 1 : 0);
|
||||||
}
|
}
|
||||||
@@ -4394,9 +4441,11 @@ TController::UpdateSituation(double dt) {
|
|||||||
while (p)
|
while (p)
|
||||||
{ // sprawdzenie odhamowania wszystkich połączonych pojazdów
|
{ // sprawdzenie odhamowania wszystkich połączonych pojazdów
|
||||||
auto *vehicle { p->MoverParameters };
|
auto *vehicle { p->MoverParameters };
|
||||||
|
double bp = vehicle->BrakePress - (vehicle->SpeedCtrlUnit.Parking ? vehicle->MaxBrakePress[0] * vehicle->StopBrakeDecc : 0.0);
|
||||||
|
if (bp < 0) bp = 0;
|
||||||
if (Ready) {
|
if (Ready) {
|
||||||
// bo jak coś nie odhamowane, to dalej nie ma co sprawdzać
|
// bo jak coś nie odhamowane, to dalej nie ma co sprawdzać
|
||||||
if (vehicle->BrakePress >= 0.4) // wg UIC określone sztywno na 0.04
|
if (bp >= 0.4) // wg UIC określone sztywno na 0.04
|
||||||
{
|
{
|
||||||
Ready = false; // nie gotowy
|
Ready = false; // nie gotowy
|
||||||
// Ra: odluźnianie przeładowanych lokomotyw, ciągniętych na zimno - prowizorka...
|
// Ra: odluźnianie przeładowanych lokomotyw, ciągniętych na zimno - prowizorka...
|
||||||
@@ -4412,8 +4461,8 @@ TController::UpdateSituation(double dt) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (fReady < vehicle->BrakePress)
|
if (fReady < bp)
|
||||||
fReady = vehicle->BrakePress; // szukanie najbardziej zahamowanego
|
fReady = bp; // szukanie najbardziej zahamowanego
|
||||||
if( ( dy = p->VectorFront().y ) != 0.0 ) {
|
if( ( dy = p->VectorFront().y ) != 0.0 ) {
|
||||||
// istotne tylko dla pojazdów na pochyleniu
|
// istotne tylko dla pojazdów na pochyleniu
|
||||||
// ciężar razy składowa styczna grawitacji
|
// ciężar razy składowa styczna grawitacji
|
||||||
|
|||||||
10
DynObj.cpp
10
DynObj.cpp
@@ -2831,8 +2831,10 @@ bool TDynamicObject::Update(double dt, double dt1)
|
|||||||
&& (MoverParameters->EngineType == TEngineType::DieselEngine)
|
&& (MoverParameters->EngineType == TEngineType::DieselEngine)
|
||||||
&& (MoverParameters->EIMCtrlType > 0)) {
|
&& (MoverParameters->EIMCtrlType > 0)) {
|
||||||
MoverParameters->CheckEIMIC(dt1);
|
MoverParameters->CheckEIMIC(dt1);
|
||||||
MoverParameters->eimic_real = MoverParameters->eimic;
|
if (MoverParameters->SpeedCtrl)
|
||||||
MoverParameters->SendCtrlToNext("EIMIC", MoverParameters->eimic, MoverParameters->CabNo);
|
MoverParameters->CheckSpeedCtrl(dt1);
|
||||||
|
MoverParameters->eimic_real = std::min(MoverParameters->eimic,MoverParameters->eimicSpeedCtrl);
|
||||||
|
MoverParameters->SendCtrlToNext("EIMIC", MoverParameters->eimic_real, MoverParameters->CabNo);
|
||||||
}
|
}
|
||||||
if( ( Mechanik->primary() )
|
if( ( Mechanik->primary() )
|
||||||
&& ( MoverParameters->EngineType == TEngineType::ElectricInductionMotor ) ) {
|
&& ( MoverParameters->EngineType == TEngineType::ElectricInductionMotor ) ) {
|
||||||
@@ -2852,10 +2854,10 @@ bool TDynamicObject::Update(double dt, double dt1)
|
|||||||
if( ( MoverParameters->Power < 1 )
|
if( ( MoverParameters->Power < 1 )
|
||||||
&& ( ctOwner != nullptr ) ) {
|
&& ( ctOwner != nullptr ) ) {
|
||||||
MoverParameters->MainCtrlPos = ctOwner->Controlling()->MainCtrlPos*MoverParameters->MainCtrlPosNo / std::max(1, ctOwner->Controlling()->MainCtrlPosNo);
|
MoverParameters->MainCtrlPos = ctOwner->Controlling()->MainCtrlPos*MoverParameters->MainCtrlPosNo / std::max(1, ctOwner->Controlling()->MainCtrlPosNo);
|
||||||
MoverParameters->ScndCtrlActualPos = ctOwner->Controlling()->ScndCtrlActualPos;
|
MoverParameters->SpeedCtrlValue = ctOwner->Controlling()->SpeedCtrlValue;
|
||||||
}
|
}
|
||||||
MoverParameters->CheckEIMIC(dt1);
|
MoverParameters->CheckEIMIC(dt1);
|
||||||
MoverParameters->CheckSpeedCtrl();
|
MoverParameters->CheckSpeedCtrl(dt1);
|
||||||
|
|
||||||
auto eimic = Min0R(MoverParameters->eimic, MoverParameters->eimicSpeedCtrl);
|
auto eimic = Min0R(MoverParameters->eimic, MoverParameters->eimicSpeedCtrl);
|
||||||
MoverParameters->eimic_real = eimic;
|
MoverParameters->eimic_real = eimic;
|
||||||
|
|||||||
@@ -681,7 +681,32 @@ struct neighbour_data {
|
|||||||
float distance { 10000.f }; // distance to the obstacle // NOTE: legacy value. TBD, TODO: use standard -1 instead?
|
float distance { 10000.f }; // distance to the obstacle // NOTE: legacy value. TBD, TODO: use standard -1 instead?
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct speed_control {
|
||||||
|
bool IsActive = false;
|
||||||
|
bool Start = false;
|
||||||
|
bool ManualStateOverride = true;
|
||||||
|
bool BrakeIntervention = false;
|
||||||
|
bool BrakeInterventionBraking = false;
|
||||||
|
bool BrakeInterventionUnbraking = false;
|
||||||
|
bool Standby = true;
|
||||||
|
bool Parking = false;
|
||||||
|
double InitialPower = 0.3;
|
||||||
|
double FullPowerVelocity = 3;
|
||||||
|
double StartVelocity = 3;
|
||||||
|
double VelocityStep = 5;
|
||||||
|
double PowerStep = 0.1;
|
||||||
|
double MinPower = 0.3;
|
||||||
|
double MaxPower = 1.0;
|
||||||
|
double MinVelocity = 20;
|
||||||
|
double MaxVelocity = 120;
|
||||||
|
double DesiredVelocity = 0;
|
||||||
|
double DesiredPower = 1.0;
|
||||||
|
double Offset = -0.5;
|
||||||
|
double FactorPpos = 0.1;
|
||||||
|
double FactorPneg = 0.4;
|
||||||
|
double FactorIpos = 0.04;
|
||||||
|
double FactorIneg = 0.0;
|
||||||
|
};
|
||||||
|
|
||||||
class TMoverParameters
|
class TMoverParameters
|
||||||
{ // Ra: wrapper na kod pascalowy, przejmujący jego funkcje Q: 20160824 - juz nie wrapper a klasa bazowa :)
|
{ // Ra: wrapper na kod pascalowy, przejmujący jego funkcje Q: 20160824 - juz nie wrapper a klasa bazowa :)
|
||||||
@@ -1187,7 +1212,11 @@ public:
|
|||||||
#endif
|
#endif
|
||||||
double MirrorMaxShift { 90.0 };
|
double MirrorMaxShift { 90.0 };
|
||||||
bool ScndS = false; /*Czy jest bocznikowanie na szeregowej*/
|
bool ScndS = false; /*Czy jest bocznikowanie na szeregowej*/
|
||||||
|
bool SpeedCtrl = false; /*czy jest tempomat*/
|
||||||
|
speed_control SpeedCtrlUnit; /*parametry tempomatu*/
|
||||||
|
double SpeedCtrlButtons[10] { 30, 40, 50, 60, 70, 80, 90, 100, 110, 120 }; /*przyciski prędkości*/
|
||||||
double SpeedCtrlDelay = 2; /*opoznienie dzialania tempomatu z wybieralna predkoscia*/
|
double SpeedCtrlDelay = 2; /*opoznienie dzialania tempomatu z wybieralna predkoscia*/
|
||||||
|
double SpeedCtrlValue = 0; /*wybrana predkosc jazdy na tempomacie*/
|
||||||
/*--sekcja zmiennych*/
|
/*--sekcja zmiennych*/
|
||||||
/*--opis konkretnego egzemplarza taboru*/
|
/*--opis konkretnego egzemplarza taboru*/
|
||||||
TLocation Loc { 0.0, 0.0, 0.0 }; //pozycja pojazdów do wyznaczenia odległości pomiędzy sprzęgami
|
TLocation Loc { 0.0, 0.0, 0.0 }; //pozycja pojazdów do wyznaczenia odległości pomiędzy sprzęgami
|
||||||
@@ -1403,6 +1432,7 @@ public:
|
|||||||
static std::vector<std::string> const eimv_labels;
|
static std::vector<std::string> const eimv_labels;
|
||||||
double SpeedCtrlTimer = 0; /*zegar dzialania tempomatu z wybieralna predkoscia*/
|
double SpeedCtrlTimer = 0; /*zegar dzialania tempomatu z wybieralna predkoscia*/
|
||||||
double eimicSpeedCtrl = 0; /*pozycja sugerowana przez tempomat*/
|
double eimicSpeedCtrl = 0; /*pozycja sugerowana przez tempomat*/
|
||||||
|
double eimicSpeedCtrlIntegral = 0; /*calkowany blad ustawienia predkosci*/
|
||||||
double NewSpeed = 0; /*nowa predkosc do zadania*/
|
double NewSpeed = 0; /*nowa predkosc do zadania*/
|
||||||
double MED_EPVC_CurrentTime = 0; /*aktualny czas licznika czasu korekcji siły EP*/
|
double MED_EPVC_CurrentTime = 0; /*aktualny czas licznika czasu korekcji siły EP*/
|
||||||
|
|
||||||
@@ -1633,7 +1663,12 @@ public:
|
|||||||
bool PantRear( bool const State, range_t const Notify = range_t::consist ); //obsluga pantografu tylnego
|
bool PantRear( bool const State, range_t const Notify = range_t::consist ); //obsluga pantografu tylnego
|
||||||
|
|
||||||
void CheckEIMIC(double dt); //sprawdzenie i zmiana nastawy zintegrowanego nastawnika jazdy/hamowania
|
void CheckEIMIC(double dt); //sprawdzenie i zmiana nastawy zintegrowanego nastawnika jazdy/hamowania
|
||||||
void CheckSpeedCtrl();
|
void CheckSpeedCtrl(double dt);
|
||||||
|
void SpeedCtrlButton(int button);
|
||||||
|
void SpeedCtrlInc();
|
||||||
|
void SpeedCtrlDec();
|
||||||
|
void SpeedCtrlPowerInc();
|
||||||
|
void SpeedCtrlPowerDec();
|
||||||
|
|
||||||
/*-funkcje typowe dla lokomotywy spalinowej z przekladnia mechaniczna*/
|
/*-funkcje typowe dla lokomotywy spalinowej z przekladnia mechaniczna*/
|
||||||
bool dizel_EngageSwitch(double state);
|
bool dizel_EngageSwitch(double state);
|
||||||
@@ -1683,6 +1718,7 @@ private:
|
|||||||
void LoadFIZ_Security( std::string const &line );
|
void LoadFIZ_Security( std::string const &line );
|
||||||
void LoadFIZ_Clima( std::string const &line );
|
void LoadFIZ_Clima( std::string const &line );
|
||||||
void LoadFIZ_Power( std::string const &Line );
|
void LoadFIZ_Power( std::string const &Line );
|
||||||
|
void LoadFIZ_SpeedControl( std::string const &Line );
|
||||||
void LoadFIZ_Engine( std::string const &Input );
|
void LoadFIZ_Engine( std::string const &Input );
|
||||||
void LoadFIZ_Switches( std::string const &Input );
|
void LoadFIZ_Switches( std::string const &Input );
|
||||||
void LoadFIZ_MotorParamTable( std::string const &Input );
|
void LoadFIZ_MotorParamTable( std::string const &Input );
|
||||||
|
|||||||
File diff suppressed because it is too large
Load Diff
44
Train.h
44
Train.h
@@ -69,10 +69,8 @@ public:
|
|||||||
find( TSubModel const *Control ) const;
|
find( TSubModel const *Control ) const;
|
||||||
};
|
};
|
||||||
|
|
||||||
class TTrain {
|
class TTrain
|
||||||
|
{
|
||||||
friend class drivingaid_panel;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
// types
|
// types
|
||||||
struct state_t {
|
struct state_t {
|
||||||
@@ -90,7 +88,6 @@ class TTrain {
|
|||||||
std::uint8_t ventilator_overload;
|
std::uint8_t ventilator_overload;
|
||||||
std::uint8_t motor_overload_threshold;
|
std::uint8_t motor_overload_threshold;
|
||||||
std::uint8_t train_heating;
|
std::uint8_t train_heating;
|
||||||
std::uint8_t cab;
|
|
||||||
std::uint8_t recorder_braking;
|
std::uint8_t recorder_braking;
|
||||||
std::uint8_t recorder_power;
|
std::uint8_t recorder_power;
|
||||||
std::uint8_t alerter_sound;
|
std::uint8_t alerter_sound;
|
||||||
@@ -101,15 +98,13 @@ class TTrain {
|
|||||||
float brake_pressure;
|
float brake_pressure;
|
||||||
float hv_voltage;
|
float hv_voltage;
|
||||||
std::array<float, 3> hv_current;
|
std::array<float, 3> hv_current;
|
||||||
float lv_voltage;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// constructors
|
|
||||||
TTrain();
|
|
||||||
// methods
|
// methods
|
||||||
bool CabChange(int iDirection);
|
bool CabChange(int iDirection);
|
||||||
bool ShowNextCurrent; // pokaz przd w podlaczonej lokomotywie (ET41)
|
bool ShowNextCurrent; // pokaz przd w podlaczonej lokomotywie (ET41)
|
||||||
bool InitializeCab(int NewCabNo, std::string const &asFileName);
|
bool InitializeCab(int NewCabNo, std::string const &asFileName);
|
||||||
|
TTrain();
|
||||||
// McZapkie-010302
|
// McZapkie-010302
|
||||||
bool Init(TDynamicObject *NewDynamicObject, bool e3d = false);
|
bool Init(TDynamicObject *NewDynamicObject, bool e3d = false);
|
||||||
|
|
||||||
@@ -118,7 +113,6 @@ class TTrain {
|
|||||||
inline std::string GetLabel( TSubModel const *Control ) const { return m_controlmapper.find( Control ); }
|
inline std::string GetLabel( TSubModel const *Control ) const { return m_controlmapper.find( Control ); }
|
||||||
void UpdateCab();
|
void UpdateCab();
|
||||||
bool Update( double const Deltatime );
|
bool Update( double const Deltatime );
|
||||||
void add_distance( double const Distance );
|
|
||||||
void SetLights();
|
void SetLights();
|
||||||
// McZapkie-310302: ladowanie parametrow z pliku
|
// McZapkie-310302: ladowanie parametrow z pliku
|
||||||
bool LoadMMediaFile(std::string const &asFileName);
|
bool LoadMMediaFile(std::string const &asFileName);
|
||||||
@@ -157,12 +151,6 @@ class TTrain {
|
|||||||
void update_sounds( double const Deltatime );
|
void update_sounds( double const Deltatime );
|
||||||
void update_sounds_runningnoise( sound_source &Sound );
|
void update_sounds_runningnoise( sound_source &Sound );
|
||||||
void update_sounds_radio();
|
void update_sounds_radio();
|
||||||
inline
|
|
||||||
end cab_to_end() const {
|
|
||||||
return (
|
|
||||||
iCabn == 2 ?
|
|
||||||
end::rear :
|
|
||||||
end::front ); }
|
|
||||||
|
|
||||||
// command handlers
|
// command handlers
|
||||||
// NOTE: we're currently using universal handlers and static handler map but it may be beneficial to have these implemented on individual class instance basis
|
// NOTE: we're currently using universal handlers and static handler map but it may be beneficial to have these implemented on individual class instance basis
|
||||||
@@ -362,7 +350,6 @@ class TTrain {
|
|||||||
static void OnCommand_radiochanneldecrease( TTrain *Train, command_data const &Command );
|
static void OnCommand_radiochanneldecrease( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_radiostopsend( TTrain *Train, command_data const &Command );
|
static void OnCommand_radiostopsend( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_radiostoptest( TTrain *Train, command_data const &Command );
|
static void OnCommand_radiostoptest( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_radiocall3send( TTrain *Train, command_data const &Command );
|
|
||||||
static void OnCommand_cabchangeforward( TTrain *Train, command_data const &Command );
|
static void OnCommand_cabchangeforward( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_cabchangebackward( TTrain *Train, command_data const &Command );
|
static void OnCommand_cabchangebackward( TTrain *Train, command_data const &Command );
|
||||||
static void OnCommand_generictoggle( TTrain *Train, command_data const &Command );
|
static void OnCommand_generictoggle( TTrain *Train, command_data const &Command );
|
||||||
@@ -373,7 +360,13 @@ class TTrain {
|
|||||||
static void OnCommand_springbrakeshutoffenable(TTrain *Train, command_data const &Command);
|
static void OnCommand_springbrakeshutoffenable(TTrain *Train, command_data const &Command);
|
||||||
static void OnCommand_springbrakeshutoffdisable(TTrain *Train, command_data const &Command);
|
static void OnCommand_springbrakeshutoffdisable(TTrain *Train, command_data const &Command);
|
||||||
static void OnCommand_springbrakerelease(TTrain *Train, command_data const &Command);
|
static void OnCommand_springbrakerelease(TTrain *Train, command_data const &Command);
|
||||||
static void OnCommand_distancecounteractivate( TTrain *Train, command_data const &Command );
|
static void OnCommand_speedcontrolincrease(TTrain *Train, command_data const &Command);
|
||||||
|
static void OnCommand_speedcontroldecrease(TTrain *Train, command_data const &Command);
|
||||||
|
static void OnCommand_speedcontrolpowerincrease(TTrain *Train, command_data const &Command);
|
||||||
|
static void OnCommand_speedcontrolpowerdecrease(TTrain *Train, command_data const &Command);
|
||||||
|
static void OnCommand_speedcontrolbutton(TTrain *Train, command_data const &Command);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// members
|
// members
|
||||||
TDynamicObject *DynamicObject { nullptr }; // przestawia zmiana pojazdu [F5]
|
TDynamicObject *DynamicObject { nullptr }; // przestawia zmiana pojazdu [F5]
|
||||||
@@ -436,7 +429,7 @@ public: // reszta może by?publiczna
|
|||||||
TGauge ggUniveralBrakeButton2;
|
TGauge ggUniveralBrakeButton2;
|
||||||
TGauge ggUniveralBrakeButton3;
|
TGauge ggUniveralBrakeButton3;
|
||||||
TGauge ggSandButton; // guzik piasecznicy
|
TGauge ggSandButton; // guzik piasecznicy
|
||||||
TGauge ggAutoSandButton; // przełącznik piasecznicy
|
TGauge ggAutoSandAllow; // przełącznik piasecznicy
|
||||||
TGauge ggAntiSlipButton;
|
TGauge ggAntiSlipButton;
|
||||||
TGauge ggFuseButton;
|
TGauge ggFuseButton;
|
||||||
TGauge ggConverterFuseButton; // hunter-261211: przycisk odblokowania nadmiarowego przetwornic i ogrzewania
|
TGauge ggConverterFuseButton; // hunter-261211: przycisk odblokowania nadmiarowego przetwornic i ogrzewania
|
||||||
@@ -447,7 +440,6 @@ public: // reszta może by?publiczna
|
|||||||
TGauge ggRadioChannelNext;
|
TGauge ggRadioChannelNext;
|
||||||
TGauge ggRadioTest;
|
TGauge ggRadioTest;
|
||||||
TGauge ggRadioStop;
|
TGauge ggRadioStop;
|
||||||
TGauge ggRadioCall3;
|
|
||||||
TGauge ggUpperLightButton;
|
TGauge ggUpperLightButton;
|
||||||
TGauge ggLeftLightButton;
|
TGauge ggLeftLightButton;
|
||||||
TGauge ggRightLightButton;
|
TGauge ggRightLightButton;
|
||||||
@@ -480,6 +472,13 @@ public: // reszta może by?publiczna
|
|||||||
TGauge ggHelperButton;
|
TGauge ggHelperButton;
|
||||||
TGauge ggNextCurrentButton;
|
TGauge ggNextCurrentButton;
|
||||||
|
|
||||||
|
// yB 191005 - tempomat
|
||||||
|
TGauge ggSpeedControlIncreaseButton;
|
||||||
|
TGauge ggSpeedControlDecreaseButton;
|
||||||
|
TGauge ggSpeedControlPowerIncreaseButton;
|
||||||
|
TGauge ggSpeedControlPowerDecreaseButton;
|
||||||
|
std::array<TGauge, 10> ggSpeedCtrlButtons; // NOTE: temporary arrangement until we have dynamically built control table
|
||||||
|
|
||||||
std::array<TGauge, 10> ggUniversals; // NOTE: temporary arrangement until we have dynamically built control table
|
std::array<TGauge, 10> ggUniversals; // NOTE: temporary arrangement until we have dynamically built control table
|
||||||
|
|
||||||
TGauge ggInstrumentLightButton;
|
TGauge ggInstrumentLightButton;
|
||||||
@@ -530,8 +529,6 @@ public: // reszta może by?publiczna
|
|||||||
TGauge ggMotorBlowersRearButton; // rear traction motor fan switch
|
TGauge ggMotorBlowersRearButton; // rear traction motor fan switch
|
||||||
TGauge ggMotorBlowersAllOffButton; // motor fans shutdown switch
|
TGauge ggMotorBlowersAllOffButton; // motor fans shutdown switch
|
||||||
|
|
||||||
TGauge ggDistanceCounterButton; // distance meter activation button
|
|
||||||
|
|
||||||
TButton btLampkaPoslizg;
|
TButton btLampkaPoslizg;
|
||||||
TButton btLampkaStyczn;
|
TButton btLampkaStyczn;
|
||||||
TButton btLampkaNadmPrzetw;
|
TButton btLampkaNadmPrzetw;
|
||||||
@@ -627,7 +624,6 @@ public: // reszta może by?publiczna
|
|||||||
TButton btLampkaMotorBlowers;
|
TButton btLampkaMotorBlowers;
|
||||||
TButton btLampkaCoolingFans;
|
TButton btLampkaCoolingFans;
|
||||||
TButton btLampkaTempomat;
|
TButton btLampkaTempomat;
|
||||||
TButton btLampkaDistanceCounter;
|
|
||||||
|
|
||||||
TButton btCabLight; // hunter-171012: lampa oswietlajaca kabine
|
TButton btCabLight; // hunter-171012: lampa oswietlajaca kabine
|
||||||
// Ra 2013-12: wirtualne "lampki" do odbijania na haslerze w PoKeys
|
// Ra 2013-12: wirtualne "lampki" do odbijania na haslerze w PoKeys
|
||||||
@@ -660,7 +656,6 @@ public: // reszta może by?publiczna
|
|||||||
sound_source m_radiosound { sound_placement::internal, 2 * EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // cached template for radio messages
|
sound_source m_radiosound { sound_placement::internal, 2 * EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // cached template for radio messages
|
||||||
std::vector<std::pair<int, std::shared_ptr<sound_source>>> m_radiomessages; // list of currently played radio messages
|
std::vector<std::pair<int, std::shared_ptr<sound_source>>> m_radiomessages; // list of currently played radio messages
|
||||||
sound_source m_radiostop { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE };
|
sound_source m_radiostop { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE };
|
||||||
sound_source m_distancecounterclear { sound_placement::internal, EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // distance meter 'good to go' alert
|
|
||||||
/*
|
/*
|
||||||
int iCabLightFlag; // McZapkie:120503: oswietlenie kabiny (0: wyl, 1: przyciemnione, 2: pelne)
|
int iCabLightFlag; // McZapkie:120503: oswietlenie kabiny (0: wyl, 1: przyciemnione, 2: pelne)
|
||||||
bool bCabLight; // hunter-091012: czy swiatlo jest zapalone?
|
bool bCabLight; // hunter-091012: czy swiatlo jest zapalone?
|
||||||
@@ -668,7 +663,7 @@ public: // reszta może by?publiczna
|
|||||||
*/
|
*/
|
||||||
// McZapkie: opis kabiny - obszar poruszania sie mechanika oraz zajetosc
|
// McZapkie: opis kabiny - obszar poruszania sie mechanika oraz zajetosc
|
||||||
std::array<TCab, maxcab + 1> Cabine; // przedzial maszynowy, kabina 1 (A), kabina 2 (B)
|
std::array<TCab, maxcab + 1> Cabine; // przedzial maszynowy, kabina 1 (A), kabina 2 (B)
|
||||||
int iCabn { 0 }; // 0: mid, 1: front, 2: rear
|
int iCabn { 0 };
|
||||||
// McZapkie: do poruszania sie po kabinie
|
// McZapkie: do poruszania sie po kabinie
|
||||||
Math3D::vector3 pMechSittingPosition; // ABu 180404
|
Math3D::vector3 pMechSittingPosition; // ABu 180404
|
||||||
Math3D::vector3 MirrorPosition( bool lewe );
|
Math3D::vector3 MirrorPosition( bool lewe );
|
||||||
@@ -714,7 +709,6 @@ private:
|
|||||||
float m_mastercontrollerreturndelay { 0.f };
|
float m_mastercontrollerreturndelay { 0.f };
|
||||||
int iRadioChannel { 1 }; // numer aktualnego kana?u radiowego
|
int iRadioChannel { 1 }; // numer aktualnego kana?u radiowego
|
||||||
std::vector<std::pair<std::string, texture_handle>> m_screens;
|
std::vector<std::pair<std::string, texture_handle>> m_screens;
|
||||||
float m_distancecounter { -1.f }; // distance traveled since meter was activated or -1 if inactive
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
float fPress[20][3]; // cisnienia dla wszystkich czlonow
|
float fPress[20][3]; // cisnienia dla wszystkich czlonow
|
||||||
|
|||||||
16
command.cpp
16
command.cpp
@@ -132,7 +132,6 @@ commanddescription_sequence Commands_descriptions = {
|
|||||||
{ "radiochanneldecrease", command_target::vehicle },
|
{ "radiochanneldecrease", command_target::vehicle },
|
||||||
{ "radiostopsend", command_target::vehicle },
|
{ "radiostopsend", command_target::vehicle },
|
||||||
{ "radiostoptest", command_target::vehicle },
|
{ "radiostoptest", command_target::vehicle },
|
||||||
{ "radiocall3send", command_target::vehicle },
|
|
||||||
// TBD, TODO: make cab change controls entity-centric
|
// TBD, TODO: make cab change controls entity-centric
|
||||||
{ "cabchangeforward", command_target::vehicle },
|
{ "cabchangeforward", command_target::vehicle },
|
||||||
{ "cabchangebackward", command_target::vehicle },
|
{ "cabchangebackward", command_target::vehicle },
|
||||||
@@ -245,7 +244,20 @@ commanddescription_sequence Commands_descriptions = {
|
|||||||
{ "springbrakeshutoffenable", command_target::vehicle },
|
{ "springbrakeshutoffenable", command_target::vehicle },
|
||||||
{ "springbrakeshutoffdisable", command_target::vehicle },
|
{ "springbrakeshutoffdisable", command_target::vehicle },
|
||||||
{ "springbrakerelease", command_target::vehicle },
|
{ "springbrakerelease", command_target::vehicle },
|
||||||
{ "distancecounteractivate", command_target::vehicle }
|
{ "speedcontrolincrease", command_target::vehicle },
|
||||||
|
{ "speedcontroldecrease", command_target::vehicle },
|
||||||
|
{ "speedcontrolpowerincrease", command_target::vehicle },
|
||||||
|
{ "speedcontrolpowerdecrease", command_target::vehicle },
|
||||||
|
{ "speedcontrolbutton0", command_target::vehicle },
|
||||||
|
{ "speedcontrolbutton1", command_target::vehicle },
|
||||||
|
{ "speedcontrolbutton2", command_target::vehicle },
|
||||||
|
{ "speedcontrolbutton3", command_target::vehicle },
|
||||||
|
{ "speedcontrolbutton4", command_target::vehicle },
|
||||||
|
{ "speedcontrolbutton5", command_target::vehicle },
|
||||||
|
{ "speedcontrolbutton6", command_target::vehicle },
|
||||||
|
{ "speedcontrolbutton7", command_target::vehicle },
|
||||||
|
{ "speedcontrolbutton8", command_target::vehicle },
|
||||||
|
{ "speedcontrolbutton9", command_target::vehicle }
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
17
command.h
17
command.h
@@ -126,7 +126,6 @@ enum class user_command {
|
|||||||
radiochanneldecrease,
|
radiochanneldecrease,
|
||||||
radiostopsend,
|
radiostopsend,
|
||||||
radiostoptest,
|
radiostoptest,
|
||||||
radiocall3send,
|
|
||||||
cabchangeforward,
|
cabchangeforward,
|
||||||
cabchangebackward,
|
cabchangebackward,
|
||||||
|
|
||||||
@@ -238,8 +237,20 @@ enum class user_command {
|
|||||||
springbrakeshutoffenable,
|
springbrakeshutoffenable,
|
||||||
springbrakeshutoffdisable,
|
springbrakeshutoffdisable,
|
||||||
springbrakerelease,
|
springbrakerelease,
|
||||||
distancecounteractivate,
|
speedcontrolincrease,
|
||||||
|
speedcontroldecrease,
|
||||||
|
speedcontrolpowerincrease,
|
||||||
|
speedcontrolpowerdecrease,
|
||||||
|
speedcontrolbutton0,
|
||||||
|
speedcontrolbutton1,
|
||||||
|
speedcontrolbutton2,
|
||||||
|
speedcontrolbutton3,
|
||||||
|
speedcontrolbutton4,
|
||||||
|
speedcontrolbutton5,
|
||||||
|
speedcontrolbutton6,
|
||||||
|
speedcontrolbutton7,
|
||||||
|
speedcontrolbutton8,
|
||||||
|
speedcontrolbutton9,
|
||||||
none = -1
|
none = -1
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -824,7 +824,49 @@ drivermouse_input::default_bindings() {
|
|||||||
user_command::none } },
|
user_command::none } },
|
||||||
{ "universal9:", {
|
{ "universal9:", {
|
||||||
user_command::generictoggle9,
|
user_command::generictoggle9,
|
||||||
user_command::none } }
|
user_command::none } },
|
||||||
|
{ "speedinc_bt:",{
|
||||||
|
user_command::speedcontrolincrease,
|
||||||
|
user_command::none } },
|
||||||
|
{ "speeddec_bt:",{
|
||||||
|
user_command::speedcontroldecrease,
|
||||||
|
user_command::none } },
|
||||||
|
{ "speedctrlpowerinc_bt:",{
|
||||||
|
user_command::speedcontrolpowerincrease,
|
||||||
|
user_command::none } },
|
||||||
|
{ "speedctrlpowerdec_bt:",{
|
||||||
|
user_command::speedcontrolpowerdecrease,
|
||||||
|
user_command::none } },
|
||||||
|
{ "speedbutton0:",{
|
||||||
|
user_command::speedcontrolbutton0,
|
||||||
|
user_command::none } },
|
||||||
|
{ "speedbutton1:",{
|
||||||
|
user_command::speedcontrolbutton1,
|
||||||
|
user_command::none } },
|
||||||
|
{ "speedbutton2:",{
|
||||||
|
user_command::speedcontrolbutton2,
|
||||||
|
user_command::none } },
|
||||||
|
{ "speedbutton3:",{
|
||||||
|
user_command::speedcontrolbutton3,
|
||||||
|
user_command::none } },
|
||||||
|
{ "speedbutton4:",{
|
||||||
|
user_command::speedcontrolbutton4,
|
||||||
|
user_command::none } },
|
||||||
|
{ "speedbutton5:",{
|
||||||
|
user_command::speedcontrolbutton5,
|
||||||
|
user_command::none } },
|
||||||
|
{ "speedbutton6:",{
|
||||||
|
user_command::speedcontrolbutton6,
|
||||||
|
user_command::none } },
|
||||||
|
{ "speedbutton7:",{
|
||||||
|
user_command::speedcontrolbutton7,
|
||||||
|
user_command::none } },
|
||||||
|
{ "speedbutton8:",{
|
||||||
|
user_command::speedcontrolbutton8,
|
||||||
|
user_command::none } },
|
||||||
|
{ "speedbutton9:",{
|
||||||
|
user_command::speedcontrolbutton9,
|
||||||
|
user_command::none } }
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user