mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-03-22 15:05:03 +01:00
build 200708. motor param table enhancement, pantograph cab control tweaks
This commit is contained in:
@@ -2054,12 +2054,11 @@ void TMoverParameters::PantographsCheck( double const Timestep ) {
|
||||
|
||||
valve.is_active = (
|
||||
( ( valve.spring ? lowvoltagepower : true ) ) // spring actuator needs power to maintain non-default state
|
||||
&& ( ( ( manualcontrol && lowvoltagepower ) ? false == valve.is_disabled : true ) ) // needs power to change state
|
||||
&& ( ( ( manualcontrol && lowvoltagepower ) ? false == valve.is_disabled : true ) ) // needs power to change state, without it just pass through
|
||||
&& ( ( ( manualcontrol && lowvoltagepower ) ? false == PantAllDown : true ) )
|
||||
&& ( ( valve.is_active )
|
||||
|| ( autostart ? lowvoltagepower :
|
||||
!autostart ? ( lowvoltagepower && valve.is_enabled ) :
|
||||
false ) ) ); // shouldn't ever get this far but, eh
|
||||
|| ( manualcontrol && lowvoltagepower && valve.is_enabled )
|
||||
|| ( autostart && lowvoltagepower ) ) ); // shouldn't ever get this far but, eh
|
||||
|
||||
pantograph.is_active = (
|
||||
( valve.is_active )
|
||||
@@ -7240,9 +7239,16 @@ bool TMoverParameters::dizel_EngageChange(double dt)
|
||||
// *************************************************************************************************
|
||||
bool TMoverParameters::dizel_AutoGearCheck(void)
|
||||
{
|
||||
bool OK;
|
||||
auto OK { false };
|
||||
|
||||
auto const VelUp { ( MotorParam[ ScndCtrlActualPos ].mfi0 != 0.0 ?
|
||||
MotorParam[ ScndCtrlActualPos ].mfi0 + ( MotorParam[ ScndCtrlActualPos ].mfi - MotorParam[ ScndCtrlActualPos ].mfi0 ) * std::max( 0.0, eimic_real ) :
|
||||
MotorParam[ ScndCtrlActualPos ].mfi ) };
|
||||
|
||||
auto const VelDown { ( ( MotorParam[ ScndCtrlActualPos ].fi0 != 0.0 ) && ( eimic_real <= 0.0 ) ?
|
||||
MotorParam[ ScndCtrlActualPos ].fi0 :
|
||||
MotorParam[ ScndCtrlActualPos ].fi ) };
|
||||
|
||||
OK = false;
|
||||
if (MotorParam[ScndCtrlActualPos].AutoSwitch && Mains)
|
||||
{
|
||||
if ((RList[MainCtrlPos].Mn == 0)&&(!hydro_TC))
|
||||
@@ -7257,14 +7263,14 @@ bool TMoverParameters::dizel_AutoGearCheck(void)
|
||||
if (MotorParam[ScndCtrlActualPos].AutoSwitch &&
|
||||
(dizel_automaticgearstatus == 0)) // sprawdz czy zmienic biegi
|
||||
{
|
||||
if( Vel > MotorParam[ ScndCtrlActualPos ].mfi ) {
|
||||
if( Vel > VelUp ) {
|
||||
// shift up
|
||||
if( ScndCtrlActualPos < ScndCtrlPosNo ) {
|
||||
dizel_automaticgearstatus = 1;
|
||||
OK = true;
|
||||
}
|
||||
}
|
||||
else if( Vel < MotorParam[ ScndCtrlActualPos ].fi ) {
|
||||
else if( Vel < VelDown ) {
|
||||
// shift down
|
||||
if( ScndCtrlActualPos > 0 ) {
|
||||
dizel_automaticgearstatus = -1;
|
||||
@@ -7465,7 +7471,7 @@ double TMoverParameters::dizel_fillcheck(int mcp, double dt)
|
||||
// napelnienie zalezne od MainCtrlPos
|
||||
if (EIMCtrlType > 0)
|
||||
{
|
||||
realfill = std::max(0.0, eimic_real);
|
||||
realfill = std::max(0.0, std::min(eimic_real, 1 - MotorParam[ ScndCtrlActualPos ].Isat));
|
||||
if (eimic_real>0.005 && !hydro_TC_Lockup)
|
||||
{
|
||||
dizel_nreg_min = std::min(dizel_nreg_min + 2.5 * dt, dizel_nmin_hdrive + eimic_real * dizel_nmin_hdrive_factor);
|
||||
@@ -8634,6 +8640,7 @@ int s2NNW(std::string s)
|
||||
// parsowanie Motor Param Table
|
||||
bool TMoverParameters::readMPT0( std::string const &line ) {
|
||||
|
||||
// TBD, TODO: split into separate functions similar to readMPT if more varied schemes appear?
|
||||
cParser parser( line );
|
||||
if( false == parser.getTokens( 7, false ) ) {
|
||||
WriteLog( "Read MPT0: arguments missing in line " + std::to_string( LISTLINE ) );
|
||||
@@ -8641,13 +8648,28 @@ bool TMoverParameters::readMPT0( std::string const &line ) {
|
||||
}
|
||||
int idx = 0; // numer pozycji
|
||||
parser >> idx;
|
||||
parser
|
||||
>> MotorParam[ idx ].mfi
|
||||
>> MotorParam[ idx ].mIsat
|
||||
>> MotorParam[ idx ].mfi0
|
||||
>> MotorParam[ idx ].fi
|
||||
>> MotorParam[ idx ].Isat
|
||||
>> MotorParam[ idx ].fi0;
|
||||
switch( EngineType ) {
|
||||
case TEngineType::DieselEngine: {
|
||||
parser
|
||||
>> MotorParam[ idx ].mIsat
|
||||
>> MotorParam[ idx ].fi0
|
||||
>> MotorParam[ idx ].fi
|
||||
>> MotorParam[ idx ].mfi0
|
||||
>> MotorParam[ idx ].mfi
|
||||
>> MotorParam[ idx ].Isat;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
parser
|
||||
>> MotorParam[ idx ].mfi
|
||||
>> MotorParam[ idx ].mIsat
|
||||
>> MotorParam[ idx ].mfi0
|
||||
>> MotorParam[ idx ].fi
|
||||
>> MotorParam[ idx ].Isat
|
||||
>> MotorParam[ idx ].fi0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if( true == parser.getTokens( 1, false ) ) {
|
||||
int autoswitch;
|
||||
parser >> autoswitch;
|
||||
|
||||
18
Train.cpp
18
Train.cpp
@@ -2179,7 +2179,7 @@ void TTrain::OnCommand_pantographtogglefront( TTrain *Train, command_data const
|
||||
else if( Command.action == GLFW_RELEASE ) {
|
||||
// impulse switches return automatically to neutral position
|
||||
if( Train->mvOccupied->PantSwitchType == "impulse" ) {
|
||||
auto const ismanual { Train->mvOccupied->Pantographs[ end::front ].valve.start_type == start_t::manual };
|
||||
auto const ismanual { Train->iCabn == 0 };
|
||||
Train->mvOccupied->OperatePantographValve(
|
||||
end::front,
|
||||
operation_t::none,
|
||||
@@ -2211,7 +2211,7 @@ void TTrain::OnCommand_pantographtogglerear( TTrain *Train, command_data const &
|
||||
else if( Command.action == GLFW_RELEASE ) {
|
||||
// impulse switches return automatically to neutral position
|
||||
if( Train->mvOccupied->PantSwitchType == "impulse" ) {
|
||||
auto const ismanual { Train->mvOccupied->Pantographs[ end::rear ].valve.start_type == start_t::manual };
|
||||
auto const ismanual { Train->iCabn == 0 };
|
||||
Train->mvOccupied->OperatePantographValve(
|
||||
end::rear,
|
||||
operation_t::none,
|
||||
@@ -2232,7 +2232,8 @@ void TTrain::OnCommand_pantographraisefront( TTrain *Train, command_data const &
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
auto const ismanual { Train->mvOccupied->Pantographs[ end::front ].valve.start_type == start_t::manual };
|
||||
// HACK: don't propagate pantograph commands issued from engine compartment, these are presumed to be manually moved levers
|
||||
auto const ismanual { Train->iCabn == 0 };
|
||||
Train->mvOccupied->OperatePantographValve(
|
||||
end::front,
|
||||
( Train->mvOccupied->PantSwitchType == "impulse" ?
|
||||
@@ -2258,7 +2259,8 @@ void TTrain::OnCommand_pantographraiserear( TTrain *Train, command_data const &C
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
auto const ismanual { Train->mvOccupied->Pantographs[ end::rear ].valve.start_type == start_t::manual };
|
||||
// HACK: don't propagate pantograph commands issued from engine compartment, these are presumed to be manually moved levers
|
||||
auto const ismanual { Train->iCabn == 0 };
|
||||
Train->mvOccupied->OperatePantographValve(
|
||||
end::rear,
|
||||
( Train->mvOccupied->PantSwitchType == "impulse" ?
|
||||
@@ -2289,7 +2291,8 @@ void TTrain::OnCommand_pantographlowerfront( TTrain *Train, command_data const &
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
auto const ismanual { Train->mvOccupied->Pantographs[ end::front ].valve.start_type == start_t::manual };
|
||||
// HACK: don't propagate pantograph commands issued from engine compartment, these are presumed to be manually moved levers
|
||||
auto const ismanual { Train->iCabn == 0 };
|
||||
Train->mvOccupied->OperatePantographValve(
|
||||
end::front,
|
||||
( Train->mvOccupied->PantSwitchType == "impulse" ?
|
||||
@@ -2319,7 +2322,8 @@ void TTrain::OnCommand_pantographlowerrear( TTrain *Train, command_data const &C
|
||||
|
||||
if( Command.action == GLFW_PRESS ) {
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
auto const ismanual { Train->mvOccupied->Pantographs[ end::rear ].valve.start_type == start_t::manual };
|
||||
// HACK: don't propagate pantograph commands issued from engine compartment, these are presumed to be manually moved levers
|
||||
auto const ismanual { Train->iCabn == 0 };
|
||||
Train->mvOccupied->OperatePantographValve(
|
||||
end::rear,
|
||||
( Train->mvOccupied->PantSwitchType == "impulse" ?
|
||||
@@ -2389,7 +2393,7 @@ void TTrain::OnCommand_pantographtoggleselected( TTrain *Train, command_data con
|
||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||
auto const state {
|
||||
Train->mvPantographUnit->PantsValve.is_enabled
|
||||
| Train->mvPantographUnit->PantsValve.is_active }; // fallback for impulse switches
|
||||
|| Train->mvPantographUnit->PantsValve.is_active }; // fallback for impulse switches
|
||||
if( state ) {
|
||||
OnCommand_pantographlowerselected( Train, Command );
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user