mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-11-29 21:33:26 +01:00
Merge staging into feat/gl46-migration
origin/staging7ac2472c3into feat/gl46-migrationdb26a33ed, so that #468 merges into staging. Merge base037158104. Staging carries master up to571487612(squashed in #514); this branch had merged master up to7c12b83ba. Conflicts, file by file: - README.md: WITH_BETTER_RENDERER row dropped (gl46), USE_SYSTEM_JSON row kept (staging) - CMakeLists.txt: gl46 lists, plus staging's new core sources (hardwareinfo, sn_utils, regionfile, inionlysettings, fieldshunting, gaugewrap, drivingaid, signalpassing, brakereleaser, crew, brakecharge); none listed twice - tests/unit/CMakeLists.txt: both (texturealpha, freecameramotion; editorSwitchDrives, Camera) - vehicle/brakingcurve.{h,cpp}, tests/unit/test_braking_curve.cpp (add/add): staging (#479 brake_acting on the same #409 code) - editor/editorHttp.cpp: staging (it has gl46's #432 and certificate fixes, plus #439 libcurl loaded at run time) - tests/unit/test_editor_http.cpp (add/add): staging (adds the available() case of #439) - utilities/Globals.h: gl46 crashdump_full (staging's CrashDumpFull is #425, replaced here by utilities/crashdump.cpp); fmradio and staging's OpenAL options both; gfx_headlights_beamwidth (#481) not taken - utilities/Globals.cpp: both (odometer.expiry, OpenAL keys, fmradio, gl46 gfx keys); gfx.headlights.beamwidth (#481) not taken - utilities/Logs.cpp: staging's log_file_name() for both files, with gl46's crashdump_set_log_file() for both - utilities/utilities.h: gl46 set_thread_random_engine(); Random(int, int) gone on both sides - tests/unit/test_utilities.cpp: staging's includes - simulation/simulationtest.cpp: gl46 (no NvRenderer, LegacyRenderer, BasicRenderer here) - ci_shadervalidator/* (incl. add/add utilities/Logs.h): gl46's validator of shaders/ogl46 and shaders/vk14; staging's #437 fixed the GL 3.3 one - gl/shader.cpp, gl/glsl_common.cpp: gl46 (shaders come from rendering/common/shadersource.cpp); HEADLIGHT_BEAM_WIDTH (#481) not taken - shaders/mat_wire.frag: gl46. Rename detection paired staging's mat_colored.frag (#481) with it - lang/editor_pl.po: union; the 12 camera speed / orthophoto entries staging adds are here already (master #312) - audio/audiorenderer.{h,cpp}: both (fmradio; startsample and the low-pass filter); the destructor releases the radio, then the filter - application/editormode.h, application/editormodeswitchdrive.cpp: staging (#509 on #330, which is all this side had) - application/application.cpp: gl46's start sequence (no init_ogl, ANGLE or NvRenderer; crash window after init_ui) with staging's hardware::log_system() (#389) - EU07.cpp: gl46 (crash reports of utilities/crashdump.cpp); staging's side was #425's handler, replaced here - model/Texture.{h,cpp}: gl46 (texture_source); staging's side is master #399/#411/#362/#386, merged here before - world/Track.h, world/TrackSleepers.h: both (TrackBlend, lay(Fastened)/fasten; TrackBuckle, pack_models) - world/Segment.cpp: staging's track buckling on the split stray factors both sides have - vehicle/Driver.h: staging's additions (#444, #494, #473, #346, timetable flags) - vehicle/Driver.cpp: staging's file, with this branch'sf4f8c75e4(road orders measured along the lane) and8fbf05674(a holding road order blocks the ones past it) applied again; #409's SeenAheadTolerance gives way to #473 - vehicle/DynObj.h: friend opengl46_renderer and friend class vehicle_table - vehicle/DynObj.cpp: gl46's vehicle_table::update() with staging's update_off_track_contacts() and update_brake_pipes() - McZapkie/Mover.cpp: staging's function splits (#239) and hose exchange (#388); every line this branch added to Mover.cpp/MOVER.h is kept - .github/workflows/build_bin.yml: staging's apt-install step (#497) and pinned download-artifact (#331) Modify/delete, kept deleted: - rendering/opengl33renderer.{cpp,h}, rendering/openglparticles.cpp, rendering/openglrenderer.{cpp,h}: staging's versions are master's, and every master change to them is in this branch's history already - shaders/light_common.glsl, shaders/mat_sunlessnormalmap_specgloss.frag: see below Carried into this branch's code: - the hose exchange after each sub-step (#387/#388) also in update_steps_parallel(), per group of vehicles, as update() does it single-threaded - physics.pipewake (pipe_wakes(), wake_cause::scndpipe) in staging's GetScndDVc(), where the main reservoir hose exchange went - hardware::log_gl_context() (#389) in after_window() of the GL 4.6 backend, init_ogl() being gone Taken back out of the auto-merge (renderers this branch removed): - shaders/vk14/tonemapping.glsl: #481's switch to ACES, applied there by rename detection - environment/skydome.cpp, simulation/simulationenvironment.cpp: #415, the sky of the legacy renderer - application/application.cpp: #384's fallback of an unknown gfxrenderer, which this branch had dropped Not carried from staging (renderer files removed here): - master #481 (571487612): old assets drawn as in 26.05 (metal diffuse, sun highlight tint, ACES, SUN_DIFFUSE_SCALE 2.5, untinted Diffuse, mat_colored base) and gfx.headlights.beamwidth. Made for the GL 3.3 shaders; the PBR shaders of shaders/ogl46 and vk14 (and their SPIR-V binaries) are the author's call - #437: the unique temporary file of the shader validator (Sonar S5443); gl46's validator still writes /tmp/shader* Unit tests: 1133 of 1137 cases pass. Four staging tests fail (derailment: a repaired vehicle is back on the rails; three pullee cases): the vehicle stands, and with physics.sleepheld (on by default here) its physics sleeps with the Fb / FStand of before. With physics.sleepheld off they pass. Left to the author.
This commit is contained in:
@@ -20,10 +20,15 @@ http://mozilla.org/MPL/2.0/.
|
||||
#include "utilities/Logs.h"
|
||||
#include "utilities/physicslog.h"
|
||||
#include "vehicle/Train.h"
|
||||
#include "vehicle/brakereleaser.h"
|
||||
#include "vehicle/brakesetting.h"
|
||||
#include "vehicle/brakingcurve.h"
|
||||
#include "vehicle/fieldshunting.h"
|
||||
#include "vehicle/handover.h"
|
||||
#include "vehicle/signalpassing.h"
|
||||
#include "vehicle/timetableservice.h"
|
||||
#include "world/mtable.h"
|
||||
#include "world/stationnames.h"
|
||||
#include "vehicle/DynObj.h"
|
||||
#include "world/Event.h"
|
||||
#include "world/MemCell.h"
|
||||
@@ -329,9 +334,7 @@ bool TSpeedPos::Update()
|
||||
// trzeba zazanaczyć, że minięty
|
||||
iFlags |= spElapsed;
|
||||
}
|
||||
else {
|
||||
bSeenAhead = true;
|
||||
}
|
||||
bSeenAhead = signal_passing::seen_ahead_on_update( fDist, bSeenAhead );
|
||||
if (iFlags & spTrack) {
|
||||
// road/track
|
||||
if (trTrack) {
|
||||
@@ -417,18 +420,14 @@ bool TSpeedPos::IsProperSemaphor(TOrders order)
|
||||
return false; // true gdy zatrzymanie, wtedy nie ma po co skanować dalej
|
||||
}
|
||||
|
||||
// how far behind the head an event found in the scan may lie and still count as one the head had ahead [m]
|
||||
constexpr double SeenAheadTolerance { 5.0 };
|
||||
|
||||
bool TSpeedPos::Set(basic_event *event, double dist, double length, TOrders order)
|
||||
bool TSpeedPos::Set(basic_event *event, double dist, double length, TOrders order, bool const Standing)
|
||||
{ // zapamiętanie zdarzenia
|
||||
fDist = dist;
|
||||
// an event already behind the head when found (under a train set across a signal) wasn't passed by it. the
|
||||
// distance is found in steps of a metre from the position of the memory cell, so a signal just ahead of the head
|
||||
// may come out a few metres behind it: those still count as seen ahead. the price is that a train set less than
|
||||
// the tolerance past a signal at stop is still reported to pass it; a train standing that close to a signal can't
|
||||
// be told from one stopped just short of it, which really passes the signal if it goes on
|
||||
bSeenAhead = ( dist >= -SeenAheadTolerance );
|
||||
// an event already behind the head when found (under a train set across a signal) wasn't passed by it. a moving
|
||||
// train may be just passing it, and the distance is found in steps of a metre, so for a moving train an event a
|
||||
// little behind the head still counts as seen ahead. a standing train passes nothing: an event found behind its
|
||||
// head counts only once an update finds it ahead
|
||||
bSeenAhead = signal_passing::seen_ahead_when_found( dist, Standing );
|
||||
iFlags = spEvent;
|
||||
evEvent = event;
|
||||
vPos = event->input_location(); // współrzędne eventu albo komórki pamięci (zrzutować na tor?)
|
||||
@@ -579,15 +578,21 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
|
||||
}
|
||||
else {
|
||||
if( iTableDirection == 0 ) { return; }
|
||||
// NOTE: belt and braces; TablePurger() used to leave these pointing past the end of the table
|
||||
if( SemNextIndex != npos
|
||||
&& SemNextIndex >= sSpeedTable.size() ) {
|
||||
SemNextIndex = npos;
|
||||
}
|
||||
if( SemNextStopIndex != npos
|
||||
&& SemNextStopIndex >= sSpeedTable.size() ) {
|
||||
SemNextStopIndex = npos;
|
||||
}
|
||||
// NOTE: belt and braces; TablePurger() used to leave these pointing past the end of the table.
|
||||
// nothing is known to do that any more, so say so when it happens
|
||||
auto const dropstaleindex = [this, fDistance]( std::size_t &Index, std::string_view const Name ) {
|
||||
if( Index == npos
|
||||
|| Index < sSpeedTable.size() ) {
|
||||
return;
|
||||
}
|
||||
ErrorLog( std::format(
|
||||
"Speed table for {}: {} {} points past the end of the table ({} records), last track {} at {:.1f} m, scan range {:.1f} m; reset",
|
||||
OwnerName(), Name, Index, sSpeedTable.size(),
|
||||
( iLast >= 0 && sSpeedTable[ iLast ].trTrack != nullptr ? sSpeedTable[ iLast ].trTrack->name() : "none" ),
|
||||
( iLast >= 0 ? sSpeedTable[ iLast ].fDist : 0.0 ), fDistance ) );
|
||||
Index = npos; };
|
||||
dropstaleindex( SemNextIndex, "SemNextIndex" );
|
||||
dropstaleindex( SemNextStopIndex, "SemNextStopIndex" );
|
||||
// kontynuacja skanowania od ostatnio sprawdzonego toru (w ostatniej pozycji zawsze jest tor)
|
||||
if( SemNextStopIndex != npos
|
||||
&& sSpeedTable[SemNextStopIndex].fVelNext == 0.0 ) {
|
||||
@@ -651,7 +656,7 @@ void TController::TableTraceRoute(double fDistance, TDynamicObject *pVehicle)
|
||||
typeid( *pEvent ) == typeid( road_order ) ?
|
||||
fCurrentDistance + ProjectEventOnTrack( pEvent, pTrack, fLastDir ) :
|
||||
GetDistanceToEvent( pTrack, pEvent, fLastDir, fCurrentDistance ) };
|
||||
if (newspeedpoint.Set(pEvent, eventdistance, fLength, OrderCurrentGet()))
|
||||
if (newspeedpoint.Set(pEvent, eventdistance, fLength, OrderCurrentGet(), mvOccupied->Vel < EU07_AI_NOMOVEMENT))
|
||||
{
|
||||
|
||||
fDistance = newspeedpoint.fDist; // jeśli sygnał stop, to nie ma potrzeby dalej skanować
|
||||
@@ -927,9 +932,8 @@ std::uint8_t passing_flags_of( TSpeedPos const &Point, double const Speedatsigna
|
||||
|
||||
void TController::CheckSignalPassed( TSpeedPos const &Point, bool const Passedbefore ) const
|
||||
{
|
||||
if( Passedbefore
|
||||
|| false == TestFlag( Point.iFlags, spElapsed )
|
||||
|| false == Point.bSeenAhead // found already behind the head: the train stood across it, it didn't pass it
|
||||
// not bSeenAhead: found already behind the head, the train stood across it or past it, it didn't pass it
|
||||
if( false == signal_passing::passed_now( Passedbefore, TestFlag( Point.iFlags, spElapsed ), Point.bSeenAhead )
|
||||
|| ( mvOccupied->CategoryFlag & 1 ) == 0 ) { // railway only
|
||||
return;
|
||||
}
|
||||
@@ -1224,8 +1228,9 @@ TController::TableUpdateStopPoint( TCommandType &Command, TSpeedPos &Point, doub
|
||||
if( ( OrderCurrentGet() & ( Shunt | Loose_shunt | Obey_train | Bank ) ) == 0 ) { return true; }
|
||||
// jeśli przystanek, trzeba obsłużyć wg rozkładu
|
||||
iDrivigFlags |= moveStopPointFound;
|
||||
// first 19 chars of the command is expected to be "PassengerStopPoint:" so we skip them
|
||||
if( ToLower( Point.evEvent->input_text() ).compare( 19, sizeof( asNextStop ), ToLower( asNextStop ) ) != 0 )
|
||||
// the W4 and the timetable name the station each in its own file, so the two spellings are compared by their key:
|
||||
// with or without the polish letters, in any case, with spaces or underscores
|
||||
if( false == timetable::stop_point_is_for( Point.evEvent->input_text(), asNextStop ) )
|
||||
{ // jeśli nazwa nie jest zgodna
|
||||
if( false == IsScheduledPassengerStopVisible // check if our next scheduled stop didn't show up earlier in the scan
|
||||
&& Point.fDist < 1.15 * fBrakeDist + 300
|
||||
@@ -1369,6 +1374,8 @@ TController::TableUpdateStopPoint( TCommandType &Command, TSpeedPos &Point, doub
|
||||
if (TrainParams.UpdateMTable( simulation::Time, asNextStop) ) {
|
||||
// to się wykona tylko raz po zatrzymaniu na W4
|
||||
record_station( Point, blackbox::station_kinds::stopped );
|
||||
// the service flags of this stop hold for its doors and departure
|
||||
m_stopflags = TrainParams.stop_flags();
|
||||
if( TrainParams.StationIndex < TrainParams.StationCount ) {
|
||||
// jeśli są dalsze stacje, bez trąbienia przed odjazdem
|
||||
// also ignore any horn cue that may be potentially set below 1 km/h and before the actual full stop
|
||||
@@ -1467,7 +1474,8 @@ TController::TableUpdateStopPoint( TCommandType &Command, TSpeedPos &Point, doub
|
||||
if( Command == TCommandType::cm_Unknown ) { // jeśli nie było komendy wcześniej
|
||||
Command = TCommandType::cm_Ready; // gotów do odjazdu z W4 (semafor może zatrzymać)
|
||||
}
|
||||
if( false == tsGuardSignal.empty() ) {
|
||||
if( false == tsGuardSignal.empty()
|
||||
&& true == timetable::has_conductor( m_stopflags ) ) {
|
||||
// jeśli mamy głos kierownika, to odegrać
|
||||
iDrivigFlags |= moveGuardSignal;
|
||||
}
|
||||
@@ -1475,7 +1483,8 @@ TController::TableUpdateStopPoint( TCommandType &Command, TSpeedPos &Point, doub
|
||||
} // koniec startu z zatrzymania
|
||||
else {
|
||||
cue_action(driver_hint::waitdeparturetime);
|
||||
if (TrainParams.IsTimeToGo(simulation::Time.data().wHour, simulation::Time.data().wMinute + simulation::Time.data().wSecond*0.0167 + 0.1)) { //if is less than 6 sec to departure
|
||||
if (timetable::has_conductor(m_stopflags) // no conductor, no door kept open for him
|
||||
&& TrainParams.IsTimeToGo(simulation::Time.data().wHour, simulation::Time.data().wMinute + simulation::Time.data().wSecond*0.0167 + 0.1)) { //if is less than 6 sec to departure
|
||||
iDrivigFlags |= moveGuardOpenDoor;
|
||||
GuardOpenDoor();
|
||||
}
|
||||
@@ -2738,8 +2747,10 @@ double TController::ESMVelocity(bool Main)
|
||||
}
|
||||
IF = std::min(IF, mvControlling->Imax*fCurrentCoeff);
|
||||
double R = mvControlling->RList[MCPN].R + mvControlling->CircuitRes + mvControlling->RList[MCPN].Mn*mvControlling->WindingRes;
|
||||
double pole = mvControlling->MotorParam[SCPN].fi *
|
||||
std::max(abs(IF) / (abs(IF) + mvControlling->MotorParam[SCPN].Isat) - mvControlling->MotorParam[SCPN].fi0, 0.0);
|
||||
// SCPN may come from the .fiz (RList ScndAct) unchecked: read it with the bounds-safe accessor, as MomentumF() does
|
||||
auto const &motorparam{mvControlling->motor_param(SCPN)};
|
||||
double pole = motorparam.fi *
|
||||
std::max(abs(IF) / (abs(IF) + motorparam.Isat) - motorparam.fi0, 0.0);
|
||||
double Us = abs(mvControlling->EngineVoltage) - IF*R;
|
||||
double ns = std::max(0.0, Us / (pole*mvControlling->RList[MCPN].Mn));
|
||||
ESMVel = ns * mvControlling->WheelDiameter*M_PI*3.6/mvControlling->Transmision.Ratio;
|
||||
@@ -2888,7 +2899,7 @@ bool TController::CheckVehicles(TOrders user)
|
||||
= 0;
|
||||
}
|
||||
|
||||
if( OrderCurrentGet() & ( Shunt | Loose_shunt | Obey_train | Bank ) ) {
|
||||
if( brake_setting::inspects_train( OrderCurrentGet(), user == Connect ) ) {
|
||||
// nastawianie hamulca do jazdy pociągowej
|
||||
AutoRewident();
|
||||
/*
|
||||
@@ -3252,15 +3263,15 @@ bool TController::PrepareEngine()
|
||||
close_line_breaker();
|
||||
}
|
||||
|
||||
auto const sufficientpantographpressure { (
|
||||
is_emu() ?
|
||||
2.5 : // Ra 2013-12: Niebugocław mówi, że w EZT podnoszą się przy 2.5
|
||||
3.5 )
|
||||
+ 0.1 }; // leeway margin
|
||||
|
||||
if( mvPantographUnit->EnginePowerSource.SourceType == TPowerSource::CurrentCollector
|
||||
&& mvPantographUnit->EnginePowerSource.CollectorParameters.CollectorsNo > 0 ) {
|
||||
// if our pantograph unit isn't a pantograph-devoid fallback
|
||||
auto const sufficientpantographpressure { (
|
||||
is_emu() ?
|
||||
2.5 : // Ra 2013-12: Niebugocław mówi, że w EZT podnoszą się przy 2.5
|
||||
3.5 )
|
||||
+ 0.1 }; // leeway margin
|
||||
|
||||
if (mvPantographUnit->PantPress < sufficientpantographpressure) {
|
||||
// załączenie małej sprężarki
|
||||
if( false == mvPantographUnit->PantAutoValve ) {
|
||||
@@ -3290,6 +3301,9 @@ bool TController::PrepareEngine()
|
||||
auto const ispoweravailable =
|
||||
mvControlling->EnginePowerSource.SourceType != TPowerSource::CurrentCollector
|
||||
|| std::max(mvControlling->GetTrainsetHighVoltage(), mvControlling->PantographVoltage) > mvControlling->EnginePowerSource.CollectorParameters.MinV;
|
||||
// standing with the pantographs up and no voltage, nothing the driver does starts the vehicle. it says so, and keeps
|
||||
// trying: towed back under the wire, or with the power switched on, the vehicle gets prepared after all
|
||||
report_power_stall( ispoweravailable, sufficientpantographpressure );
|
||||
|
||||
bool isready = false;
|
||||
|
||||
@@ -3330,6 +3344,7 @@ bool TController::PrepareEngine()
|
||||
cue_action( driver_hint::rearmotorblowerson );
|
||||
}
|
||||
}
|
||||
control_field_shunting();
|
||||
// sync virtual brake state with the 'real' one
|
||||
if( mvOccupied->BrakeHandle != TBrakeHandle::NoHandle ) {
|
||||
std::unordered_map<int, int> const brakepositions{
|
||||
@@ -3342,9 +3357,13 @@ bool TController::PrepareEngine()
|
||||
}
|
||||
}
|
||||
// set up train brake
|
||||
if( mvOccupied->fBrakeCtrlPos != mvOccupied->Handle->GetPos( bh_RP ) ) {
|
||||
if ( !mvOccupied->Handle->Time
|
||||
|| mvOccupied->Handle->GetCP() < mvOccupied->HighPipePress - 0.05 );
|
||||
if( mvOccupied->Vel < EU07_AI_NOMOVEMENT ) {
|
||||
// standing: the locomotive brake first, then the pipe is filled
|
||||
secure_standing_train();
|
||||
}
|
||||
else if( ( mvOccupied->fBrakeCtrlPos != mvOccupied->Handle->GetPos( bh_RP ) )
|
||||
&& ( ( false == mvOccupied->Handle->Time )
|
||||
|| ( mvOccupied->Handle->GetCP() < mvOccupied->HighPipePress - 0.05 ) ) ) {
|
||||
cue_action( driver_hint::trainbrakerelease );
|
||||
}
|
||||
// sync spring brake state across consist
|
||||
@@ -3376,6 +3395,39 @@ bool TController::PrepareEngine()
|
||||
return iEngineActive;
|
||||
}
|
||||
|
||||
// tells in the log, once, of standing with the pantographs up and no voltage at them, past the end of the overhead
|
||||
// wire or under a wire switched off (eu07/maszyna#421). Poweravailable is what PrepareEngine() found, Pantographpressure
|
||||
// the air the pantographs need to rise
|
||||
void
|
||||
TController::report_power_stall( bool const Poweravailable, double const Pantographpressure ) {
|
||||
|
||||
ai_power::state state;
|
||||
state.collector = mvControlling->EnginePowerSource.SourceType == TPowerSource::CurrentCollector;
|
||||
state.power = Poweravailable;
|
||||
state.standing = mvOccupied->Vel < EU07_AI_NOMOVEMENT;
|
||||
if( mvPantographUnit->PantPress >= Pantographpressure ) {
|
||||
state.pantographs_up =
|
||||
mvPantographUnit->Pantographs[ end::front ].is_active
|
||||
|| mvPantographUnit->Pantographs[ end::rear ].is_active;
|
||||
}
|
||||
// the pantographs of the vehicle carrying them hold the wire they found above them
|
||||
if( auto const *carrier { pVehicle->FindPantographCarrier() };
|
||||
carrier != nullptr && carrier->MoverParameters == mvPantographUnit ) {
|
||||
auto const pantographcount { std::min<int>( carrier->iAnimType[ ANIM_PANTS ], static_cast<int>( carrier->MoverParameters->Pantographs.size() ) ) };
|
||||
for( auto index { 0 }; index < pantographcount; ++index ) {
|
||||
if( true == carrier->MoverParameters->Pantographs[ index ].is_active
|
||||
&& carrier->pants[ index ].fParamPants->hvPowerWire != nullptr ) {
|
||||
state.wire = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
// a user driving the vehicle sees the voltmeters for themselves
|
||||
if( auto const stall { m_powerstall.update( AIControllFlag ? ai_power::check( state ) : ai_power::stall::waiting, ElapsedTime ) };
|
||||
stall.has_value() ) {
|
||||
ErrorLog( ai_power::message( *stall, pVehicle->asName, pVehicle->GetPosition() ), logtype::traction );
|
||||
}
|
||||
}
|
||||
|
||||
// wyłączanie silnika (test wyłączenia, a część wykonawcza tylko jeśli steruje komputer)
|
||||
bool TController::ReleaseEngine() {
|
||||
/*
|
||||
@@ -3773,6 +3825,13 @@ bool TController::DecBrake() {
|
||||
// any release now raises the pipe, and a long train releases more than the handle is moved back, too late
|
||||
// to apply again before the train stands: keep the brake as it is, and the locomotive brake with it
|
||||
break;
|
||||
}
|
||||
if( brake_charge::holds_application(
|
||||
bBrakeChargeHold, IsConsistCharged, mvOccupied->Vel < EU07_AI_NOMOVEMENT, BrakeCtrlPosition ) ) {
|
||||
// the order to go came while the train still charges: released now, the wagons let go as their
|
||||
// reservoirs fill and the train stands on a locomotive brake that doesn't hold it. the locomotive
|
||||
// brake stays on with it
|
||||
break;
|
||||
}
|
||||
if (deltaAcc < 0 && /*GBH mvOccupied->BrakeCtrlPosR*/ BrakeCtrlPosition > 0) {
|
||||
OK = /*mvOccupied->*/ BrakeLevelAdd(-0.25);
|
||||
@@ -3782,10 +3841,16 @@ bool TController::DecBrake() {
|
||||
if (BrakeCtrlPosition < 0.74)
|
||||
/*mvOccupied->*/ BrakeLevelSet(gbh_RP);
|
||||
}
|
||||
if( !OK ) {
|
||||
// standing, the locomotive brake holds the train until its brakes are charged: off before, a train
|
||||
// released on a gradient rolls with no air to brake with. nor through DecBrakeEIM(), which takes it off
|
||||
// as well (the locomotive brake of a vehicle without the integrated handle)
|
||||
auto const holdlocomotive {
|
||||
( false == IsConsistCharged )
|
||||
&& ( mvOccupied->Vel < EU07_AI_NOMOVEMENT ) };
|
||||
if( ( !OK ) && ( false == holdlocomotive ) ) {
|
||||
OK = mvOccupied->DecLocalBrakeLevel(2);
|
||||
}
|
||||
if( !OK ) {
|
||||
if( ( !OK ) && ( false == holdlocomotive ) ) {
|
||||
OK = DecBrakeEIM();
|
||||
}
|
||||
/*
|
||||
@@ -4486,7 +4551,16 @@ void TController::SpeedCntrl(double DesiredSpeed)
|
||||
{
|
||||
if( false == mvControlling->SpeedCtrl ) { return; }
|
||||
|
||||
if (mvControlling->EngineType == TEngineType::DieselEngine)
|
||||
if (mvControlling->IsSpeedCtrlSeparate())
|
||||
{
|
||||
// a switch of its own, the secondary controller left to the field shunting (eu07/maszyna#69)
|
||||
if (DesiredSpeed < 0.1) {
|
||||
DesiredSpeed = 0;
|
||||
}
|
||||
mvControlling->SpeedCtrlSwitch(DesiredSpeed > 0);
|
||||
mvControlling->RunCommand("SpeedCntrl", DesiredSpeed, mvControlling->CabActive);
|
||||
}
|
||||
else if (mvControlling->EngineType == TEngineType::DieselEngine)
|
||||
{
|
||||
if (DesiredSpeed < 0.1) {
|
||||
mvControlling->DecScndCtrl(2);
|
||||
@@ -4510,7 +4584,7 @@ void TController::SpeedCntrl(double DesiredSpeed)
|
||||
while( mvControlling->ScndCtrlPos < DesiredPos && true == mvControlling->IncScndCtrl(1) ) { ; } // all work is done in the condition loop
|
||||
}
|
||||
|
||||
if( mvControlling->SpeedCtrlUnit.PowerStep > 0 && mvControlling->ScndCtrlPos > 0 ) {
|
||||
if( mvControlling->SpeedCtrlUnit.PowerStep > 0 && mvControlling->IsSpeedCtrlEngaged() ) {
|
||||
while (mvControlling->SpeedCtrlUnit.DesiredPower < mvControlling->SpeedCtrlUnit.MaxPower)
|
||||
{
|
||||
mvControlling->SpeedCtrlPowerInc();
|
||||
@@ -4802,6 +4876,11 @@ void TController::Doors( bool const Open, int const Side ) {
|
||||
|
||||
auto const lewe = pVehicle->DirectionGet() > 0 ? 1 : 2;
|
||||
auto const prawe = 3 - lewe;
|
||||
// doorsteps as the timetable asks, before the doors open (eu07/maszyna#95)
|
||||
if( auto const doorstep { timetable::doorstep( m_stopflags ) };
|
||||
doorstep.has_value() && mvOccupied->Doors.step_enabled != *doorstep ) {
|
||||
cue_action( *doorstep ? driver_hint::doorstepon : driver_hint::doorstepoff );
|
||||
}
|
||||
// grant door control permission if it's not automatic
|
||||
// TBD: stricter requirements?
|
||||
if( true == pVehicle->MoverParameters->Doors.permit_needed ) {
|
||||
@@ -4813,10 +4892,9 @@ void TController::Doors( bool const Open, int const Side ) {
|
||||
}
|
||||
}
|
||||
// consist-wide remote signals to open doors doors
|
||||
if( pVehicle->MoverParameters->Doors.open_control == control_t::conductor
|
||||
|| pVehicle->MoverParameters->Doors.open_control == control_t::driver
|
||||
// NOTE: disabled for mixed controls, leave it up to passengers to open doors by themselves
|
||||
/* || ( pVehicle->MoverParameters->Doors.open_control == control_t::mixed ) */ ) {
|
||||
// NOTE: mixed controls are left up to passengers to open doors by themselves, unless the timetable has
|
||||
// the driver open all the doors
|
||||
if( true == timetable::opens_doors( *pVehicle->MoverParameters, m_stopflags ) ) {
|
||||
if( Side & prawe ) {
|
||||
cue_action( driver_hint::doorrightopen );
|
||||
}
|
||||
@@ -4966,6 +5044,7 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
||||
TrainParams = TTrainParameters(NewCommand); // rozkład jazdy
|
||||
tsGuardSignal = sound_source { sound_placement::internal, 2 * EU07_SOUND_CABCONTROLSCUTOFFRANGE }; // wywalenie kierownika
|
||||
m_lastexchangestop.clear();
|
||||
m_stopflags = {};
|
||||
if (NewCommand != "none")
|
||||
{
|
||||
if (false == TrainParams.LoadTTfile(
|
||||
@@ -5000,6 +5079,8 @@ bool TController::PutCommand( std::string NewCommand, double NewValue1, double N
|
||||
TrainParams.StationIndexInc(); // przejście do następnej
|
||||
TrainParams.StationStart = TrainParams.StationIndex;
|
||||
asNextStop = TrainParams.NextStop();
|
||||
// the flags of the first station until the train stops there
|
||||
m_stopflags = TrainParams.stop_flags();
|
||||
m_lastannouncement = announcement_t::idle;
|
||||
iDrivigFlags |= movePrimary; // skoro dostał rozkład, to jest teraz głównym
|
||||
// NewCommand = Global.asCurrentSceneryPath + NewCommand;
|
||||
@@ -6152,7 +6233,8 @@ std::string TController::NextStop() const
|
||||
if (asNextStop == "[End of route]")
|
||||
return ""; // nie zawiera nazwy stacji, gdy dojechał do końca
|
||||
// dodać godzinę odjazdu
|
||||
auto nextstop{ Bezogonkow( asNextStop, true ) };
|
||||
// the name the way the timetable spells it, in utf-8 as the user interface takes it
|
||||
auto nextstop{ TrainParams.station_caption( asNextStop ) };
|
||||
auto const *t{ TrainParams.TimeTable + TrainParams.StationIndex };
|
||||
if( t->Ah >= 0 ) {
|
||||
// przyjazd
|
||||
@@ -6568,12 +6650,18 @@ TController::determine_consist_state() {
|
||||
auto released { true }; // the brakes are off, the hold of an uphill start not counted
|
||||
auto mostapplied { 0.0 }; // the most applied brake, the hold of an uphill start not counted
|
||||
auto momentum { 0.0 };
|
||||
auto chargelevel { std::numeric_limits<double>::max() }; // the lowest pipe or auxiliary reservoir pressure of a working brake
|
||||
while (p)
|
||||
{ // sprawdzenie odhamowania wszystkich połączonych pojazdów
|
||||
auto *vehicle { p->MoverParameters };
|
||||
auto const bp { std::max( 0.0, vehicle->BrakePress - ( vehicle->SpeedCtrlUnit.Parking ? vehicle->MaxBrakePress[ 0 ] * vehicle->StopBrakeDecc : 0.0 ) ) };
|
||||
momentum += vehicle->TotalMass * vehicle->V * ( p->DirectionGet() == iDirection ? 1 : -1 );
|
||||
mostapplied = std::max( bp, mostapplied );
|
||||
if( ( vehicle->BrakeSystem != TBrakeSystem::Individual )
|
||||
&& ( vehicle->MaxBrakePress[ 3 ] > 0.0 )
|
||||
&& ( false == TestFlag( vehicle->Hamulec->GetBrakeStatus(), b_dmg ) ) ) { // a brake cut out doesn't count
|
||||
chargelevel = std::min( { chargelevel, vehicle->PipePress, vehicle->Hamulec->GetBRP() } );
|
||||
}
|
||||
auto const wasready { Ready };
|
||||
if( released || Ready ) {
|
||||
// bo jak coś nie odhamowane, to dalej nie ma co sprawdzać
|
||||
@@ -6708,6 +6796,69 @@ TController::determine_consist_state() {
|
||||
IsConsistReleased = released || ( fAccGravity < -0.05 && mostapplied < 0.8 );
|
||||
// the frame of the vehicle the AI drives from, as for fAccGravity and AbsAccS
|
||||
fConsistVelocity = 3.6 * momentum / std::max( 1.0, fMass ) * ( iDirection >= 0 ? 1 : -1 );
|
||||
// standing, the train starts only with its brakes charged: released alone, a train prepared from cold has no air to
|
||||
// brake with while its auxiliary reservoirs fill. with the train brake applied (held for an uphill start, a light
|
||||
// application while charging) they charge to what the head of the pipe has.
|
||||
// only the start the charge is in question for: the first after the train was prepared standing, or one with the
|
||||
// pipe near empty (after an emergency application, brake_charge::empty_level). after an ordinary stop the
|
||||
// reservoirs refill as the brake releases, and waiting for the last tenths of a bar there only delays the train and
|
||||
// those behind it.
|
||||
// and only the pneumatic brake: multiple units with the electro-pneumatic one start as before
|
||||
if( mvOccupied->Vel > 1.0 ) {
|
||||
// the start is made. a shunting engine coupling wagons moves at a walking pace: a higher speed would leave its
|
||||
// every start the first, waiting for each cut of wagons placed cold to charge
|
||||
bBrakeChargeStart = false;
|
||||
bBrakeChargeHold = false;
|
||||
bHasRun = true;
|
||||
}
|
||||
auto const chargeable {
|
||||
( BrakeSystem == TBrakeSystem::Pneumatic )
|
||||
&& ( mvOccupied->Vel < EU07_AI_NOMOVEMENT )
|
||||
&& ( chargelevel < std::numeric_limits<double>::max() ) };
|
||||
if( chargeable && ( chargelevel < brake_charge::empty_level ) ) {
|
||||
bBrakeChargeStart = true;
|
||||
}
|
||||
if( chargeable && bBrakeChargeStart ) {
|
||||
if( ( VelDesired <= 0.0 ) || ( AccDesired <= EU07_AI_NOACCELERATION ) ) {
|
||||
// to stand: the next start is checked anew
|
||||
BrakeCharge.going = false;
|
||||
}
|
||||
auto const trainbrakeapplied {
|
||||
AIControllFlag ?
|
||||
BrakeCtrlPosition > 0.0 :
|
||||
// a human driver's handle, which BrakeCtrlPosition doesn't follow
|
||||
mvOccupied->fBrakeCtrlPos > mvOccupied->Handle->GetPos( bh_RP ) + 0.2 };
|
||||
auto const reference {
|
||||
brake_charge::reference( mvOccupied->PipePress, std::min( mvOccupied->Handle->GetRP(), 5.0 ), trainbrakeapplied ) };
|
||||
// air to charge with: the engine prepared, the main reservoir above what the pipe charges to, and the driver's
|
||||
// brake valve feeding the pipe at the head of the train. a train still being prepared from cold can't charge,
|
||||
// nor one whose pipe is locked (unlocked by control_releaser()): it waits without that counting as a stall, held
|
||||
// by its brakes as it can't release them either
|
||||
auto const supplied {
|
||||
iEngineActive
|
||||
&& ( std::max( mvControlling->Compressor, mvOccupied->Compressor ) > reference )
|
||||
&& ( mvOccupied->PipePress >= reference - brake_charge::margin ) };
|
||||
auto const wasstalled { BrakeCharge.stalled };
|
||||
IsConsistCharged = brake_charge::charged( BrakeCharge, chargelevel, reference, ElapsedTime, supplied );
|
||||
if( BrakeCharge.stalled && ( false == wasstalled ) ) {
|
||||
WriteLog(
|
||||
"AI: " + mvOccupied->Name + " stopped charging its brakes at " + to_string( chargelevel, 2 )
|
||||
+ " bar of " + to_string( reference, 2 ) + ", starting all the same" );
|
||||
}
|
||||
if( false == IsConsistCharged ) {
|
||||
// a human driver is told to wait as the ai does, the locomotive brake applied
|
||||
cue_action( driver_hint::waitbrakecharge );
|
||||
}
|
||||
}
|
||||
else {
|
||||
IsConsistCharged = true;
|
||||
BrakeCharge = {};
|
||||
}
|
||||
if( AIControllFlag
|
||||
&& ( false == IsConsistCharged )
|
||||
&& ( false == heldforstart ) ) {
|
||||
Ready = false;
|
||||
}
|
||||
auto const departblocked {
|
||||
AIControllFlag
|
||||
&& mvOccupied->Vel < EU07_AI_NOMOVEMENT
|
||||
@@ -6747,15 +6898,38 @@ TController::determine_consist_state() {
|
||||
|
||||
void
|
||||
TController::control_wheelslip() {
|
||||
// a start that has slipped once keeps the sand on until the train is under way. with the sand off as soon as the
|
||||
// wheels grip again, the next notch slips again, and a heavy train on poor rails slips, grips and snatches over
|
||||
// and over, and may never get going (#187). a vehicle without sand starts as before
|
||||
auto const velocity { std::abs( mvOccupied->Vel ) };
|
||||
if( mvControlling->SlippingWheels
|
||||
&& velocity < EU07_AI_SANDEDSTARTVELOCITY
|
||||
&& false == mvControlling->IsMainCtrlNoPowerPos()
|
||||
&& mvControlling->Sand > 0.0 ) {
|
||||
bSandedStart = true;
|
||||
}
|
||||
else if( velocity >= EU07_AI_SANDEDSTARTVELOCITY
|
||||
|| ( velocity < EU07_AI_NOMOVEMENT && VelDesired == 0.0 ) ) {
|
||||
bSandedStart = false;
|
||||
}
|
||||
// wheel slip
|
||||
if( mvControlling->SlippingWheels ) {
|
||||
cue_action( driver_hint::sandingon ); // piasku!
|
||||
cue_action( driver_hint::tractiveforcedecrease );
|
||||
if( false == bSandedStart ) {
|
||||
cue_action( driver_hint::tractiveforcedecrease );
|
||||
cue_action( driver_hint::antislip );
|
||||
}
|
||||
else if( ElapsedTime - fSandedStartDecreaseTime >= 1.0 ) {
|
||||
// starting, a step down at a time, and no anti-slip brake: taking the power off at once and braking the
|
||||
// locomotive brings a heavy train that has just got moving to a stand again, and the start begins anew
|
||||
cue_action( driver_hint::tractiveforcedecrease );
|
||||
fSandedStartDecreaseTime = ElapsedTime;
|
||||
}
|
||||
cue_action( driver_hint::brakingforcedecrease );
|
||||
cue_action( driver_hint::antislip );
|
||||
++iDriverFailCount;
|
||||
}
|
||||
else if( std::fabs( mvControlling->Im ) > 0.75 * mvControlling->ImaxHi ) {
|
||||
else if( ( std::fabs( mvControlling->Im ) > 0.75 * mvControlling->ImaxHi )
|
||||
|| ( bSandedStart && false == mvControlling->IsMainCtrlNoPowerPos() ) ) {
|
||||
cue_action( driver_hint::sandingon ); // piaskujemy tory, coby się nie ślizgać
|
||||
}
|
||||
else {
|
||||
@@ -8267,8 +8441,16 @@ TController::adjust_desired_speed_for_braking_curve( double const Vel ) {
|
||||
// independent brake, which leaves the train brake handle where it is, kept braking earlier
|
||||
// and earlier the whole way in, to crawl the last tens of metres to the stop point
|
||||
auto const fillbrakea0 { bStopTargetIsPassengerStop ? 1.0 : fBrake_a0[ 0 ] };
|
||||
// once the brake is on, the room it takes to fill is behind; a vehicle running alone brakes with its
|
||||
// independent brake and leaves the train brake handle in running, so that brake counts as well
|
||||
braking_curve::approach const approach {
|
||||
Vel, VelNext, ActualProximityDist, brakingpointoffset, fAccGravity, AbsAccS, BrakeCtrlPosition > 0.0,
|
||||
Vel, VelNext, ActualProximityDist, brakingpointoffset, fAccGravity, AbsAccS,
|
||||
braking_curve::brake_acting(
|
||||
BrakeCtrlPosition,
|
||||
// IncLocalBrakeLevel() moves the independent brake handle on a vehicle without one too
|
||||
( mvOccupied->LocalBrake == TLocalBrake::PneumaticBrake || mvOccupied->LocalBrake == TLocalBrake::HydraulicBrake ) ?
|
||||
mvOccupied->LocalBrakePosA :
|
||||
0.0 ),
|
||||
brake_response_horizon( mvOccupied, BrakeSystem, AbsAccS, fBrake_a0[ 0 ] ),
|
||||
brake_response_horizon( mvOccupied, BrakeSystem, 1.0, fillbrakea0 ) };
|
||||
auto const deceleration { braking_curve::demand( approach, BrakeSystem == TBrakeSystem::Pneumatic ? &braketable : nullptr ) };
|
||||
@@ -8578,6 +8760,8 @@ TController::adjust_desired_speed_for_braking_test() {
|
||||
|
||||
// if( false == Global.DynamicBrakeTest ) { return; }
|
||||
if( DynamicBrakeTest >= 5 ) { return; } // all done
|
||||
if( ( DynamicBrakeTest == 0 )
|
||||
&& ( false == timetable::makes_brake_test( TrainParams.run_flags() ) ) ) { return; } // the timetable says there's none (eu07/maszyna#95)
|
||||
if( false == is_train() ) { return; } // not applicable
|
||||
if( mvOccupied->BrakeHandle == TBrakeHandle::FVel6 ) { return; } // leads to bugs in DecBrake, disable for now
|
||||
if( false == TestFlag( OrderCurrentGet(), Obey_train ) ) { return; } // not applicable
|
||||
@@ -8711,9 +8895,24 @@ TController::control_tractive_and_braking_force() {
|
||||
#endif
|
||||
}
|
||||
|
||||
// the switch of the field shunting of a diesel-electric that has one (AutoRelay=Optional with FieldShuntSwitch=Yes): off,
|
||||
// the field stays full. checked while running too, since a vehicle taken over with its engine running doesn't go through
|
||||
// PrepareEngine(). a diesel-electric with AutoRelay=Optional alone is left as before, shunting by hand with the switch off
|
||||
void TController::control_field_shunting() {
|
||||
|
||||
if( AIControllFlag
|
||||
&& mvControlling->EngineType == TEngineType::DieselElectric
|
||||
&& fieldshunting::has_switch( mvControlling->AutoRelayType, mvControlling->FieldShuntSwitch )
|
||||
&& false == mvControlling->AutoRelayFlag ) {
|
||||
mvControlling->AutoRelaySwitch( true );
|
||||
}
|
||||
}
|
||||
|
||||
// ensure relays are active
|
||||
void TController::control_relays() {
|
||||
|
||||
control_field_shunting();
|
||||
|
||||
if( fActionTime < 0.0 ) { return; }
|
||||
|
||||
if( IsAnyMotorOverloadRelayOpen ) {
|
||||
@@ -8817,7 +9016,8 @@ void TController::control_uphill_start() {
|
||||
&& ( fConsistVelocity > -0.5 )
|
||||
&& ( AccDesired > EU07_AI_NOACCELERATION )
|
||||
&& ( VelDesired > 0.0 )
|
||||
&& ( BrakeCtrlPosition > 0.0 ) ) { // only with the train brake still applied to hold the train
|
||||
&& ( BrakeCtrlPosition > 0.0 ) // only with the train brake still applied to hold the train
|
||||
&& ( IsConsistCharged ) ) { // and charged to what the pipe has, or the brake that holds the train has no air
|
||||
bUphillStart = true;
|
||||
bUphillRelease = false;
|
||||
UphillTopUp = {};
|
||||
@@ -8911,6 +9111,55 @@ void TController::end_uphill_start() {
|
||||
bUphillBrakeTopUp = false;
|
||||
}
|
||||
|
||||
// standing, a train is prepared as a driver does it: the locomotive brake first, then the brake pipe is filled. the pipe
|
||||
// filled at once releases the distributors while the auxiliary reservoirs are still empty: the train has no brake left,
|
||||
// and on a gradient rolls away as it releases. where the locomotive brake alone doesn't hold the train, the train brake
|
||||
// is applied lightly, so the reservoirs charge with the train held. the locomotive brake comes off only once the train
|
||||
// is charged and to start (DecBrake())
|
||||
void TController::secure_standing_train() {
|
||||
|
||||
if( BrakeSystem != TBrakeSystem::Pneumatic ) {
|
||||
// the electro-pneumatic brake of a multiple unit is released as before: nothing there takes the locomotive
|
||||
// brake off again when the unit starts
|
||||
cue_action( driver_hint::trainbrakerelease );
|
||||
return;
|
||||
}
|
||||
// the first start of a train that hasn't run yet waits for the brakes to charge. one that has run, prepared again
|
||||
// (a change of direction, an engine started anew), has its reservoirs charged from the run and starts as before
|
||||
if( false == bHasRun ) {
|
||||
bBrakeChargeStart = true;
|
||||
}
|
||||
if( mvOccupied->LocalBrake != TLocalBrake::ManualBrake ) {
|
||||
cue_action( driver_hint::independentbrakeapply );
|
||||
}
|
||||
if( false == brake_charge::locomotive_brake_holds( locomotive_brake_force(), fMass * fAccGravity ) ) {
|
||||
// the first service position: the pipe and the reservoirs charge to a little below the working pressure, the
|
||||
// distributors keep a light application. a stronger application already there is left as it is, but not
|
||||
// the emergency one or an empty pipe's, which don't charge
|
||||
if( AIControllFlag
|
||||
&& ( ( BrakeCtrlPosition < 1.0 ) || ( BrakeCtrlPosition > uphill_start::top_up_position ) ) ) {
|
||||
BrakeLevelSet( 1.0 );
|
||||
}
|
||||
bBrakeChargeHold = true;
|
||||
return;
|
||||
}
|
||||
bBrakeChargeHold = false;
|
||||
cue_action( driver_hint::trainbrakerelease );
|
||||
}
|
||||
|
||||
// the brake force of the locomotive brake at full application [N]. of the occupied vehicle alone: its handle acts on
|
||||
// no other, not on a second section or a locomotive in multiple control either, let alone one hauled dead
|
||||
double TController::locomotive_brake_force() const {
|
||||
|
||||
if( ( mvOccupied->LocalBrake == TLocalBrake::ManualBrake )
|
||||
|| ( mvOccupied->MaxBrakePress[ 0 ] <= 0.0 ) ) {
|
||||
return 0.0;
|
||||
}
|
||||
return brake_charge::locomotive_brake_force(
|
||||
mvOccupied->BrakeForceP( mvOccupied->MaxBrakePress[ 0 ], 0.0 ),
|
||||
mvOccupied->TotalMassxg );
|
||||
}
|
||||
|
||||
void TController::increase_tractive_force() {
|
||||
|
||||
if( fActionTime < 0.0 ) { return; } // gdy jest nakaz poczekać z jazdą, to nie ruszać
|
||||
@@ -9073,7 +9322,14 @@ void TController::control_braking_force() {
|
||||
}
|
||||
if ( (accdesiredresultant < fAccGravity - 0.05
|
||||
|| AccDesired >= EU07_AI_NOACCELERATION) // no braking asked for, yet the train is slowing down more than that
|
||||
&& accdesiredresultant - fBrake_a1[0] * 0.51 - AbsAccS > 0.05 && OrderCurrentGet() != Disconnect && VelDesired > 0.0 ) {
|
||||
&& accdesiredresultant - fBrake_a1[0] * 0.51 - AbsAccS > 0.05 && OrderCurrentGet() != Disconnect && VelDesired > 0.0
|
||||
// a human driver standing with the train not charged yet keeps the locomotive brake on, told so by the
|
||||
// waitbrakecharge hint; the ai is held back in DecBrake()
|
||||
&& ( AIControllFlag
|
||||
|| ( false == brake_charge::release_waits(
|
||||
IsConsistCharged,
|
||||
mvOccupied->Vel < EU07_AI_NOMOVEMENT,
|
||||
mvOccupied->fBrakeCtrlPos > mvOccupied->Handle->GetPos( bh_RP ) + 0.2 ) ) ) ) { // the human driver's handle
|
||||
// jak hamuje, to nie tykaj kranu za często
|
||||
// yB: luzuje hamulec dopiero przy różnicy opóźnień rzędu 0.2
|
||||
// przy odłączaniu nie zwalniamy tu hamulca
|
||||
@@ -9146,39 +9402,34 @@ void TController::control_releaser() {
|
||||
|
||||
if( false == hasreleaser ) { return; }
|
||||
|
||||
auto actuate { false };
|
||||
brake_releaser::conditions state;
|
||||
state.acceleration_desired = AccDesired;
|
||||
state.pipe_pressure = mvOccupied->PipePress;
|
||||
state.cylinder_pressure = mvOccupied->BrakePress;
|
||||
state.control_pressure = mvOccupied->Hamulec->GetCRP();
|
||||
state.velocity = mvOccupied->Vel;
|
||||
state.uphill_start = bUphillStart;
|
||||
state.pressing = TestFlag( iDrivigFlags, movePress );
|
||||
// stage 3 of uncoupling (UpdateDisconnect), from the direction change until the coupler lets go
|
||||
state.compressing_buffers =
|
||||
state.pressing && ( OrderCurrentGet() & Disconnect ) != 0 && iVehicleCount >= 0 && iDirection == iDirectionOrder;
|
||||
// a train prepared standing charges its brakes before its first start. a pipe left below the lock of the driver's
|
||||
// brake valve (a train placed cold, as after an emergency application) is unlocked as the train stands, not only
|
||||
// once it is to go: else it charges only after the order to go, and starts on what the reservoirs got by then.
|
||||
// a handle which has to be moved to unlock is left where it holds the train with the train brake
|
||||
state.charging_standing =
|
||||
bBrakeChargeStart
|
||||
&& ( mvOccupied->Vel < EU07_AI_NOMOVEMENT )
|
||||
&& ( ( mvOccupied->HandleUnlock == -3 ) || ( BrakeCtrlPosition <= 0.0 ) );
|
||||
auto const wanted { brake_releaser::decide( state ) };
|
||||
auto const actuate { wanted.actuate };
|
||||
auto isbrakehandleinrightposition { true };
|
||||
|
||||
if( AccDesired > EU07_AI_NOACCELERATION ) {
|
||||
// fill up brake pipe if needed
|
||||
if( mvOccupied->PipePress < 3.0 ) {
|
||||
actuate = true;
|
||||
// some vehicles require brake handle to be moved to specific position
|
||||
if( mvOccupied->HandleUnlock != -3 ) {
|
||||
cue_action( driver_hint::trainbrakesetpipeunlock );
|
||||
isbrakehandleinrightposition &= BrakeCtrlPosition == mvOccupied->HandleUnlock;
|
||||
}
|
||||
}
|
||||
// wyluzuj lokomotywę, to szybciej ruszymy
|
||||
// this rule is for starting off, so only below 1 km/h: at speed, just after an application, it would vent
|
||||
// the control reservoir of a locomotive that may have to brake again before the pipe has refilled it
|
||||
if( mvOccupied->BrakePress > 0.4
|
||||
&& ( mvOccupied->Hamulec->GetCRP() > 4.9
|
||||
// starting uphill the train brake stays applied on purpose, and the locomotive's own share of it has to go
|
||||
// for the power to come on (asynchronous drives and the pressure switch cut the power while it is applied)
|
||||
|| bUphillStart )
|
||||
&& mvOccupied->Vel < 1.0 ) {
|
||||
actuate = true;
|
||||
}
|
||||
// keep engine brakes released during coupling/uncoupling
|
||||
if( true == TestFlag(iDrivigFlags, movePress)
|
||||
&& mvOccupied->BrakePress > 0.1 ) {
|
||||
actuate = true;
|
||||
}
|
||||
}
|
||||
// don't overcharge train brake pipe
|
||||
if( mvOccupied->PipePress > 5.2 ) {
|
||||
actuate = false;
|
||||
// some vehicles require brake handle to be moved to specific position to fill up the brake pipe
|
||||
if( wanted.fill_pipe
|
||||
&& mvOccupied->HandleUnlock != -3 ) {
|
||||
cue_action( driver_hint::trainbrakesetpipeunlock );
|
||||
isbrakehandleinrightposition = ( BrakeCtrlPosition == mvOccupied->HandleUnlock );
|
||||
}
|
||||
|
||||
if( actuate ) {
|
||||
@@ -9199,7 +9450,9 @@ void TController::control_releaser() {
|
||||
void TController::control_main_pipe() {
|
||||
|
||||
// unlocking main pipe
|
||||
if( AccDesired > -0.03
|
||||
if( ( AccDesired > -0.03
|
||||
// standing to charge before the first start, as in control_releaser()
|
||||
|| ( bBrakeChargeStart && ( mvOccupied->Vel < EU07_AI_NOMOVEMENT ) ) )
|
||||
&& true == mvOccupied->LockPipe ) {
|
||||
UniversalBrakeButtons |= TUniversalBrake::ub_UnlockPipe;
|
||||
}
|
||||
@@ -9231,9 +9484,12 @@ void TController::control_main_pipe() {
|
||||
|
||||
update_brake_charging();
|
||||
|
||||
if( mvOccupied->Compressor < 5.0
|
||||
|| ( BrakeCtrlPosition < gbh_RP
|
||||
&& ( mvOccupied->EqvtPipePress > (fReady < 0.25 ? 5.1 : 5.2) || is_brake_charging_done() ) ) ) {
|
||||
if( ( mvOccupied->Compressor < 5.0
|
||||
|| ( BrakeCtrlPosition < gbh_RP
|
||||
&& ( mvOccupied->EqvtPipePress > (fReady < 0.25 ? 5.1 : 5.2) || is_brake_charging_done() ) ) )
|
||||
// the light application a charging train stands on stays, as in DecBrake()
|
||||
&& ( false == brake_charge::holds_application(
|
||||
bBrakeChargeHold, IsConsistCharged, mvOccupied->Vel < EU07_AI_NOMOVEMENT, BrakeCtrlPosition ) ) ) {
|
||||
cue_action( driver_hint::trainbrakerelease );
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user