diff --git a/Driver.cpp b/Driver.cpp index b36230e5..3b552cc6 100644 --- a/Driver.cpp +++ b/Driver.cpp @@ -2091,7 +2091,7 @@ double TController::ESMVelocity(bool Main) 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); - double Us = abs(mvControlling->Voltage) - IF*R; + 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; return ESMVel; @@ -2511,7 +2511,7 @@ bool TController::PrepareEngine() } } - if (mvControlling->PantFrontVolt || mvControlling->PantRearVolt || voltfront || voltrear) + if ((mvControlling->PantographVoltage != 0.0) || voltfront || voltrear) { // najpierw ustalamy kierunek, jeśli nie został ustalony if( !iDirection ) { // jeśli nie ma ustalonego kierunku @@ -2519,7 +2519,7 @@ bool TController::PrepareEngine() iDirection = mvOccupied->CabNo; // wg wybranej kabiny if( !iDirection ) { // jeśli nie ma ustalonego kierunku - if( ( mvControlling->PantFrontVolt != 0.0 ) || ( mvControlling->PantRearVolt != 0.0 ) || voltfront || voltrear ) { + if( ( mvControlling->PantographVoltage != 0.0 ) || voltfront || voltrear ) { if( mvOccupied->Couplers[ end::rear ].Connected == nullptr ) { // jeśli z tyłu nie ma nic iDirection = -1; // jazda w kierunku sprzęgu 1 @@ -2533,7 +2533,7 @@ bool TController::PrepareEngine() } else { // ustalenie kierunku, gdy jedzie - if( ( mvControlling->PantFrontVolt != 0.0 ) || ( mvControlling->PantRearVolt != 0.0 ) || voltfront || voltrear ) { + if( ( mvControlling->PantographVoltage != 0.0 ) || voltfront || voltrear ) { if( mvOccupied->V < 0 ) { // jedzie do tyłu iDirection = -1; // jazda w kierunku sprzęgu 1 @@ -2562,7 +2562,7 @@ bool TController::PrepareEngine() } } if( ( mvControlling->EnginePowerSource.SourceType != TPowerSource::CurrentCollector ) - || ( std::max( mvControlling->GetTrainsetVoltage(), std::abs( mvControlling->RunningTraction.TractionVoltage ) ) > mvControlling->EnginePowerSource.CollectorParameters.MinV ) ) { + || ( std::max( mvControlling->GetTrainsetVoltage(), mvControlling->PantographVoltage ) > mvControlling->EnginePowerSource.CollectorParameters.MinV ) ) { mvControlling->MainSwitch( true ); } } @@ -3448,7 +3448,7 @@ void TController::SpeedSet() if (fAccGravity < -0.10) // i jedzie pod górę większą niż 10 promil { // procedura wjeżdżania na ekstremalne wzniesienia if (fabs(mvControlling->Im) > 0.85 * mvControlling->Imax) // a prąd jest większy niż 85% nadmiarowego - if (mvControlling->Imax * mvControlling->Voltage / (fMass * fAccGravity) < -2.8) // a na niskim się za szybko nie pojedzie + if (mvControlling->Imax * mvControlling->EngineVoltage / (fMass * fAccGravity) < -2.8) // a na niskim się za szybko nie pojedzie { // włączenie wysokiego rozruchu; // (I*U)[A*V=W=kg*m*m/sss]/(m[kg]*a[m/ss])=v[m/s]; 2.8m/ss=10km/h if (mvControlling->RList[mvControlling->MainCtrlPos].Bn > 1) @@ -4584,7 +4584,7 @@ TController::UpdateSituation(double dt) { } // uśrednione napięcie sieci: przy spadku poniżej wartości minimalnej opóźnić rozruch o losowy czas - fVoltage = 0.5 * (fVoltage + std::abs(mvControlling->RunningTraction.TractionVoltage)); + fVoltage = 0.5 * (fVoltage + mvControlling->PantographVoltage); if( fVoltage < mvControlling->EnginePowerSource.CollectorParameters.MinV ) { // gdy rozłączenie WS z powodu niskiego napięcia if( fActionTime >= 0 ) { diff --git a/DynObj.cpp b/DynObj.cpp index 866fc9ed..24f9ed26 100644 --- a/DynObj.cpp +++ b/DynObj.cpp @@ -2764,7 +2764,8 @@ bool TDynamicObject::Update(double dt, double dt1) { // dla EZT tylko silnikowy // if (Global.bLiveTraction) { // Ra 2013-12: to niżej jest chyba trochę bez sensu - double v = MoverParameters->PantRearVolt; + tmpTraction.TractionVoltage = std::max( std::abs( MoverParameters->PantRearVolt ), std::abs( MoverParameters->PantFrontVolt ) ); + /* if (v == 0.0) { v = MoverParameters->PantFrontVolt; if( v == 0.0 ) { @@ -2775,10 +2776,10 @@ bool TDynamicObject::Update(double dt, double dt1) // } } } - if (v != 0.0) + */ + if ( tmpTraction.TractionVoltage > 0.0) { // jeśli jest zasilanie NoVoltTime = 0; - tmpTraction.TractionVoltage = v; } else { NoVoltTime += dt1; @@ -2804,19 +2805,18 @@ bool TDynamicObject::Update(double dt, double dt1) } } } - // Ra 2F1H: nie było sensu wpisywać tu zera po upływie czasu, bo zmienna była - // tymczasowa, a napięcie zerowane od razu - tmpTraction.TractionVoltage = 0; // Ra 2013-12: po co tak? } } } } - else + else { tmpTraction.TractionVoltage = 0.95 * MoverParameters->EnginePowerSource.MaxVoltage; + } tmpTraction.TractionFreq = 0; tmpTraction.TractionMaxCurrent = 7500; // Ra: chyba za dużo? powinno wywalać przy 1500 tmpTraction.TractionResistivity = 0.3; + MoverParameters->PantographVoltage = tmpTraction.TractionVoltage; // McZapkie: predkosc w torze przekazac do TrackParam // McZapkie: Vel ma wymiar [km/h] (absolutny), V ma wymiar [m/s], taka // przyjalem notacje @@ -3340,7 +3340,7 @@ bool TDynamicObject::Update(double dt, double dt1) double fCurrent = ( ( MoverParameters->DynamicBrakeFlag && MoverParameters->ResistorsFlag ) ? 0 : - MoverParameters->Itot ) + std::abs( MoverParameters->Itot ) ) + MoverParameters->TotalCurrent; // prąd pobierany przez pojazd - bez // sensu z tym (TotalCurrent) // TotalCurrent to bedzie prad nietrakcyjny (niezwiazany z napedem) @@ -3387,7 +3387,7 @@ bool TDynamicObject::Update(double dt, double dt1) if (p->hvPowerWire) { auto const lastvoltage { MoverParameters->PantFrontVolt }; // TODO: wyliczyć trzeba prąd przypadający na pantograf i wstawić do GetVoltage() - MoverParameters->PantFrontVolt = p->hvPowerWire->VoltageGet( MoverParameters->Voltage, fPantCurrent ); + MoverParameters->PantFrontVolt = p->hvPowerWire->VoltageGet( MoverParameters->PantographVoltage, fPantCurrent ); fCurrent -= fPantCurrent; // taki prąd płynie przez powyższy pantograf // TODO: refactor reaction to voltage change to mover as sound event for specific pantograph if( ( lastvoltage == 0.0 ) @@ -3421,7 +3421,7 @@ bool TDynamicObject::Update(double dt, double dt1) if (p->hvPowerWire) { auto const lastvoltage { MoverParameters->PantRearVolt }; // TODO: wyliczyć trzeba prąd przypadający na pantograf i wstawić do GetVoltage() - MoverParameters->PantRearVolt = p->hvPowerWire->VoltageGet( MoverParameters->Voltage, fPantCurrent ); + MoverParameters->PantRearVolt = p->hvPowerWire->VoltageGet( MoverParameters->PantographVoltage, fPantCurrent ); fCurrent -= fPantCurrent; // taki prąd płynie przez powyższy pantograf // TODO: refactor reaction to voltage change to mover as sound event for specific pantograph if( ( lastvoltage == 0.0 ) @@ -3801,7 +3801,7 @@ void TDynamicObject::RenderSounds() { if( MoverParameters->ConverterFlag ) { frequency = ( MoverParameters->EngineType == TEngineType::ElectricSeriesMotor ? - ( MoverParameters->RunningTraction.TractionVoltage / MoverParameters->NominalVoltage ) * MoverParameters->RList[ MoverParameters->RlistSize ].Mn : + ( MoverParameters->PantographVoltage / MoverParameters->NominalVoltage ) * MoverParameters->RList[ MoverParameters->RlistSize ].Mn : 1.0 ); frequency = sConverter.m_frequencyoffset + sConverter.m_frequencyfactor * frequency; sConverter diff --git a/McZapkie/MOVER.h b/McZapkie/MOVER.h index 44162ed5..1eac3fab 100644 --- a/McZapkie/MOVER.h +++ b/McZapkie/MOVER.h @@ -1381,7 +1381,7 @@ public: //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 Voltage = 0.0; /*aktualne napiecie sieci zasilajacej*/ + 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? @@ -1394,6 +1394,7 @@ public: bool ResistorsFlag = false; /*!o jazda rezystorowa*/ double RventRot = 0.0; /*!s obroty wentylatorow rozruchowych*/ bool UnBrake = false; /*w EZT - nacisniete odhamowywanie*/ + 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 diff --git a/McZapkie/Mover.cpp b/McZapkie/Mover.cpp index d6b14614..4a3975bb 100644 --- a/McZapkie/Mover.cpp +++ b/McZapkie/Mover.cpp @@ -1484,9 +1484,7 @@ void TMoverParameters::MainsCheck( double const Deltatime ) { localvoltage = std::max( localvoltage, - std::max( - PantFrontVolt, - PantRearVolt ) ); + PantographVoltage ); break; } default: { @@ -1513,9 +1511,7 @@ void TMoverParameters::PowerCouplersCheck( double const Deltatime ) { // HACK: main circuit can be fed through couplers, so we explicitly check pantograph supply here localvoltage = ( true == Mains ? - std::max( - PantFrontVolt, - PantRearVolt ) : + PantographVoltage : 0.0 ); break; } @@ -1530,9 +1526,7 @@ void TMoverParameters::PowerCouplersCheck( double const Deltatime ) { localvoltage = std::max( localvoltage, - std::max( - PantFrontVolt, - PantRearVolt ) ); + PantographVoltage ); break; } default: { @@ -1597,7 +1591,7 @@ void TMoverParameters::PowerCouplersCheck( double const Deltatime ) { // bez napiecia... if( couplervoltage != 0.0 ) { // ...ale jest cos na sprzegach: - coupler.power_high.current = ( Itot + TotalCurrent ) * coupler.power_high.voltage / couplervoltage; // obciążenie rozkladane stosownie do napiec + coupler.power_high.current = ( std::abs( Itot ) + TotalCurrent ) * coupler.power_high.voltage / couplervoltage; // obciążenie rozkladane stosownie do napiec if( true == coupler.power_high.is_live ) { coupler.power_high.current += connectedothercoupler.power_high.current; } @@ -1718,7 +1712,7 @@ void TMoverParameters::HeatingCheck( double const Timestep ) { break; } case TPowerSource::Main: { - voltage = ( true == Mains ? Voltage : 0.0 ); + voltage = ( true == Mains ? PantographVoltage : 0.0 ); break; } default: { @@ -1726,7 +1720,7 @@ void TMoverParameters::HeatingCheck( double const Timestep ) { } } - Heating = ( std::abs( voltage ) > heatingpowerthreshold ); + Heating = ( voltage > heatingpowerthreshold ); if( Heating ) { TotalCurrent += 1000 * HeatingPower / voltage; // heater power cost presumably specified in kilowatts @@ -3747,7 +3741,7 @@ void TMoverParameters::CompressorCheck(double dt) CompressorSpeedF * ( 2.0 * MaxCompressorF - Compressor ) / MaxCompressorF * dt; - TotalCurrent += 0.0015 * Voltage; // tymczasowo tylko obciążenie sprężarki, tak z 5A na sprężarkę + TotalCurrent += 0.0015 * PantographVoltage; // tymczasowo tylko obciążenie sprężarki, tak z 5A na sprężarkę } } else { @@ -3929,15 +3923,15 @@ void TMoverParameters::CompressorCheck(double dt) if( ( CompressorPower == 5 ) && ( Couplers[ 1 ].Connected != NULL ) ) { // tymczasowo tylko obciążenie sprężarki, tak z 5A na sprężarkę - Couplers[ 1 ].Connected->TotalCurrent += 0.0015 * Couplers[ 1 ].Connected->Voltage; + Couplers[ 1 ].Connected->TotalCurrent += 0.0015 * Couplers[ 1 ].Connected->PantographVoltage; } else if( ( CompressorPower == 4 ) && ( Couplers[ 0 ].Connected != NULL ) ) { // tymczasowo tylko obciążenie sprężarki, tak z 5A na sprężarkę - Couplers[ 0 ].Connected->TotalCurrent += 0.0015 * Couplers[ 0 ].Connected->Voltage; + Couplers[ 0 ].Connected->TotalCurrent += 0.0015 * Couplers[ 0 ].Connected->PantographVoltage; } else { // tymczasowo tylko obciążenie sprężarki, tak z 5A na sprężarkę - TotalCurrent += 0.0015 * Voltage; + TotalCurrent += 0.0015 * PantographVoltage; } } } @@ -4504,27 +4498,27 @@ void TMoverParameters::ComputeTotalForce(double dt) { if( EngineType == TEngineType::ElectricSeriesMotor ) { LastRelayTime += dt; } - if( Mains && /*(abs(CabNo) < 2) &&*/ ( EngineType == TEngineType::ElectricSeriesMotor ) ) // potem ulepszyc! pantogtrafy! + + if( EngineType == TEngineType::ElectricSeriesMotor ) // potem ulepszyc! pantogtrafy! { // Ra 2014-03: uwzględnienie kierunku jazdy w napięciu na silnikach, a powinien być zdefiniowany nawrotnik - if( CabNo == 0 ) - Voltage = RunningTraction.TractionVoltage * ActiveDir; - else - Voltage = RunningTraction.TractionVoltage * DirAbsolute; // ActiveDir*CabNo; - } // bo nie dzialalo - // TODO: clean up this elseif to match changes in power coupling code - else if( ( EngineType == TEngineType::ElectricInductionMotor ) - || ( ( ( Couplers[ end::front ].CouplingFlag & ctrain_power ) == ctrain_power ) - || ( ( Couplers[ end::rear ].CouplingFlag & ctrain_power ) == ctrain_power ) ) ) { - // potem ulepszyc! pantogtrafy! - Voltage = + EngineVoltage = std::max( - RunningTraction.TractionVoltage, - std::max( - Couplers[ end::front ].power_high.voltage, - Couplers[ end::rear ].power_high.voltage ) ); - } + GetTrainsetVoltage(), + ( Mains ? + PantographVoltage : + 0 ) ); + if( CabNo == 0 ) { + EngineVoltage *= ActiveDir; + } + else { + EngineVoltage *= DirAbsolute; // ActiveDir*CabNo; + } + } // bo nie dzialalo else { - Voltage = 0; + EngineVoltage = + std::max( + GetTrainsetVoltage(), + PantographVoltage ); } FTrain = ( @@ -5097,7 +5091,7 @@ double TMoverParameters::TractionForce( double dt ) { case TEngineType::ElectricSeriesMotor: { // update the state of voltage relays - auto const voltage { std::max( GetTrainsetVoltage(), std::abs( RunningTraction.TractionVoltage ) ) }; + auto const voltage { std::max( GetTrainsetVoltage(), PantographVoltage ) }; NoVoltRelay = ( EnginePowerSource.SourceType != TPowerSource::CurrentCollector ) || ( voltage >= EnginePowerSource.CollectorParameters.MinV ); @@ -5116,8 +5110,8 @@ double TMoverParameters::TractionForce( double dt ) { // TODO: check if we can use instead the code for electricseriesmotor if( ( Mains ) ) { // nie wchodzić w funkcję bez potrzeby - if( ( std::max( GetTrainsetVoltage(), std::abs( RunningTraction.TractionVoltage ) ) < EnginePowerSource.CollectorParameters.MinV ) - || ( std::max( GetTrainsetVoltage(), std::abs( RunningTraction.TractionVoltage ) ) > EnginePowerSource.CollectorParameters.MaxV + 200 ) ) { + if( ( std::max( GetTrainsetVoltage(), PantographVoltage ) < EnginePowerSource.CollectorParameters.MinV ) + || ( std::max( GetTrainsetVoltage(), PantographVoltage ) > EnginePowerSource.CollectorParameters.MaxV + 200 ) ) { MainSwitch( false, ( TrainType == dt_EZT ? range_t::unit : range_t::local ) ); // TODO: check whether we need to send this EMU-wide } } @@ -5176,13 +5170,13 @@ double TMoverParameters::TractionForce( double dt ) { // enrot:=Transmision.Ratio*nrot; // yB: szereg dwoch sekcji w ET42 if ((TrainType == dt_ET42) && (Imax == ImaxHi)) - Voltage = Voltage / 2.0; - Mm = Momentum(Current(enrot, Voltage)); // oblicza tez prad p/slinik + EngineVoltage = EngineVoltage / 2.0; + Mm = Momentum(Current(enrot, EngineVoltage)); // oblicza tez prad p/slinik if (TrainType == dt_ET42) { if (Imax == ImaxHi) - Voltage = Voltage * 2; + EngineVoltage = EngineVoltage * 2; if ((DynamicBrakeFlag) && (abs(Im) > 300)) // przeiesione do mover.cpp FuseOff(); } @@ -5277,7 +5271,7 @@ double TMoverParameters::TractionForce( double dt ) { // jazda manewrowa if( true == ShuntMode ) { if( ( true == Mains ) && ( MainCtrlPowerPos() > 0 ) ) { - Voltage = ( SST[ MainCtrlPos ].Umax * AnPos ) + ( SST[ MainCtrlPos ].Umin * ( 1.0 - AnPos ) ); + EngineVoltage = ( SST[ MainCtrlPos ].Umax * AnPos ) + ( SST[ MainCtrlPos ].Umin * ( 1.0 - AnPos ) ); // NOTE: very crude way to approximate power generated at current rpm instead of instant top output // NOTE, TODO: doesn't take into account potentially increased revolutions if heating is on, fix it auto const rpmratio { 60.0 * enrot / DElist[ MainCtrlPos ].RPM }; @@ -5285,7 +5279,7 @@ double TMoverParameters::TractionForce( double dt ) { Ft = tmp * 1000.0 / ( abs( tmpV ) + 1.6 ); } else { - Voltage = 0; + EngineVoltage = 0; Ft = 0; } PosRatio = 1; @@ -5346,10 +5340,10 @@ double TMoverParameters::TractionForce( double dt ) { Im = NPoweredAxles * sqrt(abs(Mm * MotorParam[ScndCtrlPos].Isat)); if( ShuntMode ) { - EnginePower = Voltage * Im / 1000.0; + EnginePower = EngineVoltage * Im / 1000.0; if( EnginePower > tmp ) { EnginePower = tmp; - Voltage = EnginePower * 1000.0 / Im; + EngineVoltage = EnginePower * 1000.0 / Im; } if( EnginePower < tmp ) { Ft *= EnginePower / tmp; @@ -5367,31 +5361,31 @@ double TMoverParameters::TractionForce( double dt ) { // jak pod obciazeniem if( true == Flat ) { // ograniczenie napiecia w pradnicy - plaszczak u gory - Voltage = 1000.0 * tmp / std::abs( Im ); + EngineVoltage = 1000.0 * tmp / std::abs( Im ); } else { // charakterystyka pradnicy obcowzbudnej (elipsa) - twierdzenie Pitagorasa - Voltage = + EngineVoltage = std::sqrt( std::abs( square( DElist[ MainCtrlPos ].Umax ) - square( DElist[ MainCtrlPos ].Umax * Im / DElist[ MainCtrlPos ].Imax ) ) ) * ( MainCtrlPos - 1 ) + ( 1.0 - Im / DElist[ MainCtrlPos ].Imax ) * DElist[ MainCtrlPos ].Umax * ( MainCtrlPosNo - MainCtrlPos ); - Voltage /= ( MainCtrlPosNo - 1 ); - Voltage = clamp( - Voltage, + EngineVoltage /= ( MainCtrlPosNo - 1 ); + EngineVoltage = clamp( + EngineVoltage, Im * 0.05, ( 1000.0 * tmp / std::abs( Im ) ) ); } } - if( ( Voltage > DElist[ MainCtrlPos ].Umax ) + if( ( EngineVoltage > DElist[ MainCtrlPos ].Umax ) || ( Im == 0 ) ) { // gdy wychodzi za duze napiecie albo przy biegu jalowym (jest cos takiego?) - Voltage = DElist[ MainCtrlPos ].Umax * ( ConverterFlag ? 1 : 0 ); + EngineVoltage = DElist[ MainCtrlPos ].Umax * ( ConverterFlag ? 1 : 0 ); } - EnginePower = Voltage * Im / 1000.0; + EnginePower = EngineVoltage * Im / 1000.0; /* // power curve drop // NOTE: disabled for the time being due to side-effects @@ -5406,7 +5400,7 @@ double TMoverParameters::TractionForce( double dt ) { if ((Imax > 1) && (Im > Imax)) FuseOff(); if (FuseFlag) - Voltage = 0; + EngineVoltage = 0; // przekazniki bocznikowania, kazdy inny dla kazdej pozycji if ((IsMainCtrlNoPowerPos()) || (ShuntMode) || (false==Mains)) @@ -5724,7 +5718,7 @@ double TMoverParameters::TractionForce( double dt ) { else tmp = eimc[eimc_f_Uzmax]; - eimv[eimv_Uzsmax] = Min0R(Voltage - eimc[eimc_f_DU], tmp); + eimv[eimv_Uzsmax] = Min0R(EngineVoltage - eimc[eimc_f_DU], tmp); eimv[eimv_fkr] = eimv[eimv_Uzsmax] / eimc[eimc_f_cfu]; if( (eimv_pr < 0 ) ) { eimv[ eimv_Pmax ] = eimc[ eimc_p_Ph ]; @@ -5733,7 +5727,7 @@ double TMoverParameters::TractionForce( double dt ) { eimv[ eimv_Pmax ] = std::min( eimc[ eimc_p_Pmax ], - 0.001 * Voltage * ( eimc[ eimc_p_Imax ] - eimc[ eimc_f_I0 ] ) * Pirazy2 * eimc[ eimc_s_cim ] / eimc[ eimc_s_p ] / eimc[ eimc_s_cfu ] ); + 0.001 * EngineVoltage * ( eimc[ eimc_p_Imax ] - eimc[ eimc_f_I0 ] ) * Pirazy2 * eimc[ eimc_s_cim ] / eimc[ eimc_s_p ] / eimc[ eimc_s_cfu ] ); } eimv[ eimv_FMAXMAX ] = 0.001 @@ -5792,20 +5786,20 @@ double TMoverParameters::TractionForce( double dt ) { eimv[eimv_Ic] = (eimv[eimv_fp] - DirAbsolute * enrot * eimc[eimc_s_p]) * eimc[eimc_s_dfic] * eimv[eimv_pole]; eimv[eimv_If] = eimv[eimv_Ic] * eimc[eimc_s_icif]; eimv[eimv_M] = eimv[eimv_pole] * eimv[eimv_Ic] * eimc[eimc_s_cim]; - eimv[eimv_Ipoj] = (eimv[eimv_Ic] * NPoweredAxles * eimv[eimv_U]) / (Voltage - eimc[eimc_f_DU]) + eimc[eimc_f_I0]; + eimv[eimv_Ipoj] = (eimv[eimv_Ic] * NPoweredAxles * eimv[eimv_U]) / (EngineVoltage - eimc[eimc_f_DU]) + eimc[eimc_f_I0]; eimv[eimv_Pm] = ActiveDir * eimv[eimv_M] * NPoweredAxles * enrot * Pirazy2 / 1000; - eimv[eimv_Pe] = eimv[eimv_Ipoj] * Voltage / 1000; + eimv[eimv_Pe] = eimv[eimv_Ipoj] * EngineVoltage / 1000; eimv[eimv_eta] = eimv[eimv_Pm] / eimv[eimv_Pe]; Im = eimv[eimv_If]; if ((eimv[eimv_Ipoj] >= 0)) Vadd *= (1.0 - 2.0 * dt); - else if ((std::abs(Voltage) < EnginePowerSource.CollectorParameters.MaxV)) + else if ((std::abs(EngineVoltage) < EnginePowerSource.CollectorParameters.MaxV)) Vadd *= (1.0 - dt); else Vadd = Max0R( Vadd * (1.0 - 0.2 * dt), - 0.007 * (std::abs(Voltage) - (EnginePowerSource.CollectorParameters.MaxV - 100))); + 0.007 * (std::abs(EngineVoltage) - (EnginePowerSource.CollectorParameters.MaxV - 100))); Itot = eimv[eimv_Ipoj] * (0.01 + Min0R(0.99, 0.99 - Vadd)); EnginePower = abs(eimv[eimv_Ic] * eimv[eimv_U] * NPoweredAxles) / 1000; diff --git a/Texture.cpp b/Texture.cpp index f04d5617..416e1baa 100644 --- a/Texture.cpp +++ b/Texture.cpp @@ -1026,23 +1026,26 @@ opengl_texture::set_filtering() const { ::glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, Global.AnisotropicFiltering ); } - bool sharpen{ false }; - for( auto const &trait : traits ) { + if( false == Global.gfx_usegles ) { - switch( trait ) { + bool sharpen{ false }; + for( auto const &trait : traits ) { - case '#': { sharpen = true; break; } - default: { break; } + switch( trait ) { + + case '#': { sharpen = true; break; } + default: { break; } + } } - } - if( true == sharpen ) { - // #: sharpen more - ::glTexEnvf( GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, -2.0 ); - } - else { - // regular texture sharpening - ::glTexEnvf( GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, -1.0 ); + if( true == sharpen ) { + // #: sharpen more + ::glTexEnvf( GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, -2.0 ); + } + else { + // regular texture sharpening + ::glTexEnvf( GL_TEXTURE_FILTER_CONTROL, GL_TEXTURE_LOD_BIAS, -1.0 ); + } } } diff --git a/Train.cpp b/Train.cpp index 03f90e89..607864e8 100644 --- a/Train.cpp +++ b/Train.cpp @@ -535,8 +535,8 @@ dictionary_source *TTrain::GetTrainState() { dict->insert( "slipping_wheels", mvOccupied->SlippingWheels ); dict->insert( "sanding", mvOccupied->SandDose ); // electric current data - dict->insert( "traction_voltage", std::abs( mvControlled->RunningTraction.TractionVoltage ) ); - dict->insert( "voltage", std::abs( mvControlled->Voltage ) ); + dict->insert( "traction_voltage", std::abs( mvControlled->PantographVoltage ) ); + dict->insert( "voltage", std::abs( mvControlled->EngineVoltage ) ); dict->insert( "im", std::abs( mvControlled->Im ) ); dict->insert( "fuse", mvControlled->FuseFlag ); dict->insert( "epfuse", mvOccupied->EpFuse ); @@ -5703,10 +5703,10 @@ bool TTrain::Update( double const Deltatime ) // Ra 2014-09: napięcia i prądy muszą być ustalone najpierw, bo wysyłane są ewentualnie na PoKeys if ((mvControlled->EngineType != TEngineType::DieselElectric) && (mvControlled->EngineType != TEngineType::ElectricInductionMotor)) // Ra 2014-09: czy taki rozdzia? ma sens? - fHVoltage = mvControlled->RunningTraction.TractionVoltage; // Winger czy to nie jest zle? + fHVoltage = std::max( mvControlled->PantographVoltage, mvControlled->GetTrainsetVoltage() ); // Winger czy to nie jest zle? // *mvControlled->Mains); else - fHVoltage = mvControlled->Voltage; + fHVoltage = mvControlled->EngineVoltage; if (ShowNextCurrent) { // jeśli pokazywać drugi człon if (mvSecond) @@ -5789,7 +5789,7 @@ bool TTrain::Update( double const Deltatime ) fEIMParams[1 + in][6] = p->MoverParameters->eimv[eimv_If]; fEIMParams[1 + in][7] = p->MoverParameters->eimv[eimv_U]; fEIMParams[1 + in][8] = p->MoverParameters->Itot;//p->MoverParameters->eimv[eimv_Ipoj]; - fEIMParams[1 + in][9] = p->MoverParameters->Voltage; + fEIMParams[1 + in][9] = p->MoverParameters->EngineVoltage; fEIMParams[0][6] += fEIMParams[1 + in][8]; bMains[in] = p->MoverParameters->Mains; fCntVol[in] = p->MoverParameters->BatteryVoltage; @@ -5984,7 +5984,7 @@ bool TTrain::Update( double const Deltatime ) { if (mvControlled->DynamicBrakeFlag) { - ggEngineVoltage.UpdateValue(abs(mvControlled->Im * 5)); + ggEngineVoltage.UpdateValue(std::abs(mvControlled->Im * 5)); } else { @@ -5995,12 +5995,12 @@ bool TTrain::Update( double const Deltatime ) else x = 2; if ((mvControlled->RList[mvControlled->MainCtrlActualPos].Mn > 0) && - (abs(mvControlled->Im) > 0)) + (std::abs(mvControlled->Im) > 0)) { ggEngineVoltage.UpdateValue( - (x * (mvControlled->RunningTraction.TractionVoltage - + (x * (mvControlled->PantographVoltage - mvControlled->RList[mvControlled->MainCtrlActualPos].R * - abs(mvControlled->Im)) / + std::abs(mvControlled->Im)) / mvControlled->RList[mvControlled->MainCtrlActualPos].Mn)); } else diff --git a/driveruipanels.cpp b/driveruipanels.cpp index 4d66241f..ca9e422b 100644 --- a/driveruipanels.cpp +++ b/driveruipanels.cpp @@ -598,11 +598,11 @@ debug_panel::update_section_vehicle( std::vector &Output ) { // power transfers mover.Couplers[ end::front ].power_high.voltage, mover.Couplers[ end::front ].power_high.current, - std::string( mover.Couplers[ end::front ].power_high.is_local ? "" : "-" ).c_str(), - std::string( vehicle.DirectionGet() ? ":<<" : ":>>" ).c_str(), - mover.Voltage, - std::string( vehicle.DirectionGet() ? "<<:" : ">>:" ).c_str(), - std::string( mover.Couplers[ end::rear ].power_high.is_local ? "" : "-" ).c_str(), + std::string( mover.Couplers[ end::front ].power_high.is_local ? ":" : ":=" ).c_str(), + std::string( vehicle.DirectionGet() ? "<<" : ">>" ).c_str(), + mover.EngineVoltage, + std::string( vehicle.DirectionGet() ? "<<" : ">>" ).c_str(), + std::string( mover.Couplers[ end::rear ].power_high.is_local ? ":" : "=:" ).c_str(), mover.Couplers[ end::rear ].power_high.voltage, mover.Couplers[ end::rear ].power_high.current ); diff --git a/gl/framebuffer.cpp b/gl/framebuffer.cpp index 6c347ab9..da6764f3 100644 --- a/gl/framebuffer.cpp +++ b/gl/framebuffer.cpp @@ -1,6 +1,9 @@ #include "stdafx.h" #include "framebuffer.h" +#include "Logs.h" +#include "utilities.h" + gl::framebuffer::framebuffer() { glGenFramebuffers(1, *this); @@ -43,8 +46,14 @@ void gl::framebuffer::detach(GLenum location) bool gl::framebuffer::is_complete() { bind(); - GLenum status = glCheckFramebufferStatus(GL_FRAMEBUFFER); - return status == GL_FRAMEBUFFER_COMPLETE; + GLenum const status { glCheckFramebufferStatus( GL_FRAMEBUFFER ) }; + auto const iscomplete { status == GL_FRAMEBUFFER_COMPLETE }; + + if( false == iscomplete ) { + ErrorLog( "framebuffer status error: " + to_hex_str( status ) ); + } + + return iscomplete; } void gl::framebuffer::clear(GLbitfield mask) diff --git a/messaging.cpp b/messaging.cpp index 95712c0c..43eb7047 100644 --- a/messaging.cpp +++ b/messaging.cpp @@ -335,7 +335,7 @@ WyslijNamiary(TDynamicObject const *Vehicle) Vehicle->MoverParameters->ShowCurrent(p + 1); // amperomierze kolejnych grup // WriteLog("zapisalem prady"); r.iPar[30] = Vehicle->MoverParameters->WarningSignal; // trabienie - r.fPar[31] = Vehicle->MoverParameters->RunningTraction.TractionVoltage; // napiecie WN + r.fPar[31] = Vehicle->MoverParameters->PantographVoltage; // napiecie WN // WriteLog("Parametry gotowe"); i <<= 2; // ilość bajtów r.cString[i] = char(j); // na końcu nazwa, żeby jakoś zidentyfikować diff --git a/opengl33renderer.cpp b/opengl33renderer.cpp index f05d90ec..2a4f9b87 100644 --- a/opengl33renderer.cpp +++ b/opengl33renderer.cpp @@ -31,7 +31,7 @@ bool opengl33_renderer::Init(GLFWwindow *Window) if (!Init_caps()) return false; - WriteLog("preparing renderer.."); + WriteLog("preparing renderer..."); OpenGLMatrices.upload() = false; // set matrix stack in virtual mode @@ -272,7 +272,7 @@ bool opengl33_renderer::Init(GLFWwindow *Window) WriteLog("picking objects created"); - WriteLog("renderer initialization finished!"); + WriteLog("gfx renderer setup complete"); return true; } @@ -3994,22 +3994,22 @@ bool opengl33_renderer::Init_caps() } if (!GLAD_GL_EXT_texture_sRGB) - ErrorLog("EXT_texture_sRGB not supported!"); + ErrorLog("warning: EXT_texture_sRGB not supported"); if (!GLAD_GL_EXT_texture_compression_s3tc) - ErrorLog("EXT_texture_compression_s3tc not supported!"); + ErrorLog("warning: EXT_texture_compression_s3tc not supported"); if (GLAD_GL_ARB_texture_filter_anisotropic) - WriteLog("ARB_texture_filter_anisotropic supported!"); + WriteLog("ARB_texture_filter_anisotropic supported"); if (GLAD_GL_ARB_multi_bind) - WriteLog("ARB_multi_bind supported!"); + WriteLog("ARB_multi_bind supported"); if (GLAD_GL_ARB_direct_state_access) - WriteLog("ARB_direct_state_access supported!"); + WriteLog("ARB_direct_state_access supported"); if (GLAD_GL_ARB_clip_control) - WriteLog("ARB_clip_control supported!"); + WriteLog("ARB_clip_control supported"); } else { @@ -4020,20 +4020,20 @@ bool opengl33_renderer::Init_caps() } if (GLAD_GL_EXT_texture_filter_anisotropic) - WriteLog("EXT_texture_filter_anisotropic supported."); + WriteLog("EXT_texture_filter_anisotropic supported"); if (GLAD_GL_EXT_clip_control) - WriteLog("EXT_clip_control supported."); + WriteLog("EXT_clip_control supported"); if (GLAD_GL_EXT_geometry_shader) - WriteLog("EXT_geometry_shader supported."); + WriteLog("EXT_geometry_shader supported"); } glGetError(); glLineWidth(2.0f); if (!glGetError()) { - WriteLog("wide lines supported."); + WriteLog("wide lines supported"); m_widelines_supported = true; } else