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

build 210905. vehicle startup logic enhancements, whois event enhancement, line breaker activation type, material shadow rank, shadow rank cutoff value, shadow angle cutoff value, minor bug fixes

This commit is contained in:
tmj-fstate
2021-09-05 21:09:46 +02:00
parent 2e86b3a5e9
commit 26d09440b0
28 changed files with 360 additions and 112 deletions

View File

@@ -1364,6 +1364,7 @@ public:
std::array<neighbour_data, 2> Neighbours; // potential collision sources
bool Power110vIsAvailable = false; // cached availability of 110v power
bool Power24vIsAvailable = false; // cached availability of 110v power
double Power24vVoltage { 0.0 }; // cached battery voltage
bool EventFlag = false; /*!o true jesli cos nietypowego sie wydarzy*/
int SoundFlag = 0; /*!o patrz stale sound_ */
int AIFlag{ 0 }; // HACK: events of interest for consist owner
@@ -1489,6 +1490,7 @@ public:
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
start_t MainsStart { start_t::manual };
bool LineBreakerClosesOnlyAtNoPowerPos{ false };
bool ControlPressureSwitch{ false }; // activates if the main pipe and/or brake cylinder pressure aren't within operational levels
bool HasControlPressureSwitch{ true };
@@ -1811,6 +1813,7 @@ public:
bool ChangeCompressorPreset( int const Change, range_t const Notify = range_t::consist );
bool HeatingSwitch( bool const State, range_t const Notify = range_t::consist );
void HeatingSwitch_( bool const State );
double EnginePowerSourceVoltage() const; // returns voltage of defined main engine power source
/*-funkcje typowe dla lokomotywy elektrycznej*/
void LowVoltagePowerCheck( double const Deltatime );

View File

@@ -171,6 +171,10 @@ double TMoverParameters::Current(double n, double U)
}
else {
Mn = RList[ MainCtrlActualPos ].Mn * RList[ MainCtrlActualPos ].Bn;
if( RList[ MainCtrlActualPos ].Bn > 1 ) {
Bn = 1;
R = CircuitRes;
}
}
if (DynamicBrakeFlag && (!FuseFlag) && (DynamicBrakeType == dbrake_automatic) &&
@@ -1511,13 +1515,14 @@ void TMoverParameters::compute_movement_( double const Deltatime ) {
PowerCouplersCheck( Deltatime, coupling::power110v );
PowerCouplersCheck( Deltatime, coupling::power24v );
Power24vIsAvailable = ( ( PowerCircuits[ 0 ].first > 0 ) || ( GetTrainsetVoltage( coupling::power24v ) > 0 ) );
Power24vVoltage = std::max( PowerCircuits[ 0 ].first, GetTrainsetVoltage( coupling::power24v ) );
Power24vIsAvailable = ( Power24vVoltage > 0 );
Power110vIsAvailable = ( ( PowerCircuits[ 1 ].first > 0 ) || ( GetTrainsetVoltage( coupling::power110v ) > 0 ) );
}
void TMoverParameters::MainsCheck( double const Deltatime ) {
if( MainsInitTime == 0.0 ) { return; }
// if( MainsInitTime == 0.0 ) { return; }
// TBD, TODO: move voltage calculation to separate method and use also in power coupler state calculation?
auto localvoltage { 0.0 };
@@ -1529,6 +1534,13 @@ void TMoverParameters::MainsCheck( double const Deltatime ) {
PantographVoltage );
break;
}
case TPowerSource::Accumulator: {
localvoltage =
std::max(
localvoltage,
Power24vVoltage );
break;
}
default: {
break;
}
@@ -1544,6 +1556,13 @@ void TMoverParameters::MainsCheck( double const Deltatime ) {
// this allows for simpler rejection of cases where MainsInitTime == 0
MainsInitTimeCountdown -= Deltatime;
}
else {
// optional automatic circuit start
if( ( MainsStart != start_t::manual )
&& ( false == ( Mains || dizel_startup ) ) ) {
MainSwitch( true );
}
}
}
else {
// no power supply
@@ -2039,9 +2058,11 @@ void TMoverParameters::MotorBlowersCheck( double const Timestep ) {
// activation check
for( auto &blower : MotorBlowers ) {
auto disable = blower.is_disabled;
auto const start { ( Vel >= blower.min_start_velocity && Im > 0.5 ) };
auto const stop { ( Vel < 0.5 && Im < 0.5 ) };
if (blower.min_start_velocity >= 0)
{
if ( Vel < 0.5 && Im < 0.5 )
if ( stop )
{
blower.stop_timer += Timestep;
if (blower.stop_timer > blower.sustain_time)
@@ -2049,7 +2070,7 @@ void TMoverParameters::MotorBlowersCheck( double const Timestep ) {
disable = true;
}
}
else if (Vel >= blower.min_start_velocity && Im > 0.5)
else if ( start )
{
blower.stop_timer = 0;
}
@@ -2067,9 +2088,10 @@ void TMoverParameters::MotorBlowersCheck( double const Timestep ) {
// && ( true == blower.breaker )
&& ( false == disable)
&& ( ( true == blower.is_active )
|| ( blower.start_type == start_t::manual ?
|| ( ( blower.stop_timer == 0.f ) // HACK: will be true for blower with exceeded start_velocity, and for one without start_velocity
&& ( blower.start_type == start_t::manual ?
blower.is_enabled :
true ) ) );
true ) ) ) );
}
// update
for( auto &fan : MotorBlowers ) {
@@ -3570,7 +3592,8 @@ bool TMoverParameters::MainSwitchCheck() const {
}
case TEngineType::ElectricSeriesMotor:
case TEngineType::ElectricInductionMotor: {
powerisavailable = ( std::max( GetTrainsetHighVoltage(), PantographVoltage ) > 0.5 * EnginePowerSource.MaxVoltage );
// TODO: check whether we can simplify this check and skip the outer EngineType switch
powerisavailable = ( EnginePowerSourceVoltage() > 0.5 * EnginePowerSource.MaxVoltage );
break;
}
default: {
@@ -3692,6 +3715,15 @@ void TMoverParameters::HeatingSwitch_( bool const State ) {
HeatingAllow = State;
}
// returns voltage of defined main engine power source
double TMoverParameters::EnginePowerSourceVoltage() const {
return (
EnginePowerSource.SourceType == TPowerSource::CurrentCollector ? std::max( GetTrainsetHighVoltage(), PantographVoltage ) :
EnginePowerSource.SourceType == TPowerSource::Accumulator ? Power24vVoltage :
0.0 );
}
// *************************************************************************************************
// Q: 20160711
// zwiększenie nastawy hamulca
@@ -4892,10 +4924,8 @@ void TMoverParameters::ComputeTotalForce(double dt) {
{ // Ra 2014-03: uwzględnienie kierunku jazdy w napięciu na silnikach, a powinien być zdefiniowany nawrotnik
EngineVoltage = (
Mains ?
std::max(
GetTrainsetHighVoltage(),
PantographVoltage ) :
0.00 );
EnginePowerSourceVoltage() :
0.0 );
if( CabActive == 0 ) {
EngineVoltage *= DirActive;
}
@@ -10360,6 +10390,13 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
// main circuit
extract_value( MainsInitTime, "MainInitTime", line, "" );
{
auto lookup = starts.find( extract_value( "MainStart", line ) );
MainsStart =
lookup != starts.end() ?
lookup->second :
start_t::manual;
}
// battery
{
auto lookup = starts.find( extract_value( "BatteryStart", line ) );