mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 20:59:19 +02:00
build 190712. heating generator state cab controls, engine state ui readout fix, minor ai logic tweaks
This commit is contained in:
41
Driver.cpp
41
Driver.cpp
@@ -3440,30 +3440,35 @@ void TController::SpeedSet()
|
||||
break;
|
||||
case TEngineType::DieselEngine:
|
||||
// Ra 2014-06: "automatyczna" skrzynia biegów...
|
||||
if (!mvControlling->MotorParam[mvControlling->ScndCtrlPos].AutoSwitch) // gdy biegi ręczne
|
||||
if ((mvControlling->ShuntMode ? mvControlling->AnPos : 1.0) * mvControlling->Vel >
|
||||
0.75 * mvControlling->MotorParam[mvControlling->ScndCtrlPos].mfi)
|
||||
if( false == mvControlling->MotorParam[ mvControlling->ScndCtrlPos ].AutoSwitch ) {
|
||||
// gdy biegi ręczne
|
||||
if( ( mvControlling->ShuntMode ? mvControlling->AnPos : 1.0 ) * mvControlling->Vel >
|
||||
0.75 * mvControlling->MotorParam[ mvControlling->ScndCtrlPos ].mfi )
|
||||
// if (mvControlling->enrot>0.95*mvControlling->dizel_nMmax) //youBy: jeśli obroty >
|
||||
// 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
|
||||
mvControlling->DecMainCtrl(2);
|
||||
if (mvControlling->IncScndCtrl(1))
|
||||
if (mvControlling->MotorParam[mvControlling->ScndCtrlPos].mIsat ==
|
||||
0.0) // jeśli bieg jałowy
|
||||
mvControlling->IncScndCtrl(1); // to kolejny
|
||||
if( mvControlling->ScndCtrlPos < mvControlling->ScndCtrlPosNo ) {
|
||||
// ...presuming there is a higher gear
|
||||
mvControlling->DecMainCtrl( 2 );
|
||||
if( mvControlling->IncScndCtrl( 1 ) ) {
|
||||
while( ( mvControlling->MotorParam[ mvControlling->ScndCtrlPos ].mIsat == 0.0 ) // jeśli bieg jałowy
|
||||
&& ( mvControlling->IncScndCtrl( 1 ) ) ) { // to kolejny
|
||||
;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if ((mvControlling->ShuntMode ? mvControlling->AnPos : 1.0) * mvControlling->Vel <
|
||||
mvControlling->MotorParam[mvControlling->ScndCtrlPos].fi)
|
||||
{ // jak prędkość mniejsza niż minimalna na danym biegu, wrzucić niższy
|
||||
mvControlling->DecMainCtrl(2);
|
||||
mvControlling->DecScndCtrl(1);
|
||||
if (mvControlling->MotorParam[mvControlling->ScndCtrlPos].mIsat ==
|
||||
0.0) // jeśli bieg jałowy
|
||||
if (mvControlling->ScndCtrlPos) // a jeszcze zera nie osiągnięto
|
||||
mvControlling->DecScndCtrl(1); // to kolejny wcześniejszy
|
||||
else if( ( mvControlling->ShuntMode ? mvControlling->AnPos : 1.0 ) * mvControlling->Vel <
|
||||
mvControlling->MotorParam[ mvControlling->ScndCtrlPos ].fi ) { // jak prędkość mniejsza niż minimalna na danym biegu, wrzucić niższy
|
||||
mvControlling->DecMainCtrl( 2 );
|
||||
mvControlling->DecScndCtrl( 1 );
|
||||
if( mvControlling->MotorParam[ mvControlling->ScndCtrlPos ].mIsat == 0.0 ) // jeśli bieg jałowy
|
||||
if( mvControlling->ScndCtrlPos ) // a jeszcze zera nie osiągnięto
|
||||
mvControlling->DecScndCtrl( 1 ); // to kolejny wcześniejszy
|
||||
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;
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1572,6 +1572,8 @@ void TMoverParameters::HeatingCheck( double const Timestep ) {
|
||||
|
||||
auto const absrevolutions { std::abs( generator.revolutions ) };
|
||||
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_max ? generator.voltage_max * absrevolutions / generator.revolutions_max :
|
||||
interpolate(
|
||||
|
||||
12
Train.cpp
12
Train.cpp
@@ -8377,6 +8377,18 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
||||
gauge.AssignDouble(&mvControlled->AnPos);
|
||||
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
|
||||
{
|
||||
// failed to match the label
|
||||
|
||||
@@ -750,17 +750,14 @@ debug_panel::update_vehicle_brake() const {
|
||||
|
||||
void
|
||||
debug_panel::update_section_engine( std::vector<text_line> &Output ) {
|
||||
|
||||
if( m_input.train == nullptr ) { return; }
|
||||
// engine data
|
||||
if( m_input.vehicle == nullptr ) { return; }
|
||||
if( m_input.mover == nullptr ) { return; }
|
||||
|
||||
auto const &train { *m_input.train };
|
||||
auto const &vehicle{ *m_input.vehicle };
|
||||
auto const &mover{ *m_input.mover };
|
||||
|
||||
// engine data
|
||||
// induction motor data
|
||||
// induction motor data
|
||||
if( mover.EngineType == TEngineType::ElectricInductionMotor ) {
|
||||
|
||||
Output.emplace_back( " eimc: eimv: press:", Global.UITextColor );
|
||||
@@ -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 );
|
||||
|
||||
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 ) {
|
||||
parameters += " med:";
|
||||
@@ -784,6 +785,7 @@ debug_panel::update_section_engine( std::vector<text_line> &Output ) {
|
||||
Output.emplace_back( parameters, Global.UITextColor );
|
||||
}
|
||||
}
|
||||
// diesel engine data
|
||||
if( mover.EngineType == TEngineType::DieselEngine ) {
|
||||
|
||||
std::string parameterstext = "param value";
|
||||
|
||||
Reference in New Issue
Block a user