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

main circuit logic enhancement, ai route scanning fix, event0 activation fix

This commit is contained in:
tmj-fstate
2019-06-29 15:02:33 +02:00
parent 12a71b7f3f
commit 7c07aa9682
6 changed files with 71 additions and 20 deletions

View File

@@ -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 {