mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 17:29:18 +02:00
main circuit logic enhancement, ai route scanning fix, event0 activation fix
This commit is contained in:
@@ -1247,6 +1247,8 @@ public:
|
||||
|
||||
/*-zmienne dla lokomotyw*/
|
||||
bool Mains = false; /*polozenie glownego wylacznika*/
|
||||
double MainsInitTime{ 0.0 }; // config, initialization time (in seconds) of the main circuit after it receives power, before it can be closed
|
||||
double MainsInitTimeCountdown{ 0.0 }; // current state of main circuit initialization, remaining time (in seconds) until it's ready
|
||||
int MainCtrlPos = 0; /*polozenie glownego nastawnika*/
|
||||
int ScndCtrlPos = 0; /*polozenie dodatkowego nastawnika*/
|
||||
int LightsPos = 0;
|
||||
@@ -1527,6 +1529,7 @@ public:
|
||||
bool CompressorSwitch( bool State, range_t const Notify = range_t::consist );/*! wl/wyl sprezarki*/
|
||||
|
||||
/*-funkcje typowe dla lokomotywy elektrycznej*/
|
||||
void MainsCheck( double const Deltatime );
|
||||
void PowerCouplersCheck( double const Deltatime );
|
||||
void ConverterCheck( double const Timestep ); // przetwornica
|
||||
void HeatingCheck( double const Timestep );
|
||||
|
||||
@@ -1309,10 +1309,11 @@ void TMoverParameters::compute_movement_( double const Deltatime ) {
|
||||
RunInternalCommand();
|
||||
|
||||
// automatyczny rozruch
|
||||
if (EngineType == TEngineType::ElectricSeriesMotor)
|
||||
|
||||
if (AutoRelayCheck())
|
||||
SetFlag(SoundFlag, sound::relay);
|
||||
if( EngineType == TEngineType::ElectricSeriesMotor ) {
|
||||
if( AutoRelayCheck() ) {
|
||||
SetFlag( SoundFlag, sound::relay );
|
||||
}
|
||||
}
|
||||
|
||||
if( ( EngineType == TEngineType::DieselEngine )
|
||||
|| ( EngineType == TEngineType::DieselElectric ) ) {
|
||||
@@ -1324,6 +1325,8 @@ void TMoverParameters::compute_movement_( double const Deltatime ) {
|
||||
// TODO: gather and move current calculations to dedicated method
|
||||
TotalCurrent = 0;
|
||||
|
||||
// main circuit
|
||||
MainsCheck( Deltatime );
|
||||
// traction motors
|
||||
MotorBlowersCheck( Deltatime );
|
||||
// uklady hamulcowe:
|
||||
@@ -1365,6 +1368,37 @@ void TMoverParameters::compute_movement_( double const Deltatime ) {
|
||||
PowerCouplersCheck( Deltatime );
|
||||
}
|
||||
|
||||
void TMoverParameters::MainsCheck( double const Deltatime ) {
|
||||
|
||||
// TODO: move other main circuit checks here
|
||||
|
||||
if( MainsInitTime == 0.0 ) { return; }
|
||||
|
||||
if( MainsInitTimeCountdown > 0.0 ) {
|
||||
MainsInitTimeCountdown -= Deltatime;
|
||||
}
|
||||
// TBD, TODO: move voltage calculation to separate method and use also in power coupler state calculation?
|
||||
auto localvoltage { 0.0 };
|
||||
switch( EnginePowerSource.SourceType ) {
|
||||
case TPowerSource::CurrentCollector: {
|
||||
localvoltage =
|
||||
std::max(
|
||||
localvoltage,
|
||||
std::max(
|
||||
PantFrontVolt,
|
||||
PantRearVolt ) );
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( ( localvoltage == 0.0 )
|
||||
&& ( GetTrainsetVoltage() == 0 ) ) {
|
||||
MainsInitTimeCountdown = MainsInitTime;
|
||||
}
|
||||
}
|
||||
|
||||
void TMoverParameters::PowerCouplersCheck( double const Deltatime ) {
|
||||
// TODO: add support for other power sources
|
||||
auto localvoltage { 0.0 };
|
||||
@@ -2846,6 +2880,7 @@ void TMoverParameters::MainSwitch_( bool const State ) {
|
||||
if( ( false == State )
|
||||
|| ( ( ( ScndCtrlPos == 0 ) || ( EngineType == TEngineType::ElectricInductionMotor ) )
|
||||
&& ( ( ConvOvldFlag == false ) || ( TrainType == dt_EZT ) )
|
||||
&& ( MainsInitTimeCountdown <= 0.0 )
|
||||
&& ( true == NoVoltRelay )
|
||||
&& ( true == OvervoltageRelay )
|
||||
&& ( LastSwitchingTime > CtrlDelay )
|
||||
@@ -8959,6 +8994,8 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
|
||||
false;
|
||||
extract_value(SpeedCtrlAutoTurnOffFlag, "SpeedCtrlATOF", line, "");
|
||||
|
||||
// main circuit
|
||||
extract_value( MainsInitTime, "MainInitTime", line, "" );
|
||||
// converter
|
||||
{
|
||||
std::map<std::string, start_t> starts {
|
||||
|
||||
Reference in New Issue
Block a user