16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-19 03:09:18 +02:00

build 171028: post-merge fixes, ai shunt mode driving tweaks

This commit is contained in:
tmj-fstate
2017-10-29 14:56:41 +01:00
parent 5e09a6b90d
commit 2fece17ca0
6 changed files with 35 additions and 34 deletions

View File

@@ -4323,11 +4323,11 @@ TController::UpdateSituation(double dt) {
vehicle->fTrackBlock );
double k = coupler->Connected->Vel; // prędkość pojazdu z przodu (zakładając,
// że jedzie w tę samą stronę!!!)
if( k < vel + 10 ) {
if( k - vel < 10 ) {
// porównanie modułów prędkości [km/h]
// zatroszczyć się trzeba, jeśli tamten nie jedzie znacząco szybciej
double const distance = vehicle->fTrackBlock - fMaxProximityDist - ( fBrakeDist * 1.15 ); // odległość bezpieczna zależy od prędkości
if( distance < 0 ) {
if( distance < 0.0 ) {
// jeśli odległość jest zbyt mała
if( k < 10.0 ) // k - prędkość tego z przodu
{ // jeśli tamten porusza się z niewielką prędkością albo stoi
@@ -4533,10 +4533,19 @@ TController::UpdateSituation(double dt) {
*/
if( VelNext == 0.0 ) {
if( mvOccupied->CategoryFlag & 1 ) {
// hamowanie tak, aby stanąć
VelDesired = VelNext;
AccDesired = ( VelNext * VelNext - vel * vel ) / ( 25.92 * ( ActualProximityDist + 0.1 - 0.5*fMinProximityDist ) );
AccDesired = std::min( AccDesired, fAccThreshold );
// trains
if( ( OrderCurrentGet() & Shunt )
&& ( pVehicles[0]->fTrackBlock < 50.0 ) ) {
// crude detection of edge case, if approaching another vehicle coast slowly until min distance
// this should allow to bunch up trainsets more on sidings
VelDesired = Global::Min0RSpeed( VelDesired, 5.0 );
}
else {
// hamowanie tak, aby stanąć
VelDesired = VelNext;
AccDesired = ( VelNext * VelNext - vel * vel ) / ( 25.92 * ( ActualProximityDist + 0.1 - 0.5*fMinProximityDist ) );
AccDesired = std::min( AccDesired, fAccThreshold );
}
}
else {
// for cars (and others) coast at low speed until we hit min proximity range

View File

@@ -1461,7 +1461,7 @@ void TDynamicObject::ABuScanObjects( int Direction, double Distance )
if( distance < 100.0 ) {
// at short distances start to calculate range between couplers directly
// odległość do najbliższego pojazdu w linii prostej
fTrackBlock = std::min( fTrackBlock, MoverParameters->Couplers[ mycoupler ].CoupleDist );
fTrackBlock = MoverParameters->Couplers[ mycoupler ].CoupleDist;
}
if( ( false == TestFlag( track->iCategoryFlag, 1 ) )
&& ( distance > 50.0 ) ) {
@@ -2605,14 +2605,14 @@ bool TDynamicObject::Update(double dt, double dt1)
// if (Global::bLiveTraction)
{ // Ra 2013-12: to niżej jest chyba trochę bez sensu
double v = MoverParameters->PantRearVolt;
if (v == 0.0)
{
if (v == 0.0) {
v = MoverParameters->PantFrontVolt;
if (v == 0.0)
if ((MoverParameters->TrainType & (dt_EZT | dt_ET40 | dt_ET41 | dt_ET42)) &&
MoverParameters->EngineType !=
ElectricInductionMotor) // dwuczłony mogą mieć sprzęg WN
if( v == 0.0 ) {
if( MoverParameters->TrainType & ( dt_EZT | dt_ET40 | dt_ET41 | dt_ET42 ) ) {
// dwuczłony mogą mieć sprzęg WN
v = MoverParameters->GetTrainsetVoltage(); // ostatnia szansa
}
}
}
if (v != 0.0)
{ // jeśli jest zasilanie
@@ -2627,21 +2627,21 @@ bool TDynamicObject::Update(double dt, double dt1)
if( MoverParameters->Vel > 0.5 ) {
// jeśli jedzie
// Ra 2014-07: doraźna blokada logowania zimnych lokomotyw - zrobić to trzeba inaczej
if( MoverParameters->PantFrontUp || MoverParameters->PantRearUp )
// if (NoVoltTime>0.02) //tu można ograniczyć czas rozłączenia
// if (DebugModeFlag) //logowanie nie zawsze
if( MoverParameters->PantFrontUp
|| MoverParameters->PantRearUp ) {
if( ( MoverParameters->Mains )
&& ( ( MoverParameters->EngineType != ElectricInductionMotor )
|| ( MoverParameters->GetTrainsetVoltage() < 0.1f ) ) ) {
// Ra 15-01: logować tylko, jeśli WS załączony
// yB 16-03: i nie jest to asynchron zasilany z daleka
// Ra 15-01: bezwzględne współrzędne pantografu nie są dostępne,
// więc lepiej się tego nie zaloguje
&& ( MoverParameters->GetTrainsetVoltage() < 0.1f ) ) {
// Ra 15-01: logować tylko, jeśli WS załączony
// yB 16-03: i nie jest to asynchron zasilany z daleka
// Ra 15-01: bezwzględne współrzędne pantografu nie są dostępne,
// więc lepiej się tego nie zaloguje
ErrorLog(
"Bad traction: " + MoverParameters->Name
"Bad traction: " + MoverParameters->Name
+ " lost power for " + to_string( NoVoltTime, 2 ) + " sec. at "
+ to_string( glm::dvec3{ vPosition } ) );
}
}
}
// Ra 2F1H: nie było sensu wpisywać tu zera po upływie czasu, bo zmienna była
// tymczasowa, a napięcie zerowane od razu

View File

@@ -4698,14 +4698,6 @@ double TMoverParameters::TractionForce(double dt)
dmoment = eimv[eimv_Fful];
// NOTE: the commands to operate the sandbox are likely to conflict with other similar ai decisions
// TODO: gather these in single place so they can be resolved together
if( ( std::abs( ( PosRatio + 9.66 * dizel_fill ) * dmoment * 100 ) > 0.95 * Adhesive( RunningTrack.friction ) * TotalMassxg ) ) {
PosRatio = 0;
tmp = 4;
} // przeciwposlizg
if( ( std::abs( ( PosRatio + 9.80 * dizel_fill ) * dmoment * 100 ) > 0.95 * Adhesive( RunningTrack.friction ) * TotalMassxg ) ) {
PosRatio = 0;
tmp = 9;
} // przeciwposlizg
if( ( SlippingWheels ) ) {
PosRatio = 0;
tmp = 9;

View File

@@ -57,7 +57,7 @@ protected:
public:
// data access
typename type_sequence &
type_sequence &
sequence() {
return m_items; }

View File

@@ -47,7 +47,7 @@ struct scratch_data {
float offset { 0.f };
float velocity { 0.f };
std::vector<TDynamicObject *> vehicles;
std::vector<std::int8_t> couplings;
std::vector<int> couplings;
TDynamicObject * driver { nullptr };
bool is_open { false };
} trainset;

View File

@@ -1,5 +1,5 @@
#pragma once
#define VERSION_MAJOR 17
#define VERSION_MINOR 1027
#define VERSION_MINOR 1028
#define VERSION_REVISION 0