16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 12:49:18 +02:00

Merge branch 'tmj-dev' into milek-dev

This commit is contained in:
milek7
2019-04-05 19:26:42 +02:00
21 changed files with 576 additions and 198 deletions

View File

@@ -892,6 +892,7 @@ public:
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*/
std::shared_ptr<TBrake> Hamulec;
@@ -1131,6 +1132,7 @@ public:
double AccN = 0.0; // przyspieszenie normalne w [m/s^2]
double AccVert = 0.0; // vertical acceleration
double nrot = 0.0;
double nrot_eps = 0.0; //przyspieszenie kątowe kół (bez kierunku)
double WheelFlat = 0.0;
bool TruckHunting { true }; // enable/disable truck hunting calculation
/*! rotacja kol [obr/s]*/
@@ -1306,6 +1308,7 @@ public:
/*- zmienne dla lokomotyw z silnikami indukcyjnymi -*/
double eimic = 0; /*aktualna pozycja zintegrowanego sterowania jazda i hamowaniem*/
double eimic_real = 0; /*faktycznie uzywana pozycja zintegrowanego sterowania jazda i hamowaniem*/
double eim_localbrake = 0; /*nastawa hamowania dodatkowego pneumatycznego lokomotywy*/
int EIMCtrlType = 0; /*rodzaj wariantu zadajnika jazdy*/
bool SpeedCtrlTypeTime = false; /*czy tempomat sterowany czasowo*/
double eimv_pr = 0; /*realizowany procent dostepnej sily rozruchu/hamowania*/
@@ -1352,6 +1355,7 @@ public:
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
bool PhysicActivation = true;
@@ -1498,6 +1502,7 @@ public:
/*-funkcje typowe dla lokomotywy elektrycznej*/
void ConverterCheck( double const Timestep ); // przetwornica
void HeatingCheck( double const Timestep );
void WaterPumpCheck( double const Timestep );
void WaterHeaterCheck( double const Timestep );
void FuelPumpCheck( double const Timestep );

View File

