mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 17:29:18 +02:00
Merge branch 'tmj-dev' into milek-dev
This commit is contained in:
@@ -1003,13 +1003,6 @@ public:
|
||||
TRotation Rot { 0.0, 0.0, 0.0 };
|
||||
std::string Name; /*nazwa wlasna*/
|
||||
TCoupling Couplers[2]; //urzadzenia zderzno-sprzegowe, polaczenia miedzy wagonami
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
double HVCouplers[ 2 ][ 2 ]; //przewod WN
|
||||
enum hvcoupler {
|
||||
current = 0,
|
||||
voltage
|
||||
};
|
||||
#endif
|
||||
bool EventFlag = false; /*!o true jesli cos nietypowego sie wydarzy*/
|
||||
int SoundFlag = 0; /*!o patrz stale sound_ */
|
||||
double DistCounter = 0.0; /*! licznik kilometrow */
|
||||
|
||||
@@ -316,12 +316,6 @@ ActiveCab( Cab )
|
||||
Couplers[b].DmaxC = 0.1;
|
||||
Couplers[b].FmaxC = 1000.0;
|
||||
}
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
for( int side = 0; side < 2; ++side ) {
|
||||
HVCouplers[ side ][ hvcoupler::current ] = 0.0;
|
||||
HVCouplers[ side ][ hvcoupler::voltage ] = 0.0;
|
||||
}
|
||||
#endif
|
||||
for( int b = 0; b < 3; ++b ) {
|
||||
BrakeCylMult[ b ] = 0.0;
|
||||
}
|
||||
@@ -816,13 +810,23 @@ void TMoverParameters::UpdateBatteryVoltage(double dt)
|
||||
&& ( EngineType != TEngineType::WheelsDriven )
|
||||
&& ( NominalBatteryVoltage > 0 ) ) {
|
||||
|
||||
// HACK: allow to draw power also from adjacent converter, applicable for EMUs
|
||||
// TODO: expand power cables system to include low voltage power transfers
|
||||
// HACK: emulate low voltage generator powered directly by the diesel engine
|
||||
auto const converteractive{ (
|
||||
( ConverterFlag )
|
||||
|| ( ( ( Couplers[ side::front ].CouplingFlag & coupling::permanent ) != 0 ) && Couplers[ side::front ].Connected->ConverterFlag )
|
||||
|| ( ( ( Couplers[ side::rear ].CouplingFlag & coupling::permanent ) != 0 ) && Couplers[ side::rear ].Connected->ConverterFlag ) )
|
||||
|| ( ( EngineType == TEngineType::DieselElectric ) && ( true == Mains ) )
|
||||
|| ( ( EngineType == TEngineType::DieselEngine ) && ( true == Mains ) ) };
|
||||
|
||||
if ((NominalBatteryVoltage / BatteryVoltage < 1.22) && Battery)
|
||||
{ // 110V
|
||||
if (!ConverterFlag)
|
||||
if (!converteractive)
|
||||
sn1 = (dt * 2.0); // szybki spadek do ok 90V
|
||||
else
|
||||
sn1 = 0;
|
||||
if (ConverterFlag)
|
||||
if (converteractive)
|
||||
sn2 = -(dt * 2.0); // szybki wzrost do 110V
|
||||
else
|
||||
sn2 = 0;
|
||||
@@ -846,7 +850,7 @@ void TMoverParameters::UpdateBatteryVoltage(double dt)
|
||||
sn1 = (dt * 0.0046);
|
||||
else
|
||||
sn1 = 0;
|
||||
if (ConverterFlag)
|
||||
if (converteractive)
|
||||
sn2 = -(dt * 50); // szybki wzrost do 110V
|
||||
else
|
||||
sn2 = 0;
|
||||
@@ -1120,33 +1124,18 @@ double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShap
|
||||
if( ( Couplers[ side ].CouplingFlag & ctrain_power )
|
||||
|| ( ( Heating )
|
||||
&& ( Couplers[ side ].CouplingFlag & ctrain_heating ) ) ) {
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
HVCouplers[ oppositeside ][ hvcoupler::voltage ] =
|
||||
std::max(
|
||||
std::abs( hvc ),
|
||||
Couplers[ side ].Connected->HVCouplers[ Couplers[ side ].ConnectedNr ][ hvcoupler::voltage ] - HVCouplers[ side ][ hvcoupler::current ] * 0.02 );
|
||||
#else
|
||||
auto const &connectedcoupler = Couplers[ side ].Connected->Couplers[ Couplers[ side ].ConnectedNr ];
|
||||
Couplers[ oppositeside ].power_high.voltage =
|
||||
std::max(
|
||||
std::abs( hvc ),
|
||||
connectedcoupler.power_high.voltage - Couplers[ side ].power_high.current * 0.02 );
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
HVCouplers[ oppositeside ][ hvcoupler::voltage ] = std::abs( hvc ) - HVCouplers[ side ][ hvcoupler::current ] * 0.02;
|
||||
#else
|
||||
Couplers[ oppositeside ].power_high.voltage = std::abs( hvc ) - Couplers[ side ].power_high.current * 0.02;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
hvc = HVCouplers[ side::front ][ hvcoupler::voltage ] + HVCouplers[ side::rear ][ hvcoupler::voltage ];
|
||||
#else
|
||||
hvc = Couplers[ side::front ].power_high.voltage + Couplers[ side::rear ].power_high.voltage;
|
||||
#endif
|
||||
|
||||
if( std::abs( PantFrontVolt ) + std::abs( PantRearVolt ) < 1.0 ) {
|
||||
// bez napiecia...
|
||||
@@ -1160,29 +1149,17 @@ double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShap
|
||||
if( ( Couplers[ side ].CouplingFlag & ctrain_power )
|
||||
|| ( ( Heating )
|
||||
&& ( Couplers[ side ].CouplingFlag & ctrain_heating ) ) ) {
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
auto const oppositeside = ( Couplers[side].ConnectedNr == side::front ? side::rear : side::front );
|
||||
HVCouplers[ side ][ hvcoupler::current ] =
|
||||
Couplers[side].Connected->HVCouplers[oppositeside][hvcoupler::current] +
|
||||
Itot * HVCouplers[side][hvcoupler::voltage] / hvc; // obciążenie rozkladane stosownie do napiec
|
||||
#else
|
||||
auto const &connectedsothercoupler =
|
||||
auto const &connectedcoupler =
|
||||
Couplers[ side ].Connected->Couplers[
|
||||
( Couplers[ side ].ConnectedNr == side::front ?
|
||||
side::rear :
|
||||
side::front ) ];
|
||||
Couplers[ side ].power_high.current =
|
||||
connectedsothercoupler.power_high.current
|
||||
connectedcoupler.power_high.current
|
||||
+ Itot * Couplers[ side ].power_high.voltage / hvc; // obciążenie rozkladane stosownie do napiec
|
||||
#endif
|
||||
}
|
||||
else {
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
// pierwszy pojazd
|
||||
HVCouplers[side][hvcoupler::current] = Itot * HVCouplers[side][hvcoupler::voltage] / hvc;
|
||||
#else
|
||||
Couplers[ side ].power_high.current = Itot * Couplers[ side ].power_high.voltage / hvc;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1196,19 +1173,13 @@ double TMoverParameters::ComputeMovement(double dt, double dt1, const TTrackShap
|
||||
if( ( Couplers[ side ].CouplingFlag & ctrain_power )
|
||||
|| ( ( Heating )
|
||||
&& ( Couplers[ side ].CouplingFlag & ctrain_heating ) ) ) {
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
auto const oppositeside = ( Couplers[ side ].ConnectedNr == side::front ? side::rear : side::front );
|
||||
TotalCurrent += Couplers[ side ].Connected->HVCouplers[ oppositeside ][ hvcoupler::current ];
|
||||
HVCouplers[ side ][ hvcoupler::current ] = 0.0;
|
||||
#else
|
||||
auto const &connectedsothercoupler =
|
||||
auto const &connectedcoupler =
|
||||
Couplers[ side ].Connected->Couplers[
|
||||
( Couplers[ side ].ConnectedNr == side::front ?
|
||||
side::rear :
|
||||
side::front ) ];
|
||||
TotalCurrent += connectedsothercoupler.power_high.current;
|
||||
TotalCurrent += connectedcoupler.power_high.current;
|
||||
Couplers[ side ].power_high.current = 0.0;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1561,18 +1532,18 @@ void TMoverParameters::WaterPumpCheck( double const Timestep ) {
|
||||
// water heater status check
|
||||
void TMoverParameters::WaterHeaterCheck( double const Timestep ) {
|
||||
|
||||
WaterHeater.is_damaged = (
|
||||
( true == WaterHeater.is_damaged )
|
||||
|| ( ( true == WaterHeater.is_active )
|
||||
&& ( false == WaterPump.is_active ) ) );
|
||||
|
||||
WaterHeater.is_active = (
|
||||
( false == WaterHeater.is_damaged )
|
||||
&& ( true == Battery )
|
||||
&& ( true == WaterHeater.is_enabled )
|
||||
&& ( true == WaterHeater.breaker )
|
||||
&& ( ( WaterHeater.is_active ) || ( WaterHeater.config.temp_min < 0 ) || ( dizel_heat.temperatura1 < WaterHeater.config.temp_min ) ) );
|
||||
|
||||
|
||||
WaterHeater.is_damaged = (
|
||||
( true == WaterHeater.is_damaged )
|
||||
|| ( ( true == WaterHeater.is_active )
|
||||
&& ( false == WaterPump.is_active ) ) );
|
||||
|
||||
if( ( WaterHeater.config.temp_max > 0 )
|
||||
&& ( dizel_heat.temperatura1 > WaterHeater.config.temp_max ) ) {
|
||||
WaterHeater.is_active = false;
|
||||
@@ -4017,11 +3988,9 @@ void TMoverParameters::ComputeTotalForce(double dt, double dt1, bool FullVer)
|
||||
Voltage =
|
||||
std::max(
|
||||
RunningTraction.TractionVoltage,
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
std::max( HVCouplers[side::front][hvcoupler::voltage], HVCouplers[side::rear][hvcoupler::voltage] ) );
|
||||
#else
|
||||
std::max( Couplers[ side::front ].power_high.voltage, Couplers[ side::rear ].power_high.voltage ) );
|
||||
#endif
|
||||
std::max(
|
||||
Couplers[ side::front ].power_high.voltage,
|
||||
Couplers[ side::rear ].power_high.voltage ) );
|
||||
}
|
||||
else {
|
||||
Voltage = 0;
|
||||
@@ -6708,7 +6677,7 @@ TMoverParameters::AssignLoad( std::string const &Name, float const Amount ) {
|
||||
for( auto const &loadattributes : LoadAttributes ) {
|
||||
if( Name == loadattributes.name ) {
|
||||
LoadType = loadattributes;
|
||||
LoadAmount = Amount;
|
||||
LoadAmount = clamp( Amount, 0.f, MaxLoad ) ;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
@@ -6746,7 +6715,7 @@ bool TMoverParameters::LoadingDone(double const LSpeed, std::string const &Loadn
|
||||
if( ( LoadAmount <= 0 ) || ( CommandIn.Value1 <= 0 ) ) {
|
||||
// pusto lub rozładowano żądaną ilość
|
||||
LoadStatus = 4; // skończony rozładunek
|
||||
LoadAmount = std::max( 0.f, LoadAmount ); //ładunek nie może być ujemny
|
||||
LoadAmount = clamp( LoadAmount, 0.f, MaxLoad); //ładunek nie może być ujemny
|
||||
}
|
||||
if( LoadAmount == 0.f ) {
|
||||
AssignLoad(""); // jak nic nie ma, to nie ma też nazwy
|
||||
@@ -7033,16 +7002,6 @@ std::string TMoverParameters::EngineDescription(int what) const
|
||||
// *************************************************************************************************
|
||||
double TMoverParameters::GetTrainsetVoltage(void)
|
||||
{//ABu: funkcja zwracajaca napiecie dla calego skladu, przydatna dla EZT
|
||||
#ifdef EU07_USE_OLD_HVCOUPLERS
|
||||
return std::max(
|
||||
HVCouplers[ side::front ][ hvcoupler::voltage ],
|
||||
HVCouplers[ side::rear ][ hvcoupler::voltage ] );
|
||||
#else
|
||||
/*
|
||||
return std::max(
|
||||
Couplers[ side::front ].power_high.voltage,
|
||||
Couplers[ side::rear ].power_high.voltage );
|
||||
*/
|
||||
return std::max(
|
||||
( ( ( Couplers[side::front].Connected )
|
||||
&& ( ( Couplers[ side::front ].CouplingFlag & ctrain_power )
|
||||
@@ -7056,7 +7015,6 @@ double TMoverParameters::GetTrainsetVoltage(void)
|
||||
&& ( Couplers[ side::rear ].CouplingFlag & ctrain_heating ) ) ) ) ?
|
||||
Couplers[ side::rear ].Connected->Couplers[ Couplers[ side::rear ].ConnectedNr ].power_high.voltage :
|
||||
0.0 ) );
|
||||
#endif
|
||||
}
|
||||
|
||||
// *************************************************************************************************
|
||||
|
||||
Reference in New Issue
Block a user