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

build 190712. heating generator state cab controls, engine state ui readout fix, minor ai logic tweaks

This commit is contained in:
tmj-fstate
2019-07-16 10:32:57 +02:00
parent 06b7f009cc
commit 3feca56c08
5 changed files with 46 additions and 25 deletions

View File

@@ -3440,30 +3440,35 @@ void TController::SpeedSet()
break; break;
case TEngineType::DieselEngine: case TEngineType::DieselEngine:
// Ra 2014-06: "automatyczna" skrzynia biegów... // Ra 2014-06: "automatyczna" skrzynia biegów...
if (!mvControlling->MotorParam[mvControlling->ScndCtrlPos].AutoSwitch) // gdy biegi ręczne if( false == mvControlling->MotorParam[ mvControlling->ScndCtrlPos ].AutoSwitch ) {
// gdy biegi ręczne
if( ( mvControlling->ShuntMode ? mvControlling->AnPos : 1.0 ) * mvControlling->Vel > if( ( mvControlling->ShuntMode ? mvControlling->AnPos : 1.0 ) * mvControlling->Vel >
0.75 * mvControlling->MotorParam[ mvControlling->ScndCtrlPos ].mfi ) 0.75 * mvControlling->MotorParam[ mvControlling->ScndCtrlPos ].mfi )
// if (mvControlling->enrot>0.95*mvControlling->dizel_nMmax) //youBy: jeśli obroty > // if (mvControlling->enrot>0.95*mvControlling->dizel_nMmax) //youBy: jeśli obroty >
// 0,95 nmax, wrzuć wyższy bieg - Ra: to nie działa // 0,95 nmax, wrzuć wyższy bieg - Ra: to nie działa
{ // jak prędkość większa niż 0.6 maksymalnej na danym biegu, wrzucić wyższy { // jak prędkość większa niż 0.6 maksymalnej na danym biegu, wrzucić wyższy
if( mvControlling->ScndCtrlPos < mvControlling->ScndCtrlPosNo ) {
// ...presuming there is a higher gear
mvControlling->DecMainCtrl( 2 ); mvControlling->DecMainCtrl( 2 );
if (mvControlling->IncScndCtrl(1)) if( mvControlling->IncScndCtrl( 1 ) ) {
if (mvControlling->MotorParam[mvControlling->ScndCtrlPos].mIsat == while( ( mvControlling->MotorParam[ mvControlling->ScndCtrlPos ].mIsat == 0.0 ) // jeśli bieg jałowy
0.0) // jeśli bieg jałowy && ( mvControlling->IncScndCtrl( 1 ) ) ) { // to kolejny
mvControlling->IncScndCtrl(1); // to kolejny ;
}
}
}
} }
else if( ( mvControlling->ShuntMode ? mvControlling->AnPos : 1.0 ) * mvControlling->Vel < else if( ( mvControlling->ShuntMode ? mvControlling->AnPos : 1.0 ) * mvControlling->Vel <
mvControlling->MotorParam[mvControlling->ScndCtrlPos].fi) mvControlling->MotorParam[ mvControlling->ScndCtrlPos ].fi ) { // jak prędkość mniejsza niż minimalna na danym biegu, wrzucić niższy
{ // jak prędkość mniejsza niż minimalna na danym biegu, wrzucić niższy
mvControlling->DecMainCtrl( 2 ); mvControlling->DecMainCtrl( 2 );
mvControlling->DecScndCtrl( 1 ); mvControlling->DecScndCtrl( 1 );
if (mvControlling->MotorParam[mvControlling->ScndCtrlPos].mIsat == if( mvControlling->MotorParam[ mvControlling->ScndCtrlPos ].mIsat == 0.0 ) // jeśli bieg jałowy
0.0) // jeśli bieg jałowy
if( mvControlling->ScndCtrlPos ) // a jeszcze zera nie osiągnięto if( mvControlling->ScndCtrlPos ) // a jeszcze zera nie osiągnięto
mvControlling->DecScndCtrl( 1 ); // to kolejny wcześniejszy mvControlling->DecScndCtrl( 1 ); // to kolejny wcześniejszy
else else
mvControlling->IncScndCtrl( 1 ); // a jak zeszło na zero, to powrót mvControlling->IncScndCtrl( 1 ); // a jak zeszło na zero, to powrót
} }
}
break; break;
} }
}; };

View File

