diff --git a/.gitmodules b/.gitmodules index b9fac3e3..6ace3b51 100644 --- a/.gitmodules +++ b/.gitmodules @@ -19,3 +19,7 @@ [submodule "ref/asio"] path = ref/asio url = https://github.com/chriskohlhoff/asio.git +[submodule "ref/discord-rpc"] + path = ref/discord-rpc + url = https://github.com/discord/discord-rpc.git + branch = v3.4.0 diff --git a/AnimModel.cpp b/AnimModel.cpp index 15a1ccc5..30154b57 100644 --- a/AnimModel.cpp +++ b/AnimModel.cpp @@ -318,6 +318,10 @@ bool TAnimModel::Load(cParser *parser, bool ter) LightsOff[5] = pModel->GetFromName("Light_Off05"); LightsOff[6] = pModel->GetFromName("Light_Off06"); LightsOff[7] = pModel->GetFromName("Light_Off07"); + sm_winter_variant = pModel->GetFromName("winter_variant"); + sm_spring_variant = pModel->GetFromName("spring_variant"); + sm_summer_variant = pModel->GetFromName("summer_variant"); + sm_autumn_variant = pModel->GetFromName("autumn_variant"); } for (int i = 0; i < iMaxNumLights; ++i) if (LightsOn[i] || LightsOff[i]) // Ra: zlikwidowałem wymóg istnienia obu @@ -494,9 +498,59 @@ void TAnimModel::RaAnimate( unsigned int const Framestamp ) { m_framestamp = Framestamp; } +// aktualizujemy submodele w zaleznosci od aktualnej porty roku +void TAnimModel::on_season_update() { + if (Global.Season == "winter:") // pokazujemy wariant zimowy + { + if (this->sm_winter_variant != nullptr) + this->sm_winter_variant->SetVisibilityLevel(1.f, true, false); + if (this->sm_spring_variant != nullptr) + this->sm_spring_variant->SetVisibilityLevel(0.f, true, false); + if (this->sm_summer_variant != nullptr) + this->sm_summer_variant->SetVisibilityLevel(0.f, true, false); + if (this->sm_autumn_variant != nullptr) + this->sm_autumn_variant->SetVisibilityLevel(0.f, true, false); + } + else if (Global.Season == "spring:") // pokazujemy wariant wiosenny + { + if (this->sm_winter_variant != nullptr) + this->sm_winter_variant->SetVisibilityLevel(0.f, true, false); + if (this->sm_spring_variant != nullptr) + this->sm_spring_variant->SetVisibilityLevel(1.f, true, false); + if (this->sm_summer_variant != nullptr) + this->sm_summer_variant->SetVisibilityLevel(0.f, true, false); + if (this->sm_autumn_variant != nullptr) + this->sm_autumn_variant->SetVisibilityLevel(0.f, true, false); + } + else if (Global.Season == "summer:") // pokazujemy wariant letni + { + if (this->sm_winter_variant != nullptr) + this->sm_winter_variant->SetVisibilityLevel(0.f, true, false); + if (this->sm_spring_variant != nullptr) + this->sm_spring_variant->SetVisibilityLevel(0.f, true, false); + if (this->sm_summer_variant != nullptr) + this->sm_summer_variant->SetVisibilityLevel(1.f, true, false); + if (this->sm_autumn_variant != nullptr) + this->sm_autumn_variant->SetVisibilityLevel(0.f, true, false); + } + else if (Global.Season == "autumn:") // pokazujemy wariant jesienny + { + if (this->sm_winter_variant != nullptr) + this->sm_winter_variant->SetVisibilityLevel(0.f, true, false); + if (this->sm_spring_variant != nullptr) + this->sm_spring_variant->SetVisibilityLevel(0.f, true, false); + if (this->sm_summer_variant != nullptr) + this->sm_summer_variant->SetVisibilityLevel(0.f, true, false); + if (this->sm_autumn_variant != nullptr) + this->sm_autumn_variant->SetVisibilityLevel(1.f, true, false); + } +} + void TAnimModel::RaPrepare() { // ustawia światła i animacje we wzorcu modelu przed renderowaniem egzemplarza bool state; // stan światła + if (Global.UpdateMaterials) + on_season_update(); for (int i = 0; i < iNumLights; ++i) { auto const lightmode { static_cast( std::abs( lsLights[ i ] ) ) }; @@ -656,9 +710,9 @@ TAnimModel::export_as_text_( std::ostream &Output ) const { // header Output << "model "; // location and rotation - Output - << location().x << ' ' - << location().y << ' ' + Output << std::fixed << std::setprecision(3) // ustawienie dokładnie 3 cyfr po przecinku + << location().x << ' ' + << location().y << ' ' << location().z << ' '; Output << "0 " ; diff --git a/AnimModel.h b/AnimModel.h index 42546377..e62685df 100644 --- a/AnimModel.h +++ b/AnimModel.h @@ -25,12 +25,14 @@ const int iMaxNumLights = 8; float const DefaultDarkThresholdLevel { 0.325f }; // typy stanu świateł -enum TLightState { - ls_Off = 0, // zgaszone - ls_On = 1, // zapalone - ls_Blink = 2, // migające - ls_Dark = 3, // Ra: zapalajce się automatycznie, gdy zrobi się ciemno - ls_Home = 4 // like ls_dark but off late at night +enum TLightState +{ + ls_Off = 0, // zgaszone + ls_On = 1, // zapalone + ls_Blink = 2, // migające + ls_Dark = 3, // Ra: zapalajce się automatycznie, gdy zrobi się ciemno + ls_Home = 4, // like ls_dark but off late at night + ls_winter = 5 // turned on when its winter }; class TAnimVocaloidFrame @@ -125,6 +127,7 @@ public: int TerrainCount(); TSubModel * TerrainSquare(int n); int Flags(); + void on_season_update(); inline material_data const * Material() const { @@ -174,6 +177,10 @@ public: int iNumLights { 0 }; std::array LightsOn {}; // Ra: te wskaźniki powinny być w ramach TModel3d std::array LightsOff {}; + TSubModel *sm_winter_variant {}; // submodel zimowego wariantu + TSubModel *sm_spring_variant {}; // submodel wiosennego wariantu + TSubModel *sm_summer_variant {}; // submodel letniego wariantu + TSubModel *sm_autumn_variant {}; // submodel jesiennego wariantu std::array lsLights {}; // ls_Off std::array m_lightcolors; // -1 in constructor std::array m_lighttimers {}; diff --git a/CMakeLists.txt b/CMakeLists.txt index f5ffa847..c7b6c507 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -444,6 +444,12 @@ target_link_libraries(${PROJECT_NAME} Threads::Threads) find_package(GLM REQUIRED) target_include_directories(${PROJECT_NAME} PRIVATE ${GLM_INCLUDE_DIR}) +# add ref/discord-rpc to the project in the same way other dependencies are added +add_subdirectory(ref/discord-rpc) +target_link_libraries(${PROJECT_NAME} discord-rpc) + + + find_package(OpenAL REQUIRED) if (TARGET OpenAL::OpenAL) target_link_libraries(${PROJECT_NAME} OpenAL::OpenAL) diff --git a/Driver.cpp b/Driver.cpp index 1269bcf3..e350979f 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -5704,6 +5704,7 @@ void TController::TakeControl( bool const Aidriver, bool const Forcevehiclecheck { // teraz AI prowadzi AIControllFlag = AIdriver; pVehicle->Controller = AIdriver; + control_lights(); // reinicjalizacja swiatel mvOccupied->CabActivisation(true); iDirection = 0; // kierunek jazdy trzeba dopiero zgadnąć TableClear(); // ponowne utworzenie tabelki, bo człowiek mógł pojechać niezgodnie z sygnałami @@ -5740,6 +5741,8 @@ void TController::TakeControl( bool const Aidriver, bool const Forcevehiclecheck } else { // a teraz użytkownik + if (!is_train() || !is_car()) // gasimy swiatla jesli przejmujemy odstawione + pVehicle->RaLightsSet(0, 0); AIControllFlag = Humandriver; pVehicle->Controller = Humandriver; if( eAction == TAction::actSleep ) { diff --git a/DynObj.cpp b/DynObj.cpp index 1ea3aae1..7176a231 100644 --- a/DynObj.cpp +++ b/DynObj.cpp @@ -97,8 +97,110 @@ void TAnimPant::AKP_4E() fHeightExtra[3] = -0.07f; //+0.3048 fHeightExtra[4] = -0.15f; //+0.3810 }; +void TAnimPant::WBL85() +{ // ustawienie wymiarów dla pantografu WBL88 + vPos = Math3D::vector3(0, 0, 0); // przypisanie domyśnych współczynników do pantografów + + // mnozniki animacji ramion dla pantografu WBL88 + rd1rf = 1.f; + rd2rf = 1.2; + rg1rf = 0.875; + rg2rf = 1.0; + slizgrf = 1.f; + + fLenL1 = 1.98374; + fLenU1 = 2.14199; + fHoriz = 0.142; // 0.54555075 przesunięcie ślizgu w długości pojazdu względem + // osi obrotu dolnego ramienia + fHeight = 0.09353; // wysokość ślizgu ponad oś obrotu + fWidth = 0.4969; // połowa szerokości ślizgu + fAngleL0 = DegToRad(2.8547285515689267247882521833308); + fAngleL = fAngleL0; // początkowy kąt dolnego ramienia + // fAngleU0=acos((1.22*cos(fAngleL)+0.535)/1.755); //górne ramię + fAngleU0 = acos((fLenL1 * cos(fAngleL) + fHoriz) / fLenU1); // górne ramię + fAngleU = fAngleU0; // początkowy kąt + // PantWys=1.22*sin(fAngleL)+1.755*sin(fAngleU); //wysokość początkowa + PantWys = fLenL1 * sin(fAngleL) + fLenU1 * sin(fAngleU) + fHeight; // wysokość początkowa + PantTraction = PantWys; + hvPowerWire = NULL; + fWidthExtra = 0.381f; //(2.032m-1.027)/2 + // poza obszarem roboczym jest aproksymacja łamaną o 5 odcinkach + fHeightExtra[0] = 0.0f; //+0.0762 + fHeightExtra[1] = -0.01f; //+0.1524 + fHeightExtra[2] = -0.03f; //+0.2286 + fHeightExtra[3] = -0.07f; //+0.3048 + fHeightExtra[4] = -0.15f; //+0.3810 +}; +void TAnimPant::EC160_200() +{ // ustawienie wymiarów dla pantografow EC160 lub EC200 + vPos = Math3D::vector3(0, 0, 0); // przypisanie domyśnych współczynników do pantografów + + // mnozniki animacji ramion dla pantografow EC160 lub EC200 + rd1rf = 1.f; + rd2rf = 0.85; + rg1rf = 1.f; + rg2rf = 1.f; // 0.833 + slizgrf = 1.f; + + fLenL1 = 1.98374; + fLenU1 = 2.14199; + fHoriz = 0.142; // 0.54555075 przesunięcie ślizgu w długości pojazdu względem + // osi obrotu dolnego ramienia + fHeight = 0.09353; // wysokość ślizgu ponad oś obrotu + fWidth = 0.4969; // połowa szerokości ślizgu + fAngleL0 = DegToRad(2.8547285515689267247882521833308); + fAngleL = fAngleL0; // początkowy kąt dolnego ramienia + // fAngleU0=acos((1.22*cos(fAngleL)+0.535)/1.755); //górne ramię + fAngleU0 = acos((fLenL1 * cos(fAngleL) + fHoriz) / fLenU1); // górne ramię + fAngleU = fAngleU0; // początkowy kąt + // PantWys=1.22*sin(fAngleL)+1.755*sin(fAngleU); //wysokość początkowa + PantWys = fLenL1 * sin(fAngleL) + fLenU1 * sin(fAngleU) + fHeight; // wysokość początkowa + PantTraction = PantWys; + hvPowerWire = NULL; + fWidthExtra = 0.381f; //(2.032m-1.027)/2 + // poza obszarem roboczym jest aproksymacja łamaną o 5 odcinkach + fHeightExtra[0] = 0.0f; //+0.0762 + fHeightExtra[1] = -0.01f; //+0.1524 + fHeightExtra[2] = -0.03f; //+0.2286 + fHeightExtra[3] = -0.07f; //+0.3048 + fHeightExtra[4] = -0.15f; //+0.3810 +}; +void TAnimPant::DSAx() +{ // ustawienie wymiarów dla pantografow z rodziny DSA + vPos = Math3D::vector3(0, 0, 0); // przypisanie domyśnych współczynników do pantografów + + // mnozniki animacji ramion dla pantografow z rodziny DSA + rd1rf = 1.f; + rd2rf = 1.025; + rg1rf = 0.875; + rg2rf = 1.f; + slizgrf = 1.f; + + fLenL1 = 1.98374; + fLenU1 = 2.14199; + fHoriz = 0.142; // 0.54555075 przesunięcie ślizgu w długości pojazdu względem + // osi obrotu dolnego ramienia + fHeight = 0.09353; // wysokość ślizgu ponad oś obrotu + fWidth = 0.4969; // połowa szerokości ślizgu + fAngleL0 = DegToRad(2.8547285515689267247882521833308); + fAngleL = fAngleL0; // początkowy kąt dolnego ramienia + // fAngleU0=acos((1.22*cos(fAngleL)+0.535)/1.755); //górne ramię + fAngleU0 = acos((fLenL1 * cos(fAngleL) + fHoriz) / fLenU1); // górne ramię + fAngleU = fAngleU0; // początkowy kąt + // PantWys=1.22*sin(fAngleL)+1.755*sin(fAngleU); //wysokość początkowa + PantWys = fLenL1 * sin(fAngleL) + fLenU1 * sin(fAngleU) + fHeight; // wysokość początkowa + PantTraction = PantWys; + hvPowerWire = NULL; + fWidthExtra = 0.381f; //(2.032m-1.027)/2 + // poza obszarem roboczym jest aproksymacja łamaną o 5 odcinkach + fHeightExtra[0] = 0.0f; //+0.0762 + fHeightExtra[1] = -0.01f; //+0.1524 + fHeightExtra[2] = -0.03f; //+0.2286 + fHeightExtra[3] = -0.07f; //+0.3048 + fHeightExtra[4] = -0.15f; //+0.3810 +}; //--------------------------------------------------------------------------- -int TAnim::TypeSet(int i, int fl) +int TAnim::TypeSet(int i, TMoverParameters currentMover, int fl) { // ustawienie typu animacji i zależnej od niego ilości animowanych submodeli fMaxDist = -1.0; // normalnie nie pokazywać switch (i) @@ -127,7 +229,21 @@ int TAnim::TypeSet(int i, int fl) case 5: // 5-pantograf - 5 submodeli iFlags = 0x055; fParamPants = new TAnimPant(); - fParamPants->AKP_4E(); + switch (currentMover.EnginePowerSource.CollectorParameters.PantographType) { + case (TPantType::AKP_4E): + fParamPants->AKP_4E(); + break; + case(TPantType::DSAx): + fParamPants->DSAx(); + break; + case(TPantType::EC160_200): + fParamPants->EC160_200(); + break; + case(TPantType::WBL85): + fParamPants->WBL85(); + break; + } + break; case 6: iFlags = 0x068; @@ -138,6 +254,9 @@ int TAnim::TypeSet(int i, int fl) case 8: iFlags = 0x080; break; // mirror + case 9: + iFlags = 0x023; // 2: Rotating/Motion-based, 8: Uses 3 submodels + break; default: iFlags = 0; } @@ -576,20 +695,20 @@ void TDynamicObject::UpdateDoorPlug(TAnim *pAnim) { void TDynamicObject::UpdatePant(TAnim *pAnim) { // animacja pantografu - 4 obracane ramiona, ślizg piąty - float a, b, c; - a = RadToDeg(pAnim->fParamPants->fAngleL - pAnim->fParamPants->fAngleL0); - b = RadToDeg(pAnim->fParamPants->fAngleU - pAnim->fParamPants->fAngleU0); - c = a + b; - if (pAnim->smElement[0]) - pAnim->smElement[0]->SetRotate(float3(-1, 0, 0), a); // dolne ramię - if (pAnim->smElement[1]) - pAnim->smElement[1]->SetRotate(float3(1, 0, 0), a); - if (pAnim->smElement[2]) - pAnim->smElement[2]->SetRotate(float3(1, 0, 0), c); // górne ramię - if (pAnim->smElement[3]) - pAnim->smElement[3]->SetRotate(float3(-1, 0, 0), c); - if (pAnim->smElement[4]) - pAnim->smElement[4]->SetRotate(float3(-1, 0, 0), b); //ślizg + float a, b, c; + a = RadToDeg(pAnim->fParamPants->fAngleL - pAnim->fParamPants->fAngleL0); + b = RadToDeg(pAnim->fParamPants->fAngleU - pAnim->fParamPants->fAngleU0); + c = a + b; + if (pAnim->smElement[0]) + pAnim->smElement[0]->SetRotate(float3(-1, 0, 0), a); // dolne ramie 1 + if (pAnim->smElement[1]) + pAnim->smElement[1]->SetRotate(float3(1, 0, 0), a * pAnim->fParamPants->rd2rf); // dolne ramie 2 + if (pAnim->smElement[2]) + pAnim->smElement[2]->SetRotate(float3(1, 0, 0), c); // górne ramie 1 + if (pAnim->smElement[3]) + pAnim->smElement[3]->SetRotate(float3(-1, 0, 0), c * pAnim->fParamPants->rg2rf); // gorne ramie 2 + if (pAnim->smElement[4]) + pAnim->smElement[4]->SetRotate(float3(-1, 0, 0), b * pAnim->fParamPants->slizgrf); // ślizg } // doorstep animation, shift @@ -645,6 +764,24 @@ void TDynamicObject::UpdateMirror( TAnim *pAnim ) { interpolate( 0.0, MoverParameters->MirrorMaxShift, dMirrorMoveL * isactive ) ); } +// wipers +void TDynamicObject::UpdateWiper(TAnim* pAnim) +{ + if (!pAnim || !pAnim->smElement) + return; + + int i = pAnim->iNumber; + // odwaramy animacje dla parzystych indexow + const double rotateAngle = (i + 1) % 2 == 0 ? -MoverParameters->WiperAngle : MoverParameters->WiperAngle; + + if (pAnim->smElement[0]) // ramie 1 + pAnim->smElement[0]->SetRotate(float3(0, 1, 0), smoothInterpolate(0.0, rotateAngle, dWiperPos[i])); + if (pAnim->smElement[1]) // ramie 2 + pAnim->smElement[1]->SetRotate(float3(0, 1, 0), smoothInterpolate(0.0, rotateAngle, dWiperPos[i])); + if (pAnim->smElement[2]) // pioro + pAnim->smElement[2]->SetRotate(float3(0, 1, 0), smoothInterpolate(0.0, -rotateAngle, dWiperPos[i])); +} + /* void TDynamicObject::UpdateLeverDouble(TAnim *pAnim) { // animacja gałki zależna od double @@ -1048,12 +1185,15 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) btnOn = true; } + // only external models ( external_only_on / external_only_off ) + btExteriorOnly.Turn(!bDisplayCab); // display only when cab is not rendered + if( ( false == bDisplayCab ) // edge case, lowpoly may act as a stand-in for the hi-fi cab, so make sure not to show the driver when inside && ( Mechanik != nullptr ) && ( ( Mechanik->action() != TAction::actSleep ) /* || ( MoverParameters->Battery ) */ ) ) { // rysowanie figurki mechanika - btMechanik1.Turn( MoverParameters->CabOccupied > 0 ); + btMechanik1.Turn(MoverParameters->CabOccupied > 0); btMechanik2.Turn( MoverParameters->CabOccupied < 0 ); if( MoverParameters->CabOccupied != 0 ) { btnOn = true; @@ -1168,6 +1308,28 @@ void TDynamicObject::ABuLittleUpdate(double ObjSqrDist) } btnOn = true; } + + // logika dlugich + if (TestFlag(MoverParameters->iLights[end::front], light::highbeamlight_left)) + m_highbeam13.TurnxOnWithOnAsFallback(); + else + m_highbeam13.TurnOff(); + + if (TestFlag(MoverParameters->iLights[end::front], light::highbeamlight_right)) + m_highbeam12.TurnxOnWithOnAsFallback(); + else + m_highbeam12.TurnOff(); + + // i to samo od dupy strony + if (TestFlag(MoverParameters->iLights[end::rear], light::highbeamlight_left)) + m_highbeam23.TurnxOnWithOnAsFallback(); + else + m_highbeam23.TurnOff(); + + if (TestFlag(MoverParameters->iLights[end::rear], light::highbeamlight_right)) + m_highbeam22.TurnxOnWithOnAsFallback(); + else + m_highbeam22.TurnOff(); } // interior light levels auto sectionlightcolor { glm::vec4( 1.f ) }; @@ -2197,9 +2359,13 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424" m_headlamp11.Init( "headlamp11", mdModel ); // górne m_headlamp12.Init( "headlamp12", mdModel ); // prawe m_headlamp13.Init( "headlamp13", mdModel ); // lewe + m_highbeam12.Init("highbeam12", mdModel); // prawe dlugie + m_highbeam13.Init("highbeam13", mdModel); // lewe dlugie m_headlamp21.Init( "headlamp21", mdModel ); m_headlamp22.Init( "headlamp22", mdModel ); m_headlamp23.Init( "headlamp23", mdModel ); + m_highbeam22.Init("highbeam22", mdModel); + m_highbeam23.Init("highbeam23", mdModel); m_headsignal12.Init( "headsignal12", mdModel ); m_headsignal13.Init( "headsignal13", mdModel ); m_headsignal22.Init( "headsignal22", mdModel ); @@ -2216,6 +2382,10 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424" iInventory[ end::front ] |= m_headlamp11.Active() ? light::headlight_upper : 0; iInventory[ end::front ] |= m_headlamp12.Active() ? light::headlight_right : 0; iInventory[ end::front ] |= m_headlamp13.Active() ? light::headlight_left : 0; + + iInventory[end::front] |= m_highbeam12.Active() ? light::highbeamlight_right : 0; + iInventory[end::front] |= m_highbeam13.Active() ? light::highbeamlight_left : 0; + iInventory[ end::rear ] |= m_headlamp21.Active() ? light::headlight_upper : 0; iInventory[ end::rear ] |= m_headlamp22.Active() ? light::headlight_right : 0; iInventory[ end::rear ] |= m_headlamp23.Active() ? light::headlight_left : 0; @@ -2223,8 +2393,15 @@ TDynamicObject::Init(std::string Name, // nazwa pojazdu, np. "EU07-424" iInventory[ end::front ] |= m_headsignal13.Active() ? light::auxiliary_left : 0; iInventory[ end::rear ] |= m_headsignal22.Active() ? light::auxiliary_right : 0; iInventory[ end::rear ] |= m_headsignal23.Active() ? light::auxiliary_left : 0; + + iInventory[end::rear] |= m_highbeam22.Active() ? light::highbeamlight_right : 0; + iInventory[end::rear] |= m_highbeam23.Active() ? light::highbeamlight_left : 0; + + btExteriorOnly.Init("external_only", mdModel, false); + btMechanik1.Init( "mechanik1", mdLowPolyInt, false); btMechanik2.Init( "mechanik2", mdLowPolyInt, false); + if( MoverParameters->dizel_heat.water.config.shutters ) { btShutters1.Init( "shutters1", mdModel, false ); } @@ -3949,6 +4126,70 @@ bool TDynamicObject::Update(double dt, double dt1) MoverParameters->PantFrontVolt = 0.95 * MoverParameters->EnginePowerSource.MaxVoltage; } + // wipers + if (dWiperPos.size() > 0) // tylko dla wozow ze zdefiniowanymi wycierakami + { + for (int i = 0; i < dWiperPos.size(); i++) // iteracja po kazdej wycieraczce + { + bool wipersActive; + auto const bytesum = MoverParameters->WiperList[MoverParameters->wiperSwitchPos].byteSum; + // rozroznienie kabinowe + if (MoverParameters->CabActive == 1) + { + wipersActive = ((bytesum & (1 << i)) != 0) && MoverParameters->Battery; + } + else if (MoverParameters->CabActive == -1) + { + // odwroconie indexow wycieraczek + wipersActive = ((bytesum & (1 << dWiperPos.size() - 1 - i)) != 0) && MoverParameters->Battery; + } + else { + wipersActive = false; + } + + auto const currentWiperParams = MoverParameters->WiperList[workingSwitchPos[i]]; + + wiperOutTimer[i] += dt1; // aktualizujemy zegarek + wiperParkTimer[i] += dt1; // aktualizujemy zegarek + + if (wipersActive || dWiperPos[i] > 0.0) // zeby wrocily do trybu park + { + if (dWiperPos[i] > 0.0 && !wipersActive) // bezwzgledny powrot do zera + { + dWiperPos[i] = std::max(0.0, dWiperPos[i] - (1.f / currentWiperParams.WiperSpeed) * dt1); + } + else { + + if (dWiperPos[i] < 1.0 && !wiperDirection[i] && wiperParkTimer[i] > currentWiperParams.interval) + // go out + { + dWiperPos[i] = std::min(1.0, dWiperPos[i] + (1.f / currentWiperParams.WiperSpeed) * dt1); + } + if (dWiperPos[i] > 0.0 && wiperDirection[i] && wiperOutTimer[i] > currentWiperParams.outBackDelay) + // return back + { + dWiperPos[i] = std::max(0.0, dWiperPos[i] - (1.f / currentWiperParams.WiperSpeed) * dt1); + } + if (dWiperPos[i] == 1.0) // we reached end + { + wiperParkTimer[i] = 0.0; + wiperDirection[i] = true; // switch direction + } + if (dWiperPos[i] == 0.0) + { + // when in park position + wiperOutTimer[i] = 0.0; + wiperDirection[i] = false; + workingSwitchPos[i] = MoverParameters->wiperSwitchPos; // update configuration + } + + } + } + } + } + + + // mirrors if( (MoverParameters->Vel > MoverParameters->MirrorVelClose) || (MoverParameters->CabActive == 0) && (activation::mirrors) @@ -4162,6 +4403,10 @@ void TDynamicObject::TurnOff() m_headlamp21.TurnOff(); m_headlamp22.TurnOff(); m_headlamp23.TurnOff(); + m_highbeam12.TurnOff(); + m_highbeam13.TurnOff(); + m_highbeam22.TurnOff(); + m_highbeam23.TurnOff(); m_headsignal12.TurnOff(); m_headsignal13.TurnOff(); m_headsignal22.TurnOff(); @@ -5002,12 +5247,14 @@ TDynamicObject::radius() const { // McZapkie-250202 // wczytywanie pliku z danymi multimedialnymi (dzwieki) void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string const &ReplacableSkin ) { - + rTypeName = TypeName; + rReplacableSkin = ReplacableSkin; Global.asCurrentDynamicPath = asBaseDir; std::string asFileName = asBaseDir + TypeName + ".mmd"; std::string asAnimName; bool Stop_InternalData = false; pants = NULL; // wskaźnik pierwszego obiektu animującego dla pantografów + wipers = NULL; // wskaznik pierwszego obiektu animujacego dla wycieraczek { // preliminary check whether the file exists cParser parser( TypeName + ".mmd", cParser::buffer_FILE, asBaseDir ); @@ -5094,16 +5341,20 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co pAnimations.resize( iAnimations ); int i, j, k = 0, sm = 0; - for (j = 0; j < ANIM_TYPES; ++j) - for (i = 0; i < iAnimType[j]; ++i) + for (j = 0; j < ANIM_TYPES; ++j) // petla po wszystkich wpisach w animations + for (i = 0; i < iAnimType[j]; ++i) // petla iteruje sie tyle razy ile mamy wpisane w animations { if (j == ANIM_PANTS) // zliczamy poprzednie animacje if (!pants) if (iAnimType[ANIM_PANTS]) // o ile jakieś pantografy są (a domyślnie są) pants = &pAnimations[k]; // zapamiętanie na potrzeby wyszukania submodeli + if (j == ANIM_WIPERS) + if (!wipers) + if (iAnimType[ANIM_WIPERS]) + wipers = &pAnimations[k]; pAnimations[k].iShift = sm; // przesunięcie do przydzielenia wskaźnika - sm += pAnimations[k++].TypeSet(j); // ustawienie typu animacji i zliczanie tablicowanych submodeli - } + sm += pAnimations[k++].TypeSet(j, *MoverParameters); // ustawienie typu animacji i zliczanie tablicowanych submodeli + } if (sm) // o ile są bardziej złożone animacje { pAnimated = new TSubModel *[sm]; // tabela na animowane submodele @@ -5673,6 +5924,52 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co } } + else if (token == "animwiperprefix:") + { + parser.getTokens(1, false); + parser >> token; + TSubModel *sm; + if (wipers) + { + + for (int i = 0; i < iAnimType[ANIM_WIPERS]; i++) // zebranie wszystkich submodeli wycieraczek + { + dWiperPos.emplace_back(0.0); // dodajemy na koniec zeby sie miejsce tam zrobilo i nie bylo invalid addressow potem + + asAnimName = token + std::to_string(i + 1); + // element wycieraczki nr 1 + sm = GetSubmodelFromName(mdModel, asAnimName + "_p1"); + wipers[i].smElement[0] = sm; + if (sm) + { + wipers[i].smElement[0]->WillBeAnimated(); + // auto const offset{wipers[i].smElement[0]->offset()}; + } + + // element wycieraczki nr 2 + sm = GetSubmodelFromName(mdModel, asAnimName + "_p2"); + wipers[i].smElement[1] = sm; + if (sm) + { + wipers[i].smElement[1]->WillBeAnimated(); + // auto const offset{wipers[i].smElement[0]->offset()}; + } + + // element wycieraczki nr 3 + sm = GetSubmodelFromName(mdModel, asAnimName + "_p3"); + wipers[i].smElement[2] = sm; + if (sm) + { + wipers[i].smElement[2]->WillBeAnimated(); + // auto const offset{wipers[i].smElement[0]->offset()}; + } + wipers[i].yUpdate = std::bind(&TDynamicObject::UpdateWiper, this, std::placeholders::_1); + wipers[i].fMaxDist = 150 * 150; + wipers[i].iNumber = i; + } + } + } + } while( ( token != "" ) && ( token != "endmodels" ) ); @@ -6424,6 +6721,19 @@ void TDynamicObject::LoadMMediaFile( std::string const &TypeName, std::string co m_powertrainsounds.rsEngageSlippery.m_frequencyfactor /= ( 1 + MoverParameters->nmax ); } + + // dzwieki wycieraczkuf + else if (token == "wiperFromPark:") + { + sWiperFromPark.deserialize(parser, sound_type::single); + sWiperFromPark.owner(this); + } + else if (token == "wiperToPark:") + { + sWiperToPark.deserialize(parser, sound_type::single); + sWiperToPark.owner(this); + } + else if (token == "retarder:") { m_powertrainsounds.retarder.deserialize(parser, sound_type::single, sound_parameters::amplitude | sound_parameters::frequency); m_powertrainsounds.retarder.owner(this); @@ -7000,7 +7310,6 @@ void TDynamicObject::Damage(char flag) }; void TDynamicObject::SetLights() { - auto const isfrontcaboccupied { MoverParameters->CabOccupied * DirectionGet() >= 0 }; int const automaticmarkers { MoverParameters->CabActive == 0 && ( MoverParameters->InactiveCabFlag & activation::redmarkers ) ? light::redmarker_left + light::redmarker_right : 0 }; @@ -7054,6 +7363,47 @@ void TDynamicObject::RaLightsSet(int head, int rear) if( head >= 0 ) { auto const vehicleend { iDirection > 0 ? end::front : end::rear }; MoverParameters->iLights[ vehicleend ] = ( head & iInventory[ vehicleend ] ); + bool tLeft = MoverParameters->iLights[vehicleend] & (light::auxiliary_left | light::headlight_left); // roboczo czy jakiekolwiek swiatlo z lewej jest zapalone + bool tRight = MoverParameters->iLights[vehicleend] & (light::auxiliary_right | light::headlight_right); // a tu z prawej + if (Controller == Humandriver) { + switch (MoverParameters->modernDimmerState) + { + case 0: + // wylaczone + MoverParameters->iLights[vehicleend] &= 0 | light::rearendsignals; // zostawiamy tylko tabliczki jesli sa + HighBeamLights = false; + DimHeadlights = false; + break; + case 1: + // przyciemnione normalne + DimHeadlights = true; // odpalamy przyciemnienie normalnych reflektorow + HighBeamLights = false; + break; + case 3: + // dlugie przyciemnione + DimHeadlights = true; + HighBeamLights = true; + MoverParameters->iLights[vehicleend] &= + light::headlight_upper | light::rearendsignals | light::redmarker_left | light::redmarker_right | light::rearendsignals; // nie ruszamy gornych i koncowek + MoverParameters->iLights[vehicleend] |= tLeft ? light::highbeamlight_left : 0; // jesli swiatlo z lewej zapalone to odpal dlugie + MoverParameters->iLights[vehicleend] |= tRight ? light::highbeamlight_right : 0; // a tu z prawej + break; + case 4: + // zwykle dlugie + DimHeadlights = false; + HighBeamLights = true; + MoverParameters->iLights[vehicleend] &= + light::headlight_upper | light::rearendsignals | light::redmarker_left | light::redmarker_right | light::rearendsignals; // nie ruszamy gornych i koncowek + MoverParameters->iLights[vehicleend] |= tLeft ? light::highbeamlight_left : 0; // jesli swiatlo z lewej zapalone to odpal dlugie + MoverParameters->iLights[vehicleend] |= tRight ? light::highbeamlight_right : 0; // a tu z prawej + break; + default: // to case 2 - zwykle + DimHeadlights = false; + HighBeamLights = false; + break; + } + } + } if( rear >= 0 ) { auto const vehicleend{ iDirection > 0 ? end::rear : end::front }; @@ -7660,9 +8010,9 @@ TDynamicObject::update_shake( double const Timedelta ) { if( iVel > 0.5 ) { // acceleration-driven base shake shakevector += Math3D::vector3( - -MoverParameters->AccN * Timedelta * 5.0, // highlight side sway - -MoverParameters->AccVert * Timedelta, - -MoverParameters->AccSVBased * Timedelta * 1.5); // accent acceleration/deceleration + -MoverParameters->AccN * Timedelta * 5.0 * Global.ShakingMultiplierRL, // highlight side sway + -MoverParameters->AccVert * Timedelta * Global.ShakingMultiplierUD, + -MoverParameters->AccSVBased * Timedelta * 1.5 * Global.ShakingMultiplierBF); // accent acceleration/deceleration } auto shake { 1.25 * ShakeSpring.ComputateForces( shakevector, ShakeState.offset ) }; @@ -7923,7 +8273,7 @@ TDynamicObject::powertrain_sounds::render( TMoverParameters const &Vehicle, doub // youBy - przenioslem, bo diesel tez moze miec turbo if( Vehicle.TurboTest > 0 ) { // udawanie turbo: - auto const pitch_diesel { Vehicle.EngineType == TEngineType::DieselEngine ? Vehicle.enrot / Vehicle.dizel_nmax * Vehicle.dizel_fill : 1 }; + auto const pitch_diesel{(Vehicle.EngineType == TEngineType::DieselEngine || Vehicle.EngineType == TEngineType::DieselElectric) ? Vehicle.enrot / Vehicle.dizel_nmax * Vehicle.dizel_fill : 1}; auto const goalpitch { std::max( 0.025, ( /*engine_volume **/ pitch_diesel + engine_turbo.m_frequencyoffset ) * engine_turbo.m_frequencyfactor ) }; auto const goalvolume { ( ( ( Vehicle.MainCtrlPos >= Vehicle.TurboTest ) && ( Vehicle.enrot > 0.1 ) ) ? diff --git a/DynObj.h b/DynObj.h index 807e09df..b2b0f817 100644 --- a/DynObj.h +++ b/DynObj.h @@ -22,6 +22,8 @@ http://mozilla.org/MPL/2.0/. #include "sound.h" #include "Spring.h" +#include + #define EU07_SOUND_BOGIESOUNDS //--------------------------------------------------------------------------- @@ -36,7 +38,8 @@ int const ANIM_PANTS = 5; // pantografy int const ANIM_STEAMS = 6; // napęd parowozu int const ANIM_DOORSTEPS = 7; int const ANIM_MIRRORS = 8; -int const ANIM_TYPES = 9; // Ra: ilość typów animacji +int const ANIM_WIPERS = 9; +int const ANIM_TYPES = 10; // Ra: ilość typów animacji class TAnim; //typedef void(__closure *TUpdate)(TAnim *pAnim); // typ funkcji aktualizującej położenie submodeli @@ -103,7 +106,17 @@ class TAnimPant float fWidthExtra; // dodatkowy rozmiar poziomy poza część roboczą (fWidth) float fHeightExtra[5]; //łamana symulująca kształt nabieżnika // double fHorizontal; //Ra 2015-01: położenie drutu względem osi pantografu + + // factory ktore mozna nadpisac z fiza + float rd1rf{1.f}; // mnoznik obrotu ramienia dolnego 1 + float rd2rf{1.f}; // mnoznik obrotu ramienia dolnego 2 + float rg1rf{1.f}; // mnoznik obrotu ramienia gornego 1 + float rg2rf{1.f}; // mnoznik obrotu ramienia gornego 2 + float slizgrf{1.f}; // mnoznik obrotu slizgacza void AKP_4E(); + void WBL85(); + void DSAx(); + void EC160_200(); }; class TAnim @@ -115,8 +128,8 @@ public: // destructor ~TAnim(); // methods - int TypeSet( int i, int fl = 0 ); // ustawienie typu -// members + int TypeSet(int i, TMoverParameters currentMover, int fl = 0); // ustawienie typu + // members union { TSubModel *smAnimated; // animowany submodel (jeśli tylko jeden, np. oś) @@ -209,7 +222,11 @@ public: inline TDynamicObject *PrevConnected() const { return MoverParameters->Neighbours[ end::front ].vehicle; }; // pojazd podłączony od strony sprzęgu 0 (kabina 1) inline int NextConnectedNo() const { return MoverParameters->Neighbours[ end::rear ].vehicle_end; } inline int PrevConnectedNo() const { return MoverParameters->Neighbours[ end::front ].vehicle_end; } -// double fTrackBlock; // odległość do przeszkody do dalszego ruchu (wykrywanie kolizji z innym pojazdem) + + // Dev tools + void Reload(); + + // double fTrackBlock; // odległość do przeszkody do dalszego ruchu (wykrywanie kolizji z innym pojazdem) // modele składowe pojazdu TModel3d *mdModel; // model pudła @@ -277,7 +294,8 @@ private: void UpdatePlatformTranslate(TAnim *pAnim); // doorstep animation, shift void UpdatePlatformRotate(TAnim *pAnim); // doorstep animation, rotate void UpdateMirror(TAnim *pAnim); // mirror animation -/* + void UpdateWiper(TAnim *pAnim); // wiper animation + /* void UpdateLeverDouble(TAnim *pAnim); // animacja gałki zależna od double void UpdateLeverFloat(TAnim *pAnim); // animacja gałki zależna od float void UpdateLeverInt(TAnim *pAnim); // animacja gałki zależna od int (wartość) @@ -301,6 +319,14 @@ private: Math3D::vector3 vFloor; // podłoga dla ładunku public: TAnim *pants; // indeks obiektu animującego dla pantografu 0 + TAnim *wipers; // wycieraczki + std::vector wiperOutTimer = std::vector(8, 0.0); + std::vector wiperParkTimer = std::vector(8, 0.0); + std::vector workingSwitchPos = std::vector(8, 0); // working switch position (to not break wipers when switching modes) + std::vector dWiperPos; // timing na osi czasu animacji wycieraczki + std::vector wiperDirection = std::vector(8, false); // false - return direction; true - out direction + std::vector wiper_playSoundFromStart = std::vector(8, false); + std::vector wiper_playSoundToStart = std::vector(8, false); double NoVoltTime; // czas od utraty zasilania double dMirrorMoveL{ 0.0 }; double dMirrorMoveR{ 0.0 }; @@ -469,13 +495,18 @@ private: AirCoupler m_headlamp11; // oswietlenie czolowe - przod AirCoupler m_headlamp12; AirCoupler m_headlamp13; + AirCoupler m_highbeam12; // dlugie + AirCoupler m_highbeam13; AirCoupler m_headlamp21; // oswietlenie czolowe - tyl AirCoupler m_headlamp22; AirCoupler m_headlamp23; + AirCoupler m_highbeam22; + AirCoupler m_highbeam23; AirCoupler m_headsignal12; AirCoupler m_headsignal13; AirCoupler m_headsignal22; AirCoupler m_headsignal23; + TButton btExteriorOnly; TButton btMechanik1; TButton btMechanik2; TButton btShutters1; // cooling shutters for primary water circuit @@ -515,6 +546,8 @@ private: springbrake_sounds m_springbrakesounds; sound_source rsSlippery { sound_placement::external, EU07_SOUND_BRAKINGCUTOFFRANGE }; // moved from cab sound_source sSand { sound_placement::external }; + sound_source sWiperToPark { sound_placement::internal }; + sound_source sWiperFromPark { sound_placement::internal }; // moving part and other external sounds sound_source m_startjolt { sound_placement::general }; // movement start jolt, played once on initial acceleration at slow enough speed bool m_startjoltplayed { false }; @@ -569,8 +602,12 @@ private: TDynamicObject *ABuFindObject( int &Foundcoupler, double &Distance, TTrack const *Track, int const Direction, int const Mycoupler ) const; void ABuCheckMyTrack(); + std::string rTypeName; // nazwa typu pojazdu + std::string rReplacableSkin; // nazwa tekstury pojazdu + public: bool DimHeadlights{ false }; // status of the headlight dimming toggle. NOTE: single toggle for all lights is a simplification. TODO: separate per-light switches + bool HighBeamLights { false }; // status of the highbeam toggle // checks whether there's unbroken connection of specified type to specified vehicle bool is_connected( TDynamicObject const *Vehicle, coupling const Coupling = coupling::coupler ) const; TDynamicObject * PrevAny() const; diff --git a/Globals.cpp b/Globals.cpp index bea4c702..1df21179 100644 --- a/Globals.cpp +++ b/Globals.cpp @@ -211,6 +211,15 @@ global_settings::ConfigParse(cParser &Parser) { { Parser.getTokens(); Parser >> MultipleLogs; + } + else if (token == "shakefactor") + { + Parser.getTokens(); + Parser >> ShakingMultiplierBF; + Parser.getTokens(); + Parser >> ShakingMultiplierRL; + Parser.getTokens(); + Parser >> ShakingMultiplierUD; } else if (token == "logs.filter") { diff --git a/Globals.h b/Globals.h index eca5b5da..5142c602 100644 --- a/Globals.h +++ b/Globals.h @@ -16,6 +16,9 @@ http://mozilla.org/MPL/2.0/. #include "light.h" #include "utilities.h" #include "motiontelemetry.h" +#include "ref/discord-rpc/include/discord_rpc.h" +#include + #ifdef WITH_UART #include "uart.h" #endif @@ -27,6 +30,11 @@ struct global_settings { // members // data items // TODO: take these out of the settings + + /// + /// Mapa z watkami w formacie + /// + std::map threads = {}; bool shiftState{ false }; //m7todo: brzydko bool ctrlState{ false }; bool altState{ false }; @@ -117,7 +125,9 @@ struct global_settings { glm::ivec2 window_size; // main window size in platform-specific virtual pixels glm::ivec2 cursor_pos; // cursor position in platform-specific virtual pixels glm::ivec2 fb_size; // main window framebuffer size - + float ShakingMultiplierBF {1.f}; // mnożnik bujania kamera przod/tyl + float ShakingMultiplierRL {1.f}; // mnożnik bujania kamera lewo/prawo + float ShakingMultiplierUD {1.f}; // mnożnik bujania kamera gora/dol float fDistanceFactor{ 1.f }; // baza do przeliczania odległości dla LoD float targetfps{ 0.0f }; bool bFullScreen{ false }; diff --git a/Logs.cpp b/Logs.cpp index 61d1c5ad..c24610c6 100644 --- a/Logs.cpp +++ b/Logs.cpp @@ -14,6 +14,7 @@ http://mozilla.org/MPL/2.0/. #include "winheaders.h" #include "utilities.h" #include "uilayer.h" +#include std::ofstream output; // standardowy "log.txt", można go wyłączyć std::ofstream errors; // lista błędów "errors.txt", zawsze działa @@ -68,61 +69,88 @@ std::string filename_scenery() { } } +// log service stacks +std::deque InfoStack; +std::deque ErrorStack; + + +void LogService() +{ + while (true) + { + // loop for logging + + // write logs and log.txt + while (!InfoStack.empty()) + { + char *msg = InfoStack.front(); // get first element of stack + InfoStack.pop_front(); + if (Global.iWriteLogEnabled & 1) + { + if (!output.is_open()) + { + + std::string const filename = (Global.MultipleLogs ? "logs/log (" + filename_scenery() + ") " + filename_date() + ".txt" : "log.txt"); + output.open(filename, std::ios::trunc); + } + output << msg << "\n"; + output.flush(); + } + + log_scrollback.emplace_back(std::string(msg)); + if (log_scrollback.size() > 200) + log_scrollback.pop_front(); + + if (Global.iWriteLogEnabled & 2) + { +#ifdef _WIN32 + // hunter-271211: pisanie do konsoli tylko, gdy nie jest ukrywana + SetConsoleTextAttribute(GetStdHandle(STD_OUTPUT_HANDLE), FOREGROUND_GREEN | FOREGROUND_INTENSITY); + DWORD wr = 0; + WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), msg, (DWORD)strlen(msg), &wr, NULL); + WriteConsole(GetStdHandle(STD_OUTPUT_HANDLE), endstring, (DWORD)strlen(endstring), &wr, NULL); +#else + printf("%s\n", msg); +#endif + } + } + + // write to errors.txt + while (!ErrorStack.empty()) + { + char *msg = ErrorStack.front(); + ErrorStack.pop_front(); + + if (!(Global.iWriteLogEnabled & 1)) + return; + + if (!errors.is_open()) + { + + std::string const filename = (Global.MultipleLogs ? "logs/errors (" + filename_scenery() + ") " + filename_date() + ".txt" : "errors.txt"); + errors.open(filename, std::ios::trunc); + errors << "EU07.EXE " + Global.asVersion << "\n"; + } + + errors << msg << "\n"; + errors.flush(); + } + std::this_thread::sleep_for(std::chrono::milliseconds(5)); // dont burn cpu so much + } +} + void WriteLog( const char *str, logtype const Type ) { if( str == nullptr ) { return; } if( true == TestFlag( Global.DisabledLogTypes, static_cast( Type ) ) ) { return; } - - if (Global.iWriteLogEnabled & 1) { - if( !output.is_open() ) { - - std::string const filename = - ( Global.MultipleLogs ? - "logs/log (" + filename_scenery() + ") " + filename_date() + ".txt" : - "log.txt" ); - output.open( filename, std::ios::trunc ); - } - output << str << "\n"; - output.flush(); - } - - log_scrollback.emplace_back(std::string(str)); - if (log_scrollback.size() > 200) - log_scrollback.pop_front(); - - if( Global.iWriteLogEnabled & 2 ) { -#ifdef _WIN32 - // hunter-271211: pisanie do konsoli tylko, gdy nie jest ukrywana - SetConsoleTextAttribute( GetStdHandle( STD_OUTPUT_HANDLE ), FOREGROUND_GREEN | FOREGROUND_INTENSITY ); - DWORD wr = 0; - WriteConsole( GetStdHandle( STD_OUTPUT_HANDLE ), str, (DWORD)strlen( str ), &wr, NULL ); - WriteConsole( GetStdHandle( STD_OUTPUT_HANDLE ), endstring, (DWORD)strlen( endstring ), &wr, NULL ); -#else - printf("%s\n", str); -#endif - } + InfoStack.emplace_back(strdup(str)); } void ErrorLog( const char *str, logtype const Type ) { if( str == nullptr ) { return; } if( true == TestFlag( Global.DisabledLogTypes, static_cast( Type ) ) ) { return; } - - if (!(Global.iWriteLogEnabled & 1)) - return; - - if (!errors.is_open()) { - - std::string const filename = - ( Global.MultipleLogs ? - "logs/errors (" + filename_scenery() + ") " + filename_date() + ".txt" : - "errors.txt" ); - errors.open( filename, std::ios::trunc ); - errors << "EU07.EXE " + Global.asVersion << "\n"; - } - - errors << str << "\n"; - errors.flush(); + ErrorStack.emplace_back(strdup(str)); }; void Error(const std::string &asMessage, bool box) diff --git a/Logs.h b/Logs.h index ebdb5719..f7bf5795 100644 --- a/Logs.h +++ b/Logs.h @@ -23,7 +23,7 @@ enum class logtype : unsigned int { traction = ( 1 << 9 ), powergrid = ( 1 << 10 ), }; - +void LogService(); void WriteLog( const char *str, logtype const Type = logtype::generic ); void Error( const std::string &asMessage, bool box = false ); void Error( const char* &asMessage, bool box = false ); diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index c23f16f5..59f61e46 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -205,6 +205,8 @@ enum light { rearendsignals = ( 1 << 6 ), auxiliary_left = ( 1 << 7 ), auxiliary_right = ( 1 << 8 ), + highbeamlight_left = ( 1 << 9 ), + highbeamlight_right = ( 1 << 10 ) }; // door operation methods; exclusive @@ -467,6 +469,13 @@ struct TBoilerType { //} }; /*rodzaj odbieraka pradu*/ +enum TPantType +{ + AKP_4E, + DSAx, + EC160_200, + WBL85 +}; struct TCurrentCollector { long CollectorsNo; //musi być tu, bo inaczej się kopie double MinH; double MaxH; //zakres ruchu pantografu, nigdzie nie używany @@ -478,6 +487,7 @@ struct TCurrentCollector { double MaxPress; //maksymalne ciśnienie za reduktorem bool FakePower; int PhysicalLayout; + TPantType PantographType; //inline TCurrentCollector() { // CollectorsNo = 0; // MinH, MaxH, CSW, MinV, MaxV = 0.0; @@ -599,6 +609,17 @@ struct TDEScheme double Umax = 0.0; /*napiecie maksymalne*/ double Imax = 0.0; /*prad maksymalny*/ }; + +struct TWiperScheme +{ + uint8_t byteSum = 0; // suma bitowa pracujacych wycieraczek + double WiperSpeed = 0.0; // predkosc wycieraczki + double interval = 0.0; // interwal pracy wycieraczki + double outBackDelay = 0.0; // czas po jakim wycieraczka zacznie wracac z konca do poczatku +}; +typedef TWiperScheme TWiperSchemeTable[16]; + + typedef TDEScheme TDESchemeTable[33]; /*tablica rezystorow rozr.*/ struct TShuntScheme { @@ -812,304 +833,322 @@ struct inverter { class TMoverParameters { // Ra: wrapper na kod pascalowy, przejmujący jego funkcje Q: 20160824 - juz nie wrapper a klasa bazowa :) -private: -// types -/* TODO: implement - // communication cable, exchanging control signals with adjacent vehicle - struct jumper_cable { - // types - using flag_pair = std::pair; - // members - // booleans - // std::array flags {}; - // boolean pairs, exchanged data is swapped when connected to a matching end (front to front or back to back) - // TBD, TODO: convert to regular bool array for efficiency once it's working? - std::array flag_pairs {}; - // integers - // std::array values {}; - }; -*/ - // basic approximation of a generic device - // TBD: inheritance or composition? - struct basic_device { - // config - start_t start_type { start_t::manual }; - // ld inputs - bool is_enabled { false }; // device is allowed/requested to operate - bool is_disabled { false }; // device is requested to stop - // TODO: add remaining inputs; start conditions and potential breakers - // ld outputs - bool is_active { false }; // device is working - }; - - struct basic_light : public basic_device { - // config - float dimming { 1.0f }; // light strength multiplier - // ld outputs - float intensity { 0.0f }; // current light strength - }; - - struct cooling_fan : public basic_device { - // config - float speed { 0.f }; // cooling fan rpm; either fraction of parent rpm, or absolute value if negative - float sustain_time { 0.f }; // time of sustaining work of cooling fans after stop - float min_start_velocity { -1.f }; // minimal velocity of vehicle, when cooling fans activate - // ld outputs - float revolutions { 0.f }; // current fan rpm - float stop_timer { 0.f }; // current time, when shut off condition is active - }; - - // basic approximation of a fuel pump - struct fuel_pump : public basic_device { - // TODO: fuel consumption, optional automatic engine start after activation - }; - - // basic approximation of an oil pump - struct oil_pump : public basic_device { - // config - float pressure_minimum { 0.f }; // lowest acceptable working pressure - float pressure_maximum { 0.65f }; // oil pressure at maximum engine revolutions - // ld inputs - float resource_amount { 1.f }; // amount of affected resource, compared to nominal value - // internal data - float pressure_target { 0.f }; - // ld outputs - float pressure { 0.f }; // current pressure - }; - - // basic approximation of a water pump - struct water_pump : public basic_device { - // ld inputs - // TODO: move to breaker list in the basic device once implemented - bool breaker { false }; // device is allowed to operate - }; - - // basic approximation of a solenoid valve - struct basic_valve : basic_device { - // config - bool solenoid { true }; // requires electric power to operate - bool spring { true }; // spring return or double acting actuator - }; - - // basic approximation of a pantograph - struct basic_pantograph { - // ld inputs - basic_valve valve; // associated pneumatic valve - // ld outputs - bool is_active { false }; // device is working - bool sound_event { false }; // indicates last state which generated sound event - double voltage { 0.0 }; - }; - - // basic approximation of doors - struct basic_door { - // config - // ld inputs - bool open_permit { false }; // door can be opened - bool local_open { false }; // local attempt to open the door - bool local_close { false }; // local attempt to close the door - bool remote_open { false }; // received remote signal to open the door - bool remote_close { false }; // received remote signal to close the door - // internal data - float auto_timer { -1.f }; // delay between activation of open state and closing state for automatic doors - float close_delay { 0.f }; // delay between activation of closing state and actual closing - float open_delay { 0.f }; // delay between activation of opening state and actual opening - float position { 0.f }; // current shift of the door from the closed position - float step_position { 0.f }; // current shift of the movable step from the retracted position - // ld outputs - bool is_closed { true }; // the door is fully closed - bool is_door_closed { true }; // the door is fully closed, step doesn't matter - bool is_closing { false }; // the door is currently closing - bool is_opening { false }; // the door is currently opening - bool is_open { false }; // the door is fully open - bool step_folding { false }; // the doorstep is currently closing - bool step_unfolding { false }; // the doorstep is currently opening - }; - - struct door_data { - // config - control_t open_control { control_t::passenger }; - float open_rate { 1.f }; - float open_delay { 0.f }; - control_t close_control { control_t::passenger }; - float close_rate { 1.f }; - float close_delay { 0.f }; - int type { 2 }; - float range { 0.f }; // extent of primary move/rotation - float range_out { 0.f }; // extent of shift outward, applicable for plug doors - int step_type { 2 }; - float step_rate { 0.5f }; - float step_range { 0.f }; - bool has_lock { false }; - bool has_warning { false }; - bool has_autowarning { false }; - float auto_duration { -1.f }; // automatic door closure delay period - float auto_velocity { -1.f }; // automatic door closure velocity threshold - bool auto_include_remote { false }; // automatic door closure applies also to remote control - bool permit_needed { false }; - std::vector permit_presets; // permit presets selectable with preset switch - float voltage { 0.f }; // power type required for door movement - // ld inputs - bool lock_enabled { true }; - bool step_enabled { true }; - bool remote_only { false }; // door ignores local control signals - // internal data - int permit_preset { -1 }; // curent position of preset selection switch - // vehicle parts - std::array instances; // door on the right and left side of the vehicle - // ld outputs - bool is_locked { false }; - double doorLockSpeed = 10.0; // predkosc przy ktorej wyzwalana jest blokada drzwi - }; - - struct water_heater { - // config - struct heater_config_t { - float temp_min { -1 }; // lowest accepted temperature - float temp_max { -1 }; // highest accepted temperature - } config; - // ld inputs - bool breaker { false }; // device is allowed to operate - bool is_enabled { false }; // device is requested to operate - // ld outputs - bool is_active { false }; // device is working - bool is_damaged { false }; // device is damaged - }; - - struct heat_data { - // input, state of relevant devices - bool cooling { false }; // TODO: user controlled device, implement - // bool okienko { true }; // window in the engine compartment - // system configuration - bool auxiliary_water_circuit { false }; // cooling system has an extra water circuit - double fan_speed { 0.075 }; // cooling fan rpm; either fraction of engine rpm, or absolute value if negative - // heat exchange factors - double kw { 0.35 }; - double kv { 0.6 }; - double kfe { 1.0 }; - double kfs { 80.0 }; - double kfo { 25.0 }; - double kfo2 { 25.0 }; - // system parts - struct fluid_circuit_t { - - struct circuit_config_t { - float temp_min { -1 }; // lowest accepted temperature - float temp_max { -1 }; // highest accepted temperature - float temp_cooling { -1 }; // active cooling activation point - float temp_flow { -1 }; // fluid flow activation point - bool shutters { false }; // the radiator has shutters to assist the cooling - } config; - bool is_cold { false }; // fluid is too cold - bool is_warm { false }; // fluid is too hot - bool is_hot { false }; // fluid temperature crossed cooling threshold - bool is_flowing { false }; // fluid is being pushed through the circuit - } water, - water_aux, - oil; - // output, state of affected devices - bool PA { false }; // malfunction flag - float rpmw { 0.0 }; // current main circuit fan revolutions - float rpmwz { 0.0 }; // desired main circuit fan revolutions - bool zaluzje1 { false }; - float rpmw2 { 0.0 }; // current auxiliary circuit fan revolutions - float rpmwz2 { 0.0 }; // desired auxiliary circuit fan revolutions - bool zaluzje2 { false }; - // output, temperatures - float Te { 15.0 }; // ambient temperature TODO: get it from environment data - // NOTE: by default the engine is initialized in warm, startup-ready state - float Ts { 50.0 }; // engine temperature - float To { 45.0 }; // oil temperature - float Tsr { 50.0 }; // main circuit radiator temperature (?) - float Twy { 50.0 }; // main circuit water temperature - float Tsr2 { 40.0 }; // secondary circuit radiator temperature (?) - float Twy2 { 40.0 }; // secondary circuit water temperature - float temperatura1 { 50.0 }; - float temperatura2 { 40.0 }; - float powerfactor { 1.0 }; // coefficient of heat generation for engines other than su45 - }; - - struct spring_brake { - std::shared_ptr Cylinder; - bool Activate { false }; //Input: switching brake on/off in exploitation - main valve/switch - bool ShuttOff { true }; //Input: shutting brake off during failure - valve in pneumatic container - bool Release { false }; //Input: emergency releasing rod - - bool IsReady{ false }; //Output: readyness to braking - cylinder is armed, spring is tentioned - bool IsActive{ false }; //Output: brake is working - double SBP{ 0.0 }; //Output: pressure in spring brake cylinder - - bool PNBrakeConnection{ false }; //Conf: connection to pneumatic brake cylinders - double MaxSetPressure { 0.0 }; //Conf: Maximal pressure for switched off brake - double ResetPressure{ 0.0 }; //Conf: Pressure for arming brake cylinder - double MinForcePressure{ 0.1 }; //Conf: Minimal pressure for zero force - double MaxBrakeForce{ 0.0 }; //Conf: Maximal tension for brake pads/shoes - double PressureOn{ -2.0 }; //Conf: Pressure changing ActiveFlag to "On" - double PressureOff{ -1.0 }; //Conf: Pressure changing ActiveFlag to "Off" - double ValveOffArea{ 0.0 }; //Conf: Area of filling valve - double ValveOnArea{ 0.0 }; //Conf: Area of dumping valve - double ValvePNBrakeArea{ 0.0 }; //Conf: Area of bypass to brake cylinders - - int MultiTractionCoupler{ 127 }; //Conf: Coupling flag necessary for transmitting the command - + private: + // types + /* TODO: implement + // communication cable, exchanging control signals with adjacent vehicle + struct jumper_cable { + // types + using flag_pair = std::pair; + // members + // booleans + // std::array flags {}; + // boolean pairs, exchanged data is swapped when connected to a matching end (front to front or back to back) + // TBD, TODO: convert to regular bool array for efficiency once it's working? + std::array flag_pairs {}; + // integers + // std::array values {}; + }; + */ + // basic approximation of a generic device + // TBD: inheritance or composition? + struct basic_device + { + // config + start_t start_type{start_t::manual}; + // ld inputs + bool is_enabled{false}; // device is allowed/requested to operate + bool is_disabled{false}; // device is requested to stop + // TODO: add remaining inputs; start conditions and potential breakers + // ld outputs + bool is_active{false}; // device is working }; -public: + struct basic_light : public basic_device + { + // config + float dimming{1.0f}; // light strength multiplier + // ld outputs + float intensity{0.0f}; // current light strength + }; + struct cooling_fan : public basic_device + { + // config + float speed{0.f}; // cooling fan rpm; either fraction of parent rpm, or absolute value if negative + float sustain_time{0.f}; // time of sustaining work of cooling fans after stop + float min_start_velocity{-1.f}; // minimal velocity of vehicle, when cooling fans activate + // ld outputs + float revolutions{0.f}; // current fan rpm + float stop_timer{0.f}; // current time, when shut off condition is active + }; + + // basic approximation of a fuel pump + struct fuel_pump : public basic_device + { + // TODO: fuel consumption, optional automatic engine start after activation + }; + + // basic approximation of an oil pump + struct oil_pump : public basic_device + { + // config + float pressure_minimum{0.f}; // lowest acceptable working pressure + float pressure_maximum{0.65f}; // oil pressure at maximum engine revolutions + // ld inputs + float resource_amount{1.f}; // amount of affected resource, compared to nominal value + // internal data + float pressure_target{0.f}; + // ld outputs + float pressure{0.f}; // current pressure + }; + + // basic approximation of a water pump + struct water_pump : public basic_device + { + // ld inputs + // TODO: move to breaker list in the basic device once implemented + bool breaker{false}; // device is allowed to operate + }; + + // basic approximation of a solenoid valve + struct basic_valve : basic_device + { + // config + bool solenoid{true}; // requires electric power to operate + bool spring{true}; // spring return or double acting actuator + }; + + // basic approximation of a pantograph + struct basic_pantograph + { + // ld inputs + basic_valve valve; // associated pneumatic valve + // ld outputs + bool is_active{false}; // device is working + bool sound_event{false}; // indicates last state which generated sound event + double voltage{0.0}; + }; + + // basic approximation of doors + struct basic_door + { + // config + // ld inputs + bool open_permit{false}; // door can be opened + bool local_open{false}; // local attempt to open the door + bool local_close{false}; // local attempt to close the door + bool remote_open{false}; // received remote signal to open the door + bool remote_close{false}; // received remote signal to close the door + // internal data + float auto_timer{-1.f}; // delay between activation of open state and closing state for automatic doors + float close_delay{0.f}; // delay between activation of closing state and actual closing + float open_delay{0.f}; // delay between activation of opening state and actual opening + float position{0.f}; // current shift of the door from the closed position + float step_position{0.f}; // current shift of the movable step from the retracted position + // ld outputs + bool is_closed{true}; // the door is fully closed + bool is_door_closed{true}; // the door is fully closed, step doesn't matter + bool is_closing{false}; // the door is currently closing + bool is_opening{false}; // the door is currently opening + bool is_open{false}; // the door is fully open + bool step_folding{false}; // the doorstep is currently closing + bool step_unfolding{false}; // the doorstep is currently opening + }; + + struct door_data + { + // config + control_t open_control{control_t::passenger}; + float open_rate{1.f}; + float open_delay{0.f}; + control_t close_control{control_t::passenger}; + float close_rate{1.f}; + float close_delay{0.f}; + int type{2}; + float range{0.f}; // extent of primary move/rotation + float range_out{0.f}; // extent of shift outward, applicable for plug doors + int step_type{2}; + float step_rate{0.5f}; + float step_range{0.f}; + bool has_lock{false}; + bool has_warning{false}; + bool has_autowarning{false}; + float auto_duration{-1.f}; // automatic door closure delay period + float auto_velocity{-1.f}; // automatic door closure velocity threshold + bool auto_include_remote{false}; // automatic door closure applies also to remote control + bool permit_needed{false}; + std::vector permit_presets; // permit presets selectable with preset switch + float voltage{0.f}; // power type required for door movement + // ld inputs + bool lock_enabled{true}; + bool step_enabled{true}; + bool remote_only{false}; // door ignores local control signals + // internal data + int permit_preset{-1}; // curent position of preset selection switch + // vehicle parts + std::array instances; // door on the right and left side of the vehicle + // ld outputs + bool is_locked{false}; + double doorLockSpeed = 10.0; // predkosc przy ktorej wyzwalana jest blokada drzwi + }; + + struct water_heater + { + // config + struct heater_config_t + { + float temp_min{-1}; // lowest accepted temperature + float temp_max{-1}; // highest accepted temperature + } config; + // ld inputs + bool breaker{false}; // device is allowed to operate + bool is_enabled{false}; // device is requested to operate + // ld outputs + bool is_active{false}; // device is working + bool is_damaged{false}; // device is damaged + }; + + struct heat_data + { + // input, state of relevant devices + bool cooling{false}; // TODO: user controlled device, implement + // bool okienko { true }; // window in the engine compartment + // system configuration + bool auxiliary_water_circuit{false}; // cooling system has an extra water circuit + double fan_speed{0.075}; // cooling fan rpm; either fraction of engine rpm, or absolute value if negative + // heat exchange factors + double kw{0.35}; + double kv{0.6}; + double kfe{1.0}; + double kfs{80.0}; + double kfo{25.0}; + double kfo2{25.0}; + // system parts + struct fluid_circuit_t + { + + struct circuit_config_t + { + float temp_min{-1}; // lowest accepted temperature + float temp_max{-1}; // highest accepted temperature + float temp_cooling{-1}; // active cooling activation point + float temp_flow{-1}; // fluid flow activation point + bool shutters{false}; // the radiator has shutters to assist the cooling + } config; + bool is_cold{false}; // fluid is too cold + bool is_warm{false}; // fluid is too hot + bool is_hot{false}; // fluid temperature crossed cooling threshold + bool is_flowing{false}; // fluid is being pushed through the circuit + } water, water_aux, oil; + // output, state of affected devices + bool PA{false}; // malfunction flag + float rpmw{0.0}; // current main circuit fan revolutions + float rpmwz{0.0}; // desired main circuit fan revolutions + bool zaluzje1{false}; + float rpmw2{0.0}; // current auxiliary circuit fan revolutions + float rpmwz2{0.0}; // desired auxiliary circuit fan revolutions + bool zaluzje2{false}; + // output, temperatures + float Te{15.0}; // ambient temperature TODO: get it from environment data + // NOTE: by default the engine is initialized in warm, startup-ready state + float Ts{50.0}; // engine temperature + float To{45.0}; // oil temperature + float Tsr{50.0}; // main circuit radiator temperature (?) + float Twy{50.0}; // main circuit water temperature + float Tsr2{40.0}; // secondary circuit radiator temperature (?) + float Twy2{40.0}; // secondary circuit water temperature + float temperatura1{50.0}; + float temperatura2{40.0}; + float powerfactor{1.0}; // coefficient of heat generation for engines other than su45 + }; + + struct spring_brake + { + std::shared_ptr Cylinder; + bool Activate{false}; // Input: switching brake on/off in exploitation - main valve/switch + bool ShuttOff{true}; // Input: shutting brake off during failure - valve in pneumatic container + bool Release{false}; // Input: emergency releasing rod + + bool IsReady{false}; // Output: readyness to braking - cylinder is armed, spring is tentioned + bool IsActive{false}; // Output: brake is working + double SBP{0.0}; // Output: pressure in spring brake cylinder + + bool PNBrakeConnection{false}; // Conf: connection to pneumatic brake cylinders + double MaxSetPressure{0.0}; // Conf: Maximal pressure for switched off brake + double ResetPressure{0.0}; // Conf: Pressure for arming brake cylinder + double MinForcePressure{0.1}; // Conf: Minimal pressure for zero force + double MaxBrakeForce{0.0}; // Conf: Maximal tension for brake pads/shoes + double PressureOn{-2.0}; // Conf: Pressure changing ActiveFlag to "On" + double PressureOff{-1.0}; // Conf: Pressure changing ActiveFlag to "Off" + double ValveOffArea{0.0}; // Conf: Area of filling valve + double ValveOnArea{0.0}; // Conf: Area of dumping valve + double ValvePNBrakeArea{0.0}; // Conf: Area of bypass to brake cylinders + + int MultiTractionCoupler{127}; // Conf: Coupling flag necessary for transmitting the command + }; + + public: + std::string chkPath; + bool reload_FIZ(); double dMoveLen = 0.0; /*---opis lokomotywy, wagonu itp*/ /*--opis serii--*/ - int CategoryFlag = 1; /*1 - pociag, 2 - samochod, 4 - statek, 8 - samolot*/ - /*--sekcja stalych typowych parametrow*/ - std::string TypeName; /*nazwa serii/typu*/ + int CategoryFlag = 1; /*1 - pociag, 2 - samochod, 4 - statek, 8 - samolot*/ + /*--sekcja stalych typowych parametrow*/ + std::string TypeName; /*nazwa serii/typu*/ int TrainType = 0; /*typ: EZT/elektrowoz - Winger 040304 Ra: powinno być szybciej niż string*/ - TEngineType EngineType = TEngineType::None; /*typ napedu*/ - TPowerParameters EnginePowerSource; /*zrodlo mocy dla silnikow*/ - TPowerParameters SystemPowerSource; /*zrodlo mocy dla systemow sterowania/przetwornic/sprezarek*/ - TPowerParameters HeatingPowerSource; /*zrodlo mocy dla ogrzewania*/ + TEngineType EngineType = TEngineType::None; /*typ napedu*/ + TPowerParameters EnginePowerSource; /*zrodlo mocy dla silnikow*/ + TPowerParameters SystemPowerSource; /*zrodlo mocy dla systemow sterowania/przetwornic/sprezarek*/ + TPowerParameters HeatingPowerSource; /*zrodlo mocy dla ogrzewania*/ TPowerParameters AlterHeatPowerSource; /*alternatywne zrodlo mocy dla ogrzewania*/ - TPowerParameters LightPowerSource; /*zrodlo mocy dla oswietlenia*/ - TPowerParameters AlterLightPowerSource;/*alternatywne mocy dla oswietlenia*/ - double Vmax = -1.0; - double Mass = 0.0; - double Power = 0.0; /*max. predkosc kontrukcyjna, masa wlasna, moc*/ - double Mred = 0.0; /*Ra: zredukowane masy wirujące; potrzebne do obliczeń hamowania*/ + TPowerParameters LightPowerSource; /*zrodlo mocy dla oswietlenia*/ + TPowerParameters AlterLightPowerSource; /*alternatywne mocy dla oswietlenia*/ + double Vmax = -1.0; + double Mass = 0.0; + double Power = 0.0; /*max. predkosc kontrukcyjna, masa wlasna, moc*/ + double Mred = 0.0; /*Ra: zredukowane masy wirujące; potrzebne do obliczeń hamowania*/ double TotalMass = 0.0; /*wyliczane przez ComputeMass*/ double HeatingPower = 0.0; - double EngineHeatingRPM { 0.0 }; // guaranteed engine revolutions with heating enabled - double LightPower = 0.0; /*moc pobierana na ogrzewanie/oswietlenie*/ - double BatteryVoltage = 0.0; /*Winger - baterie w elektrykach*/ + double EngineHeatingRPM{0.0}; // guaranteed engine revolutions with heating enabled + double LightPower = 0.0; /*moc pobierana na ogrzewanie/oswietlenie*/ + double BatteryVoltage = 0.0; /*Winger - baterie w elektrykach*/ bool Battery = false; /*Czy sa zalaczone baterie*/ - start_t BatteryStart = start_t::manual; + start_t BatteryStart = start_t::manual; bool EpFuse = true; /*Czy sa zalavzone baterie*/ double EpForce = 0.0; /*Poziom zadanej sily EP*/ - bool Signalling = false; /*Czy jest zalaczona sygnalizacja hamowania ostatniego wagonu*/ - bool Radio = false; /*Czy jest zalaczony radiotelefon*/ - float NominalBatteryVoltage = 0.f; /*Winger - baterie w elektrykach*/ - TDimension Dim; /*wymiary*/ - double Cx = 0.0; /*wsp. op. aerodyn.*/ - float Floor = 0.96f; //poziom podłogi dla ładunków - float WheelDiameter = 1.f; /*srednica kol napednych*/ - float WheelDiameterL = 0.9f; //Ra: srednica kol tocznych przednich - float WheelDiameterT = 0.9f; //Ra: srednica kol tocznych tylnych - float TrackW = 1.435f; /*nominalna szerokosc toru [m]*/ + bool Signalling = false; /*Czy jest zalaczona sygnalizacja hamowania ostatniego wagonu*/ + bool Radio = false; /*Czy jest zalaczony radiotelefon*/ + float NominalBatteryVoltage = 0.f; /*Winger - baterie w elektrykach*/ + TDimension Dim; /*wymiary*/ + double Cx = 0.0; /*wsp. op. aerodyn.*/ + float Floor = 0.96f; // poziom podłogi dla ładunków + float WheelDiameter = 1.f; /*srednica kol napednych*/ + float WheelDiameterL = 0.9f; // Ra: srednica kol tocznych przednich + float WheelDiameterT = 0.9f; // Ra: srednica kol tocznych tylnych + float TrackW = 1.435f; /*nominalna szerokosc toru [m]*/ double AxleInertialMoment = 0.0; /*moment bezwladnosci zestawu kolowego*/ - std::string AxleArangement; /*uklad osi np. Bo'Bo' albo 1'C*/ - int NPoweredAxles = 0; /*ilosc osi napednych liczona z powyzszego*/ - int NAxles = 0; /*ilosc wszystkich osi j.w.*/ - int BearingType = 1; /*lozyska: 0 - slizgowe, 1 - toczne*/ - double ADist = 0.0; double BDist = 0.0; /*odlegosc osi oraz czopow skretu*/ - /*hamulce:*/ - int NBpA = 0; /*ilosc el. ciernych na os: 0 1 2 lub 4*/ - int SandCapacity = 0; /*zasobnik piasku [kg]*/ - TBrakeSystem BrakeSystem = TBrakeSystem::Individual;/*rodzaj hamulca zespolonego*/ - TBrakeSubSystem BrakeSubsystem = TBrakeSubSystem::ss_None ; + std::string AxleArangement; /*uklad osi np. Bo'Bo' albo 1'C*/ + int NPoweredAxles = 0; /*ilosc osi napednych liczona z powyzszego*/ + int NAxles = 0; /*ilosc wszystkich osi j.w.*/ + int BearingType = 1; /*lozyska: 0 - slizgowe, 1 - toczne*/ + double ADist = 0.0; + double BDist = 0.0; /*odlegosc osi oraz czopow skretu*/ + /*hamulce:*/ + int NBpA = 0; /*ilosc el. ciernych na os: 0 1 2 lub 4*/ + int SandCapacity = 0; /*zasobnik piasku [kg]*/ + TBrakeSystem BrakeSystem = TBrakeSystem::Individual; /*rodzaj hamulca zespolonego*/ + TBrakeSubSystem BrakeSubsystem = TBrakeSubSystem::ss_None; TBrakeValve BrakeValve = TBrakeValve::NoValve; TBrakeHandle BrakeHandle = TBrakeHandle::NoHandle; TBrakeHandle BrakeLocHandle = TBrakeHandle::NoHandle; bool LocHandleTimeTraxx = false; /*hamulec dodatkowy typu traxx*/ double MBPM = 1.0; /*masa najwiekszego cisnienia*/ + int wiperSwitchPos = 0; // pozycja przelacznika wycieraczek + double WiperAngle = {45.0}; // kat pracy wycieraczek + std::shared_ptr Hamulec; std::shared_ptr Handle; std::shared_ptr LocHandle; @@ -1117,37 +1156,40 @@ public: std::shared_ptr Pipe2; spring_brake SpringBrake; - TLocalBrake LocalBrake = TLocalBrake::NoBrake; /*rodzaj hamulca indywidualnego*/ + TLocalBrake LocalBrake = TLocalBrake::NoBrake; /*rodzaj hamulca indywidualnego*/ TBrakePressureTable BrakePressureTable; /*wyszczegolnienie cisnien w rurze*/ - TBrakePressure BrakePressureActual; //wartości ważone dla aktualnej pozycji kranu - int ASBType = 0; /*0: brak hamulca przeciwposlizgowego, 1: reczny, 2: automat*/ - int UniversalBrakeButtonFlag[3] = { 0, 0, 0 }; /* mozliwe działania przycisków hamulcowych */ - int UniversalResetButtonFlag[3] = { 0, 0, 0 }; // customizable reset buttons assignments + TBrakePressure BrakePressureActual; // wartości ważone dla aktualnej pozycji kranu + int ASBType = 0; /*0: brak hamulca przeciwposlizgowego, 1: reczny, 2: automat*/ + int UniversalBrakeButtonFlag[3] = {0, 0, 0}; /* mozliwe działania przycisków hamulcowych */ + int UniversalResetButtonFlag[3] = {0, 0, 0}; // customizable reset buttons assignments int TurboTest = 0; - double MaxBrakeForce = 0.0; /*maksymalna sila nacisku hamulca*/ - double MaxBrakePress[5]; //pomocniczy, proz, sred, lad, pp + bool isBatteryButtonImpulse = false; // czy przelacznik baterii traktowac jako pojedynczy przycisk + bool shouldHoldBatteryButton = false; // czy nalezy przytrzymac przycisk baterii aby wlaczyc/wylaczyc baterie + float BatteryButtonHoldTime = 1.f; // minimalny czas przytrzymania przycisku baterii + double MaxBrakeForce = 0.0; /*maksymalna sila nacisku hamulca*/ + double MaxBrakePress[5]; // pomocniczy, proz, sred, lad, pp double P2FTrans = 0.0; - double TrackBrakeForce = 0.0; /*sila nacisku hamulca szynowego*/ - int BrakeMethod = 0; /*flaga rodzaju hamulca*/ - bool Handle_AutomaticOverload = false; //automatyczna asymilacja na pozycji napelniania - bool Handle_ManualOverload = false; //reczna asymilacja na guzik + double TrackBrakeForce = 0.0; /*sila nacisku hamulca szynowego*/ + int BrakeMethod = 0; /*flaga rodzaju hamulca*/ + bool Handle_AutomaticOverload = false; // automatyczna asymilacja na pozycji napelniania + bool Handle_ManualOverload = false; // reczna asymilacja na guzik double Handle_GenericDoubleParameter1 = 0.0; double Handle_GenericDoubleParameter2 = 0.0; - double Handle_OverloadMaxPressure = 1.0; //maksymalne zwiekszenie cisnienia przy asymilacji - double Handle_OverloadPressureDecrease = 0.002; //predkosc spadku cisnienia przy asymilacji - /*max. cisnienie w cyl. ham., stala proporcjonalnosci p-K*/ + double Handle_OverloadMaxPressure = 1.0; // maksymalne zwiekszenie cisnienia przy asymilacji + double Handle_OverloadPressureDecrease = 0.002; // predkosc spadku cisnienia przy asymilacji + /*max. cisnienie w cyl. ham., stala proporcjonalnosci p-K*/ double HighPipePress = 0.0; - double LowPipePress = 0.0; - double DeltaPipePress = 0.0; + double LowPipePress = 0.0; + double DeltaPipePress = 0.0; /*max. i min. robocze cisnienie w przewodzie glownym oraz roznica miedzy nimi*/ - double CntrlPipePress = 0.0; //ciśnienie z zbiorniku sterującym + double CntrlPipePress = 0.0; // ciśnienie z zbiorniku sterującym double BrakeVolume = 0.0; - double BrakeVVolume = 0.0; - double VeselVolume = 0.0; + double BrakeVVolume = 0.0; + double VeselVolume = 0.0; /*pojemnosc powietrza w ukladzie hamulcowym, w ukladzie glownej sprezarki [m^3] */ int BrakeCylNo = 0; /*ilosc cylindrow ham.*/ double BrakeCylRadius = 0.0; - double BrakeCylDist = 0.0; + double BrakeCylDist = 0.0; double BrakeCylMult[3]; int LoadFlag = 0; /*promien cylindra, skok cylindra, przekladnia hamulcowa*/ @@ -1160,13 +1202,13 @@ public: std::string BrakeValveParams; double Spg = 0.0; double MinCompressor = 0.0; - double MaxCompressor = 0.0; + double MaxCompressor = 0.0; double MinCompressor_cabA = 0.0; double MaxCompressor_cabA = 0.0; double MinCompressor_cabB = 0.0; double MaxCompressor_cabB = 0.0; bool CabDependentCompressor = false; - double CompressorSpeed = 0.0; + double CompressorSpeed = 0.0; int CompressorList[4][9]; // pozycje świateł, przód - tył, 1 .. 16 double EmergencyValveOn = 0.0; double EmergencyValveOff = 0.0; @@ -1181,37 +1223,39 @@ public: bool CompressorListWrap = false; /*cisnienie wlaczania, zalaczania sprezarki, wydajnosc sprezarki*/ TBrakeDelayTable BrakeDelay; /*opoznienie hamowania/odhamowania t/o*/ - double AirLeakRate{ 0.01 }; // base rate of air leak from brake system components ( 0.001 = 1 l/sec ) - int BrakeCtrlPosNo = 0; /*ilosc pozycji hamulca*/ - /*nastawniki:*/ - int MainCtrlPosNo = 0; /*ilosc pozycji nastawnika*/ + double AirLeakRate{0.01}; // base rate of air leak from brake system components ( 0.001 = 1 l/sec ) + int BrakeCtrlPosNo = 0; /*ilosc pozycji hamulca*/ + /*nastawniki:*/ + int MainCtrlPosNo = 0; /*ilosc pozycji nastawnika*/ int ScndCtrlPosNo = 0; int LightsPosNo = 0; - int LightsDefPos = 1; + int LightsDefPos = 1; bool LightsWrap = false; int Lights[2][17]; // pozycje świateł, przód - tył, 1 .. 16 - int ScndInMain{ 0 }; /*zaleznosc bocznika od nastawnika*/ - bool MBrake = false; /*Czy jest hamulec reczny*/ - double maxTachoSpeed = { 0.0 }; // maksymalna predkosc na tarczce predkosciomierza analogowego - double StopBrakeDecc = { 0.0 }; - bool ReleaseParkingBySpringBrake { false }; - bool ReleaseParkingBySpringBrakeWhenDoorIsOpen{ false }; - bool SpringBrakeCutsOffDrive { true }; - double SpringBrakeDriveEmergencyVel { -1 }; - bool HideDirStatusWhenMoving { false }; // Czy gasic lampki kierunku powyzej predkosci zdefiniowanej przez HideDirStatusSpeed - int HideDirStatusSpeed{ 1 }; // Predkosc od ktorej lampki kierunku sa wylaczane + int ScndInMain{0}; /*zaleznosc bocznika od nastawnika*/ + bool MBrake = false; /*Czy jest hamulec reczny*/ + double maxTachoSpeed = {0.0}; // maksymalna predkosc na tarczce predkosciomierza analogowego + double StopBrakeDecc = 0.0; + bool ReleaseParkingBySpringBrake{false}; + bool ReleaseParkingBySpringBrakeWhenDoorIsOpen{false}; + bool SpringBrakeCutsOffDrive{true}; + double SpringBrakeDriveEmergencyVel{-1}; + bool HideDirStatusWhenMoving{false}; // Czy gasic lampki kierunku powyzej predkosci zdefiniowanej przez HideDirStatusSpeed + int HideDirStatusSpeed{1}; // Predkosc od ktorej lampki kierunku sa wylaczane + bool isDoubleClickForMeasureNeeded = {false}; // czy rozpoczecie pomiaru odleglosci odbywa sie po podwojnym wcisnienciu przycisku? + float DistanceCounterDoublePressPeriod = {1.f}; // czas w jakim nalezy podwojnie wcisnac przycisk, aby rozpoczac pomiar odleglosci TSecuritySystem SecuritySystem; - int EmergencyBrakeWarningSignal{ 0 }; // combined with basic WarningSignal when manual emergency brake is active - TUniversalCtrlTable UniCtrlList; /*lista pozycji uniwersalnego nastawnika*/ - int UniCtrlListSize = 0; /*wielkosc listy pozycji uniwersalnego nastawnika*/ + int EmergencyBrakeWarningSignal{0}; // combined with basic WarningSignal when manual emergency brake is active + TUniversalCtrlTable UniCtrlList; /*lista pozycji uniwersalnego nastawnika*/ + int UniCtrlListSize = 0; /*wielkosc listy pozycji uniwersalnego nastawnika*/ bool UniCtrlIntegratedBrakePNCtrl = false; /*zintegrowany nastawnik JH obsluguje hamulec PN*/ bool UniCtrlIntegratedBrakeCtrl = false; /*zintegrowany nastawnik JH obsluguje hamowanie*/ - bool UniCtrlIntegratedLocalBrakeCtrl = false; /*zintegrowany nastawnik JH obsluguje hamowanie hamulcem pomocniczym*/ - int UniCtrlNoPowerPos{ 0 }; // cached highesr position not generating traction force - std::pair> PantsPreset { "0132", { 0, 0 } }; // pantograph preset switches; .first holds possible setups as chars, .second holds currently selected preset in each cab + bool UniCtrlIntegratedLocalBrakeCtrl = false; /*zintegrowany nastawnik JH obsluguje hamowanie hamulcem pomocniczym*/ + int UniCtrlNoPowerPos{0}; // cached highesr position not generating traction force + std::pair> PantsPreset{"0132", {0, 0}}; // pantograph preset switches; .first holds possible setups as chars, .second holds currently selected preset in each cab /*-sekcja parametrow dla lokomotywy elektrycznej*/ - TSchemeTable RList; /*lista rezystorow rozruchowych i polaczen silnikow, dla dizla: napelnienia*/ + TSchemeTable RList; /*lista rezystorow rozruchowych i polaczen silnikow, dla dizla: napelnienia*/ int RlistSize = 0; TMotorParameters MotorParam[MotorParametersArraySize + 1]; /*rozne parametry silnika przy bocznikowaniach*/ @@ -1221,22 +1265,24 @@ public: // NToothM, NToothW : byte; // Ratio: real; {NToothW/NToothM} // end; - double NominalVoltage = 0.0; /*nominalne napiecie silnika*/ + double NominalVoltage = 0.0; /*nominalne napiecie silnika*/ double WindingRes = 0.0; - double u = 0.0; //wspolczynnik tarcia yB wywalic!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! - double CircuitRes = 0.0; /*rezystancje silnika i obwodu*/ - int IminLo = 0; int IminHi = 0; /*prady przelacznika automatycznego rozruchu, uzywane tez przez ai_driver*/ + double u = 0.0; // wspolczynnik tarcia yB wywalic!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! + double CircuitRes = 0.0; /*rezystancje silnika i obwodu*/ + int IminLo = 0; + int IminHi = 0; /*prady przelacznika automatycznego rozruchu, uzywane tez przez ai_driver*/ int ImaxLo = 0; // maksymalny prad niskiego rozruchu - int ImaxHi = 0; // maksymalny prad wysokiego rozruchu - bool MotorOverloadRelayHighThreshold { false }; - double nmax = 0.0; /*maksymalna dop. ilosc obrotow /s*/ - double InitialCtrlDelay = 0.0; double CtrlDelay = 0.0; /* -//- -//- miedzy kolejnymi poz.*/ - double CtrlDownDelay = 0.0; /* -//- -//- przy schodzeniu z poz.*/ /*hunter-101012*/ - int FastSerialCircuit = 0;/*0 - po kolei zamyka styczniki az do osiagniecia szeregowej, 1 - natychmiastowe wejscie na szeregowa*/ /*hunter-111012*/ + int ImaxHi = 0; // maksymalny prad wysokiego rozruchu + bool MotorOverloadRelayHighThreshold{false}; + double nmax = 0.0; /*maksymalna dop. ilosc obrotow /s*/ + double InitialCtrlDelay = 0.0; + double CtrlDelay = 0.0; /* -//- -//- miedzy kolejnymi poz.*/ + double CtrlDownDelay = 0.0; /* -//- -//- przy schodzeniu z poz.*/ /*hunter-101012*/ + int FastSerialCircuit = 0; /*0 - po kolei zamyka styczniki az do osiagniecia szeregowej, 1 - natychmiastowe wejscie na szeregowa*/ /*hunter-111012*/ int BackwardsBranchesAllowed = 1; - int AutoRelayType = 0; /*0 -brak, 1 - jest, 2 - opcja*/ - bool CoupledCtrl = false; /*czy mainctrl i scndctrl sa sprzezone*/ - bool HasCamshaft { false }; + int AutoRelayType = 0; /*0 -brak, 1 - jest, 2 - opcja*/ + bool CoupledCtrl = false; /*czy mainctrl i scndctrl sa sprzezone*/ + bool HasCamshaft{false}; int DynamicBrakeType = 0; /*patrz dbrake_**/ int DynamicBrakeAmpmeters = 2; /*liczba amperomierzy przy hamowaniu ED*/ double DynamicBrakeRes = 5.8; /*rezystancja oporników przy hamowaniu ED*/ @@ -1250,28 +1296,28 @@ public: double TUHEX_Sum2 = 750; /*nastawa2 sterownika hamowania ED*/ double TUHEX_Sum3 = 750; /*nastawa3 sterownika hamowania ED*/ int TUHEX_Stages = 0; /*liczba stopni hamowania ED*/ - // TODO: wrap resistor fans variables and state into a device - int RVentType = 0; /*0 - brak, 1 - jest, 2 - automatycznie wlaczany*/ - double RVentnmax = 1.0; /*maks. obroty wentylatorow oporow rozruchowych*/ - double RVentCutOff = 0.0; /*rezystancja wylaczania wentylatorow dla RVentType=2*/ - double RVentSpeed { 0.5 }; //rozpedzanie sie wentylatora obr/s^2} - double RVentMinI { 50.0 }; //przy jakim pradzie sie wylaczaja} - bool RVentForceOn { false }; // forced activation switch + // TODO: wrap resistor fans variables and state into a device + int RVentType = 0; /*0 - brak, 1 - jest, 2 - automatycznie wlaczany*/ + double RVentnmax = 1.0; /*maks. obroty wentylatorow oporow rozruchowych*/ + double RVentCutOff = 0.0; /*rezystancja wylaczania wentylatorow dla RVentType=2*/ + double RVentSpeed{0.5}; // rozpedzanie sie wentylatora obr/s^2} + double RVentMinI{50.0}; // przy jakim pradzie sie wylaczaja} + bool RVentForceOn{false}; // forced activation switch int CompressorPower = 1; // 0: main circuit, 1: z przetwornicy, reczne, 2: w przetwornicy, stale, 3: diesel engine, 4: converter of unit in front, 5: converter of unit behind int SmallCompressorPower = 0; /*Winger ZROBIC*/ - bool Trafo = false; /*pojazd wyposażony w transformator*/ + bool Trafo = false; /*pojazd wyposażony w transformator*/ - /*-sekcja parametrow dla lokomotywy spalinowej z przekladnia mechaniczna*/ + /*-sekcja parametrow dla lokomotywy spalinowej z przekladnia mechaniczna*/ double dizel_Mmax = 1.0; - double dizel_nMmax = 1.0; - double dizel_Mnmax = 2.0; - double dizel_nmax = 2.0; - double dizel_nominalfill = 0.0; + double dizel_nMmax = 1.0; + double dizel_Mnmax = 2.0; + double dizel_nmax = 2.0; + double dizel_nominalfill = 0.0; std::map dizel_Momentum_Table; std::map dizel_vel2nmax_Table; /*parametry aproksymacji silnika spalinowego*/ double dizel_Mstand = 0.0; /*moment oporow ruchu silnika dla enrot=0*/ - /* dizel_auto_min, dizel_auto_max: real; {predkosc obrotowa przelaczania automatycznej skrzyni biegow*/ + /* dizel_auto_min, dizel_auto_max: real; {predkosc obrotowa przelaczania automatycznej skrzyni biegow*/ double dizel_nmax_cutoff = 0.0; /*predkosc obrotowa zadzialania ogranicznika predkosci*/ double dizel_nmin = 0.0; /*najmniejsza dopuszczalna predkosc obrotowa*/ double dizel_nmin_hdrive = 0.0; /*najmniejsza dopuszczalna predkosc obrotowa w czasie jazdy na hydro */ @@ -1281,12 +1327,14 @@ public: double dizel_minVelfullengage = 0.0; /*najmniejsza predkosc przy jezdzie ze sprzeglem bez poslizgu*/ double dizel_maxVelANS = 3.0; /*predkosc progowa rozlaczenia przetwornika momentu*/ double dizel_AIM = 1.0; /*moment bezwladnosci walu itp*/ - double dizel_RevolutionsDecreaseRate{ 2.0 }; + double dizel_RevolutionsDecreaseRate{2.0}; double dizel_NominalFuelConsumptionRate = 250.0; /*jednostkowe zużycie paliwa przy mocy nominalnej, wczytywane z fiz, g/kWh*/ double dizel_FuelConsumption = 0.0; /*współczynnik zużycia paliwa przeliczony do jednostek maszynowych, l/obrót*/ double dizel_FuelConsumptionActual = 0.0; /*chwilowe spalanie paliwa w l/h*/ double dizel_FuelConsumptedTotal = 0.0; /*ilość paliwa zużyta od początku symulacji, l*/ - double dizel_engageDia = 0.5; double dizel_engageMaxForce = 6000.0; double dizel_engagefriction = 0.5; /*parametry sprzegla*/ + double dizel_engageDia = 0.5; + double dizel_engageMaxForce = 6000.0; + double dizel_engagefriction = 0.5; /*parametry sprzegla*/ double engagedownspeed = 0.9; double engageupspeed = 0.5; /*parametry przetwornika momentu*/ @@ -1317,304 +1365,319 @@ public: bool hydro_R_Clutch = false; /*czy retarder ma rozłączalne sprzęgło*/ double hydro_R_ClutchSpeed = 10.0; /*szybkość narastania obrotów po włączeniu sprzęgła retardera*/ bool hydro_R_WithIndividual = false; /*czy dla autobusów jest to łączone*/ - /*- dla lokomotyw spalinowo-elektrycznych -*/ + /*- dla lokomotyw spalinowo-elektrycznych -*/ double AnPos = 0.0; // pozycja sterowania dokladnego (analogowego) bool AnalogCtrl = false; // bool AnMainCtrl = false; // bool ShuntModeAllow = false; - bool ShuntMode = false; + bool ShuntMode = false; bool Flat = false; double Vhyp = 1.0; TDESchemeTable DElist; + TWiperSchemeTable WiperList; + int WiperListSize; + double Vadd = 1.0; TMPTRelayTable MPTRelay; int RelayType = 0; TShuntSchemeTable SST; - double PowerCorRatio = 1.0; //Wspolczynnik korekcyjny - /*- dla uproszczonego modelu silnika (dumb) oraz dla drezyny*/ + double PowerCorRatio = 1.0; // Wspolczynnik korekcyjny + /*- dla uproszczonego modelu silnika (dumb) oraz dla drezyny*/ double Ftmax = 0.0; /*- dla lokomotyw z silnikami indukcyjnymi -*/ double eimc[26]; - bool EIMCLogForce = false; // - static std::vector const eimc_labels; - double InverterFrequency { 0.0 }; // current frequency of power inverters + bool EIMCLogForce = false; // + static std::vector const eimc_labels; + double InverterFrequency{0.0}; // current frequency of power inverters int InvertersNo = 0; // number of inverters double InvertersRatio = 0.0; - std::vector Inverters; //all inverters - int InverterControlCouplerFlag = 4; //which coupling flag is necessary to controll inverters - int Imaxrpc = 0; // Maksymalny prad rezystora hamowania chlodzonego pasywnie - int BRVto = 0; // Czas jaki wentylatory jeszcze dodatkowo schladzaja rezystor - double BRVtimer = 0; // Timer dla podtrzymania wentylatora + std::vector Inverters; // all inverters + int InverterControlCouplerFlag = 4; // which coupling flag is necessary to controll inverters + int Imaxrpc = 0; // Maksymalny prad rezystora hamowania chlodzonego pasywnie + int BRVto = 0; // Czas jaki wentylatory jeszcze dodatkowo schladzaja rezystor + double BRVtimer = 0; // Timer dla podtrzymania wentylatora std::map EIM_Pmax_Table; /*tablica mocy maksymalnej od predkosci*/ /* -dla pojazdów z blendingiem EP/ED (MED) */ double MED_Vmax = 0; // predkosc maksymalna dla obliczen chwilowej sily hamowania EP w MED double MED_Vmin = 0; // predkosc minimalna dla obliczen chwilowej sily hamowania EP w MED double MED_Vref = 0; // predkosc referencyjna dla obliczen dostepnej sily hamowania EP w MED - double MED_amax { 9.81 }; // maksymalne opoznienie hamowania sluzbowego MED + double MED_amax{9.81}; // maksymalne opoznienie hamowania sluzbowego MED bool MED_EPVC = 0; // czy korekcja sily hamowania EP, gdy nie ma dostepnego ED double MED_EPVC_Time = 7; // czas korekcji sily hamowania EP, gdy nie ma dostepnego ED bool MED_Ncor = 0; // czy korekcja sily hamowania z uwzglednieniem nacisku - double MED_MinBrakeReqED = 0; // minimalne zadanie sily hamowania uruchamiajace ED - ponizej tylko EP + double MED_MinBrakeReqED = 0; // minimalne zadanie sily hamowania uruchamiajace ED - ponizej tylko EP double MED_FrED_factor = 1; // mnoznik sily hamowania ED do korekty blendingu double MED_ED_Delay1 = 0; // opoznienie wdrazania hamowania ED (pierwszy raz) double MED_ED_Delay2 = 0; // opoznienie zwiekszania sily hamowania ED (kolejne razy) - int DCEMUED_CC { 0 }; //na którym sprzęgu sprawdzać działanie ED - double DCEMUED_EP_max_Vel{ 0.0 }; //maksymalna prędkość, przy której działa EP przy włączonym ED w jednostce (dla tocznych) - double DCEMUED_EP_min_Im{ 0.0 }; //minimalny prąd, przy którym EP nie działa przy włączonym ED w członie (dla silnikowych) - double DCEMUED_EP_delay{ 0.0 }; //opóźnienie włączenia hamulca EP przy hamowaniu ED - zwłoka wstępna + int DCEMUED_CC{0}; // na którym sprzęgu sprawdzać działanie ED + double DCEMUED_EP_max_Vel{0.0}; // maksymalna prędkość, przy której działa EP przy włączonym ED w jednostce (dla tocznych) + double DCEMUED_EP_min_Im{0.0}; // minimalny prąd, przy którym EP nie działa przy włączonym ED w członie (dla silnikowych) + double DCEMUED_EP_delay{0.0}; // opóźnienie włączenia hamulca EP przy hamowaniu ED - zwłoka wstępna /*-dla wagonow*/ - struct load_attributes { - std::string name; // name of the cargo - float offset_min { 0.f }; // offset applied to cargo model when load amount is 0 + struct load_attributes + { + std::string name; // name of the cargo + float offset_min{0.f}; // offset applied to cargo model when load amount is 0 - load_attributes() = default; - load_attributes( std::string const &Name, float const Offsetmin ) : - name( Name ), offset_min( Offsetmin ) - {} - }; - std::vector LoadAttributes; - float MaxLoad = 0.f; /*masa w T lub ilosc w sztukach - ladownosc*/ - double OverLoadFactor = 0.0; /*ile razy moze byc przekroczona ladownosc*/ - float LoadSpeed = 0.f; float UnLoadSpeed = 0.f;/*szybkosc na- i rozladunku jednostki/s*/ + load_attributes() = default; + load_attributes(std::string const &Name, float const Offsetmin) : name(Name), offset_min(Offsetmin) {} + }; + std::vector LoadAttributes; + float MaxLoad = 0.f; /*masa w T lub ilosc w sztukach - ladownosc*/ + double OverLoadFactor = 0.0; /*ile razy moze byc przekroczona ladownosc*/ + float LoadSpeed = 0.f; + float UnLoadSpeed = 0.f; /*szybkosc na- i rozladunku jednostki/s*/ #ifdef EU07_USEOLDDOORCODE - int DoorOpenCtrl = 0; int DoorCloseCtrl = 0; /*0: przez pasazera, 1: przez maszyniste, 2: samoczynne (zamykanie)*/ - double DoorStayOpen = 0.0; /*jak dlugo otwarte w przypadku DoorCloseCtrl=2*/ - bool DoorClosureWarning = false; /*czy jest ostrzeganie przed zamknieciem*/ - bool DoorClosureWarningAuto = false; // departure signal plays automatically while door closing button is held down - double DoorOpenSpeed = 1.0; double DoorCloseSpeed = 1.0; /*predkosc otwierania i zamykania w j.u. */ - double DoorMaxShiftL = 0.5; double DoorMaxShiftR = 0.5; double DoorMaxPlugShift = 0.1;/*szerokosc otwarcia lub kat*/ - int DoorOpenMethod = 2; /*sposob otwarcia - 1: przesuwne, 2: obrotowe, 3: trójelementowe*/ - float DoorCloseDelay { 0.f }; // delay (in seconds) before the door begin closing, once conditions to close are met - double PlatformSpeed = 0.5; /*szybkosc stopnia*/ - double PlatformMaxShift { 0.0 }; /*wysuniecie stopnia*/ - int PlatformOpenMethod { 2 }; /*sposob animacji stopnia*/ + int DoorOpenCtrl = 0; + int DoorCloseCtrl = 0; /*0: przez pasazera, 1: przez maszyniste, 2: samoczynne (zamykanie)*/ + double DoorStayOpen = 0.0; /*jak dlugo otwarte w przypadku DoorCloseCtrl=2*/ + bool DoorClosureWarning = false; /*czy jest ostrzeganie przed zamknieciem*/ + bool DoorClosureWarningAuto = false; // departure signal plays automatically while door closing button is held down + double DoorOpenSpeed = 1.0; + double DoorCloseSpeed = 1.0; /*predkosc otwierania i zamykania w j.u. */ + double DoorMaxShiftL = 0.5; + double DoorMaxShiftR = 0.5; + double DoorMaxPlugShift = 0.1; /*szerokosc otwarcia lub kat*/ + int DoorOpenMethod = 2; /*sposob otwarcia - 1: przesuwne, 2: obrotowe, 3: trójelementowe*/ + float DoorCloseDelay{0.f}; // delay (in seconds) before the door begin closing, once conditions to close are met + double PlatformSpeed = 0.5; /*szybkosc stopnia*/ + double PlatformMaxShift{0.0}; /*wysuniecie stopnia*/ + int PlatformOpenMethod{2}; /*sposob animacji stopnia*/ #endif - double MirrorMaxShift { 90.0 }; - double MirrorVelClose { 5.0 }; - bool MirrorForbidden{ false }; /*czy jest pozwolenie na otworzenie lusterek (przycisk)*/ + double MirrorMaxShift{90.0}; + double MirrorVelClose{5.0}; + bool MirrorForbidden{false}; /*czy jest pozwolenie na otworzenie lusterek (przycisk)*/ 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 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 SpeedCtrlValue = 0; /*wybrana predkosc jazdy na tempomacie*/ - /*--sekcja zmiennych*/ - /*--opis konkretnego egzemplarza taboru*/ - TLocation Loc { 0.0, 0.0, 0.0 }; //pozycja pojazdów do wyznaczenia odległości pomiędzy sprzęgami - TRotation Rot { 0.0, 0.0, 0.0 }; - glm::vec3 Front{}; - std::string Name; /*nazwa wlasna*/ - TCoupling Couplers[2]; //urzadzenia zderzno-sprzegowe, polaczenia miedzy wagonami - std::array Neighbours; // potential collision sources - bool Power110vIsAvailable = false; // cached availability of 110v power - bool Power24vIsAvailable = false; // cached availability of 110v power - double Power24vVoltage { 0.0 }; // cached battery voltage - bool EventFlag = false; /*!o true jesli cos nietypowego sie wydarzy*/ - int SoundFlag = 0; /*!o patrz stale sound_ */ - int AIFlag{ 0 }; // HACK: events of interest for consist owner - double DistCounter = 0.0; /*! licznik kilometrow */ - std::pair EnergyMeter; // energy from grid [kWh] - double V = 0.0; //predkosc w [m/s] względem sprzęgów (dodania gdy jedzie w stronę 0) - double Vel = 0.0; //moduł prędkości w [km/h], używany przez AI - double AccS = 0.0; //efektywne przyspieszenie styczne w [m/s^2] (wszystkie siły) - double AccSVBased {}; // tangential acceleration calculated from velocity change + /*--sekcja zmiennych*/ + /*--opis konkretnego egzemplarza taboru*/ + TLocation Loc{0.0, 0.0, 0.0}; // pozycja pojazdów do wyznaczenia odległości pomiędzy sprzęgami + TRotation Rot{0.0, 0.0, 0.0}; + glm::vec3 Front{}; + std::string Name; /*nazwa wlasna*/ + TCoupling Couplers[2]; // urzadzenia zderzno-sprzegowe, polaczenia miedzy wagonami + std::array Neighbours; // potential collision sources + bool Power110vIsAvailable = false; // cached availability of 110v power + bool Power24vIsAvailable = false; // cached availability of 110v power + double Power24vVoltage{0.0}; // cached battery voltage + bool EventFlag = false; /*!o true jesli cos nietypowego sie wydarzy*/ + int SoundFlag = 0; /*!o patrz stale sound_ */ + int AIFlag{0}; // HACK: events of interest for consist owner + double DistCounter = 0.0; /*! licznik kilometrow */ + std::pair EnergyMeter; // energy from grid [kWh] + double V = 0.0; // predkosc w [m/s] względem sprzęgów (dodania gdy jedzie w stronę 0) + double Vel = 0.0; // moduł prędkości w [km/h], używany przez AI + double AccS = 0.0; // efektywne przyspieszenie styczne w [m/s^2] (wszystkie siły) + double AccSVBased{}; // tangential acceleration calculated from velocity change double AccN = 0.0; // przyspieszenie normalne w [m/s^2] double AccVert = 0.0; // vertical acceleration - double nrot = 0.0; // predkosc obrotowa kol (obrotow na sekunde) - double nrot_eps = 0.0; //przyspieszenie kątowe kół (bez kierunku) + double nrot = 0.0; // predkosc obrotowa kol (obrotow na sekunde) + double nrot_eps = 0.0; // przyspieszenie kątowe kół (bez kierunku) double WheelFlat = 0.0; - bool TruckHunting { true }; // enable/disable truck hunting calculation + bool TruckHunting{true}; // enable/disable truck hunting calculation /*! rotacja kol [obr/s]*/ - double EnginePower = 0.0; /*! chwilowa moc silnikow*/ - double dL = 0.0; double Fb = 0.0; double Ff = 0.0; /*przesuniecie, sila hamowania i tarcia*/ - double FTrain = 0.0; double FStand = 0.0; /*! sila pociagowa i oporow ruchu*/ - double FTotal = 0.0; /*! calkowita sila dzialajaca na pojazd*/ - double UnitBrakeForce = 0.0; /*!s siła hamowania przypadająca na jeden element*/ - double Ntotal = 0.0; /*!s siła nacisku klockow*/ - bool SlippingWheels = false; bool SandDose = false; /*! poslizg kol, sypanie piasku*/ + double EnginePower = 0.0; /*! chwilowa moc silnikow*/ + double dL = 0.0; + double Fb = 0.0; + double Ff = 0.0; /*przesuniecie, sila hamowania i tarcia*/ + double FTrain = 0.0; + double FStand = 0.0; /*! sila pociagowa i oporow ruchu*/ + double FTotal = 0.0; /*! calkowita sila dzialajaca na pojazd*/ + double UnitBrakeForce = 0.0; /*!s siła hamowania przypadająca na jeden element*/ + double Ntotal = 0.0; /*!s siła nacisku klockow*/ + bool SlippingWheels = false; + bool SandDose = false; /*! poslizg kol, sypanie piasku*/ bool SandDoseManual = false; /*piaskowanie reczne*/ bool SandDoseAuto = false; /*piaskowanie automatyczne*/ bool SandDoseAutoAllow = true; /*zezwolenie na automatyczne piaskowanie*/ - double Sand = 0.0; /*ilosc piasku*/ - double BrakeSlippingTimer = 0.0; /*pomocnicza zmienna do wylaczania przeciwposlizgu*/ + double Sand = 0.0; /*ilosc piasku*/ + double BrakeSlippingTimer = 0.0; /*pomocnicza zmienna do wylaczania przeciwposlizgu*/ double dpBrake = 0.0; - double dpPipe = 0.0; - double dpMainValve = 0.0; - double dpLocalValve = 0.0; - double EmergencyValveFlow = 0.0; // air flow through alerter valve during last simulation step + double dpPipe = 0.0; + double dpMainValve = 0.0; + double dpLocalValve = 0.0; + double EmergencyValveFlow = 0.0; // air flow through alerter valve during last simulation step /*! przyrosty cisnienia w kroku czasowym*/ - double ScndPipePress = 0.0; /*cisnienie w przewodzie zasilajacym*/ - double BrakePress = 0.0; /*!o cisnienie w cylindrach hamulcowych*/ - double LocBrakePress = 0.0; /*!o cisnienie w cylindrach hamulcowych z pomocniczego*/ - double PipeBrakePress = 0.0; /*!o cisnienie w cylindrach hamulcowych z przewodu*/ - double PipePress = 0.0; /*!o cisnienie w przewodzie glownym*/ - double EqvtPipePress = 0.0; /*!o cisnienie w przewodzie glownym skladu*/ - double Volume = 0.0; /*objetosc spr. powietrza w zbiorniku hamulca*/ - double CompressedVolume = 0.0; /*objetosc spr. powietrza w ukl. zasilania*/ - double PantVolume = 0.48; /*objetosc spr. powietrza w ukl. pantografu*/ // aby podniesione pantografy opadły w krótkim czasie przy wyłączonej sprężarce - double Compressor = 0.0; /*! cisnienie w ukladzie zasilajacym*/ - bool CompressorFlag = false; /*!o czy wlaczona sprezarka*/ - bool PantCompFlag = false; /*!o czy wlaczona sprezarka pantografow*/ - bool CompressorAllow = false; /*! zezwolenie na uruchomienie sprezarki NBMX*/ - bool CompressorAllowLocal{ true }; // local device state override (most units don't have this fitted so it's set to true not to intefere) - bool CompressorGovernorLock{ false }; // indicates whether compressor pressure switch was activated due to reaching cut-out pressure - bool CompressorTankValve{ false }; // indicates excessive pressure is vented from compressor tank directly and instantly - start_t CompressorStart{ start_t::manual }; // whether the compressor is started manually, or another way - start_t PantographCompressorStart{ start_t::manual }; - basic_valve PantsValve; - std::array Pantographs; - bool PantAllDown { false }; - double PantFrontVolt = 0.0; //pantograf pod napieciem? 'Winger 160404 + double ScndPipePress = 0.0; /*cisnienie w przewodzie zasilajacym*/ + double BrakePress = 0.0; /*!o cisnienie w cylindrach hamulcowych*/ + double LocBrakePress = 0.0; /*!o cisnienie w cylindrach hamulcowych z pomocniczego*/ + double PipeBrakePress = 0.0; /*!o cisnienie w cylindrach hamulcowych z przewodu*/ + double PipePress = 0.0; /*!o cisnienie w przewodzie glownym*/ + double EqvtPipePress = 0.0; /*!o cisnienie w przewodzie glownym skladu*/ + double Volume = 0.0; /*objetosc spr. powietrza w zbiorniku hamulca*/ + double CompressedVolume = 0.0; /*objetosc spr. powietrza w ukl. zasilania*/ + double PantVolume = 0.48; /*objetosc spr. powietrza w ukl. pantografu*/ // aby podniesione pantografy opadły w krótkim czasie przy wyłączonej sprężarce + double Compressor = 0.0; /*! cisnienie w ukladzie zasilajacym*/ + bool CompressorFlag = false; /*!o czy wlaczona sprezarka*/ + bool PantCompFlag = false; /*!o czy wlaczona sprezarka pantografow*/ + bool CompressorAllow = false; /*! zezwolenie na uruchomienie sprezarki NBMX*/ + bool CompressorAllowLocal{true}; // local device state override (most units don't have this fitted so it's set to true not to intefere) + bool CompressorGovernorLock{false}; // indicates whether compressor pressure switch was activated due to reaching cut-out pressure + bool CompressorTankValve{false}; // indicates excessive pressure is vented from compressor tank directly and instantly + start_t CompressorStart{start_t::manual}; // whether the compressor is started manually, or another way + start_t PantographCompressorStart{start_t::manual}; + basic_valve PantsValve; + std::array Pantographs; + bool PantAllDown{false}; + double PantFrontVolt = 0.0; // pantograf pod napieciem? 'Winger 160404 double PantRearVolt = 0.0; - // TODO converter parameters, for when we start cleaning up mover parameters - start_t ConverterStart{ start_t::manual }; // whether converter is started manually, or by other means - float ConverterStartDelay{ 0.0f }; // delay (in seconds) before the converter is started, once its activation conditions are met - double ConverterStartDelayTimer{ 0.0 }; // helper, for tracking whether converter start delay passed - bool ConverterAllow = false; /*zezwolenie na prace przetwornicy NBMX*/ - bool ConverterAllowLocal{ true }; // local device state override (most units don't have this fitted so it's set to true not to intefere) - bool ConverterFlag = false; /*! czy wlaczona przetwornica NBMX*/ + // TODO converter parameters, for when we start cleaning up mover parameters + start_t ConverterStart{start_t::manual}; // whether converter is started manually, or by other means + float ConverterStartDelay{0.0f}; // delay (in seconds) before the converter is started, once its activation conditions are met + double ConverterStartDelayTimer{0.0}; // helper, for tracking whether converter start delay passed + bool ConverterAllow = false; /*zezwolenie na prace przetwornicy NBMX*/ + bool ConverterAllowLocal{true}; // local device state override (most units don't have this fitted so it's set to true not to intefere) + bool ConverterFlag = false; /*! czy wlaczona przetwornica NBMX*/ bool BRVentilators = false; /* Czy rezystor hamowania pracuje */ - start_t ConverterOverloadRelayStart { start_t::manual }; // whether overload relay reset responds to dedicated button - bool ConverterOverloadRelayOffWhenMainIsOff { false }; - fuel_pump FuelPump; - oil_pump OilPump; - water_pump WaterPump; - water_heater WaterHeater; - bool WaterCircuitsLink { false }; // optional connection between water circuits - heat_data dizel_heat; - std::array MotorBlowers; - door_data Doors; - float DoorsOpenWithPermitAfter { -1.f }; // remote open if permit button is held for specified time. NOTE: separate from door data as its cab control thing - int DoorsPermitLightBlinking { 0 }; //when the doors permit signal light is blinking + start_t ConverterOverloadRelayStart{start_t::manual}; // whether overload relay reset responds to dedicated button + bool ConverterOverloadRelayOffWhenMainIsOff{false}; + fuel_pump FuelPump; + oil_pump OilPump; + water_pump WaterPump; + water_heater WaterHeater; + bool WaterCircuitsLink{false}; // optional connection between water circuits + heat_data dizel_heat; + std::array MotorBlowers; + door_data Doors; + float DoorsOpenWithPermitAfter{-1.f}; // remote open if permit button is held for specified time. NOTE: separate from door data as its cab control thing + int DoorsPermitLightBlinking{0}; // when the doors permit signal light is blinking - int BrakeCtrlPos = -2; /*nastawa hamulca zespolonego*/ - double BrakeCtrlPosR = 0.0; /*nastawa hamulca zespolonego - plynna dla FV4a*/ - double BrakeCtrlPos2 = 0.0; /*nastawa hamulca zespolonego - kapturek dla FV4a*/ - int ManualBrakePos = 0; /*nastawa hamulca recznego*/ - double LocalBrakePosA = 0.0; /*nastawa hamulca pomocniczego*/ - double LocalBrakePosAEIM = 0.0; /*pozycja hamulca pomocniczego ep dla asynchronicznych ezt*/ - bool UniversalBrakeButtonActive[3] = { false, false, false }; /* brake button pressed */ -/* - int BrakeStatus = b_off; //0 - odham, 1 - ham., 2 - uszk., 4 - odluzniacz, 8 - antyposlizg, 16 - uzyte EP, 32 - pozycja R, 64 - powrot z R -*/ - bool AlarmChainFlag = false; // manual emergency brake - bool RadioStopFlag = false; /*hamowanie nagle*/ - bool LockPipe = false; /*locking brake pipe in emergency state*/ - bool UnlockPipe = false; /*unlockig brake pipe button pressed*/ - int BrakeDelayFlag = 0; /*nastawa opoznienia ham. osob/towar/posp/exp 0/1/2/4*/ - int BrakeDelays = 0; /*nastawy mozliwe do uzyskania*/ - int BrakeOpModeFlag = 0; /*nastawa trybu pracy PS/PN/EP/MED 1/2/4/8*/ - int BrakeOpModes = 0; /*nastawy mozliwe do uzyskania*/ - bool DynamicBrakeFlag = false; /*czy wlaczony hamulec elektrodymiczny*/ - bool DynamicBrakeEMUStatus = true; /*czy hamulec ED dziala w ezt*/ - int TUHEX_StageActual = 0; /*aktualny stopien tuhexa*/ - bool TUHEX_ResChange = false; /*czy zmiana rezystancji hamowania ED - odwzbudzanie*/ - bool TUHEX_Active = false; /*czy hamowanie ED wywołane z zewnątrz*/ - // NapUdWsp: integer; - double LimPipePress = 0.0; /*stabilizator cisnienia*/ - double ActFlowSpeed = 0.0; /*szybkosc stabilizatora*/ + int BrakeCtrlPos = -2; /*nastawa hamulca zespolonego*/ + double BrakeCtrlPosR = 0.0; /*nastawa hamulca zespolonego - plynna dla FV4a*/ + double BrakeCtrlPos2 = 0.0; /*nastawa hamulca zespolonego - kapturek dla FV4a*/ + int ManualBrakePos = 0; /*nastawa hamulca recznego*/ + double LocalBrakePosA = 0.0; /*nastawa hamulca pomocniczego*/ + double LocalBrakePosAEIM = 0.0; /*pozycja hamulca pomocniczego ep dla asynchronicznych ezt*/ + bool UniversalBrakeButtonActive[3] = {false, false, false}; /* brake button pressed */ + /* + int BrakeStatus = b_off; //0 - odham, 1 - ham., 2 - uszk., 4 - odluzniacz, 8 - antyposlizg, 16 - uzyte EP, 32 - pozycja R, 64 - powrot z R + */ + bool AlarmChainFlag = false; // manual emergency brake + bool RadioStopFlag = false; /*hamowanie nagle*/ + bool LockPipe = false; /*locking brake pipe in emergency state*/ + bool UnlockPipe = false; /*unlockig brake pipe button pressed*/ + int BrakeDelayFlag = 0; /*nastawa opoznienia ham. osob/towar/posp/exp 0/1/2/4*/ + int BrakeDelays = 0; /*nastawy mozliwe do uzyskania*/ + int BrakeOpModeFlag = 0; /*nastawa trybu pracy PS/PN/EP/MED 1/2/4/8*/ + int BrakeOpModes = 0; /*nastawy mozliwe do uzyskania*/ + bool DynamicBrakeFlag = false; /*czy wlaczony hamulec elektrodymiczny*/ + bool DynamicBrakeEMUStatus = true; /*czy hamulec ED dziala w ezt*/ + int TUHEX_StageActual = 0; /*aktualny stopien tuhexa*/ + bool TUHEX_ResChange = false; /*czy zmiana rezystancji hamowania ED - odwzbudzanie*/ + bool TUHEX_Active = false; /*czy hamowanie ED wywołane z zewnątrz*/ + // NapUdWsp: integer; + double LimPipePress = 0.0; /*stabilizator cisnienia*/ + double ActFlowSpeed = 0.0; /*szybkosc stabilizatora*/ + int DamageFlag = 0; // kombinacja bitowa stalych dtrain_* } + int EngDmgFlag = 0; // kombinacja bitowa stalych usterek} + int DerailReason = 0; // przyczyna wykolejenia - int DamageFlag = 0; //kombinacja bitowa stalych dtrain_* } - int EngDmgFlag = 0; //kombinacja bitowa stalych usterek} - int DerailReason = 0; //przyczyna wykolejenia - - //EndSignalsFlag: byte; {ABu 060205: zmiany - koncowki: 1/16 - swiatla prz/tyl, 2/31 - blachy prz/tyl} - //HeadSignalsFlag: byte; {ABu 060205: zmiany - swiatla: 1/2/4 - przod, 16/32/63 - tyl} + // EndSignalsFlag: byte; {ABu 060205: zmiany - koncowki: 1/16 - swiatla prz/tyl, 2/31 - blachy prz/tyl} + // HeadSignalsFlag: byte; {ABu 060205: zmiany - swiatla: 1/2/4 - przod, 16/32/63 - tyl} TCommand CommandIn; /*komenda przekazywana przez PutCommand*/ /*i wykonywana przez RunInternalCommand*/ - std::string CommandOut; /*komenda przekazywana przez ExternalCommand*/ - std::string CommandLast; //Ra: ostatnio wykonana komenda do podglądu - double ValueOut = 0.0; /*argument komendy która ma byc przekazana na zewnatrz*/ + std::string CommandOut; /*komenda przekazywana przez ExternalCommand*/ + std::string CommandLast; // Ra: ostatnio wykonana komenda do podglądu + double ValueOut = 0.0; /*argument komendy która ma byc przekazana na zewnatrz*/ - TTrackShape RunningShape;/*geometria toru po ktorym jedzie pojazd*/ - TTrackParam RunningTrack;/*parametry toru po ktorym jedzie pojazd*/ - double OffsetTrackH = 0.0; double OffsetTrackV = 0.0; /*przesuniecie poz. i pion. w/m osi toru*/ + TTrackShape RunningShape; /*geometria toru po ktorym jedzie pojazd*/ + TTrackParam RunningTrack; /*parametry toru po ktorym jedzie pojazd*/ + double OffsetTrackH = 0.0; + double OffsetTrackV = 0.0; /*przesuniecie poz. i pion. w/m osi toru*/ - /*-zmienne dla lokomotyw*/ - bool Mains = false; /*polozenie glownego wylacznika*/ - double MainsInitTime{ 0.0 }; // config, initialization time (in seconds) of the main circuit after it receives power, before it can be closed - double MainsInitTimeCountdown{ 0.0 }; // current state of main circuit initialization, remaining time (in seconds) until it's ready - start_t MainsStart { start_t::manual }; - bool LineBreakerClosesOnlyAtNoPowerPos{ false }; - bool ControlPressureSwitch{ false }; // activates if the main pipe and/or brake cylinder pressure aren't within operational levels - bool HasControlPressureSwitch{ true }; - bool ReleaserEnabledOnlyAtNoPowerPos{ false }; + /*-zmienne dla lokomotyw*/ + bool Mains = false; /*polozenie glownego wylacznika*/ + double MainsInitTime{0.0}; // config, initialization time (in seconds) of the main circuit after it receives power, before it can be closed + double MainsInitTimeCountdown{0.0}; // current state of main circuit initialization, remaining time (in seconds) until it's ready + start_t MainsStart{start_t::manual}; + bool LineBreakerClosesOnlyAtNoPowerPos{false}; + bool ControlPressureSwitch{false}; // activates if the main pipe and/or brake cylinder pressure aren't within operational levels + bool HasControlPressureSwitch{true}; + bool ReleaserEnabledOnlyAtNoPowerPos{false}; int MainCtrlPos = 0; /*polozenie glownego nastawnika*/ int ScndCtrlPos = 0; /*polozenie dodatkowego nastawnika*/ int LightsPos = 0; /*polozenie przelacznika wielopozycyjnego swiatel*/ int CompressorListPos = 0; /*polozenie przelacznika wielopozycyjnego sprezarek*/ - int DirActive = 0; //czy lok. jest wlaczona i w ktorym kierunku: względem wybranej kabiny: -1 - do tylu, +1 - do przodu, 0 - wylaczona - int DirAbsolute = 0; //zadany kierunek jazdy względem sprzęgów (1=w strone 0,-1=w stronę 1) - int MainCtrlMaxDirChangePos { 0 }; // can't change reverser state with master controller set above this position - int CabActive = 0; //numer kabiny, z której jest sterowanie: 1 lub -1; w przeciwnym razie brak sterowania - rozrzad - int CabOccupied = 0; //numer kabiny, w ktorej jest obsada (zwykle jedna na skład) // TODO: move to TController - bool CabMaster = false; //czy pojazd jest nadrzędny w składzie - inline bool IsCabMaster() { return ((CabActive == CabOccupied) && CabMaster); } //czy aktualna kabina jest na pewno tą, z której można sterować - bool AutomaticCabActivation = true; //czy zmostkowany rozrzad przelacza sie sam przy zmianie kabiny - int InactiveCabFlag = 0; //co sie dzieje przy dezaktywacji kabiny - bool InactiveCabPantsCheck = false; //niech DynamicObject sprawdzi pantografy + int DirActive = 0; // czy lok. jest wlaczona i w ktorym kierunku: względem wybranej kabiny: -1 - do tylu, +1 - do przodu, 0 - wylaczona + int DirAbsolute = 0; // zadany kierunek jazdy względem sprzęgów (1=w strone 0,-1=w stronę 1) + int MainCtrlMaxDirChangePos{0}; // can't change reverser state with master controller set above this position + int CabActive = 0; // numer kabiny, z której jest sterowanie: 1 lub -1; w przeciwnym razie brak sterowania - rozrzad + int CabOccupied = 0; // numer kabiny, w ktorej jest obsada (zwykle jedna na skład) // TODO: move to TController + bool CabMaster = false; // czy pojazd jest nadrzędny w składzie + inline bool IsCabMaster() + { + return ((CabActive == CabOccupied) && CabMaster); + } // czy aktualna kabina jest na pewno tą, z której można sterować + bool AutomaticCabActivation = true; // czy zmostkowany rozrzad przelacza sie sam przy zmianie kabiny + int InactiveCabFlag = 0; // co sie dzieje przy dezaktywacji kabiny + bool InactiveCabPantsCheck = false; // niech DynamicObject sprawdzi pantografy double LastSwitchingTime = 0.0; /*czas ostatniego przelaczania czegos*/ - int WarningSignal = 0; // 0: nie trabi, 1,2,4: trabi + int WarningSignal = 0; // 0: nie trabi, 1,2,4: trabi bool DepartureSignal = false; /*sygnal odjazdu*/ bool InsideConsist = false; /*-zmienne dla lokomotywy elektrycznej*/ - TTractionParam RunningTraction;/*parametry sieci trakcyjnej najblizej lokomotywy*/ + TTractionParam RunningTraction; /*parametry sieci trakcyjnej najblizej lokomotywy*/ double enrot = 0.0; // ilosc obrotow silnika - double Im = 0.0; // prad silnika -/* - // currently not used - double IHeating = 0.0; - double ITraction = 0.0; -*/ - double Itot = 0.0; // prad calkowity - double TotalCurrent = 0.0; - // momenty - double Mm = 0.0; - double Mw = 0.0; - // sily napedne - double Fw = 0.0; - double Ft = 0.0; - //Ra: Im jest ujemny, jeśli lok jedzie w stronę sprzęgu 1 - //a ujemne powinien być przy odwróconej polaryzacji sieci... - //w wielu miejscach jest używane abs(Im) - int Imin = 0; int Imax = 0; /*prad przelaczania automatycznego rozruchu, prad bezpiecznika*/ + double Im = 0.0; // prad silnika + /* + // currently not used + double IHeating = 0.0; + double ITraction = 0.0; + */ + double Itot = 0.0; // prad calkowity + double TotalCurrent = 0.0; + // momenty + double Mm = 0.0; + double Mw = 0.0; + // sily napedne + double Fw = 0.0; + double Ft = 0.0; + // Ra: Im jest ujemny, jeśli lok jedzie w stronę sprzęgu 1 + // a ujemne powinien być przy odwróconej polaryzacji sieci... + // w wielu miejscach jest używane abs(Im) + int Imin = 0; + int Imax = 0; /*prad przelaczania automatycznego rozruchu, prad bezpiecznika*/ double EngineVoltage = 0.0; // voltage supplied to engine int MainCtrlActualPos = 0; /*wskaznik RList*/ int ScndCtrlActualPos = 0; /*wskaznik MotorParam*/ - bool DelayCtrlFlag = false; //czy czekanie na 1. pozycji na załączenie? - double LastRelayTime = 0.0; /*czas ostatniego przelaczania stycznikow*/ - bool AutoRelayFlag = false; /*mozna zmieniac jesli AutoRelayType=2*/ - bool FuseFlag = false; /*!o bezpiecznik nadmiarowy*/ - bool ConvOvldFlag = false; /*! nadmiarowy przetwornicy i ogrzewania*/ - bool GroundRelay { true }; // switches off to protect against damage from earths - start_t GroundRelayStart { start_t::manual }; // relay activation method - bool StLinFlag = false; /*!o styczniki liniowe*/ - bool StLinSwitchOff{ false }; // state of the button forcing motor connectors open - bool ResistorsFlag = false; /*!o jazda rezystorowa*/ - double RventRot = 0.0; /*!s obroty wentylatorow rozruchowych*/ - double PantographVoltage{ 0.0 }; // voltage supplied to pantographs + bool DelayCtrlFlag = false; // czy czekanie na 1. pozycji na załączenie? + double LastRelayTime = 0.0; /*czas ostatniego przelaczania stycznikow*/ + bool AutoRelayFlag = false; /*mozna zmieniac jesli AutoRelayType=2*/ + bool FuseFlag = false; /*!o bezpiecznik nadmiarowy*/ + bool ConvOvldFlag = false; /*! nadmiarowy przetwornicy i ogrzewania*/ + bool GroundRelay{true}; // switches off to protect against damage from earths + start_t GroundRelayStart{start_t::manual}; // relay activation method + bool StLinFlag = false; /*!o styczniki liniowe*/ + bool StLinSwitchOff{false}; // state of the button forcing motor connectors open + bool ResistorsFlag = false; /*!o jazda rezystorowa*/ + double RventRot = 0.0; /*!s obroty wentylatorow rozruchowych*/ + double PantographVoltage{0.0}; // voltage supplied to pantographs double PantPress = 0.0; /*Cisnienie w zbiornikach pantografow*/ - bool PantPressSwitchActive{ false }; // state of the pantograph pressure switch. gets primed at defined pressure level in pantograph air system - bool PantPressLockActive{ false }; // pwr system state flag. fires when pressure switch activates by pantograph pressure dropping below defined level - bool NoVoltRelay{ true }; // switches off if the power level drops below threshold - bool OvervoltageRelay{ true }; // switches off if the power level goes above threshold - bool s_CAtestebrake = false; //hunter-091012: zmienna dla testu ca - std::array, 4> PowerCircuits; //24v, 110v, 3x400v and 3000v power circuits, voltage from local sources and current draw pairs + bool PantPressSwitchActive{false}; // state of the pantograph pressure switch. gets primed at defined pressure level in pantograph air system + bool PantPressLockActive{false}; // pwr system state flag. fires when pressure switch activates by pantograph pressure dropping below defined level + bool NoVoltRelay{true}; // switches off if the power level drops below threshold + bool OvervoltageRelay{true}; // switches off if the power level goes above threshold + bool s_CAtestebrake = false; // hunter-091012: zmienna dla testu ca + std::array, 4> PowerCircuits; // 24v, 110v, 3x400v and 3000v power circuits, voltage from local sources and current draw pairs - /*-zmienne dla lokomotywy spalinowej z przekladnia mechaniczna*/ + /*-zmienne dla lokomotywy spalinowej z przekladnia mechaniczna*/ double dizel_fill = 0.0; /*napelnienie*/ double dizel_engagestate = 0.0; /*sprzeglo skrzyni biegow: 0 - luz, 1 - wlaczone, 0.5 - wlaczone 50% (z poslizgiem)*/ double dizel_engage = 0.0; /*sprzeglo skrzyni biegow: aktualny docisk*/ double dizel_automaticgearstatus = 0.0; /*0 - bez zmiany, -1 zmiana na nizszy +1 zmiana na wyzszy*/ - bool dizel_startup { false }; // engine startup procedure request indicator - bool dizel_ignition { false }; // engine ignition request indicator - bool dizel_spinup { false }; // engine spin up to idle speed flag - double dizel_engagedeltaomega = 0.0; /*roznica predkosci katowych tarcz sprzegla*/ + bool dizel_startup{false}; // engine startup procedure request indicator + bool dizel_ignition{false}; // engine ignition request indicator + bool dizel_spinup{false}; // engine spin up to idle speed flag + double dizel_engagedeltaomega = 0.0; /*roznica predkosci katowych tarcz sprzegla*/ double dizel_n_old = 0.0; /*poredkosc na potrzeby obliczen sprzegiel*/ double dizel_Torque = 0.0; /*aktualny moment obrotowy silnika spalinowego*/ double dizel_Power = 0.0; /*aktualna moc silnika spalinowego*/ @@ -1638,7 +1701,7 @@ public: double hydro_R_n = 0.0; /*predkosc obrotowa retardera*/ bool hydro_R_ClutchActive = false; /*czy retarder jest napędzany*/ - /*- zmienne dla lokomotyw z silnikami indukcyjnymi -*/ + /*- zmienne dla lokomotyw z silnikami indukcyjnymi -*/ double eimic = 0; /*aktualna pozycja zintegrowanego sterowania jazda i hamowaniem*/ double eimic_analog = 0; /*pozycja zadajnika analogowa*/ double eimic_real = 0; /*faktycznie uzywana pozycja zintegrowanego sterowania jazda i hamowaniem*/ @@ -1650,7 +1713,7 @@ public: bool EIMCtrlEmergency = false; /*czy ma dodatkowe zero jazdy i zero hamowania */ double eimv_pr = 0; /*realizowany procent dostepnej sily rozruchu/hamowania*/ double eimv[21]; - static std::vector const eimv_labels; + static std::vector const eimv_labels; double SpeedCtrlTimer = 0; /*zegar dzialania tempomatu z wybieralna predkoscia*/ double eimicSpeedCtrl = 1; /*pozycja sugerowana przez tempomat*/ double eimicSpeedCtrlIntegral = 0; /*calkowany blad ustawienia predkosci*/ @@ -1659,7 +1722,7 @@ public: double MED_ED_DelayTimer = 0; /*aktualny czas licznika opoznienia hamowania ED*/ /*-zmienne dla drezyny*/ - double PulseForce = 0.0; /*przylozona sila*/ + double PulseForce = 0.0; /*przylozona sila*/ double PulseForceTimer = 0.0; int PulseForceCount = 0; @@ -1667,44 +1730,64 @@ public: double eAngle = M_PI * 0.5; /*-dla wagonow*/ - float LoadAmount = 0.f; /*masa w T lub ilosc w sztukach - zaladowane*/ - load_attributes LoadType; - std::string LoadQuantity; // jednostki miary - int LoadStatus = 0; //+1=trwa rozladunek,+2=trwa zaladunek,+4=zakończono,0=zaktualizowany model - bool LoadTypeChange{ false }; // indicates load type was changed - double LastLoadChangeTime = 0.0; //raz (roz)ładowania + float LoadAmount = 0.f; /*masa w T lub ilosc w sztukach - zaladowane*/ + load_attributes LoadType; + std::string LoadQuantity; // jednostki miary + int LoadStatus = 0; //+1=trwa rozladunek,+2=trwa zaladunek,+4=zakończono,0=zaktualizowany model + bool LoadTypeChange{false}; // indicates load type was changed + double LastLoadChangeTime = 0.0; // raz (roz)ładowania #ifdef EU07_USEOLDDOORCODE - bool DoorBlocked = false; //Czy jest blokada drzwi - bool DoorLockEnabled { true }; - bool DoorLeftOpened = false; //stan drzwi - double DoorLeftOpenTimer { -1.0 }; // left door closing timer for automatic door type + bool DoorBlocked = false; // Czy jest blokada drzwi + bool DoorLockEnabled{true}; + bool DoorLeftOpened = false; // stan drzwi + double DoorLeftOpenTimer{-1.0}; // left door closing timer for automatic door type bool DoorRightOpened = false; - double DoorRightOpenTimer{ -1.0 }; // right door closing timer for automatic door type + double DoorRightOpenTimer{-1.0}; // right door closing timer for automatic door type #endif - // TODO: move these switch types where they belong, cabin definition + // TODO: move these switch types where they belong, cabin definition std::string PantSwitchType; std::string ConvSwitchType; - std::string StLinSwitchType; + std::string StLinSwitchType; - bool Heating = false; //ogrzewanie 'Winger 020304 - bool HeatingAllow { false }; // heating switch // TODO: wrap heating in a basic device - int DoubleTr = 1; //trakcja ukrotniona - przedni pojazd 'Winger 160304 - basic_light CompartmentLights; + bool Heating = false; // ogrzewanie 'Winger 020304 + bool HeatingAllow{false}; // heating switch // TODO: wrap heating in a basic device + int DoubleTr = 1; // trakcja ukrotniona - przedni pojazd 'Winger 160304 + basic_light CompartmentLights; bool PhysicActivation = true; /*ABu: stale dla wyznaczania sil (i nie tylko) po optymalizacji*/ double FrictConst1 = 0.0; double FrictConst2s = 0.0; - double FrictConst2d= 0.0; + double FrictConst2d = 0.0; double TotalMassxg = 0.0; /*TotalMass*g*/ - double fBrakeCtrlPos = -2.0; // płynna nastawa hamulca zespolonego + double fBrakeCtrlPos = -2.0; // płynna nastawa hamulca zespolonego bool bPantKurek3 = true; // kurek trójdrogowy (pantografu): true=połączenie z ZG, false=połączenie z małą sprężarką // domyślnie zbiornik pantografu połączony jest ze zbiornikiem głównym - bool PantAutoValve { false }; // type of installed pantograph compressor valve + bool PantAutoValve{false}; // type of installed pantograph compressor valve int iProblem = 0; // flagi problemów z taborem, aby AI nie musiało porównywać; 0=może jechać int iLights[2]; // bity zapalonych świateł tutaj, żeby dało się liczyć pobór prądu + // Status nowszego hebelka od przyciemniania swiatel/swiatel dlugich + // 0 - swiatla wylaczone (opcja dziala tylko gdy w fiz zdefiniowano OffState w sekcji Switches; w przeciwnym wypadku pstryk startuje z wartoscia == 1 + // 1 - swiatla normalne przyciemnione + // 2 - swiatla normalne + // 3 - swiatla dlugie przyciemnione + // 4 - swiatla dlugie normalne + int modernDimmerState{0}; + bool modernContainOffPos{true}; + bool enableModernDimmer {false}; + + // Barwa reflektora + int refR{255}; // Czerwony + int refG{255}; // Zielony + int refB{255}; // Niebieski + + double dimMultiplier{0.6f}; // mnoznik swiatel przyciemnionych + double normMultiplier{1.0f}; // mnoznik swiatel zwyklych + double highDimMultiplier{2.5f}; // mnoznik dlugich przyciemnionych + double highMultiplier{2.8f}; // mnoznik dlugich + plc::basic_controller m_plc; int AIHintPantstate{ 0 }; // suggested pantograph setup @@ -1969,6 +2052,7 @@ private: void LoadFIZ_DCEMUED(std::string const &line); void LoadFIZ_SpringBrake(std::string const &line); void LoadFIZ_Light( std::string const &line ); + void LoadFIZ_Headlights(std::string const &Line); void LoadFIZ_Clima( std::string const &line ); void LoadFIZ_Power( std::string const &Line ); void LoadFIZ_SpeedControl( std::string const &Line ); @@ -1981,6 +2065,7 @@ private: void LoadFIZ_UCList(std::string const &Input); void LoadFIZ_DList( std::string const &Input ); void LoadFIZ_FFList( std::string const &Input ); + void LoadFIZ_WiperList(std::string const &Input); void LoadFIZ_LightsList( std::string const &Input ); void LoadFIZ_CompressorList(std::string const &Input); void LoadFIZ_PowerParamsDecode( TPowerParameters &Powerparameters, std::string const Prefix, std::string const &Input ); @@ -2002,6 +2087,7 @@ private: bool readPmaxList(std::string const &line); bool readFFList( std::string const &line ); bool readWWList( std::string const &line ); + bool readWiperList( std::string const &line ); bool readLightsList( std::string const &Input ); bool readCompressorList(std::string const &Input); void BrakeValveDecode( std::string const &s ); //Q 20160719 diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index 53c535cb..ffab3f71 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -8927,7 +8927,7 @@ bool startBPT; bool startMPT, startMPT0; bool startRLIST, startUCLIST; bool startDIZELMOMENTUMLIST, startDIZELV2NMAXLIST, startHYDROTCLIST, startPMAXLIST; -bool startDLIST, startFFLIST, startWWLIST; +bool startDLIST, startFFLIST, startWWLIST, startWiperList; bool startLIGHTSLIST; bool startCOMPRESSORLIST; int LISTLINE; @@ -9279,6 +9279,25 @@ bool TMoverParameters::readFFList( std::string const &line ) { return true; } +// parsowanie wiperList +bool TMoverParameters::readWiperList(std::string const& line) +{ + cParser parser(line); + if (false == parser.getTokens(4, false)) + { + WriteLog("Read WiperList: arguments missing in line " + std::to_string(LISTLINE + 1)); + return false; + } + int idx = LISTLINE++; + if (idx >= sizeof(WiperList) / sizeof(TWiperScheme)) + { + WriteLog("Read WiperList: number of entries exceeded capacity of the data table"); + return false; + } + parser >> WiperList[idx].byteSum >> WiperList[idx].WiperSpeed >> WiperList[idx].interval >> WiperList[idx].outBackDelay; + return true; +} + // parsowanie WWList bool TMoverParameters::readWWList( std::string const &line ) { @@ -9308,7 +9327,6 @@ bool TMoverParameters::readWWList( std::string const &line ) { SST[ idx ].Pmin = std::sqrt( std::pow( SST[ idx ].Umin, 2 ) / 47.6 ); SST[ idx ].Pmax = std::min( SST[ idx ].Pmax, std::pow( SST[ idx ].Umax, 2 ) / 47.6 ); } - return true; } @@ -9444,6 +9462,7 @@ void TMoverParameters::BrakeSubsystemDecode() // ************************************************************************************************* bool TMoverParameters::LoadFIZ(std::string chkpath) { + chkPath = chkpath; // assign class path for reloading const int param_ok = 1; const int wheels_ok = 2; const int dimensions_ok = 4; @@ -9462,6 +9481,7 @@ bool TMoverParameters::LoadFIZ(std::string chkpath) startPMAXLIST = false; startFFLIST = false; startWWLIST = false; + startWiperList = false; startLIGHTSLIST = false; startCOMPRESSORLIST = false; std::string file = TypeName + ".fiz"; @@ -9562,6 +9582,13 @@ bool TMoverParameters::LoadFIZ(std::string chkpath) startFFLIST = false; continue; } + if (issection("endwl", inputline)) + { + // skonczylismy czytac liste konfiguracji wycieraczek + startBPT = false; + startWiperList = false; + continue; + } if( issection( "END-WWL", inputline ) ) { startBPT = false; startWWLIST = false; @@ -9666,6 +9693,14 @@ bool TMoverParameters::LoadFIZ(std::string chkpath) continue; } + if (issection("Headlights:", inputline)) + { + startBPT = false; + fizlines.emplace("Headlights", inputline); + LoadFIZ_Headlights(inputline); + continue; + } + if (issection("Blending:", inputline)) { startBPT = false; LISTLINE = 0; @@ -9845,9 +9880,22 @@ bool TMoverParameters::LoadFIZ(std::string chkpath) { startBPT = false; startWWLIST = true; LISTLINE = 0; + continue; } + if (issection("WiperList:", inputline)) + { + startBPT = false; + fizlines.emplace("WiperList", inputline); + startWiperList = true; + LISTLINE = 0; + LoadFIZ_WiperList(inputline); + + continue; + } + + if( issection( "LightsList:", inputline ) ) { startBPT = false; fizlines.emplace( "LightsList", inputline ); @@ -9914,6 +9962,11 @@ bool TMoverParameters::LoadFIZ(std::string chkpath) readWWList( inputline ); continue; } + if (true == startWiperList) + { + readWiperList(inputline); + continue; + } if( true == startLIGHTSLIST ) { readLightsList( inputline ); continue; @@ -9935,6 +9988,13 @@ bool TMoverParameters::LoadFIZ(std::string chkpath) else result = false; + if (!modernContainOffPos) + modernDimmerState = 2; // jak nie ma opcji wylaczonej to niech sie odpali normalnie + if (!enableModernDimmer) + { + modernDimmerState = 2; + } + WriteLog("CERROR: " + to_string(ConversionError) + ", SUCCES: " + to_string(result)); return result; } @@ -10026,6 +10086,18 @@ void TMoverParameters::LoadFIZ_Load( std::string const &line ) { extract_value( UnLoadSpeed, "UnLoadSpeed", line, "" ); } +void TMoverParameters::LoadFIZ_Headlights(std::string const &line) +{ + extract_value(refR, "LampRed", line, ""); + extract_value(refG, "LampGreen", line, ""); + extract_value(refB, "LampBlue", line, ""); + + extract_value(dimMultiplier, "DimmedMultiplier", line, ""); + extract_value(normMultiplier, "NormalMultiplier", line, ""); + extract_value(highDimMultiplier, "HighbeamDimmedMultiplier", line, ""); + extract_value(highMultiplier, "HighBeamMultiplier", line, ""); +} + void TMoverParameters::LoadFIZ_Dimensions( std::string const &line ) { extract_value( Dim.L, "L", line, "" ); @@ -10602,6 +10674,12 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) { extract_value(HideDirStatusWhenMoving, "HideDirStatusWhenMoving", line, ""); extract_value(HideDirStatusSpeed, "HideDirStatusSpeed", line, ""); + extract_value(isDoubleClickForMeasureNeeded, "DCMB", line, ""); + extract_value(DistanceCounterDoublePressPeriod, "DCDPP", line, ""); + + extract_value(isBatteryButtonImpulse, "IBTB", line, ""); + extract_value(shouldHoldBatteryButton, "SBBBH", line, ""); + extract_value(BatteryButtonHoldTime, "BBHT", line, ""); std::map starts { { "Disabled", start_t::disabled }, @@ -11120,6 +11198,8 @@ void TMoverParameters::LoadFIZ_Switches( std::string const &Input ) { extract_value( UniversalResetButtonFlag[ 0 ], "RelayResetButton1", Input, "" ); extract_value( UniversalResetButtonFlag[ 1 ], "RelayResetButton2", Input, "" ); extract_value( UniversalResetButtonFlag[ 2 ], "RelayResetButton3", Input, "" ); + extract_value(enableModernDimmer, "ModernDimmer", Input, ""); + extract_value(modernContainOffPos, "ModernDimmerOffPosition", Input, ""); // pantograph presets { auto &presets { PantsPreset.first }; @@ -11242,6 +11322,13 @@ void TMoverParameters::LoadFIZ_FFList( std::string const &Input ) { extract_value( RlistSize, "Size", Input, "" ); } + +void TMoverParameters::LoadFIZ_WiperList(std::string const &Input) +{ + extract_value(WiperListSize, "Size", Input, ""); + extract_value(WiperAngle, "Angle", Input, ""); +} + void TMoverParameters::LoadFIZ_LightsList( std::string const &Input ) { extract_value( LightsPosNo, "Size", Input, "" ); @@ -11306,6 +11393,17 @@ void TMoverParameters::LoadFIZ_PowerParamsDecode( TPowerParameters &Powerparamet auto &collectorparameters = Powerparameters.CollectorParameters; collectorparameters = TCurrentCollector { 0, 0, 0, 0, 0, 0, false, 0, 0, 0, false, 0 }; + + std::string PantType = ""; + extract_value(PantType, "PantType", Line, ""); + if (PantType == "AKP_4E") + collectorparameters.PantographType = TPantType::AKP_4E; + if (PantType._Starts_with("DSA")) // zakladam ze wszystkie pantografy DSA sa takie same + collectorparameters.PantographType = TPantType::DSAx; + if (PantType == "EC160" || PantType == "EC200") + collectorparameters.PantographType = TPantType::EC160_200; + if (PantType == "WBL85") + collectorparameters.PantographType = TPantType::WBL85; extract_value( collectorparameters.CollectorsNo, "CollectorsNo", Line, "" ); extract_value( collectorparameters.MinH, "MinH", Line, "" ); @@ -12442,6 +12540,24 @@ double TMoverParameters::ShowCurrentP(int AmpN) const } } +bool TMoverParameters::reload_FIZ() { + WriteLog("[DEV] Reloading FIZ for " + Name); + // pause simulation + Global.iPause |= 0b1000; + bool result = LoadFIZ(chkPath); + if (result == true) + { + // jesli sie udalo przeladowac FIZ + Global.iPause &= 0b0111; + WriteLog("[DEV] FIZ reloaded for " + Name); + } + else { + // failed to reload - exit simulator + ErrorLog("[DEV] Failed to reload fiz for vehicle " + Name); + } + return true; +} + namespace simulation { weights_table Weights; diff --git a/PyInt.cpp b/PyInt.cpp index e70925c9..dc942da9 100644 --- a/PyInt.cpp +++ b/PyInt.cpp @@ -105,6 +105,38 @@ void render_task::run() { if( outputwidth != nullptr ) { Py_DECREF( outputwidth ); } Py_DECREF( output ); } + + // get commands from renderer + auto *commandsPO = PyObject_CallMethod(m_renderer, "getCommands", nullptr); + if (commandsPO != nullptr) + { + std::vector commands = python_external_utils::PyObjectToStringArray(commandsPO); + + Py_DECREF(commandsPO); + // we perform any actions ONLY when there are any commands in buffer + if (!commands.empty()) + { + for (const auto &command : commands) + { + auto it = simulation::commandMap.find(command); + if (it != simulation::commandMap.end()) + { + // command found + command_data cd; + cd.command = it->second; + cd.action = GLFW_PRESS; + simulation::Commands.push(cd, static_cast(command_target::vehicle) | 1); // player train is always 1 + } + else + ErrorLog("Python: Command [" + command + "] not found!"); + } + } + + } + + + + } void render_task::upload() @@ -470,6 +502,43 @@ python_taskqueue::error() { } } + +std::vector python_external_utils::PyObjectToStringArray(PyObject *pyList) +{ + std::vector result; + std::vector emptyIfError = {}; + if (!PySequence_Check(pyList)) + { + ErrorLog("Python: Failed to convert PyObject -> vector"); + return emptyIfError; + } + + Py_ssize_t size = PySequence_Size(pyList); + for (Py_ssize_t i = 0; i < size; ++i) + { + PyObject *item = PySequence_GetItem(pyList, i); // Increments reference count + if (item == nullptr) + { + ErrorLog("Python: Failed to get item from sequence."); + return emptyIfError; + } + + const char *str = PyString_AsString(item); + if (str == nullptr) + { + Py_DECREF(item); + ErrorLog("Python: Failed to convert item to string."); + return emptyIfError; + } + + result.push_back(std::string(str)); + Py_DECREF(item); // Decrease reference count for the item + } + + return result; +} + + #ifdef __GNUC__ #pragma GCC diagnostic pop #endif diff --git a/PyInt.h b/PyInt.h index 38646e7c..69cc4f84 100644 --- a/PyInt.h +++ b/PyInt.h @@ -130,7 +130,8 @@ private: auto fetch_renderer( std::string const Renderer ) -> PyObject *; void run(GLFWwindow *Context, rendertask_sequence &Tasks, uploadtask_sequence &Upload_Tasks, threading::condition_variable &Condition, std::atomic &Exit ); void error(); -// members + + // members PyObject *m_main { nullptr }; PyObject *m_stderr { nullptr }; PyThreadState *m_mainthread{ nullptr }; @@ -143,4 +144,11 @@ private: bool m_initialized { false }; }; +class python_external_utils +{ +public: + static std::vector PyObjectToStringArray(PyObject *pyList); + +}; + #endif diff --git a/README.md b/README.md index 6a60f43f..a58849ce 100644 --- a/README.md +++ b/README.md @@ -50,7 +50,7 @@ MaSzyna should work and compile natively under **Linux** and **Windows**. Other Commands will be written in [`Bash`](https://www.gnu.org/software/bash/). No-Linux users must do in corresponding technology. 0. Clone source code. - You may download source code [as ZIP archive](https://github.com/eu07/maszyna/archive/master.zip), or clone it by [`Git`](https://git-scm.com/). We won't provide tutorial to second one, the only note worth mention is that, repository doesn't contain submodules, so `--recursive` is not needed. From now, it is assumed that your working directory is inside directory with unpacked source code. + You may download source code [as ZIP archive](https://github.com/eu07/maszyna/archive/master.zip), or clone it by [`Git`](https://git-scm.com/). We won't provide tutorial to second one, the only note worth mention is that, repository contain submodules, so `--recursive` is needed. From now, it is assumed that your working directory is inside directory with unpacked source code. 1. Make directory, where build files will be stored, then enter inside it. $ mkdir build diff --git a/Spring.cpp b/Spring.cpp index da955280..59e5c55d 100644 --- a/Spring.cpp +++ b/Spring.cpp @@ -40,7 +40,7 @@ Math3D::vector3 TSpring::ComputateForces( Math3D::vector3 const &pPosition1, Mat // ScaleVector(&deltaP,1.0f / dist, &springForce); // Normalize Distance Vector // ScaleVector(&springForce,-(Hterm + Dterm),&springForce); // Calc Force - springForce = deltaP / dist * ( -( Hterm + Dterm ) ); + springForce = deltaP / dist * ( -( Hterm + Dterm )); // VectorSum(&p1->f,&springForce,&p1->f); // Apply to Particle 1 // VectorDifference(&p2->f,&springForce,&p2->f); // - Force on Particle 2 } diff --git a/Train.cpp b/Train.cpp index ff22d4c2..31f12513 100644 --- a/Train.cpp +++ b/Train.cpp @@ -288,6 +288,10 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = { { user_command::pantographraiserear, &TTrain::OnCommand_pantographraiserear }, { user_command::pantographlowerfront, &TTrain::OnCommand_pantographlowerfront }, { user_command::pantographlowerrear, &TTrain::OnCommand_pantographlowerrear }, + + {user_command::wiperswitchincrease, &TTrain::OnCommand_wiperswitchincrease}, + {user_command::wiperswitchdecrease, &TTrain::OnCommand_wiperswitchdecrease}, + { user_command::pantographlowerall, &TTrain::OnCommand_pantographlowerall }, { user_command::pantographselectnext, &TTrain::OnCommand_pantographselectnext }, { user_command::pantographselectprevious, &TTrain::OnCommand_pantographselectprevious }, @@ -375,6 +379,8 @@ TTrain::commandhandler_map const TTrain::m_commandhandlers = { { user_command::headlighttogglerearupper, &TTrain::OnCommand_headlighttogglerearupper }, { user_command::headlightenablerearupper, &TTrain::OnCommand_headlightenablerearupper }, { user_command::headlightdisablerearupper, &TTrain::OnCommand_headlightdisablerearupper }, + {user_command::modernlightdimmerdecrease, &TTrain::OnCommand_modernlightdimmerdecrease}, + {user_command::modernlightdimmerincrease, &TTrain::OnCommand_modernlightdimmerincrease}, { user_command::redmarkertogglerearleft, &TTrain::OnCommand_redmarkertogglerearleft }, { user_command::redmarkerenablerearleft, &TTrain::OnCommand_redmarkerenablerearleft }, { user_command::redmarkerdisablerearleft, &TTrain::OnCommand_redmarkerdisablerearleft }, @@ -1313,7 +1319,17 @@ void TTrain::OnCommand_distancecounteractivate( TTrain *Train, command_data cons // visual feedback Train->ggDistanceCounterButton.UpdateValue( 1.0, Train->dsbSwitch ); // activate or start anew - Train->m_distancecounter = 0.f; + if (Train->mvOccupied->isDoubleClickForMeasureNeeded) { + // handler tempomatu dla podwojnego kliku + if (Train->trainLenghtMeasureTimer >= 0.f) // jesli zdazylismy w czasie sekundy + Train->m_distancecounter = 0.f; // rozpoczynamy pomiar + else + Train->trainLenghtMeasureTimer = Train->mvOccupied->DistanceCounterDoublePressPeriod; // odpalamy zegarek od nowa + } + else { + // dla pojedynczego kliku + Train->m_distancecounter = 0.f; + } } else if( Command.action == GLFW_RELEASE ) { // visual feedback @@ -2171,6 +2187,31 @@ void TTrain::OnCommand_mubrakingindicatortoggle( TTrain *Train, command_data con } } +void TTrain::OnCommand_wiperswitchincrease(TTrain *Train, command_data const &Command) +{ + if (Command.action == GLFW_PRESS) + { + Train->mvOccupied->wiperSwitchPos++; + if (Train->mvOccupied->wiperSwitchPos > Train->mvOccupied->WiperListSize - 1) + Train->mvOccupied->wiperSwitchPos = Train->mvOccupied->WiperListSize - 1; + + // Visual feedback + Train->ggWiperSw.UpdateValue(Train->mvOccupied->wiperSwitchPos, Train->dsbSwitch); + } +} +void TTrain::OnCommand_wiperswitchdecrease(TTrain *Train, command_data const &Command) +{ + if (Command.action == GLFW_PRESS) + { + Train->mvOccupied->wiperSwitchPos--; + if (Train->mvOccupied->wiperSwitchPos < 0) + Train->mvOccupied->wiperSwitchPos = 0; + + // visual feedback + Train->ggWiperSw.UpdateValue(Train->mvOccupied->wiperSwitchPos, Train->dsbSwitch); + } +} + void TTrain::OnCommand_reverserincrease( TTrain *Train, command_data const &Command ) { if( Command.action == GLFW_PRESS ) { @@ -2356,7 +2397,8 @@ void TTrain::OnCommand_cabsignalacknowledge( TTrain *Train, command_data const & void TTrain::OnCommand_batterytoggle( TTrain *Train, command_data const &Command ) { - if( Command.action != GLFW_REPEAT ) { + if (Train->allowBatteryToggle || Command.action != GLFW_REPEAT) + { // keep the switch from flipping back and forth if key is held down if( false == Train->mvOccupied->Power24vIsAvailable ) { // turn on @@ -2370,44 +2412,160 @@ void TTrain::OnCommand_batterytoggle( TTrain *Train, command_data const &Command } void TTrain::OnCommand_batteryenable( TTrain *Train, command_data const &Command ) { + if (!Train->mvOccupied->isBatteryButtonImpulse) + { // regular button behavior + if (Command.action == GLFW_PRESS) + { + // visual feedback + Train->ggBatteryButton.UpdateValue(1.0f, Train->dsbSwitch); + Train->ggBatteryOnButton.UpdateValue(1.0f, Train->dsbSwitch); - if( Command.action == GLFW_PRESS ) { - // visual feedback - Train->ggBatteryButton.UpdateValue( 1.0f, Train->dsbSwitch ); - Train->ggBatteryOnButton.UpdateValue( 1.0f, Train->dsbSwitch ); - - Train->mvOccupied->BatterySwitch( true ); - - // side-effects - if( Train->mvOccupied->LightsPosNo > 0 ) { - Train->Dynamic()->SetLights(); - } + Train->mvOccupied->BatterySwitch(true); + Train->allowBatteryToggle = false; + // side-effects + if (Train->mvOccupied->LightsPosNo > 0) + { + Train->Dynamic()->SetLights(); + } + } + else if (Command.action == GLFW_RELEASE) + { + if (Train->ggBatteryButton.type() == TGaugeType::push) + { + // return the switch to neutral position + Train->ggBatteryButton.UpdateValue(0.5f); + } + Train->ggBatteryOnButton.UpdateValue(0.0f, Train->dsbSwitch); + Train->allowBatteryToggle = true; + } } - else if( Command.action == GLFW_RELEASE ) { - if( Train->ggBatteryButton.type() == TGaugeType::push ) { - // return the switch to neutral position - Train->ggBatteryButton.UpdateValue( 0.5f ); + else // impulse button behavior + { + if (Command.action == GLFW_PRESS) + { + if (Train->mvOccupied->shouldHoldBatteryButton) + { + // jesli przycisk trzeba przytrzymac + Train->ggBatteryButton.UpdateValue(1.0f, Train->dsbSwitch); + Train->ggBatteryOnButton.UpdateValue(1.0f, Train->dsbSwitch); + Train->fBatteryTimer = Train->mvOccupied->BatteryButtonHoldTime; // start timer + } + else + { + // jesli przycisk dziala od razu + Train->mvOccupied->BatterySwitch(true); + Train->allowBatteryToggle = false; + // side-effects + if (Train->mvOccupied->LightsPosNo > 0) + { + Train->Dynamic()->SetLights(); + } + + // visual feedback + Train->ggBatteryButton.UpdateValue(1.0f, Train->dsbSwitch); + Train->ggBatteryOnButton.UpdateValue(1.0f, Train->dsbSwitch); + } } - Train->ggBatteryOnButton.UpdateValue( 0.0f, Train->dsbSwitch ); + else if (Command.action == GLFW_RELEASE) + { + // visual feedback + Train->ggBatteryButton.UpdateValue(0.0f, Train->dsbSwitch); + Train->ggBatteryOnButton.UpdateValue(0.0f, Train->dsbSwitch); + Train->fBatteryTimer = -1.f; // + Train->allowBatteryToggle = true; + } + else if (Command.action == GLFW_REPEAT && Train->mvOccupied->shouldHoldBatteryButton) + { + // trzymamy przycisk + if (Train->fBatteryTimer <= 0.0 && Train->mvOccupied->Battery == false) { + Train->mvOccupied->BatterySwitch(true); + // side-effects + if (Train->mvOccupied->LightsPosNo > 0) + { + Train->Dynamic()->SetLights(); + } + Train->allowBatteryToggle = false; + } + + } } } void TTrain::OnCommand_batterydisable( TTrain *Train, command_data const &Command ) { - // TBD, TODO: ewentualnie zablokować z FIZ, np. w samochodach się nie odłącza akumulatora - if( Command.action == GLFW_PRESS ) { - // visual feedback - Train->ggBatteryButton.UpdateValue( 0.0f, Train->dsbSwitch ); - Train->ggBatteryOffButton.UpdateValue( 1.0f, Train->dsbSwitch ); + if (!Train->mvOccupied->isBatteryButtonImpulse) + { // regular button behavior + if (Command.action == GLFW_PRESS) + { + // visual feedback + Train->ggBatteryButton.UpdateValue(0.0f, Train->dsbSwitch); + Train->ggBatteryOffButton.UpdateValue(1.0f, Train->dsbSwitch); - Train->mvOccupied->BatterySwitch( false ); - } - else if( Command.action == GLFW_RELEASE ) { - if( Train->ggBatteryButton.type() == TGaugeType::push ) { - // return the switch to neutral position - Train->ggBatteryButton.UpdateValue( 0.5f ); - } - Train->ggBatteryOffButton.UpdateValue( 0.0f, Train->dsbSwitch ); - } + Train->mvOccupied->BatterySwitch(false); + + // side-effects + if (Train->mvOccupied->LightsPosNo > 0) + { + Train->Dynamic()->SetLights(); + } + } + else if (Command.action == GLFW_RELEASE) + { + if (Train->ggBatteryButton.type() == TGaugeType::push) + { + // return the switch to neutral position + Train->ggBatteryButton.UpdateValue(0.5f); + } + Train->ggBatteryOffButton.UpdateValue(0.0f, Train->dsbSwitch); + } + } + else // impulse button behavior + { + if (Command.action == GLFW_PRESS) + { + if (Train->mvOccupied->shouldHoldBatteryButton) + { + // jesli przycisk trzeba przytrzymac + Train->ggBatteryButton.UpdateValue(1.0f, Train->dsbSwitch); + Train->ggBatteryOffButton.UpdateValue(1.0f, Train->dsbSwitch); + Train->fBatteryTimer = Train->mvOccupied->BatteryButtonHoldTime; // start timer + } + else + { + // jesli przycisk dziala od razu + Train->mvOccupied->BatterySwitch(false); + Train->allowBatteryToggle = false; + + // side-effects + if (Train->mvOccupied->LightsPosNo > 0) + { + Train->Dynamic()->SetLights(); + } + // visual feedback + Train->ggBatteryButton.UpdateValue(1.0f, Train->dsbSwitch); + Train->ggBatteryOffButton.UpdateValue(1.0f, Train->dsbSwitch); + } + } + else if (Command.action == GLFW_RELEASE) + { + // visual feedback + Train->ggBatteryButton.UpdateValue(0.0f, Train->dsbSwitch); + Train->ggBatteryOffButton.UpdateValue(0.0f, Train->dsbSwitch); + Train->allowBatteryToggle = true; + } + else if (Command.action == GLFW_REPEAT && Train->mvOccupied->shouldHoldBatteryButton) + { + // trzymamy przycisk + if (Train->fBatteryTimer <= 0.0 && Train->mvOccupied->Battery == true) { + Train->mvOccupied->BatterySwitch(false); + Train->allowBatteryToggle = false; + // side-effects + if (Train->mvOccupied->LightsPosNo > 0) + { + Train->Dynamic()->SetLights(); + } + } + } + } } void TTrain::OnCommand_cabactivationtoggle(TTrain *Train, command_data const &Command) { @@ -2816,23 +2974,43 @@ void TTrain::change_pantograph_selection( int const Change ) { void TTrain::OnCommand_pantographvalvesupdate( TTrain *Train, command_data const &Command ) { + bool hasSeparateSwitches = Train->m_controlmapper.contains("pantvalvesupdate_bt:") && + Train->m_controlmapper.contains("pantvalvesoff_bt:"); + if( Command.action == GLFW_REPEAT ) { return; } if( Command.action == GLFW_PRESS ) { - // implement action - Train->update_pantograph_valves(); - // visual feedback - Train->ggPantValvesButton.UpdateValue( 1.0, Train->dsbSwitch ); + if (hasSeparateSwitches) + { + // implement action + Train->update_pantograph_valves(); + // visual feedback + Train->ggPantValvesUpdate.UpdateValue(1.0, Train->dsbSwitch); + } + + // Old logic to maintain compatibility + else + { + Train->update_pantograph_valves(); + Train->ggPantValvesButton.UpdateValue(1.0, Train->dsbSwitch); + } } else if( Command.action == GLFW_RELEASE ) { // visual feedback // NOTE: pantvalves_sw: is a specialized button, with no toggle behavior support - Train->ggPantValvesButton.UpdateValue( 0.5, Train->dsbSwitch ); + if (hasSeparateSwitches) + Train->ggPantValvesUpdate.UpdateValue(0.5, Train->dsbSwitch); + + // Old logic to maintain compatibility + else + Train->ggPantValvesButton.UpdateValue(0.5, Train->dsbSwitch); } } void TTrain::OnCommand_pantographvalvesoff( TTrain *Train, command_data const &Command ) { + bool hasSeparateSwitches = Train->m_controlmapper.contains("pantvalvesupdate_bt:") && Train->m_controlmapper.contains("pantvalvesoff_bt:"); + if( Command.action == GLFW_REPEAT ) { return; } if( Command.action == GLFW_PRESS ) { @@ -2840,12 +3018,18 @@ void TTrain::OnCommand_pantographvalvesoff( TTrain *Train, command_data const &C Train->mvOccupied->OperatePantographValve( end::front, operation_t::disable ); Train->mvOccupied->OperatePantographValve( end::rear, operation_t::disable ); // visual feedback - Train->ggPantValvesButton.UpdateValue( 0.0, Train->dsbSwitch ); + if (hasSeparateSwitches) + Train->ggPantValvesOff.UpdateValue(1.0, Train->dsbSwitch); + else + Train->ggPantValvesButton.UpdateValue( 0.0, Train->dsbSwitch ); } else if( Command.action == GLFW_RELEASE ) { // visual feedback - // NOTE: pantvalves_sw: is a specialized button, with no toggle behavior support - Train->ggPantValvesButton.UpdateValue( 0.5, Train->dsbSwitch ); + // NOTE: pantvalves_sw: is a speciali zed button, with no toggle behavior support + if (hasSeparateSwitches) + Train->ggPantValvesOff.UpdateValue(0.f, Train->dsbSwitch); + else + Train->ggPantValvesButton.UpdateValue( 0.5, Train->dsbSwitch ); } } @@ -4669,6 +4853,44 @@ void TTrain::OnCommand_headlightdisablerearupper( TTrain *Train, command_data co } } +void TTrain::OnCommand_modernlightdimmerincrease(TTrain* Train, command_data const& Command) +{ + if (!Train->mvOccupied->enableModernDimmer) + return; // if modern dimmer is disabled, skip entire command + if (Command.action == GLFW_PRESS) + { + // update modern dimmer state + if (Train->mvOccupied->modernDimmerState < 4) + Train->mvOccupied->modernDimmerState++; + Train->Dynamic()->SetLights(); + // visual feedback + if (Train->ggModernLightDimSw.SubModel != nullptr) + if (Train->mvOccupied->modernContainOffPos) + Train->ggModernLightDimSw.UpdateValue(Train->mvOccupied->modernDimmerState, Train->dsbSwitch); + else + Train->ggModernLightDimSw.UpdateValue(Train->mvOccupied->modernDimmerState - 1, Train->dsbSwitch); + } +} +void TTrain::OnCommand_modernlightdimmerdecrease(TTrain *Train, command_data const &Command) +{ + if (!Train->mvOccupied->enableModernDimmer) + return; // if modern dimmer is disabled, skip entire command + if (Command.action == GLFW_PRESS) + { + byte minPos = (Train->mvOccupied->modernContainOffPos) ? 0 : 1; // prevent switching to 0 if its not enabled + // update modern dimmer state + if (Train->mvOccupied->modernDimmerState > minPos) + Train->mvOccupied->modernDimmerState--; + Train->Dynamic()->SetLights(); + // visual feedback + if (Train->ggModernLightDimSw.SubModel != nullptr) + if (Train->mvOccupied->modernContainOffPos) + Train->ggModernLightDimSw.UpdateValue(Train->mvOccupied->modernDimmerState, Train->dsbSwitch); + else + Train->ggModernLightDimSw.UpdateValue(Train->mvOccupied->modernDimmerState - 1, Train->dsbSwitch); + } +} + void TTrain::OnCommand_redmarkertogglerearleft( TTrain *Train, command_data const &Command ) { if( Command.action == GLFW_PRESS ) { // NOTE: we toggle the light on opposite side, as 'rear right' is 'front left' on the rear end etc @@ -4848,10 +5070,12 @@ void TTrain::OnCommand_endsignalstoggle( TTrain *Train, command_data const &Comm } void TTrain::OnCommand_headlightsdimtoggle( TTrain *Train, command_data const &Command ) { - + if (Train->DynamicObject->MoverParameters->enableModernDimmer) + return; if( Command.action == GLFW_PRESS ) { // only reacting to press, so the switch doesn't flip back and forth if key is held down - if( false == Train->DynamicObject->DimHeadlights ) { + if (Train->DynamicObject->MoverParameters->modernDimmerState == 2) + { // turn on OnCommand_headlightsdimenable( Train, Command ); } @@ -4864,37 +5088,57 @@ void TTrain::OnCommand_headlightsdimtoggle( TTrain *Train, command_data const &C void TTrain::OnCommand_headlightsdimenable( TTrain *Train, command_data const &Command ) { + if (Train->DynamicObject->MoverParameters->enableModernDimmer) + return; if( Command.action == GLFW_PRESS ) { // only reacting to press, so the switch doesn't flip back and forth if key is held down - if( Train->ggDimHeadlightsButton.SubModel == nullptr ) { + if( Train->ggDimHeadlightsButton.SubModel != nullptr ) { // TODO: proper control deviced definition for the interiors, that doesn't hinge of presence of 3d submodels - WriteLog( "Dim Headlights switch is missing, or wasn't defined" ); - return; + // visual feedback + Train->ggDimHeadlightsButton.UpdateValue(1.0, Train->dsbSwitch); } - // visual feedback - Train->ggDimHeadlightsButton.UpdateValue( 1.0, Train->dsbSwitch ); - if( true == Train->DynamicObject->DimHeadlights ) { return; } // already enabled + /* // to jest stara logika + if (true == Train->DynamicObject->DimHeadlights) + { + return; + } // already enabled Train->DynamicObject->DimHeadlights = true; + */ + WriteLog("Switch do 1"); + Train->DynamicObject->MoverParameters->modernDimmerState = 1; // ustawiamy modern dimmer na flage przyciemnienia + Train->DynamicObject->RaLightsSet(Train->DynamicObject->MoverParameters->iLights[0], + Train->DynamicObject->MoverParameters->iLights[1] + ); // aktualizacja swiatelek } } void TTrain::OnCommand_headlightsdimdisable( TTrain *Train, command_data const &Command ) { + if (Train->DynamicObject->MoverParameters->enableModernDimmer) // nie wiem dlaczego to tak dziala ze jest odwrocona logika + return; if( Command.action == GLFW_PRESS ) { // only reacting to press, so the switch doesn't flip back and forth if key is held down - if( Train->ggDimHeadlightsButton.SubModel == nullptr ) { + if( Train->ggDimHeadlightsButton.SubModel != nullptr ) { // TODO: proper control deviced definition for the interiors, that doesn't hinge of presence of 3d submodels - WriteLog( "Dim Headlights switch is missing, or wasn't defined" ); - return; + // visual feedback + Train->ggDimHeadlightsButton.UpdateValue(0.0, Train->dsbSwitch); } - // visual feedback - Train->ggDimHeadlightsButton.UpdateValue( 0.0, Train->dsbSwitch ); + + /* // stara logika przyciemniania if( false == Train->DynamicObject->DimHeadlights ) { return; } // already enabled Train->DynamicObject->DimHeadlights = false; + + */ + WriteLog("Switch do 2"); + Train->DynamicObject->MoverParameters->modernDimmerState = 2; // ustawiamy modern dimmer na flage rozjasnienia + Train->DynamicObject->RaLightsSet( + Train->DynamicObject->MoverParameters->iLights[0], + Train->DynamicObject->MoverParameters->iLights[1] + ); // aktualizacja swiatelek } } @@ -6748,6 +6992,7 @@ void TTrain::OnCommand_vehicleboost(TTrain *Train, const command_data &Command) } } + // cab movement update, fixed step part void TTrain::UpdateCab() { @@ -6834,6 +7079,21 @@ bool TTrain::Update( double const Deltatime ) mvOccupied->OperateDoors( static_cast( idx ), true ); } } + + // train measurement timer + if (trainLenghtMeasureTimer >= 0.f) { + trainLenghtMeasureTimer -= Deltatime; + if (trainLenghtMeasureTimer < 0.f) + trainLenghtMeasureTimer = -1.f; + } + + // battery timer + if (fBatteryTimer >= 0.f) { + fBatteryTimer -= Deltatime; + if (fBatteryTimer < 0.f) + fBatteryTimer = -1.f; + } + // helper variables if( DynamicObject->Mechanik != nullptr ) { m_doors = ( @@ -7350,6 +7610,12 @@ bool TTrain::Update( double const Deltatime ) else btCompressors.Turn(false); + // Lampka zezwolenia na hamowanie ED + if (mvControlled->EpFuse) + btEDenabled.Turn(true); + else + btEDenabled.Turn(false); + // Lampka aktywowanej kabiny if (mvControlled->CabActive != 0) { btCabActived.Turn(true); @@ -7358,6 +7624,11 @@ bool TTrain::Update( double const Deltatime ) btCabActived.Turn(false); } + if (mvControlled->Battery && mvControlled->CabActive != 0) + btAKLVents.Turn(true); + else + btAKLVents.Turn(false); + if( true == lowvoltagepower ) { // McZapkie-141102: SHP i czuwak, TODO: sygnalizacja kabinowa if( mvOccupied->SecuritySystem.is_vigilance_blinking() ) { @@ -7893,6 +8164,7 @@ bool TTrain::Update( double const Deltatime ) ggBrakeProfileG.Update(); ggBrakeProfileR.Update(); ggBrakeOperationModeCtrl.Update(); + ggWiperSw.Update(); ggMaxCurrentCtrl.UpdateValue( ( true == mvControlled->ShuntModeAllow ? ( true == mvControlled->ShuntMode ? @@ -7989,12 +8261,16 @@ bool TTrain::Update( double const Deltatime ) ggPantCompressorButton.Update(); ggPantCompressorValve.Update(); + ggPantValvesOff.Update(); + ggPantValvesUpdate.Update(); + ggLightsButton.Update(); ggUpperLightButton.Update(); ggLeftLightButton.Update(); ggRightLightButton.Update(); ggLeftEndLightButton.Update(); ggRightEndLightButton.Update(); + ggModernLightDimSw.Update(); // hunter-230112 ggRearUpperLightButton.Update(); ggRearLeftLightButton.Update(); @@ -8002,6 +8278,7 @@ bool TTrain::Update( double const Deltatime ) ggRearLeftEndLightButton.Update(); ggRearRightEndLightButton.Update(); ggDimHeadlightsButton.Update(); + ggDimHeadlightsButton.Update(); //------------ ggConverterButton.Update(); ggConverterLocalButton.Update(); @@ -9367,6 +9644,7 @@ void TTrain::clear_cab_controls() ggBrakeProfileG.Clear(); ggBrakeProfileR.Clear(); ggBrakeOperationModeCtrl.Clear(); + ggWiperSw.Clear(); ggMaxCurrentCtrl.Clear(); ggMainOffButton.Clear(); ggMainOnButton.Clear(); @@ -9469,6 +9747,10 @@ void TTrain::clear_cab_controls() ggPantValvesButton.Clear(); ggPantCompressorButton.Clear(); ggPantCompressorValve.Clear(); + + ggPantValvesOff.Clear(); + ggPantValvesUpdate.Clear(); + ggI1B.Clear(); ggI2B.Clear(); ggI3B.Clear(); @@ -9580,6 +9862,7 @@ void TTrain::clear_cab_controls() ggRightLightButton.Clear(); ggUpperLightButton.Clear(); ggDimHeadlightsButton.Clear(); + ggModernLightDimSw.Clear(); ggLeftEndLightButton.Clear(); ggRightEndLightButton.Clear(); ggLightsButton.Clear(); @@ -9611,6 +9894,24 @@ void TTrain::set_cab_controls( int const Cab ) { m_linebreakerstate > 0 ? 1.f : 0.f ) ); } + + if (ggModernLightDimSw.SubModel != nullptr) { + if (mvOccupied->modernContainOffPos) + ggModernLightDimSw.PutValue(mvOccupied->modernDimmerState); + else + ggModernLightDimSw.PutValue(mvOccupied->modernDimmerState - 1); + } + + // Init separate buttons + if (ggPantValvesUpdate.SubModel != nullptr) + { + ggPantValvesUpdate.PutValue(0.f); + } + if (ggPantValvesOff.SubModel != nullptr) + { + ggPantValvesOff.PutValue(0.f); + } + // motor connectors ggStLinOffButton.PutValue( ( mvControlled->StLinSwitchOff ? @@ -9669,6 +9970,7 @@ void TTrain::set_cab_controls( int const Cab ) { 0.f ) ); } ggPantValvesButton.PutValue( 0.5f ); + // auxiliary compressor ggPantCompressorValve.PutValue( mvControlled->bPantKurek3 ? @@ -9738,7 +10040,7 @@ void TTrain::set_cab_controls( int const Cab ) { ggRightLightButton.PutValue( -1.f ); } } - if( true == DynamicObject->DimHeadlights ) { + if( 1 == DynamicObject->MoverParameters->modernDimmerState ) { ggDimHeadlightsButton.PutValue( 1.f ); } // cab lights @@ -9812,6 +10114,12 @@ void TTrain::set_cab_controls( int const Cab ) { 1.f : 0.f ); } + + if (ggWiperSw.SubModel != nullptr) + { + ggWiperSw.PutValue(mvOccupied->wiperSwitchPos); + } + if (ggBrakeOperationModeCtrl.SubModel != nullptr) { ggBrakeOperationModeCtrl.PutValue( (mvOccupied->BrakeOpModeFlag > 0 ? @@ -10051,7 +10359,9 @@ bool TTrain::initialize_button(cParser &Parser, std::string const &Label, int co { "i-universal8:", btUniversals[ 8 ] }, { "i-universal9:", btUniversals[ 9 ] }, { "i-cabactived:", btCabActived }, - {"i-compressorany:", btCompressors } + {"i-aklvents:", btAKLVents}, + {"i-compressorany:", btCompressors }, + {"i-edenabled", btEDenabled }, }; { auto lookup = lights.find( Label ); @@ -10172,6 +10482,7 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con { "leftend_sw:", ggLeftEndLightButton }, { "rightend_sw:", ggRightEndLightButton }, { "lights_sw:", ggLightsButton }, + { "moderndimmer_sw:", ggModernLightDimSw }, { "rearupperlight_sw:", ggRearUpperLightButton }, { "rearleftlight_sw:", ggRearLeftLightButton }, { "rearrightlight_sw:", ggRearRightLightButton }, @@ -10282,6 +10593,9 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con { "invertertoggle10_bt:", ggInverterToggleButtons[9] }, { "invertertoggle11_bt:", ggInverterToggleButtons[10] }, { "invertertoggle12_bt:", ggInverterToggleButtons[11] }, + {"pantvalvesupdate_bt:", ggPantValvesUpdate}, + {"pantvalvesoff_bt:", ggPantValvesOff}, + {"wipers_sw:", ggWiperSw} }; { auto const lookup { gauges.find( Label ) }; diff --git a/Train.h b/Train.h index ce0467c5..84c3fbba 100644 --- a/Train.h +++ b/Train.h @@ -226,6 +226,8 @@ class TTrain { // 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 // TBD, TODO: consider this approach if we ever want to have customized consist behaviour to received commands, based on the consist/vehicle type or whatever + static void OnCommand_wiperswitchincrease(TTrain *Train, command_data const &Command); + static void OnCommand_wiperswitchdecrease(TTrain *Train, command_data const &Command); static void OnCommand_aidriverenable( TTrain *Train, command_data const &Command ); static void OnCommand_aidriverdisable( TTrain *Train, command_data const &Command ); static void OnCommand_jointcontrollerset( TTrain *Train, command_data const &Command ); @@ -399,6 +401,8 @@ class TTrain { static void OnCommand_headlighttogglerearupper( TTrain *Train, command_data const &Command ); static void OnCommand_headlightenablerearupper( TTrain *Train, command_data const &Command ); static void OnCommand_headlightdisablerearupper( TTrain *Train, command_data const &Command ); + static void OnCommand_modernlightdimmerincrease(TTrain *Train, command_data const &Command); + static void OnCommand_modernlightdimmerdecrease(TTrain *Train, command_data const &Command); static void OnCommand_redmarkertogglerearleft( TTrain *Train, command_data const &Command ); static void OnCommand_redmarkerenablerearleft( TTrain *Train, command_data const &Command ); static void OnCommand_redmarkerdisablerearleft( TTrain *Train, command_data const &Command ); @@ -542,6 +546,8 @@ public: // reszta może by?publiczna TGauge ggBrakeProfileR; // nastawiacz PR - hamowanie dwustopniowe TGauge ggBrakeOperationModeCtrl; //przełącznik trybu pracy PS/PN/EP/MED + TGauge ggWiperSw; // przelacznik wycieraczek + TGauge ggMaxCurrentCtrl; TGauge ggMainOffButton; @@ -578,6 +584,7 @@ public: // reszta może by?publiczna TGauge ggRightEndLightButton; TGauge ggLightsButton; // przelacznik reflektorow (wszystkich) TGauge ggDimHeadlightsButton; // headlights dimming switch + TGauge ggModernLightDimSw; // modern lights dimmer // hunter-230112: przelacznik swiatel tylnich TGauge ggRearUpperLightButton; @@ -658,6 +665,8 @@ public: // reszta może by?publiczna TGauge ggPantValvesButton; TGauge ggPantCompressorButton; TGauge ggPantCompressorValve; + TGauge ggPantValvesUpdate; + TGauge ggPantValvesOff; // Winger 020304 - wlacznik ogrzewania TGauge ggTrainHeatingButton; TGauge ggSignallingButton; @@ -769,8 +778,10 @@ public: // reszta może by?publiczna TButton btLampkaRearRightLight; TButton btLampkaRearLeftEndLight; TButton btLampkaRearRightEndLight; - TButton btCabActived; - TButton btCompressors; // lampka pracy jakiejkolwiek sprezarki + TButton btCabActived; + TButton btAKLVents; + TButton btCompressors; // lampka pracy jakiejkolwiek sprezarki + TButton btEDenabled; // czy wlaczony jest hamulec ED (czy dostepny) // other TButton btLampkaMalfunction; TButton btLampkaMalfunctionB; @@ -833,6 +844,8 @@ private: float fHaslerTimer; float fConverterTimer; // hunter-261211: dla przekaznika float fMainRelayTimer; // hunter-141211: zalaczanie WSa z opoznieniem + float fBatteryTimer = {-1.f}; // Hirek: zalaczanie baterii z opoznieniem (tylko gdy zdefiniowano takie zachowanie w fiz) + bool allowBatteryToggle = true; // Hirek: zabezpieczenie przed przelaczaniem bateri on/off int ScreenUpdateRate { 0 }; // vehicle specific python screen update rate override // McZapkie-240302 - przyda sie do tachometru @@ -875,6 +888,7 @@ private: bool m_dirbackward{ false }; // helper, true if direction set to backward bool m_doorpermits{ false }; // helper, true if any door permit is active float m_doorpermittimers[2] = { -1.f, -1.f }; + float trainLenghtMeasureTimer = { -1.f }; // ld substitute bool m_couplingdisconnect { false }; bool m_couplingdisconnectback { false }; diff --git a/application.cpp b/application.cpp index a6762cc7..9e63ce3d 100644 --- a/application.cpp +++ b/application.cpp @@ -29,6 +29,9 @@ http://mozilla.org/MPL/2.0/. #include "Timer.h" #include "dictionary.h" #include "version_info.h" +#include "ref/discord-rpc/include/discord_rpc.h" +#include +#include "translation.h" #ifdef _WIN32 #pragma comment (lib, "dsound.lib") @@ -174,6 +177,83 @@ int eu07_application::run_crashgui() } return -1; } +void eu07_application::DiscordRPCService() +{ + // initialize discord-rpc + WriteLog("Initializing Discord Rich Presence..."); + static const char *discord_app_id = "1343662664504840222"; + DiscordEventHandlers handlers; + memset(&handlers, 0, sizeof(handlers)); + Discord_Initialize(discord_app_id, &handlers, 1, nullptr); + + std::string rpcScnName = Global.SceneryFile; + if (rpcScnName[0] == '$') + rpcScnName.erase(0, 1); + rpcScnName.erase(rpcScnName.size() - 4, 4); + if (rpcScnName.find('_') != std::string::npos) + { + std::replace(rpcScnName.begin(), rpcScnName.end(), '_', ' '); + } + + // calculate startup timestamp + auto now = std::chrono::system_clock::now(); + auto now_c = std::chrono::system_clock::to_time_t(now); + + // Init RPC object + static DiscordRichPresence discord_rpc; + memset(&discord_rpc, 0, sizeof(discord_rpc)); + // realworld timestamp from datetime + discord_rpc.startTimestamp = static_cast(now_c); + static std::string state = Translations.lookup_s("Scenery: ") + rpcScnName; + discord_rpc.state = state.c_str(); + discord_rpc.details = Translations.lookup_c("Loading scenery..."); + discord_rpc.largeImageKey = "logo"; + discord_rpc.largeImageText = "MaSzyna"; + + // First RPC upload + Discord_UpdatePresence(&discord_rpc); + + // run loop + while (!glfwWindowShouldClose(m_windows.front()) && !m_modestack.empty()) + { + // Discord RPC updater + if (simulation::is_ready) + { + std::string PlayerVehicle; + if (simulation::Train != nullptr) + { + PlayerVehicle = simulation::Train->name(); + // make to upper + for (auto &c : PlayerVehicle) + c = toupper(c); + + PlayerVehicle = Translations.lookup_s("Driving: ") + PlayerVehicle; + discord_rpc.details = PlayerVehicle.c_str(); + + uint16_t playerTrainVelocity = simulation::Train->Dynamic()->GetVelocity(); + if (playerTrainVelocity > 1) + { + // ikonka ze jedziemy i nie spimy + discord_rpc.smallImageKey = "driving"; + std::string smallText = Translations.lookup_s("Speed: ") + std::to_string(playerTrainVelocity) + " km/h"; + discord_rpc.smallImageText = smallText.c_str(); + } + else + { + // krecimy postoj + discord_rpc.smallImageKey = "halt"; + discord_rpc.smallImageText = Translations.lookup_c("Stopped"); + } + } + + + + + Discord_UpdatePresence(&discord_rpc); + } + std::this_thread::sleep_for(std::chrono::milliseconds(5000)); // update RPC every 5 secs + } +} int eu07_application::init( int Argc, char *Argv[] ) { @@ -186,6 +266,10 @@ eu07_application::init( int Argc, char *Argv[] ) { return result; } + // start logging service + std::thread sLoggingService(LogService); + Global.threads.emplace("LogService", std::move(sLoggingService)); + WriteLog( "Starting MaSzyna rail vehicle simulator (release: " + Global.asVersion + ")" ); WriteLog( "For online documentation and additional files refer to: http://eu07.pl" ); WriteLog( "Authors: Marcin_EU, McZapkie, ABu, Winger, Tolaris, nbmx, OLO_EU, Bart, Quark-t, " @@ -239,9 +323,15 @@ eu07_application::init( int Argc, char *Argv[] ) { if (!init_network()) return -1; + // Run DiscordRPC service + std::thread sDiscordRPC(&eu07_application::DiscordRPCService, this); + Global.threads.emplace("DiscordRPC", std::move(sDiscordRPC)); + return result; } + + double eu07_application::generate_sync() { if (Timer::GetDeltaTime() == 0.0) return 0.0; @@ -433,7 +523,8 @@ eu07_application::run() { std::this_thread::sleep_for( Global.minframetime - frametime ); } } - + Global.threads["LogService"].~thread(); // kill log service + Global.threads["DiscordRPC"].~thread(); // kill DiscordRPC service return 0; } diff --git a/application.h b/application.h index c6f846d8..00fbd6ab 100644 --- a/application.h +++ b/application.h @@ -37,6 +37,8 @@ public: int run(); // issues request for a worker thread to perform specified task. returns: true if task was scheduled + + void eu07_application::DiscordRPCService(); // discord rich presence service function (runs as separate thread) bool request( python_taskqueue::task_request const &Task ); // ensures the main thread holds the python gil and can safely execute python calls diff --git a/appveyor.yml b/appveyor.yml index d42cd5f6..6644ef1a 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,10 +3,10 @@ image: Visual Studio 2017 clone_depth: 1 build_script: - ps: >- + git submodule update --init --recursive + cd ref - - git clone "https://github.com/chriskohlhoff/asio" --depth 1 --branch asio-1-16-1 -q - + curl -o crashpad86.zip "http://get.backtrace.io/crashpad/builds/release/x86/crashpad-2020-07-01-release-x86-558c9614e3819179f30b92541450f5ac643afce5.zip" 7z x crashpad86.zip diff --git a/command.cpp b/command.cpp index cef9f524..55328e8d 100644 --- a/command.cpp +++ b/command.cpp @@ -22,358 +22,719 @@ namespace simulation { command_queue Commands; commanddescription_sequence Commands_descriptions = { - { "aidriverenable", command_target::vehicle, command_mode::oneoff }, - { "aidriverdisable", command_target::vehicle, command_mode::oneoff }, - { "jointcontrollerset", command_target::vehicle, command_mode::oneoff }, - { "mastercontrollerincrease", command_target::vehicle, command_mode::oneoff }, - { "mastercontrollerincreasefast", command_target::vehicle, command_mode::oneoff }, - { "mastercontrollerdecrease", command_target::vehicle, command_mode::oneoff }, - { "mastercontrollerdecreasefast", command_target::vehicle, command_mode::oneoff }, - { "mastercontrollerset", command_target::vehicle, command_mode::oneoff }, - { "secondcontrollerincrease", command_target::vehicle, command_mode::oneoff }, - { "secondcontrollerincreasefast", command_target::vehicle, command_mode::oneoff }, - { "secondcontrollerdecrease", command_target::vehicle, command_mode::oneoff }, - { "secondcontrollerdecreasefast", command_target::vehicle, command_mode::oneoff }, - { "secondcontrollerset", command_target::vehicle, command_mode::oneoff }, - { "mucurrentindicatorothersourceactivate", command_target::vehicle, command_mode::oneoff }, - { "independentbrakeincrease", command_target::vehicle, command_mode::continuous }, - { "independentbrakeincreasefast", command_target::vehicle, command_mode::oneoff }, - { "independentbrakedecrease", command_target::vehicle, command_mode::continuous }, - { "independentbrakedecreasefast", command_target::vehicle, command_mode::oneoff }, - { "independentbrakeset", command_target::vehicle, command_mode::oneoff }, - { "independentbrakebailoff", command_target::vehicle, command_mode::oneoff }, - { "universalbrakebutton1", command_target::vehicle, command_mode::oneoff }, - { "universalbrakebutton2", command_target::vehicle, command_mode::oneoff }, - { "universalbrakebutton3", command_target::vehicle, command_mode::oneoff }, - { "trainbrakeincrease", command_target::vehicle, command_mode::continuous }, - { "trainbrakedecrease", command_target::vehicle, command_mode::continuous }, - { "trainbrakeset", command_target::vehicle, command_mode::oneoff }, - { "trainbrakecharging", command_target::vehicle, command_mode::oneoff }, - { "trainbrakerelease", command_target::vehicle, command_mode::oneoff }, - { "trainbrakefirstservice", command_target::vehicle, command_mode::oneoff }, - { "trainbrakeservice", command_target::vehicle, command_mode::oneoff }, - { "trainbrakefullservice", command_target::vehicle, command_mode::oneoff }, - { "trainbrakehandleoff", command_target::vehicle, command_mode::oneoff }, - { "trainbrakeemergency", command_target::vehicle, command_mode::oneoff }, - { "trainbrakebasepressureincrease", command_target::vehicle, command_mode::oneoff }, - { "trainbrakebasepressuredecrease", command_target::vehicle, command_mode::oneoff }, - { "trainbrakebasepressurereset", command_target::vehicle, command_mode::oneoff }, - { "trainbrakeoperationtoggle", command_target::vehicle, command_mode::oneoff }, - { "manualbrakeincrease", command_target::vehicle, command_mode::oneoff }, - { "manualbrakedecrease", command_target::vehicle, command_mode::oneoff }, - { "alarmchaintoggle", command_target::vehicle, command_mode::oneoff }, - { "alarmchainenable", command_target::vehicle, command_mode::oneoff}, - { "alarmchaindisable", command_target::vehicle, command_mode::oneoff}, - { "wheelspinbrakeactivate", command_target::vehicle, command_mode::oneoff }, - { "sandboxactivate", command_target::vehicle, command_mode::oneoff }, - { "autosandboxtoggle", command_target::vehicle, command_mode::oneoff }, - { "autosandboxactivate", command_target::vehicle, command_mode::oneoff }, - { "autosandboxdeactivate", command_target::vehicle, command_mode::oneoff }, - { "reverserincrease", command_target::vehicle, command_mode::oneoff }, - { "reverserdecrease", command_target::vehicle, command_mode::oneoff }, - { "reverserforwardhigh", command_target::vehicle, command_mode::oneoff }, - { "reverserforward", command_target::vehicle, command_mode::oneoff }, - { "reverserneutral", command_target::vehicle, command_mode::oneoff }, - { "reverserbackward", command_target::vehicle, command_mode::oneoff }, - { "waterpumpbreakertoggle", command_target::vehicle, command_mode::oneoff }, - { "waterpumpbreakerclose", command_target::vehicle, command_mode::oneoff }, - { "waterpumpbreakeropen", command_target::vehicle, command_mode::oneoff }, - { "waterpumptoggle", command_target::vehicle, command_mode::oneoff }, - { "waterpumpenable", command_target::vehicle, command_mode::oneoff }, - { "waterpumpdisable", command_target::vehicle, command_mode::oneoff }, - { "waterheaterbreakertoggle", command_target::vehicle, command_mode::oneoff }, - { "waterheaterbreakerclose", command_target::vehicle, command_mode::oneoff }, - { "waterheaterbreakeropen", command_target::vehicle, command_mode::oneoff }, - { "waterheatertoggle", command_target::vehicle, command_mode::oneoff }, - { "waterheaterenable", command_target::vehicle, command_mode::oneoff }, - { "waterheaterdisable", command_target::vehicle, command_mode::oneoff }, - { "watercircuitslinktoggle", command_target::vehicle, command_mode::oneoff }, - { "watercircuitslinkenable", command_target::vehicle, command_mode::oneoff }, - { "watercircuitslinkdisable", command_target::vehicle, command_mode::oneoff }, - { "fuelpumptoggle", command_target::vehicle, command_mode::oneoff }, - { "fuelpumpenable", command_target::vehicle, command_mode::oneoff }, - { "fuelpumpdisable", command_target::vehicle, command_mode::oneoff }, - { "oilpumptoggle", command_target::vehicle, command_mode::oneoff }, - { "oilpumpenable", command_target::vehicle, command_mode::oneoff }, - { "oilpumpdisable", command_target::vehicle, command_mode::oneoff }, - { "linebreakertoggle", command_target::vehicle, command_mode::oneoff }, - { "linebreakeropen", command_target::vehicle, command_mode::oneoff }, - { "linebreakerclose", command_target::vehicle, command_mode::oneoff }, - { "convertertoggle", command_target::vehicle, command_mode::oneoff }, - { "converterenable", command_target::vehicle, command_mode::oneoff }, - { "converterdisable", command_target::vehicle, command_mode::oneoff }, - { "convertertogglelocal", command_target::vehicle, command_mode::oneoff }, - { "converteroverloadrelayreset", command_target::vehicle, command_mode::oneoff }, - { "compressortoggle", command_target::vehicle, command_mode::oneoff }, - { "compressorenable", command_target::vehicle, command_mode::oneoff }, - { "compressordisable", command_target::vehicle, command_mode::oneoff }, - { "compressortogglelocal", command_target::vehicle, command_mode::oneoff }, - { "compressorpresetactivatenext", command_target::vehicle, command_mode::oneoff }, - { "compressorpresetactivateprevious", command_target::vehicle, command_mode::oneoff }, - { "compressorpresetactivatedefault", command_target::vehicle, command_mode::oneoff }, - { "motoroverloadrelaythresholdtoggle", command_target::vehicle, command_mode::oneoff }, - { "motoroverloadrelaythresholdsetlow", command_target::vehicle, command_mode::oneoff }, - { "motoroverloadrelaythresholdsethigh", command_target::vehicle, command_mode::oneoff }, - { "motoroverloadrelayreset", command_target::vehicle, command_mode::oneoff }, - { "universalrelayreset1", command_target::vehicle, command_mode::oneoff }, - { "universalrelayreset2", command_target::vehicle, command_mode::oneoff }, - { "universalrelayreset3", command_target::vehicle, command_mode::oneoff }, - { "notchingrelaytoggle", command_target::vehicle, command_mode::oneoff }, - { "epbrakecontroltoggle", command_target::vehicle, command_mode::oneoff }, - { "trainbrakeoperationmodeincrease", command_target::vehicle, command_mode::oneoff }, - { "trainbrakeoperationmodedecrease", command_target::vehicle, command_mode::oneoff }, - { "brakeactingspeedincrease", command_target::vehicle, command_mode::oneoff }, - { "brakeactingspeeddecrease", command_target::vehicle, command_mode::oneoff }, - { "brakeactingspeedsetcargo", command_target::vehicle, command_mode::oneoff }, - { "brakeactingspeedsetpassenger", command_target::vehicle, command_mode::oneoff }, - { "brakeactingspeedsetrapid", command_target::vehicle, command_mode::oneoff }, - { "brakeloadcompensationincrease", command_target::vehicle, command_mode::oneoff }, - { "brakeloadcompensationdecrease", command_target::vehicle, command_mode::oneoff }, - { "mubrakingindicatortoggle", command_target::vehicle, command_mode::oneoff }, - { "alerteracknowledge", command_target::vehicle, command_mode::oneoff }, - { "cabsignalacknowledge", command_target::vehicle, command_mode::oneoff }, - { "hornlowactivate", command_target::vehicle, command_mode::oneoff }, - { "hornhighactivate", command_target::vehicle, command_mode::oneoff }, - { "whistleactivate", command_target::vehicle, command_mode::oneoff }, - { "radiotoggle", command_target::vehicle, command_mode::oneoff }, - { "radioenable", command_target::vehicle, command_mode::oneoff }, - { "radiodisable", command_target::vehicle, command_mode::oneoff }, - { "radiochannelincrease", command_target::vehicle, command_mode::oneoff }, - { "radiochanneldecrease", command_target::vehicle, command_mode::oneoff }, - { "radiochannelset", command_target::vehicle, command_mode::oneoff }, - { "radiostopsend", command_target::vehicle, command_mode::oneoff }, - { "radiostopenable", command_target::vehicle, command_mode::oneoff }, - { "radiostopdisable", command_target::vehicle, command_mode::oneoff }, - { "radiostoptest", command_target::vehicle, command_mode::oneoff }, - { "radiocall3send", command_target::vehicle, command_mode::oneoff }, - { "radiovolumeincrease", command_target::vehicle, command_mode::oneoff }, - { "radiovolumedecrease", command_target::vehicle, command_mode::oneoff }, - { "radiovolumeset", command_target::vehicle, command_mode::oneoff }, - { "cabchangeforward", command_target::vehicle, command_mode::oneoff }, - { "cabchangebackward", command_target::vehicle, command_mode::oneoff }, - { "viewturn", command_target::entity, command_mode::oneoff }, - { "movehorizontal", command_target::entity, command_mode::oneoff }, - { "movehorizontalfast", command_target::entity, command_mode::oneoff }, - { "movevertical", command_target::entity, command_mode::oneoff }, - { "moveverticalfast", command_target::entity, command_mode::oneoff }, - { "moveleft", command_target::entity, command_mode::oneoff }, - { "moveright", command_target::entity, command_mode::oneoff }, - { "moveforward", command_target::entity, command_mode::oneoff }, - { "moveback", command_target::entity, command_mode::oneoff }, - { "moveup", command_target::entity, command_mode::oneoff }, - { "movedown", command_target::entity, command_mode::oneoff }, - { "nearestcarcouplingincrease", command_target::vehicle, command_mode::oneoff }, - { "nearestcarcouplingdisconnect", command_target::vehicle, command_mode::oneoff }, - { "nearestcarcoupleradapterattach", command_target::vehicle, command_mode::oneoff }, - { "nearestcarcoupleradapterremove", command_target::vehicle, command_mode::oneoff }, - { "occupiedcarcouplingdisconnect", command_target::vehicle, command_mode::oneoff }, - { "occupiedcarcouplingdisconnectback", command_target::vehicle, command_mode::oneoff }, - { "doortoggleleft", command_target::vehicle, command_mode::oneoff }, - { "doortoggleright", command_target::vehicle, command_mode::oneoff }, - { "doorpermitleft", command_target::vehicle, command_mode::oneoff }, - { "doorpermitright", command_target::vehicle, command_mode::oneoff }, - { "doorpermitpresetactivatenext", command_target::vehicle, command_mode::oneoff }, - { "doorpermitpresetactivateprevious", command_target::vehicle, command_mode::oneoff }, - { "dooropenleft", command_target::vehicle, command_mode::oneoff }, - { "dooropenright", command_target::vehicle, command_mode::oneoff }, - { "dooropenall", command_target::vehicle, command_mode::oneoff }, - { "doorcloseleft", command_target::vehicle, command_mode::oneoff }, - { "doorcloseright", command_target::vehicle, command_mode::oneoff }, - { "doorcloseall", command_target::vehicle, command_mode::oneoff }, - { "doorsteptoggle", command_target::vehicle, command_mode::oneoff }, - { "doormodetoggle", command_target::vehicle, command_mode::oneoff }, - { "mirrorstoggle", command_target::vehicle, command_mode::oneoff }, - { "departureannounce", command_target::vehicle, command_mode::oneoff }, - { "doorlocktoggle", command_target::vehicle, command_mode::oneoff }, - { "pantographcompressorvalvetoggle", command_target::vehicle, command_mode::oneoff }, - { "pantographcompressorvalveenable", command_target::vehicle, command_mode::oneoff }, - { "pantographcompressorvalvedisable", command_target::vehicle, command_mode::oneoff }, - { "pantographcompressoractivate", command_target::vehicle, command_mode::oneoff }, - { "pantographtogglefront", command_target::vehicle, command_mode::oneoff }, - { "pantographtogglerear", command_target::vehicle, command_mode::oneoff }, - { "pantographraisefront", command_target::vehicle, command_mode::oneoff }, - { "pantographraiserear", command_target::vehicle, command_mode::oneoff }, - { "pantographlowerfront", command_target::vehicle, command_mode::oneoff }, - { "pantographlowerrear", command_target::vehicle, command_mode::oneoff }, - { "pantographlowerall", command_target::vehicle, command_mode::oneoff }, - { "pantographselectnext", command_target::vehicle, command_mode::oneoff }, - { "pantographselectprevious", command_target::vehicle, command_mode::oneoff }, - { "pantographtoggleselected", command_target::vehicle, command_mode::oneoff }, - { "pantographraiseselected", command_target::vehicle, command_mode::oneoff }, - { "pantographlowerselected", command_target::vehicle, command_mode::oneoff }, - { "pantographvalvesupdate", command_target::vehicle, command_mode::oneoff }, - { "pantographvalvesoff", command_target::vehicle, command_mode::oneoff }, - { "heatingtoggle", command_target::vehicle, command_mode::oneoff }, - { "heatingenable", command_target::vehicle, command_mode::oneoff }, - { "heatingdisable", command_target::vehicle, command_mode::oneoff }, - { "lightspresetactivatenext", command_target::vehicle, command_mode::oneoff }, - { "lightspresetactivateprevious", command_target::vehicle, command_mode::oneoff }, - { "headlighttoggleleft", command_target::vehicle, command_mode::oneoff }, - { "headlightenableleft", command_target::vehicle, command_mode::oneoff }, - { "headlightdisableleft", command_target::vehicle, command_mode::oneoff }, - { "headlighttoggleright", command_target::vehicle, command_mode::oneoff }, - { "headlightenableright", command_target::vehicle, command_mode::oneoff }, - { "headlightdisableright", command_target::vehicle, command_mode::oneoff }, - { "headlighttoggleupper", command_target::vehicle, command_mode::oneoff }, - { "headlightenableupper", command_target::vehicle, command_mode::oneoff }, - { "headlightdisableupper", command_target::vehicle, command_mode::oneoff }, - { "redmarkertoggleleft", command_target::vehicle, command_mode::oneoff }, - { "redmarkerenableleft", command_target::vehicle, command_mode::oneoff }, - { "redmarkerdisableleft", command_target::vehicle, command_mode::oneoff }, - { "redmarkertoggleright", command_target::vehicle, command_mode::oneoff }, - { "redmarkerenableright", command_target::vehicle, command_mode::oneoff }, - { "redmarkerdisableright", command_target::vehicle, command_mode::oneoff }, - { "headlighttogglerearleft", command_target::vehicle, command_mode::oneoff }, - { "headlightenablerearleft", command_target::vehicle, command_mode::oneoff }, - { "headlightdisablerearleft", command_target::vehicle, command_mode::oneoff }, - { "headlighttogglerearright", command_target::vehicle, command_mode::oneoff }, - { "headlightenablerearright", command_target::vehicle, command_mode::oneoff }, - { "headlightdisablerearright", command_target::vehicle, command_mode::oneoff }, - { "headlighttogglerearupper", command_target::vehicle, command_mode::oneoff }, - { "headlightenablerearupper", command_target::vehicle, command_mode::oneoff }, - { "headlightdisablerearupper", command_target::vehicle, command_mode::oneoff }, - { "redmarkertogglerearleft", command_target::vehicle, command_mode::oneoff }, - { "redmarkerenablerearleft", command_target::vehicle, command_mode::oneoff }, - { "redmarkerdisablerearleft", command_target::vehicle, command_mode::oneoff }, - { "redmarkertogglerearright", command_target::vehicle, command_mode::oneoff }, - { "redmarkerenablerearright", command_target::vehicle, command_mode::oneoff }, - { "redmarkerdisablerearright", command_target::vehicle, command_mode::oneoff }, - { "redmarkerstoggle", command_target::vehicle, command_mode::oneoff }, - { "endsignalstoggle", command_target::vehicle, command_mode::oneoff }, - { "headlightsdimtoggle", command_target::vehicle, command_mode::oneoff }, - { "headlightsdimenable", command_target::vehicle, command_mode::oneoff }, - { "headlightsdimdisable", command_target::vehicle, command_mode::oneoff }, - { "motorconnectorsopen", command_target::vehicle, command_mode::oneoff }, - { "motorconnectorsclose", command_target::vehicle, command_mode::oneoff }, - { "motordisconnect", command_target::vehicle, command_mode::oneoff }, - { "interiorlighttoggle", command_target::vehicle, command_mode::oneoff }, - { "interiorlightenable", command_target::vehicle, command_mode::oneoff }, - { "interiorlightdisable", command_target::vehicle, command_mode::oneoff }, - { "interiorlightdimtoggle", command_target::vehicle, command_mode::oneoff }, - { "interiorlightdimenable", command_target::vehicle, command_mode::oneoff }, - { "interiorlightdimdisable", command_target::vehicle, command_mode::oneoff }, - { "compartmentlightstoggle", command_target::vehicle, command_mode::oneoff }, - { "compartmentlightsenable", command_target::vehicle, command_mode::oneoff }, - { "compartmentlightsdisable", command_target::vehicle, command_mode::oneoff }, - { "instrumentlighttoggle", command_target::vehicle, command_mode::oneoff }, - { "instrumentlightenable", command_target::vehicle, command_mode::oneoff }, - { "instrumentlightdisable", command_target::vehicle, command_mode::oneoff }, - { "dashboardlighttoggle", command_target::vehicle, command_mode::oneoff }, - { "dashboardlightenable", command_target::vehicle, command_mode::oneoff }, - { "dashboardlightdisable", command_target::vehicle, command_mode::oneoff }, - { "timetablelighttoggle", command_target::vehicle, command_mode::oneoff }, - { "timetablelightenable", command_target::vehicle, command_mode::oneoff }, - { "timetablelightdisable", command_target::vehicle, command_mode::oneoff }, - { "generictoggle0", command_target::vehicle, command_mode::oneoff }, - { "generictoggle1", command_target::vehicle, command_mode::oneoff }, - { "generictoggle2", command_target::vehicle, command_mode::oneoff }, - { "generictoggle3", command_target::vehicle, command_mode::oneoff }, - { "generictoggle4", command_target::vehicle, command_mode::oneoff }, - { "generictoggle5", command_target::vehicle, command_mode::oneoff }, - { "generictoggle6", command_target::vehicle, command_mode::oneoff }, - { "generictoggle7", command_target::vehicle, command_mode::oneoff }, - { "generictoggle8", command_target::vehicle, command_mode::oneoff }, - { "generictoggle9", command_target::vehicle, command_mode::oneoff }, - { "batterytoggle", command_target::vehicle, command_mode::oneoff }, - { "batteryenable", command_target::vehicle, command_mode::oneoff }, - { "batterydisable", command_target::vehicle, command_mode::oneoff }, - { "cabactivationtoggle", command_target::vehicle, command_mode::oneoff }, - { "cabactivationenable", command_target::vehicle, command_mode::oneoff }, - { "cabactivationdisable", command_target::vehicle, command_mode::oneoff }, - { "motorblowerstogglefront", command_target::vehicle, command_mode::oneoff }, - { "motorblowerstogglerear", command_target::vehicle, command_mode::oneoff }, - { "motorblowersdisableall", command_target::vehicle, command_mode::oneoff }, - { "coolingfanstoggle", command_target::vehicle, command_mode::oneoff }, - { "tempomattoggle", command_target::vehicle, command_mode::oneoff }, - { "springbraketoggle", command_target::vehicle, command_mode::oneoff }, - { "springbrakeenable", command_target::vehicle, command_mode::oneoff }, - { "springbrakedisable", command_target::vehicle, command_mode::oneoff }, - { "springbrakeshutofftoggle", command_target::vehicle, command_mode::oneoff }, - { "springbrakeshutoffenable", command_target::vehicle, command_mode::oneoff }, - { "springbrakeshutoffdisable", command_target::vehicle, command_mode::oneoff }, - { "springbrakerelease", command_target::vehicle }, - { "distancecounteractivate", command_target::vehicle, command_mode::oneoff }, - { "speedcontrolincrease", command_target::vehicle, command_mode::oneoff }, - { "speedcontroldecrease", command_target::vehicle, command_mode::oneoff }, - { "speedcontrolpowerincrease", command_target::vehicle, command_mode::oneoff }, - { "speedcontrolpowerdecrease", command_target::vehicle, command_mode::oneoff }, - { "speedcontrolbutton0", command_target::vehicle, command_mode::oneoff }, - { "speedcontrolbutton1", command_target::vehicle, command_mode::oneoff }, - { "speedcontrolbutton2", command_target::vehicle, command_mode::oneoff }, - { "speedcontrolbutton3", command_target::vehicle, command_mode::oneoff }, - { "speedcontrolbutton4", command_target::vehicle, command_mode::oneoff }, - { "speedcontrolbutton5", command_target::vehicle, command_mode::oneoff }, - { "speedcontrolbutton6", command_target::vehicle, command_mode::oneoff }, - { "speedcontrolbutton7", command_target::vehicle, command_mode::oneoff }, - { "speedcontrolbutton8", command_target::vehicle, command_mode::oneoff }, - { "speedcontrolbutton9", command_target::vehicle, command_mode::oneoff }, - { "inverterenable1", command_target::vehicle, command_mode::oneoff }, - { "inverterenable2", command_target::vehicle, command_mode::oneoff }, - { "inverterenable3", command_target::vehicle, command_mode::oneoff }, - { "inverterenable4", command_target::vehicle, command_mode::oneoff }, - { "inverterenable5", command_target::vehicle, command_mode::oneoff }, - { "inverterenable6", command_target::vehicle, command_mode::oneoff }, - { "inverterenable7", command_target::vehicle, command_mode::oneoff }, - { "inverterenable8", command_target::vehicle, command_mode::oneoff }, - { "inverterenable9", command_target::vehicle, command_mode::oneoff }, - { "inverterenable10", command_target::vehicle, command_mode::oneoff }, - { "inverterenable11", command_target::vehicle, command_mode::oneoff }, - { "inverterenable12", command_target::vehicle, command_mode::oneoff }, - { "inverterdisable1", command_target::vehicle, command_mode::oneoff }, - { "inverterdisable2", command_target::vehicle, command_mode::oneoff }, - { "inverterdisable3", command_target::vehicle, command_mode::oneoff }, - { "inverterdisable4", command_target::vehicle, command_mode::oneoff }, - { "inverterdisable5", command_target::vehicle, command_mode::oneoff }, - { "inverterdisable6", command_target::vehicle, command_mode::oneoff }, - { "inverterdisable7", command_target::vehicle, command_mode::oneoff }, - { "inverterdisable8", command_target::vehicle, command_mode::oneoff }, - { "inverterdisable9", command_target::vehicle, command_mode::oneoff }, - { "inverterdisable10", command_target::vehicle, command_mode::oneoff }, - { "inverterdisable11", command_target::vehicle, command_mode::oneoff }, - { "inverterdisable12", command_target::vehicle, command_mode::oneoff }, - { "invertertoggle1", command_target::vehicle, command_mode::oneoff }, - { "invertertoggle2", command_target::vehicle, command_mode::oneoff }, - { "invertertoggle3", command_target::vehicle, command_mode::oneoff }, - { "invertertoggle4", command_target::vehicle, command_mode::oneoff }, - { "invertertoggle5", command_target::vehicle, command_mode::oneoff }, - { "invertertoggle6", command_target::vehicle, command_mode::oneoff }, - { "invertertoggle7", command_target::vehicle, command_mode::oneoff }, - { "invertertoggle8", command_target::vehicle, command_mode::oneoff }, - { "invertertoggle9", command_target::vehicle, command_mode::oneoff }, - { "invertertoggle10", command_target::vehicle, command_mode::oneoff }, - { "invertertoggle11", command_target::vehicle, command_mode::oneoff }, - { "invertertoggle12", command_target::vehicle, command_mode::oneoff }, - { "globalradiostop", command_target::simulation, command_mode::oneoff }, - { "timejump", command_target::simulation, command_mode::oneoff }, - { "timejumplarge", command_target::simulation, command_mode::oneoff }, - { "timejumpsmall", command_target::simulation, command_mode::oneoff }, - { "setdatetime", command_target::simulation, command_mode::oneoff }, - { "setweather", command_target::simulation, command_mode::oneoff }, - { "settemperature", command_target::simulation, command_mode::oneoff }, - { "vehiclemoveforwards", command_target::vehicle, command_mode::oneoff }, - { "vehiclemovebackwards", command_target::vehicle, command_mode::oneoff }, - { "vehicleboost", command_target::vehicle, command_mode::oneoff }, - { "debugtoggle", command_target::simulation, command_mode::oneoff }, - { "focuspauseset", command_target::simulation, command_mode::oneoff }, - { "pausetoggle", command_target::simulation, command_mode::oneoff }, - { "entervehicle", command_target::simulation, command_mode::oneoff }, - { "resetconsist", command_target::simulation, command_mode::oneoff }, - { "fillcompressor", command_target::simulation, command_mode::oneoff }, - { "consistreleaser", command_target::simulation, command_mode::oneoff }, - { "queueevent", command_target::simulation, command_mode::oneoff }, - { "setlight", command_target::simulation, command_mode::oneoff }, - { "insertmodel", command_target::simulation, command_mode::oneoff }, - { "deletemodel", command_target::simulation, command_mode::oneoff }, - { "trainsetmove", command_target::simulation, command_mode::oneoff }, - { "consistteleport", command_target::simulation, command_mode::oneoff }, - { "pullalarmchain", command_target::simulation, command_mode::oneoff }, - { "sendaicommand", command_target::simulation, command_mode::oneoff }, - { "spawntrainset", command_target::simulation, command_mode::oneoff }, - { "destroytrainset", command_target::simulation, command_mode::oneoff }, - { "quitsimulation", command_target::simulation, command_mode::oneoff }, + {"aidriverenable", command_target::vehicle, command_mode::oneoff}, + {"aidriverdisable", command_target::vehicle, command_mode::oneoff}, + {"jointcontrollerset", command_target::vehicle, command_mode::oneoff}, + {"mastercontrollerincrease", command_target::vehicle, command_mode::oneoff}, + {"mastercontrollerincreasefast", command_target::vehicle, command_mode::oneoff}, + {"mastercontrollerdecrease", command_target::vehicle, command_mode::oneoff}, + {"mastercontrollerdecreasefast", command_target::vehicle, command_mode::oneoff}, + {"mastercontrollerset", command_target::vehicle, command_mode::oneoff}, + {"secondcontrollerincrease", command_target::vehicle, command_mode::oneoff}, + {"secondcontrollerincreasefast", command_target::vehicle, command_mode::oneoff}, + {"secondcontrollerdecrease", command_target::vehicle, command_mode::oneoff}, + {"secondcontrollerdecreasefast", command_target::vehicle, command_mode::oneoff}, + {"secondcontrollerset", command_target::vehicle, command_mode::oneoff}, + {"mucurrentindicatorothersourceactivate", command_target::vehicle, command_mode::oneoff}, + {"independentbrakeincrease", command_target::vehicle, command_mode::continuous}, + {"independentbrakeincreasefast", command_target::vehicle, command_mode::oneoff}, + {"independentbrakedecrease", command_target::vehicle, command_mode::continuous}, + {"independentbrakedecreasefast", command_target::vehicle, command_mode::oneoff}, + {"independentbrakeset", command_target::vehicle, command_mode::oneoff}, + {"independentbrakebailoff", command_target::vehicle, command_mode::oneoff}, + {"universalbrakebutton1", command_target::vehicle, command_mode::oneoff}, + {"universalbrakebutton2", command_target::vehicle, command_mode::oneoff}, + {"universalbrakebutton3", command_target::vehicle, command_mode::oneoff}, + {"trainbrakeincrease", command_target::vehicle, command_mode::continuous}, + {"trainbrakedecrease", command_target::vehicle, command_mode::continuous}, + {"trainbrakeset", command_target::vehicle, command_mode::oneoff}, + {"trainbrakecharging", command_target::vehicle, command_mode::oneoff}, + {"trainbrakerelease", command_target::vehicle, command_mode::oneoff}, + {"trainbrakefirstservice", command_target::vehicle, command_mode::oneoff}, + {"trainbrakeservice", command_target::vehicle, command_mode::oneoff}, + {"trainbrakefullservice", command_target::vehicle, command_mode::oneoff}, + {"trainbrakehandleoff", command_target::vehicle, command_mode::oneoff}, + {"trainbrakeemergency", command_target::vehicle, command_mode::oneoff}, + {"trainbrakebasepressureincrease", command_target::vehicle, command_mode::oneoff}, + {"trainbrakebasepressuredecrease", command_target::vehicle, command_mode::oneoff}, + {"trainbrakebasepressurereset", command_target::vehicle, command_mode::oneoff}, + {"trainbrakeoperationtoggle", command_target::vehicle, command_mode::oneoff}, + {"manualbrakeincrease", command_target::vehicle, command_mode::oneoff}, + {"manualbrakedecrease", command_target::vehicle, command_mode::oneoff}, + {"alarmchaintoggle", command_target::vehicle, command_mode::oneoff}, + {"alarmchainenable", command_target::vehicle, command_mode::oneoff}, + {"alarmchaindisable", command_target::vehicle, command_mode::oneoff}, + {"wheelspinbrakeactivate", command_target::vehicle, command_mode::oneoff}, + {"sandboxactivate", command_target::vehicle, command_mode::oneoff}, + {"autosandboxtoggle", command_target::vehicle, command_mode::oneoff}, + {"autosandboxactivate", command_target::vehicle, command_mode::oneoff}, + {"autosandboxdeactivate", command_target::vehicle, command_mode::oneoff}, + {"reverserincrease", command_target::vehicle, command_mode::oneoff}, + {"reverserdecrease", command_target::vehicle, command_mode::oneoff}, + {"reverserforwardhigh", command_target::vehicle, command_mode::oneoff}, + {"reverserforward", command_target::vehicle, command_mode::oneoff}, + {"reverserneutral", command_target::vehicle, command_mode::oneoff}, + {"reverserbackward", command_target::vehicle, command_mode::oneoff}, + {"waterpumpbreakertoggle", command_target::vehicle, command_mode::oneoff}, + {"waterpumpbreakerclose", command_target::vehicle, command_mode::oneoff}, + {"waterpumpbreakeropen", command_target::vehicle, command_mode::oneoff}, + {"waterpumptoggle", command_target::vehicle, command_mode::oneoff}, + {"waterpumpenable", command_target::vehicle, command_mode::oneoff}, + {"waterpumpdisable", command_target::vehicle, command_mode::oneoff}, + {"waterheaterbreakertoggle", command_target::vehicle, command_mode::oneoff}, + {"waterheaterbreakerclose", command_target::vehicle, command_mode::oneoff}, + {"waterheaterbreakeropen", command_target::vehicle, command_mode::oneoff}, + {"waterheatertoggle", command_target::vehicle, command_mode::oneoff}, + {"waterheaterenable", command_target::vehicle, command_mode::oneoff}, + {"waterheaterdisable", command_target::vehicle, command_mode::oneoff}, + {"watercircuitslinktoggle", command_target::vehicle, command_mode::oneoff}, + {"watercircuitslinkenable", command_target::vehicle, command_mode::oneoff}, + {"watercircuitslinkdisable", command_target::vehicle, command_mode::oneoff}, + {"fuelpumptoggle", command_target::vehicle, command_mode::oneoff}, + {"fuelpumpenable", command_target::vehicle, command_mode::oneoff}, + {"fuelpumpdisable", command_target::vehicle, command_mode::oneoff}, + {"oilpumptoggle", command_target::vehicle, command_mode::oneoff}, + {"oilpumpenable", command_target::vehicle, command_mode::oneoff}, + {"oilpumpdisable", command_target::vehicle, command_mode::oneoff}, + {"linebreakertoggle", command_target::vehicle, command_mode::oneoff}, + {"linebreakeropen", command_target::vehicle, command_mode::oneoff}, + {"linebreakerclose", command_target::vehicle, command_mode::oneoff}, + {"convertertoggle", command_target::vehicle, command_mode::oneoff}, + {"converterenable", command_target::vehicle, command_mode::oneoff}, + {"converterdisable", command_target::vehicle, command_mode::oneoff}, + {"convertertogglelocal", command_target::vehicle, command_mode::oneoff}, + {"converteroverloadrelayreset", command_target::vehicle, command_mode::oneoff}, + {"compressortoggle", command_target::vehicle, command_mode::oneoff}, + {"compressorenable", command_target::vehicle, command_mode::oneoff}, + {"compressordisable", command_target::vehicle, command_mode::oneoff}, + {"compressortogglelocal", command_target::vehicle, command_mode::oneoff}, + {"compressorpresetactivatenext", command_target::vehicle, command_mode::oneoff}, + {"compressorpresetactivateprevious", command_target::vehicle, command_mode::oneoff}, + {"compressorpresetactivatedefault", command_target::vehicle, command_mode::oneoff}, + {"motoroverloadrelaythresholdtoggle", command_target::vehicle, command_mode::oneoff}, + {"motoroverloadrelaythresholdsetlow", command_target::vehicle, command_mode::oneoff}, + {"motoroverloadrelaythresholdsethigh", command_target::vehicle, command_mode::oneoff}, + {"motoroverloadrelayreset", command_target::vehicle, command_mode::oneoff}, + {"universalrelayreset1", command_target::vehicle, command_mode::oneoff}, + {"universalrelayreset2", command_target::vehicle, command_mode::oneoff}, + {"universalrelayreset3", command_target::vehicle, command_mode::oneoff}, + {"notchingrelaytoggle", command_target::vehicle, command_mode::oneoff}, + {"epbrakecontroltoggle", command_target::vehicle, command_mode::oneoff}, + {"epbrakecontrolenable", command_target::vehicle, command_mode::oneoff}, + {"epbrakecontroldisable", command_target::vehicle, command_mode::oneoff}, + {"trainbrakeoperationmodeincrease", command_target::vehicle, command_mode::oneoff}, + {"trainbrakeoperationmodedecrease", command_target::vehicle, command_mode::oneoff}, + {"brakeactingspeedincrease", command_target::vehicle, command_mode::oneoff}, + {"brakeactingspeeddecrease", command_target::vehicle, command_mode::oneoff}, + {"brakeactingspeedsetcargo", command_target::vehicle, command_mode::oneoff}, + {"brakeactingspeedsetpassenger", command_target::vehicle, command_mode::oneoff}, + {"brakeactingspeedsetrapid", command_target::vehicle, command_mode::oneoff}, + {"brakeloadcompensationincrease", command_target::vehicle, command_mode::oneoff}, + {"brakeloadcompensationdecrease", command_target::vehicle, command_mode::oneoff}, + {"mubrakingindicatortoggle", command_target::vehicle, command_mode::oneoff}, + {"alerteracknowledge", command_target::vehicle, command_mode::oneoff}, + {"cabsignalacknowledge", command_target::vehicle, command_mode::oneoff}, + {"hornlowactivate", command_target::vehicle, command_mode::oneoff}, + {"hornhighactivate", command_target::vehicle, command_mode::oneoff}, + {"whistleactivate", command_target::vehicle, command_mode::oneoff}, + {"radiotoggle", command_target::vehicle, command_mode::oneoff}, + {"radioenable", command_target::vehicle, command_mode::oneoff}, + {"radiodisable", command_target::vehicle, command_mode::oneoff}, + {"radiochannelincrease", command_target::vehicle, command_mode::oneoff}, + {"radiochanneldecrease", command_target::vehicle, command_mode::oneoff}, + {"radiochannelset", command_target::vehicle, command_mode::oneoff}, + {"radiostopsend", command_target::vehicle, command_mode::oneoff}, + {"radiostopenable", command_target::vehicle, command_mode::oneoff}, + {"radiostopdisable", command_target::vehicle, command_mode::oneoff}, + {"radiostoptest", command_target::vehicle, command_mode::oneoff}, + {"radiocall3send", command_target::vehicle, command_mode::oneoff}, + {"radiovolumeincrease", command_target::vehicle, command_mode::oneoff}, + {"radiovolumedecrease", command_target::vehicle, command_mode::oneoff}, + {"radiovolumeset", command_target::vehicle, command_mode::oneoff}, + {"cabchangeforward", command_target::vehicle, command_mode::oneoff}, + {"cabchangebackward", command_target::vehicle, command_mode::oneoff}, + {"modernlightdimmerdecrease", command_target::vehicle, command_mode::oneoff}, + {"modernlightdimmerincrease", command_target::vehicle, command_mode::oneoff}, + {"viewturn", command_target::entity, command_mode::oneoff}, + {"movehorizontal", command_target::entity, command_mode::oneoff}, + {"movehorizontalfast", command_target::entity, command_mode::oneoff}, + {"movevertical", command_target::entity, command_mode::oneoff}, + {"moveverticalfast", command_target::entity, command_mode::oneoff}, + {"moveleft", command_target::entity, command_mode::oneoff}, + {"moveright", command_target::entity, command_mode::oneoff}, + {"moveforward", command_target::entity, command_mode::oneoff}, + {"moveback", command_target::entity, command_mode::oneoff}, + {"moveup", command_target::entity, command_mode::oneoff}, + {"movedown", command_target::entity, command_mode::oneoff}, + {"nearestcarcouplingincrease", command_target::vehicle, command_mode::oneoff}, + {"nearestcarcouplingdisconnect", command_target::vehicle, command_mode::oneoff}, + {"nearestcarcoupleradapterattach", command_target::vehicle, command_mode::oneoff}, + {"nearestcarcoupleradapterremove", command_target::vehicle, command_mode::oneoff}, + {"occupiedcarcouplingdisconnect", command_target::vehicle, command_mode::oneoff}, + {"occupiedcarcouplingdisconnectback", command_target::vehicle, command_mode::oneoff}, + {"doortoggleleft", command_target::vehicle, command_mode::oneoff}, + {"doortoggleright", command_target::vehicle, command_mode::oneoff}, + {"doorpermitleft", command_target::vehicle, command_mode::oneoff}, + {"doorpermitright", command_target::vehicle, command_mode::oneoff}, + {"doorpermitpresetactivatenext", command_target::vehicle, command_mode::oneoff}, + {"doorpermitpresetactivateprevious", command_target::vehicle, command_mode::oneoff}, + {"dooropenleft", command_target::vehicle, command_mode::oneoff}, + {"dooropenright", command_target::vehicle, command_mode::oneoff}, + {"dooropenall", command_target::vehicle, command_mode::oneoff}, + {"doorcloseleft", command_target::vehicle, command_mode::oneoff}, + {"doorcloseright", command_target::vehicle, command_mode::oneoff}, + {"doorcloseall", command_target::vehicle, command_mode::oneoff}, + {"doorsteptoggle", command_target::vehicle, command_mode::oneoff}, + {"doormodetoggle", command_target::vehicle, command_mode::oneoff}, + {"mirrorstoggle", command_target::vehicle, command_mode::oneoff}, + {"departureannounce", command_target::vehicle, command_mode::oneoff}, + {"doorlocktoggle", command_target::vehicle, command_mode::oneoff}, + {"pantographcompressorvalvetoggle", command_target::vehicle, command_mode::oneoff}, + {"pantographcompressorvalveenable", command_target::vehicle, command_mode::oneoff}, + {"pantographcompressorvalvedisable", command_target::vehicle, command_mode::oneoff}, + {"pantographcompressoractivate", command_target::vehicle, command_mode::oneoff}, + {"pantographtogglefront", command_target::vehicle, command_mode::oneoff}, + {"pantographtogglerear", command_target::vehicle, command_mode::oneoff}, + {"pantographraisefront", command_target::vehicle, command_mode::oneoff}, + {"pantographraiserear", command_target::vehicle, command_mode::oneoff}, + {"pantographlowerfront", command_target::vehicle, command_mode::oneoff}, + {"pantographlowerrear", command_target::vehicle, command_mode::oneoff}, + {"pantographlowerall", command_target::vehicle, command_mode::oneoff}, + {"pantographselectnext", command_target::vehicle, command_mode::oneoff}, + {"pantographselectprevious", command_target::vehicle, command_mode::oneoff}, + {"pantographtoggleselected", command_target::vehicle, command_mode::oneoff}, + {"pantographraiseselected", command_target::vehicle, command_mode::oneoff}, + {"pantographlowerselected", command_target::vehicle, command_mode::oneoff}, + {"pantographvalvesupdate", command_target::vehicle, command_mode::oneoff}, + {"pantographvalvesoff", command_target::vehicle, command_mode::oneoff}, + {"heatingtoggle", command_target::vehicle, command_mode::oneoff}, + {"heatingenable", command_target::vehicle, command_mode::oneoff}, + {"heatingdisable", command_target::vehicle, command_mode::oneoff}, + {"lightspresetactivatenext", command_target::vehicle, command_mode::oneoff}, + {"lightspresetactivateprevious", command_target::vehicle, command_mode::oneoff}, + {"headlighttoggleleft", command_target::vehicle, command_mode::oneoff}, + {"headlightenableleft", command_target::vehicle, command_mode::oneoff}, + {"headlightdisableleft", command_target::vehicle, command_mode::oneoff}, + {"headlighttoggleright", command_target::vehicle, command_mode::oneoff}, + {"headlightenableright", command_target::vehicle, command_mode::oneoff}, + {"headlightdisableright", command_target::vehicle, command_mode::oneoff}, + {"headlighttoggleupper", command_target::vehicle, command_mode::oneoff}, + {"headlightenableupper", command_target::vehicle, command_mode::oneoff}, + {"headlightdisableupper", command_target::vehicle, command_mode::oneoff}, + {"redmarkertoggleleft", command_target::vehicle, command_mode::oneoff}, + {"redmarkerenableleft", command_target::vehicle, command_mode::oneoff}, + {"redmarkerdisableleft", command_target::vehicle, command_mode::oneoff}, + {"redmarkertoggleright", command_target::vehicle, command_mode::oneoff}, + {"redmarkerenableright", command_target::vehicle, command_mode::oneoff}, + {"redmarkerdisableright", command_target::vehicle, command_mode::oneoff}, + {"headlighttogglerearleft", command_target::vehicle, command_mode::oneoff}, + {"headlightenablerearleft", command_target::vehicle, command_mode::oneoff}, + {"headlightdisablerearleft", command_target::vehicle, command_mode::oneoff}, + {"headlighttogglerearright", command_target::vehicle, command_mode::oneoff}, + {"headlightenablerearright", command_target::vehicle, command_mode::oneoff}, + {"headlightdisablerearright", command_target::vehicle, command_mode::oneoff}, + {"headlighttogglerearupper", command_target::vehicle, command_mode::oneoff}, + {"headlightenablerearupper", command_target::vehicle, command_mode::oneoff}, + {"headlightdisablerearupper", command_target::vehicle, command_mode::oneoff}, + {"redmarkertogglerearleft", command_target::vehicle, command_mode::oneoff}, + {"redmarkerenablerearleft", command_target::vehicle, command_mode::oneoff}, + {"redmarkerdisablerearleft", command_target::vehicle, command_mode::oneoff}, + {"redmarkertogglerearright", command_target::vehicle, command_mode::oneoff}, + {"redmarkerenablerearright", command_target::vehicle, command_mode::oneoff}, + {"redmarkerdisablerearright", command_target::vehicle, command_mode::oneoff}, + {"redmarkerstoggle", command_target::vehicle, command_mode::oneoff}, + {"endsignalstoggle", command_target::vehicle, command_mode::oneoff}, + {"headlightsdimtoggle", command_target::vehicle, command_mode::oneoff}, + {"headlightsdimenable", command_target::vehicle, command_mode::oneoff}, + {"headlightsdimdisable", command_target::vehicle, command_mode::oneoff}, + {"motorconnectorsopen", command_target::vehicle, command_mode::oneoff}, + {"motorconnectorsclose", command_target::vehicle, command_mode::oneoff}, + {"motordisconnect", command_target::vehicle, command_mode::oneoff}, + {"interiorlighttoggle", command_target::vehicle, command_mode::oneoff}, + {"interiorlightenable", command_target::vehicle, command_mode::oneoff}, + {"interiorlightdisable", command_target::vehicle, command_mode::oneoff}, + {"interiorlightdimtoggle", command_target::vehicle, command_mode::oneoff}, + {"interiorlightdimenable", command_target::vehicle, command_mode::oneoff}, + {"interiorlightdimdisable", command_target::vehicle, command_mode::oneoff}, + {"compartmentlightstoggle", command_target::vehicle, command_mode::oneoff}, + {"compartmentlightsenable", command_target::vehicle, command_mode::oneoff}, + {"compartmentlightsdisable", command_target::vehicle, command_mode::oneoff}, + {"instrumentlighttoggle", command_target::vehicle, command_mode::oneoff}, + {"instrumentlightenable", command_target::vehicle, command_mode::oneoff}, + {"instrumentlightdisable", command_target::vehicle, command_mode::oneoff}, + {"dashboardlighttoggle", command_target::vehicle, command_mode::oneoff}, + {"dashboardlightenable", command_target::vehicle, command_mode::oneoff}, + {"dashboardlightdisable", command_target::vehicle, command_mode::oneoff}, + {"timetablelighttoggle", command_target::vehicle, command_mode::oneoff}, + {"timetablelightenable", command_target::vehicle, command_mode::oneoff}, + {"timetablelightdisable", command_target::vehicle, command_mode::oneoff}, + {"generictoggle0", command_target::vehicle, command_mode::oneoff}, + {"generictoggle1", command_target::vehicle, command_mode::oneoff}, + {"generictoggle2", command_target::vehicle, command_mode::oneoff}, + {"generictoggle3", command_target::vehicle, command_mode::oneoff}, + {"generictoggle4", command_target::vehicle, command_mode::oneoff}, + {"generictoggle5", command_target::vehicle, command_mode::oneoff}, + {"generictoggle6", command_target::vehicle, command_mode::oneoff}, + {"generictoggle7", command_target::vehicle, command_mode::oneoff}, + {"generictoggle8", command_target::vehicle, command_mode::oneoff}, + {"generictoggle9", command_target::vehicle, command_mode::oneoff}, + {"batterytoggle", command_target::vehicle, command_mode::oneoff}, + {"batteryenable", command_target::vehicle, command_mode::oneoff}, + {"batterydisable", command_target::vehicle, command_mode::oneoff}, + {"cabactivationtoggle", command_target::vehicle, command_mode::oneoff}, + {"cabactivationenable", command_target::vehicle, command_mode::oneoff}, + {"cabactivationdisable", command_target::vehicle, command_mode::oneoff}, + {"motorblowerstogglefront", command_target::vehicle, command_mode::oneoff}, + {"motorblowerstogglerear", command_target::vehicle, command_mode::oneoff}, + {"motorblowersdisableall", command_target::vehicle, command_mode::oneoff}, + {"coolingfanstoggle", command_target::vehicle, command_mode::oneoff}, + {"tempomattoggle", command_target::vehicle, command_mode::oneoff}, + {"springbraketoggle", command_target::vehicle, command_mode::oneoff}, + {"springbrakeenable", command_target::vehicle, command_mode::oneoff}, + {"springbrakedisable", command_target::vehicle, command_mode::oneoff}, + {"springbrakeshutofftoggle", command_target::vehicle, command_mode::oneoff}, + {"springbrakeshutoffenable", command_target::vehicle, command_mode::oneoff}, + {"springbrakeshutoffdisable", command_target::vehicle, command_mode::oneoff}, + {"springbrakerelease", command_target::vehicle}, + {"distancecounteractivate", command_target::vehicle, command_mode::oneoff}, + {"speedcontrolincrease", command_target::vehicle, command_mode::oneoff}, + {"speedcontroldecrease", command_target::vehicle, command_mode::oneoff}, + {"speedcontrolpowerincrease", command_target::vehicle, command_mode::oneoff}, + {"speedcontrolpowerdecrease", command_target::vehicle, command_mode::oneoff}, + {"speedcontrolbutton0", command_target::vehicle, command_mode::oneoff}, + {"speedcontrolbutton1", command_target::vehicle, command_mode::oneoff}, + {"speedcontrolbutton2", command_target::vehicle, command_mode::oneoff}, + {"speedcontrolbutton3", command_target::vehicle, command_mode::oneoff}, + {"speedcontrolbutton4", command_target::vehicle, command_mode::oneoff}, + {"speedcontrolbutton5", command_target::vehicle, command_mode::oneoff}, + {"speedcontrolbutton6", command_target::vehicle, command_mode::oneoff}, + {"speedcontrolbutton7", command_target::vehicle, command_mode::oneoff}, + {"speedcontrolbutton8", command_target::vehicle, command_mode::oneoff}, + {"speedcontrolbutton9", command_target::vehicle, command_mode::oneoff}, + {"inverterenable1", command_target::vehicle, command_mode::oneoff}, + {"inverterenable2", command_target::vehicle, command_mode::oneoff}, + {"inverterenable3", command_target::vehicle, command_mode::oneoff}, + {"inverterenable4", command_target::vehicle, command_mode::oneoff}, + {"inverterenable5", command_target::vehicle, command_mode::oneoff}, + {"inverterenable6", command_target::vehicle, command_mode::oneoff}, + {"inverterenable7", command_target::vehicle, command_mode::oneoff}, + {"inverterenable8", command_target::vehicle, command_mode::oneoff}, + {"inverterenable9", command_target::vehicle, command_mode::oneoff}, + {"inverterenable10", command_target::vehicle, command_mode::oneoff}, + {"inverterenable11", command_target::vehicle, command_mode::oneoff}, + {"inverterenable12", command_target::vehicle, command_mode::oneoff}, + {"inverterdisable1", command_target::vehicle, command_mode::oneoff}, + {"inverterdisable2", command_target::vehicle, command_mode::oneoff}, + {"inverterdisable3", command_target::vehicle, command_mode::oneoff}, + {"inverterdisable4", command_target::vehicle, command_mode::oneoff}, + {"inverterdisable5", command_target::vehicle, command_mode::oneoff}, + {"inverterdisable6", command_target::vehicle, command_mode::oneoff}, + {"inverterdisable7", command_target::vehicle, command_mode::oneoff}, + {"inverterdisable8", command_target::vehicle, command_mode::oneoff}, + {"inverterdisable9", command_target::vehicle, command_mode::oneoff}, + {"inverterdisable10", command_target::vehicle, command_mode::oneoff}, + {"inverterdisable11", command_target::vehicle, command_mode::oneoff}, + {"inverterdisable12", command_target::vehicle, command_mode::oneoff}, + {"invertertoggle1", command_target::vehicle, command_mode::oneoff}, + {"invertertoggle2", command_target::vehicle, command_mode::oneoff}, + {"invertertoggle3", command_target::vehicle, command_mode::oneoff}, + {"invertertoggle4", command_target::vehicle, command_mode::oneoff}, + {"invertertoggle5", command_target::vehicle, command_mode::oneoff}, + {"invertertoggle6", command_target::vehicle, command_mode::oneoff}, + {"invertertoggle7", command_target::vehicle, command_mode::oneoff}, + {"invertertoggle8", command_target::vehicle, command_mode::oneoff}, + {"invertertoggle9", command_target::vehicle, command_mode::oneoff}, + {"invertertoggle10", command_target::vehicle, command_mode::oneoff}, + {"invertertoggle11", command_target::vehicle, command_mode::oneoff}, + {"invertertoggle12", command_target::vehicle, command_mode::oneoff}, + {"globalradiostop", command_target::simulation, command_mode::oneoff}, + {"timejump", command_target::simulation, command_mode::oneoff}, + {"timejumplarge", command_target::simulation, command_mode::oneoff}, + {"timejumpsmall", command_target::simulation, command_mode::oneoff}, + {"setdatetime", command_target::simulation, command_mode::oneoff}, + {"setweather", command_target::simulation, command_mode::oneoff}, + {"settemperature", command_target::simulation, command_mode::oneoff}, + {"vehiclemoveforwards", command_target::vehicle, command_mode::oneoff}, + {"vehiclemovebackwards", command_target::vehicle, command_mode::oneoff}, + {"vehicleboost", command_target::vehicle, command_mode::oneoff}, + {"debugtoggle", command_target::simulation, command_mode::oneoff}, + {"focuspauseset", command_target::simulation, command_mode::oneoff}, + {"pausetoggle", command_target::simulation, command_mode::oneoff}, + {"entervehicle", command_target::simulation, command_mode::oneoff}, + {"resetconsist", command_target::simulation, command_mode::oneoff}, + {"fillcompressor", command_target::simulation, command_mode::oneoff}, + {"consistreleaser", command_target::simulation, command_mode::oneoff}, + {"queueevent", command_target::simulation, command_mode::oneoff}, + {"setlight", command_target::simulation, command_mode::oneoff}, + {"insertmodel", command_target::simulation, command_mode::oneoff}, + {"deletemodel", command_target::simulation, command_mode::oneoff}, + {"trainsetmove", command_target::simulation, command_mode::oneoff}, + {"consistteleport", command_target::simulation, command_mode::oneoff}, + {"pullalarmchain", command_target::simulation, command_mode::oneoff}, + {"sendaicommand", command_target::simulation, command_mode::oneoff}, + {"spawntrainset", command_target::simulation, command_mode::oneoff}, + {"destroytrainset", command_target::simulation, command_mode::oneoff}, + {"quitsimulation", command_target::simulation, command_mode::oneoff}, + {"wiperswitchincrease", command_target::vehicle, command_mode::oneoff}, + {"wiperswitchdecrease", command_target::vehicle, command_mode::oneoff}, }; -} // simulation +// Maps of command and coresponding strings +std::unordered_map commandMap = {{"aidriverdisable", user_command::aidriverdisable}, + {"jointcontrollerset", user_command::jointcontrollerset}, + {"mastercontrollerincrease", user_command::mastercontrollerincrease}, + {"mastercontrollerincreasefast", user_command::mastercontrollerincreasefast}, + {"mastercontrollerdecrease", user_command::mastercontrollerdecrease}, + {"mastercontrollerdecreasefast", user_command::mastercontrollerdecreasefast}, + {"mastercontrollerset", user_command::mastercontrollerset}, + {"secondcontrollerincrease", user_command::secondcontrollerincrease}, + {"secondcontrollerincreasefast", user_command::secondcontrollerincreasefast}, + {"secondcontrollerdecrease", user_command::secondcontrollerdecrease}, + {"secondcontrollerdecreasefast", user_command::secondcontrollerdecreasefast}, + {"secondcontrollerset", user_command::secondcontrollerset}, + {"mucurrentindicatorothersourceactivate", user_command::mucurrentindicatorothersourceactivate}, + {"independentbrakeincrease", user_command::independentbrakeincrease}, + {"independentbrakeincreasefast", user_command::independentbrakeincreasefast}, + {"independentbrakedecrease", user_command::independentbrakedecrease}, + {"independentbrakedecreasefast", user_command::independentbrakedecreasefast}, + {"independentbrakeset", user_command::independentbrakeset}, + {"independentbrakebailoff", user_command::independentbrakebailoff}, + {"universalbrakebutton1", user_command::universalbrakebutton1}, + {"universalbrakebutton2", user_command::universalbrakebutton2}, + {"universalbrakebutton3", user_command::universalbrakebutton3}, + {"trainbrakeincrease", user_command::trainbrakeincrease}, + {"trainbrakedecrease", user_command::trainbrakedecrease}, + {"trainbrakeset", user_command::trainbrakeset}, + {"trainbrakecharging", user_command::trainbrakecharging}, + {"trainbrakerelease", user_command::trainbrakerelease}, + {"trainbrakefirstservice", user_command::trainbrakefirstservice}, + {"trainbrakeservice", user_command::trainbrakeservice}, + {"trainbrakefullservice", user_command::trainbrakefullservice}, + {"trainbrakehandleoff", user_command::trainbrakehandleoff}, + {"trainbrakeemergency", user_command::trainbrakeemergency}, + {"trainbrakebasepressureincrease", user_command::trainbrakebasepressureincrease}, + {"trainbrakebasepressuredecrease", user_command::trainbrakebasepressuredecrease}, + {"trainbrakebasepressurereset", user_command::trainbrakebasepressurereset}, + {"trainbrakeoperationtoggle", user_command::trainbrakeoperationtoggle}, + {"manualbrakeincrease", user_command::manualbrakeincrease}, + {"manualbrakedecrease", user_command::manualbrakedecrease}, + {"alarmchaintoggle", user_command::alarmchaintoggle}, + {"alarmchainenable", user_command::alarmchainenable}, + {"alarmchaindisable", user_command::alarmchaindisable}, + {"wheelspinbrakeactivate", user_command::wheelspinbrakeactivate}, + {"sandboxactivate", user_command::sandboxactivate}, + {"autosandboxtoggle", user_command::autosandboxtoggle}, + {"autosandboxactivate", user_command::autosandboxactivate}, + {"autosandboxdeactivate", user_command::autosandboxdeactivate}, + {"reverserincrease", user_command::reverserincrease}, + {"reverserdecrease", user_command::reverserdecrease}, + {"reverserforwardhigh", user_command::reverserforwardhigh}, + {"reverserforward", user_command::reverserforward}, + {"reverserneutral", user_command::reverserneutral}, + {"reverserbackward", user_command::reverserbackward}, + {"waterpumpbreakertoggle", user_command::waterpumpbreakertoggle}, + {"waterpumpbreakerclose", user_command::waterpumpbreakerclose}, + {"waterpumpbreakeropen", user_command::waterpumpbreakeropen}, + {"waterpumptoggle", user_command::waterpumptoggle}, + {"waterpumpenable", user_command::waterpumpenable}, + {"waterpumpdisable", user_command::waterpumpdisable}, + {"waterheaterbreakertoggle", user_command::waterheaterbreakertoggle}, + {"waterheaterbreakerclose", user_command::waterheaterbreakerclose}, + {"waterheaterbreakeropen", user_command::waterheaterbreakeropen}, + {"waterheatertoggle", user_command::waterheatertoggle}, + {"waterheaterenable", user_command::waterheaterenable}, + {"waterheaterdisable", user_command::waterheaterdisable}, + {"watercircuitslinktoggle", user_command::watercircuitslinktoggle}, + {"watercircuitslinkenable", user_command::watercircuitslinkenable}, + {"watercircuitslinkdisable", user_command::watercircuitslinkdisable}, + {"fuelpumptoggle", user_command::fuelpumptoggle}, + {"fuelpumpenable", user_command::fuelpumpenable}, + {"fuelpumpdisable", user_command::fuelpumpdisable}, + {"oilpumptoggle", user_command::oilpumptoggle}, + {"oilpumpenable", user_command::oilpumpenable}, + {"oilpumpdisable", user_command::oilpumpdisable}, + {"linebreakertoggle", user_command::linebreakertoggle}, + {"linebreakeropen", user_command::linebreakeropen}, + {"linebreakerclose", user_command::linebreakerclose}, + {"convertertoggle", user_command::convertertoggle}, + {"converterenable", user_command::converterenable}, + {"converterdisable", user_command::converterdisable}, + {"convertertogglelocal", user_command::convertertogglelocal}, + {"converteroverloadrelayreset", user_command::converteroverloadrelayreset}, + {"compressortoggle", user_command::compressortoggle}, + {"compressorenable", user_command::compressorenable}, + {"compressordisable", user_command::compressordisable}, + {"compressortogglelocal", user_command::compressortogglelocal}, + {"compressorpresetactivatenext", user_command::compressorpresetactivatenext}, + {"compressorpresetactivateprevious", user_command::compressorpresetactivateprevious}, + {"compressorpresetactivatedefault", user_command::compressorpresetactivatedefault}, + {"motoroverloadrelaythresholdtoggle", user_command::motoroverloadrelaythresholdtoggle}, + {"motoroverloadrelaythresholdsetlow", user_command::motoroverloadrelaythresholdsetlow}, + {"motoroverloadrelaythresholdsethigh", user_command::motoroverloadrelaythresholdsethigh}, + {"motoroverloadrelayreset", user_command::motoroverloadrelayreset}, + {"universalrelayreset1", user_command::universalrelayreset1}, + {"universalrelayreset2", user_command::universalrelayreset2}, + {"universalrelayreset3", user_command::universalrelayreset3}, + {"notchingrelaytoggle", user_command::notchingrelaytoggle}, + {"epbrakecontroltoggle", user_command::epbrakecontroltoggle}, + {"epbrakecontrolenable", user_command::epbrakecontrolenable}, + {"epbrakecontroldisable", user_command::epbrakecontroldisable}, + {"trainbrakeoperationmodeincrease", user_command::trainbrakeoperationmodeincrease}, + {"trainbrakeoperationmodedecrease", user_command::trainbrakeoperationmodedecrease}, + {"brakeactingspeedincrease", user_command::brakeactingspeedincrease}, + {"brakeactingspeeddecrease", user_command::brakeactingspeeddecrease}, + {"brakeactingspeedsetcargo", user_command::brakeactingspeedsetcargo}, + {"brakeactingspeedsetpassenger", user_command::brakeactingspeedsetpassenger}, + {"brakeactingspeedsetrapid", user_command::brakeactingspeedsetrapid}, + {"brakeloadcompensationincrease", user_command::brakeloadcompensationincrease}, + {"brakeloadcompensationdecrease", user_command::brakeloadcompensationdecrease}, + {"mubrakingindicatortoggle", user_command::mubrakingindicatortoggle}, + {"alerteracknowledge", user_command::alerteracknowledge}, + {"cabsignalacknowledge", user_command::cabsignalacknowledge}, + {"hornlowactivate", user_command::hornlowactivate}, + {"hornhighactivate", user_command::hornhighactivate}, + {"whistleactivate", user_command::whistleactivate}, + {"radiotoggle", user_command::radiotoggle}, + {"radioenable", user_command::radioenable}, + {"radiodisable", user_command::radiodisable}, + {"radiochannelincrease", user_command::radiochannelincrease}, + {"radiochanneldecrease", user_command::radiochanneldecrease}, + {"radiochannelset", user_command::radiochannelset}, + {"radiostopsend", user_command::radiostopsend}, + {"radiostopenable", user_command::radiostopenable}, + {"radiostopdisable", user_command::radiostopdisable}, + {"radiostoptest", user_command::radiostoptest}, + {"radiocall3send", user_command::radiocall3send}, + {"radiovolumeincrease", user_command::radiovolumeincrease}, + {"radiovolumedecrease", user_command::radiovolumedecrease}, + {"radiovolumeset", user_command::radiovolumeset}, + {"cabchangeforward", user_command::cabchangeforward}, + {"cabchangebackward", user_command::cabchangebackward}, + {"viewturn", user_command::viewturn}, + {"movehorizontal", user_command::movehorizontal}, + {"movehorizontalfast", user_command::movehorizontalfast}, + {"movevertical", user_command::movevertical}, + {"moveverticalfast", user_command::moveverticalfast}, + {"moveleft", user_command::moveleft}, + {"moveright", user_command::moveright}, + {"moveforward", user_command::moveforward}, + {"moveback", user_command::moveback}, + {"moveup", user_command::moveup}, + {"movedown", user_command::movedown}, + {"nearestcarcouplingincrease", user_command::nearestcarcouplingincrease}, + {"nearestcarcouplingdisconnect", user_command::nearestcarcouplingdisconnect}, + {"nearestcarcoupleradapterattach", user_command::nearestcarcoupleradapterattach}, + {"nearestcarcoupleradapterremove", user_command::nearestcarcoupleradapterremove}, + {"occupiedcarcouplingdisconnect", user_command::occupiedcarcouplingdisconnect}, + {"occupiedcarcouplingdisconnectback", user_command::occupiedcarcouplingdisconnectback}, + {"doortoggleleft", user_command::doortoggleleft}, + {"doortoggleright", user_command::doortoggleright}, + {"doorpermitleft", user_command::doorpermitleft}, + {"doorpermitright", user_command::doorpermitright}, + {"doorpermitpresetactivatenext", user_command::doorpermitpresetactivatenext}, + {"doorpermitpresetactivateprevious", user_command::doorpermitpresetactivateprevious}, + {"dooropenleft", user_command::dooropenleft}, + {"dooropenright", user_command::dooropenright}, + {"dooropenall", user_command::dooropenall}, + {"doorcloseleft", user_command::doorcloseleft}, + {"doorcloseright", user_command::doorcloseright}, + {"doorcloseall", user_command::doorcloseall}, + {"doorsteptoggle", user_command::doorsteptoggle}, + {"doormodetoggle", user_command::doormodetoggle}, + {"mirrorstoggle", user_command::mirrorstoggle}, + {"departureannounce", user_command::departureannounce}, + {"doorlocktoggle", user_command::doorlocktoggle}, + {"pantographcompressorvalvetoggle", user_command::pantographcompressorvalvetoggle}, + {"pantographcompressorvalveenable", user_command::pantographcompressorvalveenable}, + {"pantographcompressorvalvedisable", user_command::pantographcompressorvalvedisable}, + {"pantographcompressoractivate", user_command::pantographcompressoractivate}, + {"pantographtogglefront", user_command::pantographtogglefront}, + {"pantographtogglerear", user_command::pantographtogglerear}, + {"pantographraisefront", user_command::pantographraisefront}, + {"pantographraiserear", user_command::pantographraiserear}, + {"pantographlowerfront", user_command::pantographlowerfront}, + {"pantographlowerrear", user_command::pantographlowerrear}, + {"pantographlowerall", user_command::pantographlowerall}, + {"pantographselectnext", user_command::pantographselectnext}, + {"pantographselectprevious", user_command::pantographselectprevious}, + {"pantographtoggleselected", user_command::pantographtoggleselected}, + {"pantographraiseselected", user_command::pantographraiseselected}, + {"pantographlowerselected", user_command::pantographlowerselected}, + {"pantographvalvesupdate", user_command::pantographvalvesupdate}, + {"pantographvalvesoff", user_command::pantographvalvesoff}, + {"heatingtoggle", user_command::heatingtoggle}, + {"heatingenable", user_command::heatingenable}, + {"heatingdisable", user_command::heatingdisable}, + {"lightspresetactivatenext", user_command::lightspresetactivatenext}, + {"lightspresetactivateprevious", user_command::lightspresetactivateprevious}, + {"headlighttoggleleft", user_command::headlighttoggleleft}, + {"headlightenableleft", user_command::headlightenableleft}, + {"headlightdisableleft", user_command::headlightdisableleft}, + {"headlighttoggleright", user_command::headlighttoggleright}, + {"headlightenableright", user_command::headlightenableright}, + {"headlightdisableright", user_command::headlightdisableright}, + {"headlighttoggleupper", user_command::headlighttoggleupper}, + {"headlightenableupper", user_command::headlightenableupper}, + {"headlightdisableupper", user_command::headlightdisableupper}, + {"redmarkertoggleleft", user_command::redmarkertoggleleft}, + {"redmarkerenableleft", user_command::redmarkerenableleft}, + {"redmarkerdisableleft", user_command::redmarkerdisableleft}, + {"redmarkertoggleright", user_command::redmarkertoggleright}, + {"redmarkerenableright", user_command::redmarkerenableright}, + {"redmarkerdisableright", user_command::redmarkerdisableright}, + {"headlighttogglerearleft", user_command::headlighttogglerearleft}, + {"headlightenablerearleft", user_command::headlightenablerearleft}, + {"headlightdisablerearleft", user_command::headlightdisablerearleft}, + {"headlighttogglerearright", user_command::headlighttogglerearright}, + {"headlightenablerearright", user_command::headlightenablerearright}, + {"headlightdisablerearright", user_command::headlightdisablerearright}, + {"headlighttogglerearupper", user_command::headlighttogglerearupper}, + {"headlightenablerearupper", user_command::headlightenablerearupper}, + {"headlightdisablerearupper", user_command::headlightdisablerearupper}, + {"redmarkertogglerearleft", user_command::redmarkertogglerearleft}, + {"redmarkerenablerearleft", user_command::redmarkerenablerearleft}, + {"redmarkerdisablerearleft", user_command::redmarkerdisablerearleft}, + {"redmarkertogglerearright", user_command::redmarkertogglerearright}, + {"redmarkerenablerearright", user_command::redmarkerenablerearright}, + {"redmarkerdisablerearright", user_command::redmarkerdisablerearright}, + {"redmarkerstoggle", user_command::redmarkerstoggle}, + {"endsignalstoggle", user_command::endsignalstoggle}, + {"headlightsdimtoggle", user_command::headlightsdimtoggle}, + {"headlightsdimenable", user_command::headlightsdimenable}, + {"headlightsdimdisable", user_command::headlightsdimdisable}, + {"motorconnectorsopen", user_command::motorconnectorsopen}, + {"motorconnectorsclose", user_command::motorconnectorsclose}, + {"motordisconnect", user_command::motordisconnect}, + {"interiorlighttoggle", user_command::interiorlighttoggle}, + {"interiorlightenable", user_command::interiorlightenable}, + {"interiorlightdisable", user_command::interiorlightdisable}, + {"interiorlightdimtoggle", user_command::interiorlightdimtoggle}, + {"interiorlightdimenable", user_command::interiorlightdimenable}, + {"interiorlightdimdisable", user_command::interiorlightdimdisable}, + {"compartmentlightstoggle", user_command::compartmentlightstoggle}, + {"compartmentlightsenable", user_command::compartmentlightsenable}, + {"compartmentlightsdisable", user_command::compartmentlightsdisable}, + {"instrumentlighttoggle", user_command::instrumentlighttoggle}, + {"instrumentlightenable", user_command::instrumentlightenable}, + {"instrumentlightdisable", user_command::instrumentlightdisable}, + {"dashboardlighttoggle", user_command::dashboardlighttoggle}, + {"dashboardlightenable", user_command::dashboardlightenable}, + {"dashboardlightdisable", user_command::dashboardlightdisable}, + {"timetablelighttoggle", user_command::timetablelighttoggle}, + {"timetablelightenable", user_command::timetablelightenable}, + {"timetablelightdisable", user_command::timetablelightdisable}, + {"generictoggle0", user_command::generictoggle0}, + {"generictoggle1", user_command::generictoggle1}, + {"generictoggle2", user_command::generictoggle2}, + {"generictoggle3", user_command::generictoggle3}, + {"generictoggle4", user_command::generictoggle4}, + {"generictoggle5", user_command::generictoggle5}, + {"generictoggle6", user_command::generictoggle6}, + {"generictoggle7", user_command::generictoggle7}, + {"generictoggle8", user_command::generictoggle8}, + {"generictoggle9", user_command::generictoggle9}, + {"batterytoggle", user_command::batterytoggle}, + {"batteryenable", user_command::batteryenable}, + {"batterydisable", user_command::batterydisable}, + {"cabactivationtoggle", user_command::cabactivationtoggle}, + {"cabactivationenable", user_command::cabactivationenable}, + {"cabactivationdisable", user_command::cabactivationdisable}, + {"motorblowerstogglefront", user_command::motorblowerstogglefront}, + {"motorblowerstogglerear", user_command::motorblowerstogglerear}, + {"motorblowersdisableall", user_command::motorblowersdisableall}, + {"coolingfanstoggle", user_command::coolingfanstoggle}, + {"tempomattoggle", user_command::tempomattoggle}, + {"springbraketoggle", user_command::springbraketoggle}, + {"springbrakeenable", user_command::springbrakeenable}, + {"springbrakedisable", user_command::springbrakedisable}, + {"springbrakeshutofftoggle", user_command::springbrakeshutofftoggle}, + {"springbrakeshutoffenable", user_command::springbrakeshutoffenable}, + {"springbrakeshutoffdisable", user_command::springbrakeshutoffdisable}, + {"springbrakerelease", user_command::springbrakerelease}, + {"distancecounteractivate", user_command::distancecounteractivate}, + {"speedcontrolincrease", user_command::speedcontrolincrease}, + {"speedcontroldecrease", user_command::speedcontroldecrease}, + {"speedcontrolpowerincrease", user_command::speedcontrolpowerincrease}, + {"speedcontrolpowerdecrease", user_command::speedcontrolpowerdecrease}, + {"speedcontrolbutton0", user_command::speedcontrolbutton0}, + {"speedcontrolbutton1", user_command::speedcontrolbutton1}, + {"speedcontrolbutton2", user_command::speedcontrolbutton2}, + {"speedcontrolbutton3", user_command::speedcontrolbutton3}, + {"speedcontrolbutton4", user_command::speedcontrolbutton4}, + {"speedcontrolbutton5", user_command::speedcontrolbutton5}, + {"speedcontrolbutton6", user_command::speedcontrolbutton6}, + {"speedcontrolbutton7", user_command::speedcontrolbutton7}, + {"speedcontrolbutton8", user_command::speedcontrolbutton8}, + {"speedcontrolbutton9", user_command::speedcontrolbutton9}, + {"inverterenable1", user_command::inverterenable1}, + {"inverterenable2", user_command::inverterenable2}, + {"inverterenable3", user_command::inverterenable3}, + {"inverterenable4", user_command::inverterenable4}, + {"inverterenable5", user_command::inverterenable5}, + {"inverterenable6", user_command::inverterenable6}, + {"inverterenable7", user_command::inverterenable7}, + {"inverterenable8", user_command::inverterenable8}, + {"inverterenable9", user_command::inverterenable9}, + {"inverterenable10", user_command::inverterenable10}, + {"inverterenable11", user_command::inverterenable11}, + {"inverterenable12", user_command::inverterenable12}, + {"inverterdisable1", user_command::inverterdisable1}, + {"inverterdisable2", user_command::inverterdisable2}, + {"inverterdisable3", user_command::inverterdisable3}, + {"inverterdisable4", user_command::inverterdisable4}, + {"inverterdisable5", user_command::inverterdisable5}, + {"inverterdisable6", user_command::inverterdisable6}, + {"inverterdisable7", user_command::inverterdisable7}, + {"inverterdisable8", user_command::inverterdisable8}, + {"inverterdisable9", user_command::inverterdisable9}, + {"inverterdisable10", user_command::inverterdisable10}, + {"inverterdisable11", user_command::inverterdisable11}, + {"inverterdisable12", user_command::inverterdisable12}, + {"invertertoggle1", user_command::invertertoggle1}, + {"invertertoggle2", user_command::invertertoggle2}, + {"invertertoggle3", user_command::invertertoggle3}, + {"invertertoggle4", user_command::invertertoggle4}, + {"invertertoggle5", user_command::invertertoggle5}, + {"invertertoggle6", user_command::invertertoggle6}, + {"invertertoggle7", user_command::invertertoggle7}, + {"invertertoggle8", user_command::invertertoggle8}, + {"invertertoggle9", user_command::invertertoggle9}, + {"invertertoggle10", user_command::invertertoggle10}, + {"invertertoggle11", user_command::invertertoggle11}, + {"invertertoggle12", user_command::invertertoggle12}, + {"globalradiostop", user_command::globalradiostop}, + {"timejump", user_command::timejump}, + {"timejumplarge", user_command::timejumplarge}, + {"timejumpsmall", user_command::timejumpsmall}, + {"setdatetime", user_command::setdatetime}, + {"setweather", user_command::setweather}, + {"settemperature", user_command::settemperature}, + {"vehiclemoveforwards", user_command::vehiclemoveforwards}, + {"vehiclemovebackwards", user_command::vehiclemovebackwards}, + {"vehicleboost", user_command::vehicleboost}, + {"debugtoggle", user_command::debugtoggle}, + {"focuspauseset", user_command::focuspauseset}, + {"pausetoggle", user_command::pausetoggle}, + {"entervehicle", user_command::entervehicle}, + {"resetconsist", user_command::resetconsist}, + {"fillcompressor", user_command::fillcompressor}, + {"consistreleaser", user_command::consistreleaser}, + {"queueevent", user_command::queueevent}, + {"setlight", user_command::setlight}, + {"insertmodel", user_command::insertmodel}, + {"deletemodel", user_command::deletemodel}, + {"dynamicmove", user_command::dynamicmove}, + {"consistteleport", user_command::consistteleport}, + {"pullalarmchain", user_command::pullalarmchain}, + {"sendaicommand", user_command::sendaicommand}, + {"spawntrainset", user_command::spawntrainset}, + {"destroytrainset", user_command::destroytrainset}, + {"quitsimulation", user_command::quitsimulation}, + {"wiperswitchincrease", user_command::wiperswitchincrease}, + {"wiperswitchdecrease", user_command::wiperswitchdecrease}, + {"none", user_command::none}}; + +} // namespace simulation void command_queue::update() { diff --git a/command.h b/command.h index 47ae1b31..3cd6aea9 100644 --- a/command.h +++ b/command.h @@ -13,273 +13,279 @@ http://mozilla.org/MPL/2.0/. #include #include -enum class user_command { +enum class user_command +{ aidriverenable = 0, - aidriverdisable, - jointcontrollerset, - mastercontrollerincrease, - mastercontrollerincreasefast, - mastercontrollerdecrease, - mastercontrollerdecreasefast, - mastercontrollerset, - secondcontrollerincrease, - secondcontrollerincreasefast, - secondcontrollerdecrease, - secondcontrollerdecreasefast, - secondcontrollerset, - mucurrentindicatorothersourceactivate, - independentbrakeincrease, - independentbrakeincreasefast, - independentbrakedecrease, - independentbrakedecreasefast, - independentbrakeset, - independentbrakebailoff, + aidriverdisable, + jointcontrollerset, + mastercontrollerincrease, + mastercontrollerincreasefast, + mastercontrollerdecrease, + mastercontrollerdecreasefast, + mastercontrollerset, + secondcontrollerincrease, + secondcontrollerincreasefast, + secondcontrollerdecrease, + secondcontrollerdecreasefast, + secondcontrollerset, + mucurrentindicatorothersourceactivate, + independentbrakeincrease, + independentbrakeincreasefast, + independentbrakedecrease, + independentbrakedecreasefast, + independentbrakeset, + independentbrakebailoff, universalbrakebutton1, universalbrakebutton2, universalbrakebutton3, - trainbrakeincrease, - trainbrakedecrease, - trainbrakeset, - trainbrakecharging, - trainbrakerelease, - trainbrakefirstservice, - trainbrakeservice, - trainbrakefullservice, - trainbrakehandleoff, - trainbrakeemergency, - trainbrakebasepressureincrease, - trainbrakebasepressuredecrease, - trainbrakebasepressurereset, - trainbrakeoperationtoggle, - manualbrakeincrease, - manualbrakedecrease, - alarmchaintoggle, + trainbrakeincrease, + trainbrakedecrease, + trainbrakeset, + trainbrakecharging, + trainbrakerelease, + trainbrakefirstservice, + trainbrakeservice, + trainbrakefullservice, + trainbrakehandleoff, + trainbrakeemergency, + trainbrakebasepressureincrease, + trainbrakebasepressuredecrease, + trainbrakebasepressurereset, + trainbrakeoperationtoggle, + manualbrakeincrease, + manualbrakedecrease, + alarmchaintoggle, alarmchainenable, alarmchaindisable, - wheelspinbrakeactivate, - sandboxactivate, + wheelspinbrakeactivate, + sandboxactivate, autosandboxtoggle, autosandboxactivate, autosandboxdeactivate, - reverserincrease, - reverserdecrease, - reverserforwardhigh, - reverserforward, - reverserneutral, - reverserbackward, - waterpumpbreakertoggle, - waterpumpbreakerclose, - waterpumpbreakeropen, - waterpumptoggle, - waterpumpenable, - waterpumpdisable, - waterheaterbreakertoggle, - waterheaterbreakerclose, - waterheaterbreakeropen, - waterheatertoggle, - waterheaterenable, - waterheaterdisable, - watercircuitslinktoggle, - watercircuitslinkenable, - watercircuitslinkdisable, - fuelpumptoggle, - fuelpumpenable, - fuelpumpdisable, - oilpumptoggle, - oilpumpenable, - oilpumpdisable, - linebreakertoggle, - linebreakeropen, - linebreakerclose, - convertertoggle, - converterenable, - converterdisable, - convertertogglelocal, - converteroverloadrelayreset, - compressortoggle, - compressorenable, - compressordisable, - compressortogglelocal, + reverserincrease, + reverserdecrease, + reverserforwardhigh, + reverserforward, + reverserneutral, + reverserbackward, + waterpumpbreakertoggle, + waterpumpbreakerclose, + waterpumpbreakeropen, + waterpumptoggle, + waterpumpenable, + waterpumpdisable, + waterheaterbreakertoggle, + waterheaterbreakerclose, + waterheaterbreakeropen, + waterheatertoggle, + waterheaterenable, + waterheaterdisable, + watercircuitslinktoggle, + watercircuitslinkenable, + watercircuitslinkdisable, + fuelpumptoggle, + fuelpumpenable, + fuelpumpdisable, + oilpumptoggle, + oilpumpenable, + oilpumpdisable, + linebreakertoggle, + linebreakeropen, + linebreakerclose, + convertertoggle, + converterenable, + converterdisable, + convertertogglelocal, + converteroverloadrelayreset, + compressortoggle, + compressorenable, + compressordisable, + compressortogglelocal, compressorpresetactivatenext, compressorpresetactivateprevious, compressorpresetactivatedefault, - motoroverloadrelaythresholdtoggle, - motoroverloadrelaythresholdsetlow, - motoroverloadrelaythresholdsethigh, - motoroverloadrelayreset, - universalrelayreset1, - universalrelayreset2, - universalrelayreset3, - notchingrelaytoggle, - epbrakecontroltoggle, + motoroverloadrelaythresholdtoggle, + motoroverloadrelaythresholdsetlow, + motoroverloadrelaythresholdsethigh, + motoroverloadrelayreset, + universalrelayreset1, + universalrelayreset2, + universalrelayreset3, + notchingrelaytoggle, + epbrakecontroltoggle, + epbrakecontrolenable, + epbrakecontroldisable, trainbrakeoperationmodeincrease, trainbrakeoperationmodedecrease, - brakeactingspeedincrease, - brakeactingspeeddecrease, - brakeactingspeedsetcargo, - brakeactingspeedsetpassenger, - brakeactingspeedsetrapid, - brakeloadcompensationincrease, - brakeloadcompensationdecrease, - mubrakingindicatortoggle, - alerteracknowledge, + brakeactingspeedincrease, + brakeactingspeeddecrease, + brakeactingspeedsetcargo, + brakeactingspeedsetpassenger, + brakeactingspeedsetrapid, + brakeloadcompensationincrease, + brakeloadcompensationdecrease, + mubrakingindicatortoggle, + alerteracknowledge, cabsignalacknowledge, - hornlowactivate, - hornhighactivate, - whistleactivate, - radiotoggle, - radioenable, - radiodisable, - radiochannelincrease, - radiochanneldecrease, - radiochannelset, - radiostopsend, - radiostopenable, - radiostopdisable, - radiostoptest, - radiocall3send, + hornlowactivate, + hornhighactivate, + whistleactivate, + radiotoggle, + radioenable, + radiodisable, + radiochannelincrease, + radiochanneldecrease, + radiochannelset, + radiostopsend, + radiostopenable, + radiostopdisable, + radiostoptest, + radiocall3send, radiovolumeincrease, radiovolumedecrease, radiovolumeset, - cabchangeforward, - cabchangebackward, + cabchangeforward, + cabchangebackward, - viewturn, - movehorizontal, - movehorizontalfast, - movevertical, - moveverticalfast, - moveleft, - moveright, - moveforward, - moveback, - moveup, - movedown, + modernlightdimmerdecrease, + modernlightdimmerincrease, - nearestcarcouplingincrease, - nearestcarcouplingdisconnect, - nearestcarcoupleradapterattach, - nearestcarcoupleradapterremove, - occupiedcarcouplingdisconnect, + viewturn, + movehorizontal, + movehorizontalfast, + movevertical, + moveverticalfast, + moveleft, + moveright, + moveforward, + moveback, + moveup, + movedown, + + nearestcarcouplingincrease, + nearestcarcouplingdisconnect, + nearestcarcoupleradapterattach, + nearestcarcoupleradapterremove, + occupiedcarcouplingdisconnect, occupiedcarcouplingdisconnectback, - doortoggleleft, - doortoggleright, - doorpermitleft, - doorpermitright, - doorpermitpresetactivatenext, - doorpermitpresetactivateprevious, - dooropenleft, - dooropenright, - dooropenall, - doorcloseleft, - doorcloseright, - doorcloseall, - doorsteptoggle, - doormodetoggle, + doortoggleleft, + doortoggleright, + doorpermitleft, + doorpermitright, + doorpermitpresetactivatenext, + doorpermitpresetactivateprevious, + dooropenleft, + dooropenright, + dooropenall, + doorcloseleft, + doorcloseright, + doorcloseall, + doorsteptoggle, + doormodetoggle, mirrorstoggle, - departureannounce, - doorlocktoggle, - pantographcompressorvalvetoggle, - pantographcompressorvalveenable, - pantographcompressorvalvedisable, - pantographcompressoractivate, - pantographtogglefront, - pantographtogglerear, - pantographraisefront, - pantographraiserear, - pantographlowerfront, - pantographlowerrear, - pantographlowerall, - pantographselectnext, - pantographselectprevious, - pantographtoggleselected, - pantographraiseselected, - pantographlowerselected, - pantographvalvesupdate, - pantographvalvesoff, - heatingtoggle, - heatingenable, - heatingdisable, - lightspresetactivatenext, - lightspresetactivateprevious, - headlighttoggleleft, - headlightenableleft, - headlightdisableleft, - headlighttoggleright, - headlightenableright, - headlightdisableright, - headlighttoggleupper, - headlightenableupper, - headlightdisableupper, - redmarkertoggleleft, - redmarkerenableleft, - redmarkerdisableleft, - redmarkertoggleright, - redmarkerenableright, - redmarkerdisableright, - headlighttogglerearleft, - headlightenablerearleft, - headlightdisablerearleft, - headlighttogglerearright, - headlightenablerearright, - headlightdisablerearright, - headlighttogglerearupper, - headlightenablerearupper, - headlightdisablerearupper, - redmarkertogglerearleft, - redmarkerenablerearleft, - redmarkerdisablerearleft, - redmarkertogglerearright, - redmarkerenablerearright, - redmarkerdisablerearright, - redmarkerstoggle, - endsignalstoggle, - headlightsdimtoggle, - headlightsdimenable, - headlightsdimdisable, - motorconnectorsopen, - motorconnectorsclose, - motordisconnect, - interiorlighttoggle, - interiorlightenable, - interiorlightdisable, - interiorlightdimtoggle, - interiorlightdimenable, - interiorlightdimdisable, - compartmentlightstoggle, - compartmentlightsenable, - compartmentlightsdisable, - instrumentlighttoggle, - instrumentlightenable, - instrumentlightdisable, - dashboardlighttoggle, - dashboardlightenable, - dashboardlightdisable, - timetablelighttoggle, - timetablelightenable, - timetablelightdisable, - generictoggle0, - generictoggle1, - generictoggle2, - generictoggle3, - generictoggle4, - generictoggle5, - generictoggle6, - generictoggle7, - generictoggle8, - generictoggle9, - batterytoggle, - batteryenable, - batterydisable, + departureannounce, + doorlocktoggle, + pantographcompressorvalvetoggle, + pantographcompressorvalveenable, + pantographcompressorvalvedisable, + pantographcompressoractivate, + pantographtogglefront, + pantographtogglerear, + pantographraisefront, + pantographraiserear, + pantographlowerfront, + pantographlowerrear, + pantographlowerall, + pantographselectnext, + pantographselectprevious, + pantographtoggleselected, + pantographraiseselected, + pantographlowerselected, + pantographvalvesupdate, + pantographvalvesoff, + heatingtoggle, + heatingenable, + heatingdisable, + lightspresetactivatenext, + lightspresetactivateprevious, + headlighttoggleleft, + headlightenableleft, + headlightdisableleft, + headlighttoggleright, + headlightenableright, + headlightdisableright, + headlighttoggleupper, + headlightenableupper, + headlightdisableupper, + redmarkertoggleleft, + redmarkerenableleft, + redmarkerdisableleft, + redmarkertoggleright, + redmarkerenableright, + redmarkerdisableright, + headlighttogglerearleft, + headlightenablerearleft, + headlightdisablerearleft, + headlighttogglerearright, + headlightenablerearright, + headlightdisablerearright, + headlighttogglerearupper, + headlightenablerearupper, + headlightdisablerearupper, + redmarkertogglerearleft, + redmarkerenablerearleft, + redmarkerdisablerearleft, + redmarkertogglerearright, + redmarkerenablerearright, + redmarkerdisablerearright, + redmarkerstoggle, + endsignalstoggle, + headlightsdimtoggle, + headlightsdimenable, + headlightsdimdisable, + motorconnectorsopen, + motorconnectorsclose, + motordisconnect, + interiorlighttoggle, + interiorlightenable, + interiorlightdisable, + interiorlightdimtoggle, + interiorlightdimenable, + interiorlightdimdisable, + compartmentlightstoggle, + compartmentlightsenable, + compartmentlightsdisable, + instrumentlighttoggle, + instrumentlightenable, + instrumentlightdisable, + dashboardlighttoggle, + dashboardlightenable, + dashboardlightdisable, + timetablelighttoggle, + timetablelightenable, + timetablelightdisable, + generictoggle0, + generictoggle1, + generictoggle2, + generictoggle3, + generictoggle4, + generictoggle5, + generictoggle6, + generictoggle7, + generictoggle8, + generictoggle9, + batterytoggle, + batteryenable, + batterydisable, cabactivationtoggle, cabactivationenable, cabactivationdisable, - motorblowerstogglefront, - motorblowerstogglerear, - motorblowersdisableall, - coolingfanstoggle, - tempomattoggle, + motorblowerstogglefront, + motorblowerstogglerear, + motorblowersdisableall, + coolingfanstoggle, + tempomattoggle, springbraketoggle, springbrakeenable, springbrakedisable, @@ -287,7 +293,7 @@ enum class user_command { springbrakeshutoffenable, springbrakeshutoffdisable, springbrakerelease, - distancecounteractivate, + distancecounteractivate, speedcontrolincrease, speedcontroldecrease, speedcontrolpowerincrease, @@ -338,36 +344,38 @@ enum class user_command { invertertoggle10, invertertoggle11, invertertoggle12, - globalradiostop, - timejump, - timejumplarge, - timejumpsmall, - setdatetime, - setweather, - settemperature, - vehiclemoveforwards, - vehiclemovebackwards, - vehicleboost, - debugtoggle, - focuspauseset, - pausetoggle, - entervehicle, - resetconsist, - fillcompressor, - consistreleaser, - queueevent, - setlight, - insertmodel, - deletemodel, - dynamicmove, - consistteleport, - pullalarmchain, - sendaicommand, - spawntrainset, - destroytrainset, - quitsimulation, + globalradiostop, + timejump, + timejumplarge, + timejumpsmall, + setdatetime, + setweather, + settemperature, + vehiclemoveforwards, + vehiclemovebackwards, + vehicleboost, + debugtoggle, + focuspauseset, + pausetoggle, + entervehicle, + resetconsist, + fillcompressor, + consistreleaser, + queueevent, + setlight, + insertmodel, + deletemodel, + dynamicmove, + consistteleport, + pullalarmchain, + sendaicommand, + spawntrainset, + destroytrainset, + quitsimulation, + wiperswitchincrease, + wiperswitchdecrease, - none = -1 + none = -1 }; enum class command_target { @@ -481,6 +489,7 @@ extern command_queue Commands; // TODO: add name to command map, and wrap these two into helper object extern commanddescription_sequence Commands_descriptions; +extern std::unordered_map commandMap; } // command_relay: composite class component, passes specified command to appropriate command stack diff --git a/drivermouseinput.cpp b/drivermouseinput.cpp index 78529a23..2436db0f 100644 --- a/drivermouseinput.cpp +++ b/drivermouseinput.cpp @@ -506,7 +506,7 @@ drivermouse_input::bindings( std::string const &Control ) const { void drivermouse_input::default_bindings() { - + // pierwsza komenda jest od zwiekszania a druga od zmniejszania - ewentualnie kolejno lewy i prawy przycisk m_buttonbindings = { { "jointctrl:", { user_command::jointcontrollerset, @@ -731,6 +731,9 @@ drivermouse_input::default_bindings() { { "dimheadlights_sw:", { user_command::headlightsdimtoggle, user_command::none } }, + {"moderndimmer_sw:", { + user_command::modernlightdimmerincrease, + user_command::modernlightdimmerdecrease } }, { "leftend_sw:", { user_command::redmarkertoggleleft, user_command::none } }, @@ -845,6 +848,12 @@ drivermouse_input::default_bindings() { { "pantvalves_sw:", { user_command::pantographvalvesupdate, user_command::pantographvalvesoff } }, + { "pantvalvesupdate_bt:", { + user_command::pantographvalvesupdate, + user_command::none}}, + { "pantvalvesoff_bt:", { + user_command::pantographvalvesoff, + user_command::none}}, { "pantcompressor_sw:", { user_command::pantographcompressoractivate, user_command::none } }, @@ -1100,6 +1109,10 @@ drivermouse_input::default_bindings() { { "invertertoggle12_bt:",{ user_command::invertertoggle12, user_command::none } }, + { "wipers_sw:",{ + user_command::wiperswitchincrease, + user_command::wiperswitchdecrease + } }, }; } diff --git a/driveruipanels.cpp b/driveruipanels.cpp index ab9f9a1a..99bff6d0 100644 --- a/driveruipanels.cpp +++ b/driveruipanels.cpp @@ -617,8 +617,9 @@ debug_panel::render() { ImGui::Checkbox( "Debug Traction", &DebugTractionFlag ); } render_section( "Camera", m_cameralines ); - render_section( "Gfx Renderer", m_rendererlines ); + render_section( "Gfx Renderer / Statistics", m_rendererlines ); render_section_settings(); + render_section_developer(); // Developer tools #ifdef WITH_UART if(true == render_section( "UART", m_uartlines)) { int ports_num = UartStatus.available_ports.size(); @@ -1452,6 +1453,14 @@ debug_panel::update_section_renderer( std::vector &Output ) { // renderer stats Output.emplace_back( GfxRenderer->info_times(), Global.UITextColor ); Output.emplace_back( GfxRenderer->info_stats(), Global.UITextColor ); + + // CPU related + Output.emplace_back("CPU:", Global.UITextColor); + + // thread counter + textline = "Running threads: " + std::to_string(Global.threads.size() + 1); + Output.emplace_back(textline, Global.UITextColor); + } bool @@ -1475,6 +1484,19 @@ debug_panel::render_section( std::vector const &Lines ) { return true; } +bool debug_panel::render_section_developer() +{ + if (false == ImGui::CollapsingHeader("Developer tools")) + return false; + ImGui::PushStyleColor(ImGuiCol_Text, {Global.UITextColor.r, Global.UITextColor.g, Global.UITextColor.b, Global.UITextColor.a}); + ImGui::TextUnformatted("Warning! These tools are only for developers.\nDo not use them if you are NOT sure what they do!"); + ImGui::TextColored(ImVec4(1.0f, 0.0f, 0.0f, 1.0f), "These settings may crash your simulator!"); + if (ImGui::Button("Reload current vehicle .fiz") == true) + { + m_input.vehicle->MoverParameters->reload_FIZ(); // reload fiz + } +} + bool debug_panel::render_section_settings() { diff --git a/driveruipanels.h b/driveruipanels.h index e1a9acbe..f34a601e 100644 --- a/driveruipanels.h +++ b/driveruipanels.h @@ -104,7 +104,8 @@ private: bool render_section_uart(); #endif bool render_section_settings(); -// members + bool render_section_developer(); + // members std::array m_buffer; std::array m_eventsearch; input_data m_input; diff --git a/editormode.cpp b/editormode.cpp index 11a61890..f2cd69bc 100644 --- a/editormode.cpp +++ b/editormode.cpp @@ -206,7 +206,7 @@ editor_mode::on_key( int const Key, int const Scancode, int const Action, int co m_node = nullptr; m_dragging = false; - Application.set_cursor( GLFW_CURSOR_NORMAL ); + //Application.set_cursor( GLFW_CURSOR_NORMAL ); static_cast( m_userinterface.get() )->set_node(nullptr); simulation::State.delete_model(model); @@ -318,10 +318,14 @@ editor_mode::on_mouse_button( int const Button, int const Action, int const Mods if( Action == GLFW_PRESS ) { // left button press auto const mode = static_cast( m_userinterface.get() )->mode(); + auto const rotation_mode = static_cast( m_userinterface.get() )->rot_mode(); + auto const fixed_rotation_value = + static_cast(m_userinterface.get())->rot_val(); m_node = nullptr; - GfxRenderer->Pick_Node_Callback([this, mode,Action,Button](scene::basic_node *node) { + GfxRenderer->Pick_Node_Callback([this, mode, rotation_mode, fixed_rotation_value, + Action, Button](scene::basic_node *node) { editor_ui *ui = static_cast(m_userinterface.get()); if (mode == nodebank_panel::MODIFY) { @@ -329,10 +333,10 @@ editor_mode::on_mouse_button( int const Button, int const Action, int const Mods return; m_node = node; - if( m_node ) - Application.set_cursor( GLFW_CURSOR_DISABLED ); - else - m_dragging = false; + //if( m_node ) + //Application.set_cursor( GLFW_CURSOR_DISABLED ); + //else + //m_dragging = false; ui->set_node(m_node); } else if (mode == nodebank_panel::COPY) { @@ -360,8 +364,24 @@ editor_mode::on_mouse_button( int const Button, int const Action, int const Mods if (!m_dragging) return; - m_node = cloned; - Application.set_cursor( GLFW_CURSOR_DISABLED ); + + m_node = cloned; + + if (rotation_mode == functions_panel::RANDOM) + { + auto const rotation{glm::vec3{0, LocalRandom(0.0, 360.0), 0}}; + + m_editor.rotate(m_node, rotation, 1); + } + else if (rotation_mode == functions_panel::FIXED) + { + + auto const rotation{glm::vec3{0, fixed_rotation_value, 0}}; + + m_editor.rotate(m_node, rotation, 0); + + } + //Application.set_cursor( GLFW_CURSOR_DISABLED ); ui->set_node( m_node ); } }); @@ -370,8 +390,8 @@ editor_mode::on_mouse_button( int const Button, int const Action, int const Mods } else { // left button release - if( m_node ) - Application.set_cursor( GLFW_CURSOR_NORMAL ); + //if( m_node ) + //Application.set_cursor( GLFW_CURSOR_NORMAL ); m_dragging = false; // prime history stack for another snapshot m_takesnapshot = true; diff --git a/editoruilayer.cpp b/editoruilayer.cpp index 9ea162bf..0af6d525 100644 --- a/editoruilayer.cpp +++ b/editoruilayer.cpp @@ -21,6 +21,7 @@ editor_ui::editor_ui() { add_external_panel( &m_itempropertiespanel ); add_external_panel( &m_nodebankpanel ); + add_external_panel( &m_functionspanel ); } // updates state of UI elements @@ -41,6 +42,7 @@ editor_ui::update() { ui_layer::update(); m_itempropertiespanel.update( m_node ); + m_functionspanel.update( m_node ); } void @@ -63,3 +65,17 @@ nodebank_panel::edit_mode editor_ui::mode() { return m_nodebankpanel.mode; } + +functions_panel::rotation_mode +editor_ui::rot_mode() { + return m_functionspanel.rot_mode; +} +float +editor_ui::rot_val() { + return m_functionspanel.rot_value; +} +bool +editor_ui::rot_from_last() +{ + return m_functionspanel.rot_from_last; +} \ No newline at end of file diff --git a/editoruilayer.h b/editoruilayer.h index 893a03e9..2330d533 100644 --- a/editoruilayer.h +++ b/editoruilayer.h @@ -31,6 +31,12 @@ public: set_node( scene::basic_node * Node ); void add_node_template(const std::string &desc); + float + rot_val(); + bool + rot_from_last(); + functions_panel::rotation_mode + rot_mode(); const std::string * get_active_node_template(); nodebank_panel::edit_mode @@ -39,6 +45,7 @@ public: private: // members itemproperties_panel m_itempropertiespanel { "Node Properties", true }; + functions_panel m_functionspanel { "Functions", true }; nodebank_panel m_nodebankpanel{ "Node Bank", true }; scene::basic_node * m_node { nullptr }; // currently bound scene node, if any }; diff --git a/editoruipanels.cpp b/editoruipanels.cpp index ddb67be9..fc65b5c6 100644 --- a/editoruipanels.cpp +++ b/editoruipanels.cpp @@ -420,8 +420,6 @@ nodebank_panel::render() { ImGui::SameLine(); ImGui::RadioButton("Insert from bank", (int*)&mode, ADD); ImGui::SameLine(); - ImGui::RadioButton("Brush", (int*)&mode, BRUSH); - ImGui::SameLine(); ImGui::RadioButton( "Copy to bank", (int*)&mode, COPY ); ImGui::SameLine(); if (ImGui::Button("Reload Nodebank")) @@ -493,3 +491,64 @@ nodebank_panel::generate_node_label( std::string Input ) const { model : model + " (" + texture + ")" ); } + +void functions_panel::update(scene::basic_node const *Node) +{ + m_node = Node; + + if (false == is_open) + { + return; + } + + text_lines.clear(); + m_grouplines.clear(); + + std::string textline; + + // scenario inspector + auto const *node{Node}; + auto const &camera{Global.pCamera}; + + + + +} + +void +functions_panel::render() { + + if( false == is_open ) { return; } + + auto flags = + ImGuiWindowFlags_NoFocusOnAppearing + | ImGuiWindowFlags_NoCollapse + | ( size.x > 0 ? ImGuiWindowFlags_NoResize : 0 ); + + if( size.x > 0 ) { + ImGui::SetNextWindowSize( ImVec2S( size.x, size.y ) ); + } + if( size_min.x > 0 ) { + ImGui::SetNextWindowSizeConstraints( ImVec2S( size_min.x, size_min.y ), ImVec2( size_max.x, size_max.y ) ); + } + auto const panelname { ( + title.empty() ? + m_name : + title ) + + "###" + m_name }; + if( true == ImGui::Begin( panelname.c_str(), nullptr, flags ) ) { + // header section + + ImGui::RadioButton("Random rotation", (int *)&rot_mode, RANDOM); + ImGui::RadioButton("Fixed rotation", (int *)&rot_mode, FIXED); + if(rot_mode == FIXED){ + //ImGui::Checkbox("Get rotation from last object", &rot_from_last); + ImGui::SliderFloat("Rotation Value", &rot_value, 0.0f, 360.0f, "%.1f"); + }; + ImGui::RadioButton("Default rotation", (int *)&rot_mode, DEFAULT); + for( auto const &line : text_lines ) { + ImGui::TextColored( ImVec4( line.color.r, line.color.g, line.color.b, line.color.a ), line.data.c_str() ); + } + } + ImGui::End(); +} \ No newline at end of file diff --git a/editoruipanels.h b/editoruipanels.h index 22fc554e..5aed376f 100644 --- a/editoruipanels.h +++ b/editoruipanels.h @@ -73,3 +73,35 @@ private: char m_nodesearch[ 128 ]; std::shared_ptr m_selectedtemplate; }; + +class functions_panel : public ui_panel +{ + + public: + enum rotation_mode + { + RANDOM, + FIXED, + DEFAULT + }; + rotation_mode rot_mode = DEFAULT; + + float rot_value = 0.0f; + bool rot_from_last = false; + + functions_panel(std::string const &Name, bool const Isopen) : ui_panel(Name, Isopen) {} + + void update(scene::basic_node const *Node); + void render() override; + + + private: + // methods + + + // members + scene::basic_node const *m_node{nullptr}; // scene node bound to the panel + scene::group_handle m_grouphandle{null_handle}; // scene group bound to the panel + std::string m_groupprefix; + std::vector m_grouplines; +}; \ No newline at end of file diff --git a/lightarray.cpp b/lightarray.cpp index e262eb34..c12ea319 100644 --- a/lightarray.cpp +++ b/lightarray.cpp @@ -65,17 +65,42 @@ light_array::update() { light.count = 0 + ( ( lights & light::headlight_left ) ? 1 : 0 ) + ( ( lights & light::headlight_right ) ? 1 : 0 ) - + ( ( lights & light::headlight_upper ) ? 1 : 0 ); + + ( ( lights & light::headlight_upper ) ? 1 : 0 ) + + ( ( lights & light::highbeamlight_left ) ? 1: 0) + + ( ( lights & light::highbeamlight_right ) ? 1 : 0); if( light.count > 0 ) { - light.intensity = std::max( 0.0f, std::log( (float)light.count + 1.0f ) ); - light.intensity *= ( light.owner->DimHeadlights ? 0.6f : 1.0f ); + light.intensity = std::max(0.0f, std::log((float)light.count + 1.0f)); + if (light.owner->DimHeadlights && !light.owner->HighBeamLights) // tylko przyciemnione + light.intensity *= light.owner->MoverParameters->dimMultiplier; + else if (!light.owner->DimHeadlights && !light.owner->HighBeamLights) // normalne + light.intensity *= light.owner->MoverParameters->normMultiplier; + else if (light.owner->DimHeadlights && light.owner->HighBeamLights) // przyciemnione dlugie + light.intensity *= light.owner->MoverParameters->highDimMultiplier; + else if (!light.owner->DimHeadlights && light.owner->HighBeamLights) // dlugie zwykle + light.intensity *= light.owner->MoverParameters->highMultiplier; + // TBD, TODO: intensity can be affected further by other factors light.state = { - ( ( lights & light::headlight_left ) ? 1.f : 0.f ), - ( ( lights & light::headlight_upper ) ? 1.f : 0.f ), - ( ( lights & light::headlight_right ) ? 1.f : 0.f ) }; - light.state *= ( light.owner->DimHeadlights ? 0.6f : 1.0f ); + ( ( lights & light::headlight_left | light::highbeamlight_left ) ? 1.f : 0.f ), + ( ( lights & light::headlight_upper ) ? 1.f : 0.f ), + ( ( lights & light::headlight_right | light::highbeamlight_right) ? 1.f : 0.f ) }; + + light.color = { + static_cast(light.owner->MoverParameters->refR) / 255.0f, + static_cast(light.owner->MoverParameters->refG) / 255.0f, + static_cast(light.owner->MoverParameters->refB) / 255.0f + }; + + if (light.owner->DimHeadlights && !light.owner->HighBeamLights) // tylko przyciemnione + light.state *= light.owner->MoverParameters->dimMultiplier; + else if (!light.owner->DimHeadlights && !light.owner->HighBeamLights) + light.state *= light.owner->MoverParameters->normMultiplier; + else if (light.owner->DimHeadlights && light.owner->HighBeamLights) // przyciemnione dlugie + light.state *= light.owner->MoverParameters->highDimMultiplier; + else if (!light.owner->DimHeadlights && light.owner->HighBeamLights) // dlugie zwykle + light.state *= light.owner->MoverParameters->highMultiplier; + } else { light.intensity = 0.0f; diff --git a/ref/discord-rpc b/ref/discord-rpc new file mode 160000 index 00000000..963aa9f3 --- /dev/null +++ b/ref/discord-rpc @@ -0,0 +1 @@ +Subproject commit 963aa9f3e5ce81a4682c6ca3d136cddda614db33 diff --git a/scenenode.h b/scenenode.h index 7441bf3b..6689755e 100644 --- a/scenenode.h +++ b/scenenode.h @@ -47,8 +47,7 @@ operator!=( lighting_data const &Left, lighting_data const &Right ) { namespace scene { struct bounding_area { - - glm::dvec3 center; // mid point of the rectangle + glm::highp_dvec3 center; // mid point of the rectangle float radius { -1.0f }; // radius of the bounding sphere bounding_area() = default; @@ -94,7 +93,7 @@ public: material_handle material { null_handle }; lighting_data lighting; // geometry data - glm::dvec3 origin; // world position of the relative coordinate system origin + glm::highp_dvec3 origin; // world position of the relative coordinate system origin gfx::geometry_handle geometry { 0, 0 }; // relative origin-centered chunk of geometry held by gfx renderer std::vector vertices; // world space source data of the geometry // methods: diff --git a/thread_list.txt b/thread_list.txt new file mode 100644 index 00000000..71388293 --- /dev/null +++ b/thread_list.txt @@ -0,0 +1,2 @@ +- DiscordRPC - Thread for refreshing discord rich presence +- LogService - Service that logs data to files and console \ No newline at end of file diff --git a/translation.cpp b/translation.cpp index ac31091c..d5f85e63 100644 --- a/translation.cpp +++ b/translation.cpp @@ -249,6 +249,7 @@ std::string locale::label_cab_control(std::string const &Label) { "leftlight_sw:", STRN("left headlight") }, { "rightlight_sw:", STRN("right headlight") }, { "dimheadlights_sw:", STRN("headlights dimmer") }, + { "moderndimmer_sw:", STRN("headlights dimmer") }, { "leftend_sw:", STRN("left marker light") }, { "rightend_sw:", STRN("right marker light") }, { "lights_sw:", STRN("light pattern") }, @@ -282,6 +283,8 @@ std::string locale::label_cab_control(std::string const &Label) { "pantselectedoff_sw:", STRN("selected pantograph") }, { "pantselect_sw:", STRN("selected pantograph") }, { "pantvalves_sw:", STRN("selected pantograph") }, + { "pantvalvesoff_bt:", STRN("all pantographs down") }, + { "pantvalvesupdate_bt:", STRN("selected pantographs up") }, { "pantcompressor_sw:", STRN("pantograph compressor") }, { "pantcompressorvalve_sw:", STRN("pantograph 3 way valve") }, { "trainheating_sw:", STRN("heating") }, @@ -319,7 +322,8 @@ std::string locale::label_cab_control(std::string const &Label) { "universal6:", STRN("interactive part") }, { "universal7:", STRN("interactive part") }, { "universal8:", STRN("interactive part") }, - { "universal9:", STRN("interactive part") } + { "universal9:", STRN("interactive part") }, + { "wipers_sw:", STRN("wipers mode selector") }, }; auto const it = cabcontrols_labels.find( Label ); diff --git a/utilities.h b/utilities.h index 3d98eee7..4b2c557d 100644 --- a/utilities.h +++ b/utilities.h @@ -335,6 +335,14 @@ interpolate( Type_ const &First, Type_ const &Second, double const Factor ) { return static_cast( ( First * ( 1.0 - Factor ) ) + ( Second * Factor ) ); } +template Type_ smoothInterpolate(Type_ const &First, Type_ const &Second, double Factor) +{ + // Apply smoothing (ease-in-out quadratic) + Factor = Factor * Factor * (3 - 2 * Factor); + + return static_cast((First * (1.0 - Factor)) + (Second * Factor)); +} + // tests whether provided points form a degenerate triangle template bool