@@ -502,7 +502,7 @@ bool TMoverParameters::Dettach(int ConnectNo)
bool TMoverParameters::DirectionForward()
{
if ((MainCtrlPosNo > 0) && (ActiveDir < 1) && (MainCtrlPos <= MaxMainCtrlPosNoDirChange) && (EIMDirectionChangeAllow()))
if ((MainCtrlPosNo > 0) && (ActiveDir < 1) && (EIMDirectionChangeAllow()))
{
++ActiveDir;
DirAbsolute = ActiveDir * CabNo;
@@ -1075,11 +1075,13 @@ double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShap
for( int side = 0; side < 2; ++side ) {
// przekazywanie napiec
auto const oppositeside = ( side == end::front ? end::rear : end::front );
auto const oppositeside { ( side == end::front ? end::rear : end::front ) };
auto const liveconnection{
( Couplers[ side ].CouplingFlag & ctrain_power )
|| ( ( Couplers[ side ].CouplingFlag & ctrain_heating )
&& ( Couplers[ side ].Connected->Heating ) ) };
if( ( Couplers[ side ].CouplingFlag & ctrain_power )
|| ( ( Heating )
&& ( Couplers[ side ].CouplingFlag & ctrain_heating ) ) ) {
if( liveconnection ) {
auto const &connectedcoupler = Couplers[ side ].Connected->Couplers[ Couplers[ side ].ConnectedNr ];
Couplers[ oppositeside ].power_high.voltage =
std::max(
@@ -1103,8 +1105,8 @@ double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShap
Couplers[ side ].power_high.local = false; // power, if any, will be from external source
if( ( Couplers[ side ].CouplingFlag & ctrain_power )
|| ( ( Heating )
&& ( Couplers[ side ].CouplingFlag & ctrain_heating ) ) ) {
|| ( ( Couplers[ side ].CouplingFlag & ctrain_heating )
&& ( Couplers[ side ].Connected->Heating ) ) ) {
auto const &connectedcoupler =
Couplers[ side ].Connected->Couplers[
( Couplers[ side ].ConnectedNr == end::front ?
@@ -1127,8 +1129,8 @@ double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShap
Couplers[ side ].power_high.local = true; // power is coming from local pantographs
if( ( Couplers[ side ].CouplingFlag & ctrain_power )
|| ( ( Heating )
&& ( Couplers[ side ].CouplingFlag & ctrain_heating ) ) ) {
|| ( ( Couplers[ side ].CouplingFlag & ctrain_heating )
&& ( Couplers[ side ].Connected->Heating ) ) ) {
auto const &connectedcoupler =
Couplers[ side ].Connected->Couplers[
( Couplers[ side ].ConnectedNr == end::front ?
@@ -1409,6 +1411,8 @@ void TMoverParameters::compute_movement_( double const Deltatime ) {
// w rozrządczym nie (jest błąd w FIZ!) - Ra 2014-07: teraz we wszystkich
UpdatePantVolume( Deltatime ); // Ra 2014-07: obsługa zbiornika rozrządu oraz pantografów
}
// heating
HeatingCheck( Deltatime );
UpdateBrakePressure(Deltatime);
UpdatePipePressure(Deltatime);
@@ -1462,7 +1466,8 @@ void TMoverParameters::ConverterCheck( double const Timestep ) {
if( ( ConverterAllow )
&& ( ConverterAllowLocal )
&& ( false == PantPressLockActive )
&& ( Mains ) ) {
&& ( ( Mains )
|| ( GetTrainsetVoltage() > 0 ) ) ) {
// delay timer can be optionally configured, and is set anew whenever converter goes off
if( ConverterStartDelayTimer <= 0.0 ) {
ConverterFlag = true;
@@ -1477,6 +1482,17 @@ void TMoverParameters::ConverterCheck( double const Timestep ) {
}
};
// heating system status check
void TMoverParameters::HeatingCheck( double const Timestep ) {
Heating = (
( true == HeatingAllow )
// powered vehicles are generally required to activate their power source to provide heating
// passive vehicles get a pass in this regard
&& ( ( Power < 0.1 )
|| ( true == Mains ) ) );
}
// water pump status check
void TMoverParameters::WaterPumpCheck( double const Timestep ) {
// NOTE: breaker override with start type is sm42 specific hack, replace with ability to define the presence of the breaker
@@ -2355,7 +2371,7 @@ bool TMoverParameters::DirectionBackward(void)
DB = true; //
return DB; // exit; TODO: czy dobrze przetlumaczone?
}
if ((MainCtrlPosNo > 0) && (ActiveDir > -1) && (MainCtrlPos <= MaxMainCtrlPosNoDirChange) && (EIMDirectionChangeAllow()))
if ((MainCtrlPosNo > 0) && (ActiveDir > -1) && (EIMDirectionChangeAllow()))
{
if (EngineType == TEngineType::WheelsDriven)
CabNo--;
@@ -2376,7 +2392,11 @@ bool TMoverParameters::DirectionBackward(void)
bool TMoverParameters::EIMDirectionChangeAllow(void)
{
bool OK = false;
/*
// NOTE: disabled while eimic variables aren't immediately synced with master controller changes inside ai module
OK = (EngineType != TEngineType::ElectricInductionMotor || ((eimic <= 0) && (eimic_real <= 0) && (Vel < 0.1)));
*/
OK = ( MainCtrlPos <= MaxMainCtrlPosNoDirChange );
return OK;
}
@@ -3714,7 +3734,7 @@ void TMoverParameters::UpdatePipePressure(double dt)
Pipe->Flow( temp * Hamulec->GetPF( temp * PipePress, dt, Vel ) + GetDVc( dt ) );
if (ASBType == 128)
Hamulec->ASB(int(SlippingWheels));
Hamulec->ASB(int(SlippingWheels && (Vel>1))*(1+2*int(nrot_eps<-0.01)));
dpPipe = 0;
@@ -3962,6 +3982,7 @@ void TMoverParameters::ComputeTotalForce(double dt) {
// juz zoptymalizowane:
FStand = FrictionForce(RunningShape.R, RunningTrack.DamageFlag); // siła oporów ruchu
double old_nrot = abs(nrot);
nrot = v2n(); // przeliczenie prędkości liniowej na obrotową
if( ( true == TestFlag( BrakeMethod, bp_MHS ) )
@@ -4034,8 +4055,9 @@ void TMoverParameters::ComputeTotalForce(double dt) {
}
else
{
Fb = -Fwheels*Sign(V);
FTrain = 0;
double factor = (FTrain - Fb * Sign(V) != 0 ? Fwheels/(FTrain - Fb * Sign(V)) : 1.0);
Fb *= factor;
FTrain *= factor;
}
if (nrot < 0.1)
{
@@ -4044,6 +4066,7 @@ void TMoverParameters::ComputeTotalForce(double dt) {
nrot = temp_nrot;
}
nrot_eps = (abs(nrot) - (old_nrot))/dt;
// doliczenie sił z innych pojazdów
for( int end = end::front; end <= end::rear; ++end ) {
if( Neighbours[ end ].vehicle != nullptr ) {
@@ -4336,6 +4359,7 @@ double TMoverParameters::CouplerForce( int const End, double dt ) {
// zderzenie
coupler.CheckCollision = true;
if( ( coupler.CouplerType == TCouplerType::Automatic )
&& ( coupler.CouplerType == othercoupler.CouplerType )
&& ( coupler.CouplingFlag == coupling::faux ) ) {
// sprzeganie wagonow z samoczynnymi sprzegami
// EN57
@@ -6018,6 +6042,26 @@ void TMoverParameters::CheckEIMIC(double dt)
}
if (MainCtrlPos >= 3 && eimic < 0) eimic = 0;
if (MainCtrlPos <= 3 && eimic > 0) eimic = 0;
if (LocHandleTimeTraxx)
{
if (LocalBrakeRatio() < 0.05) //pozycja 0
{
eim_localbrake -= dt*0.17; //zmniejszanie
}
if (LocalBrakeRatio() > 0.15) //pozycja 2
{
eim_localbrake += dt*0.17; //wzrastanie
eim_localbrake = std::max(eim_localbrake, BrakePress / MaxBrakePress[0]);
}
else
{
if (eim_localbrake < Hamulec->GetEDBCP() / MaxBrakePress[0])
eim_localbrake = 0;
}
eim_localbrake = clamp(eim_localbrake, 0.0, 1.0);
if (eim_localbrake > 0.04 && eimic > 0) eimic = 0;
}
break;
case 2:
switch (MainCtrlPos)
@@ -7261,14 +7305,14 @@ double TMoverParameters::GetTrainsetVoltage(void)
return std::max(
( ( ( Couplers[end::front].Connected )
&& ( ( Couplers[ end::front ].CouplingFlag & ctrain_power )
|| ( ( Heating )
&& ( Couplers[ end::front ].CouplingFlag & ctrain_heating ) ) ) ) ?
|| ( ( Couplers[ end::front ].CouplingFlag & ctrain_heating )
&& ( Couplers[ end::front ].Connected->Heating ) ) ) ) ?
Couplers[end::front].Connected->Couplers[ Couplers[end::front].ConnectedNr ].power_high.voltage :
0.0 ),
( ( ( Couplers[end::rear].Connected )
&& ( ( Couplers[ end::rear ].CouplingFlag & ctrain_power )
|| ( ( Heating )
&& ( Couplers[ end::rear ].CouplingFlag & ctrain_heating ) ) ) ) ?
|| ( ( Couplers[ end::rear ].CouplingFlag & ctrain_heating )
&& ( Couplers[ end::rear ].Connected->Heating ) ) ) ) ?
Couplers[ end::rear ].Connected->Couplers[ Couplers[ end::rear ].ConnectedNr ].power_high.voltage :
0.0 ) );
}
@@ -8638,6 +8682,7 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
extract_value( CoupledCtrl, "CoupledCtrl", line, "" );
extract_value( EIMCtrlType, "EIMCtrlType", line, "" );
clamp( EIMCtrlType, 0, 3 );
LocHandleTimeTraxx = (extract_value("LocalBrakeTraxx", line) == "Yes");
extract_value( ScndS, "ScndS", line, "" ); // brak pozycji rownoleglej przy niskiej nastawie PSR

View File

@@ -391,7 +391,8 @@ void TBrake::SetEPS( double const nEPS )
void TBrake::ASB( int const state )
{ // 255-b_asb(32)
BrakeStatus = (BrakeStatus & ~b_asb) | ( state * b_asb );
BrakeStatus = (BrakeStatus & ~b_asb) | ( (state / 2) * b_asb );
BrakeStatus = (BrakeStatus & ~b_asb_unbrake) | ( (state % 2) * b_asb_unbrake);
}
int TBrake::GetStatus()
@@ -1551,7 +1552,7 @@ double TEStED::GetPF( double const PP, double const dt, double const Vel )
// powtarzacz — podwojny zawor zwrotny
temp = Max0R(LoadC * BCP / temp * Min0R(Max0R(1 - EDFlag, 0), 1), LBP);
double speed = 1;
if ((ASBP < 0.1) && ((BrakeStatus & b_asb) == b_asb))
if ((ASBP < 0.1) && ((BrakeStatus & b_asb_unbrake) == b_asb_unbrake))
{
temp = 0;
speed = 3;
@@ -1559,7 +1560,7 @@ double TEStED::GetPF( double const PP, double const dt, double const Vel )
if ((BrakeCyl->P() > temp))
dv = -PFVd(BrakeCyl->P(), 0, 0.02 * SizeBC * speed, temp) * dt;
else if ((BrakeCyl->P() < temp))
else if ((BrakeCyl->P() < temp) && ((BrakeStatus & b_asb) == 0))
dv = PFVa(BVP, BrakeCyl->P(), 0.02 * SizeBC, temp) * dt;
else
dv = 0;

View File

@@ -53,7 +53,8 @@ static int const b_on = 2; //napelnianie
static int const b_rfl = 4; //uzupelnianie
static int const b_rls = 8; //odluzniacz
static int const b_ep = 16; //elektropneumatyczny
static int const b_asb = 32; //elektropneumatyczny
static int const b_asb = 32; //przeciwposlizg-wstrzymanie
static int const b_asb_unbrake = 64; //przeciwposlizg-luzowanie
static int const b_dmg = 128; //wylaczony z dzialania
/*uszkodzenia hamulca*/