@@ -1572,6 +1572,8 @@ void TMoverParameters::HeatingCheck( double const Timestep ) {
auto const absrevolutions { std::abs( generator.revolutions ) }; auto const absrevolutions { std::abs( generator.revolutions ) };
generator.voltage = ( generator.voltage = (
false == HeatingAllow ? 0.0 :
// TODO: add support for desired voltage selector
absrevolutions < generator.revolutions_min ? generator.voltage_min * absrevolutions / generator.revolutions_min : absrevolutions < generator.revolutions_min ? generator.voltage_min * absrevolutions / generator.revolutions_min :
// absrevolutions > generator.revolutions_max ? generator.voltage_max * absrevolutions / generator.revolutions_max : // absrevolutions > generator.revolutions_max ? generator.voltage_max * absrevolutions / generator.revolutions_max :
interpolate( interpolate(

View File

@@ -8377,6 +8377,18 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
gauge.AssignDouble(&mvControlled->AnPos); gauge.AssignDouble(&mvControlled->AnPos);
m_controlmapper.insert( gauge, "shuntmodepower:" ); m_controlmapper.insert( gauge, "shuntmodepower:" );
} }
else if( Label == "heatingvoltage:" ) {
if( mvControlled->HeatingPowerSource.SourceType == TPowerSource::Generator ) {
auto &gauge = Cabine[ Cabindex ].Gauge( -1 ); // pierwsza wolna gałka
gauge.Load( Parser, DynamicObject );
gauge.AssignDouble( &(mvControlled->HeatingPowerSource.EngineGenerator.voltage) );
}
}
else if( Label == "heatingcurrent:" ) {
auto &gauge = Cabine[ Cabindex ].Gauge( -1 ); // pierwsza wolna gałka
gauge.Load( Parser, DynamicObject );
gauge.AssignDouble( &( mvControlled->TotalCurrent ) );
}
else else
{ {
// failed to match the label // failed to match the label

View File

@@ -750,16 +750,13 @@ debug_panel::update_vehicle_brake() const {
void void
debug_panel::update_section_engine( std::vector<text_line> &Output ) { debug_panel::update_section_engine( std::vector<text_line> &Output ) {
// engine data
if( m_input.train == nullptr ) { return; }
if( m_input.vehicle == nullptr ) { return; } if( m_input.vehicle == nullptr ) { return; }
if( m_input.mover == nullptr ) { return; } if( m_input.mover == nullptr ) { return; }
auto const &train { *m_input.train };
auto const &vehicle{ *m_input.vehicle }; auto const &vehicle{ *m_input.vehicle };
auto const &mover{ *m_input.mover }; auto const &mover{ *m_input.mover };
// engine data
// induction motor data // induction motor data
if( mover.EngineType == TEngineType::ElectricInductionMotor ) { if( mover.EngineType == TEngineType::ElectricInductionMotor ) {
@@ -772,7 +769,11 @@ debug_panel::update_section_engine( std::vector<text_line> &Output ) {
+ mover.eimv_labels[ i ] + to_string( mover.eimv[ i ], 2, 9 ); + mover.eimv_labels[ i ] + to_string( mover.eimv[ i ], 2, 9 );
if( i < 10 ) { if( i < 10 ) {
parameters += " | " + train.fPress_labels[ i ] + to_string( train.fPress[ i ][ 0 ], 2, 9 ); // NOTE: we pull consist data from the train structure, so show this data only if we're viewing controlled vehicle
parameters +=
( ( m_input.train != nullptr ) && ( m_input.train->Dynamic() == m_input.vehicle ) ?
" | " + TTrain::fPress_labels[ i ] + to_string( m_input.train->fPress[ i ][ 0 ], 2, 9 ) :
"" );
} }
else if( i == 12 ) { else if( i == 12 ) {
parameters += " med:"; parameters += " med:";
@@ -784,6 +785,7 @@ debug_panel::update_section_engine( std::vector<text_line> &Output ) {
Output.emplace_back( parameters, Global.UITextColor ); Output.emplace_back( parameters, Global.UITextColor );
} }
} }
// diesel engine data
if( mover.EngineType == TEngineType::DieselEngine ) { if( mover.EngineType == TEngineType::DieselEngine ) {
std::string parameterstext = "param value"; std::string parameterstext = "param value";

View File

@@ -1,5 +1,5 @@
#pragma once #pragma once
#define VERSION_MAJOR 19 #define VERSION_MAJOR 19
#define VERSION_MINOR 701 #define VERSION_MINOR 712
#define VERSION_REVISION 0 #define VERSION_REVISION 0