mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-23 09:49:19 +02: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.is_active = (
|
||||||
( ( valve.spring ? lowvoltagepower : true ) ) // spring actuator needs power to maintain non-default state
|
( ( 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 ) )
|
&& ( ( ( manualcontrol && lowvoltagepower ) ? false == PantAllDown : true ) )
|
||||||
&& ( ( valve.is_active )
|
&& ( ( valve.is_active )
|
||||||
|| ( autostart ? lowvoltagepower :
|
|| ( manualcontrol && lowvoltagepower && valve.is_enabled )
|
||||||
!autostart ? ( lowvoltagepower && valve.is_enabled ) :
|
|| ( autostart && lowvoltagepower ) ) ); // shouldn't ever get this far but, eh
|
||||||
false ) ) ); // shouldn't ever get this far but, eh
|
|
||||||
|
|
||||||
pantograph.is_active = (
|
pantograph.is_active = (
|
||||||
( valve.is_active )
|
( valve.is_active )
|
||||||
@@ -7240,9 +7239,16 @@ bool TMoverParameters::dizel_EngageChange(double dt)
|
|||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
bool TMoverParameters::dizel_AutoGearCheck(void)
|
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 (MotorParam[ScndCtrlActualPos].AutoSwitch && Mains)
|
||||||
{
|
{
|
||||||
if ((RList[MainCtrlPos].Mn == 0)&&(!hydro_TC))
|
if ((RList[MainCtrlPos].Mn == 0)&&(!hydro_TC))
|
||||||
@@ -7257,14 +7263,14 @@ bool TMoverParameters::dizel_AutoGearCheck(void)
|
|||||||
if (MotorParam[ScndCtrlActualPos].AutoSwitch &&
|
if (MotorParam[ScndCtrlActualPos].AutoSwitch &&
|
||||||
(dizel_automaticgearstatus == 0)) // sprawdz czy zmienic biegi
|
(dizel_automaticgearstatus == 0)) // sprawdz czy zmienic biegi
|
||||||
{
|
{
|
||||||
if( Vel > MotorParam[ ScndCtrlActualPos ].mfi ) {
|
if( Vel > VelUp ) {
|
||||||
// shift up
|
// shift up
|
||||||
if( ScndCtrlActualPos < ScndCtrlPosNo ) {
|
if( ScndCtrlActualPos < ScndCtrlPosNo ) {
|
||||||
dizel_automaticgearstatus = 1;
|
dizel_automaticgearstatus = 1;
|
||||||
OK = true;
|
OK = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( Vel < MotorParam[ ScndCtrlActualPos ].fi ) {
|
else if( Vel < VelDown ) {
|
||||||
// shift down
|
// shift down
|
||||||
if( ScndCtrlActualPos > 0 ) {
|
if( ScndCtrlActualPos > 0 ) {
|
||||||
dizel_automaticgearstatus = -1;
|
dizel_automaticgearstatus = -1;
|
||||||
@@ -7465,7 +7471,7 @@ double TMoverParameters::dizel_fillcheck(int mcp, double dt)
|
|||||||
// napelnienie zalezne od MainCtrlPos
|
// napelnienie zalezne od MainCtrlPos
|
||||||
if (EIMCtrlType > 0)
|
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)
|
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);
|
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
|
// parsowanie Motor Param Table
|
||||||
bool TMoverParameters::readMPT0( std::string const &line ) {
|
bool TMoverParameters::readMPT0( std::string const &line ) {
|
||||||
|
|
||||||
|
// TBD, TODO: split into separate functions similar to readMPT if more varied schemes appear?
|
||||||
cParser parser( line );
|
cParser parser( line );
|
||||||
if( false == parser.getTokens( 7, false ) ) {
|
if( false == parser.getTokens( 7, false ) ) {
|
||||||
WriteLog( "Read MPT0: arguments missing in line " + std::to_string( LISTLINE ) );
|
WriteLog( "Read MPT0: arguments missing in line " + std::to_string( LISTLINE ) );
|
||||||
@@ -8641,6 +8648,18 @@ bool TMoverParameters::readMPT0( std::string const &line ) {
|
|||||||
}
|
}
|
||||||
int idx = 0; // numer pozycji
|
int idx = 0; // numer pozycji
|
||||||
parser >> idx;
|
parser >> idx;
|
||||||
|
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
|
parser
|
||||||
>> MotorParam[ idx ].mfi
|
>> MotorParam[ idx ].mfi
|
||||||
>> MotorParam[ idx ].mIsat
|
>> MotorParam[ idx ].mIsat
|
||||||
@@ -8648,6 +8667,9 @@ bool TMoverParameters::readMPT0( std::string const &line ) {
|
|||||||
>> MotorParam[ idx ].fi
|
>> MotorParam[ idx ].fi
|
||||||
>> MotorParam[ idx ].Isat
|
>> MotorParam[ idx ].Isat
|
||||||
>> MotorParam[ idx ].fi0;
|
>> MotorParam[ idx ].fi0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if( true == parser.getTokens( 1, false ) ) {
|
if( true == parser.getTokens( 1, false ) ) {
|
||||||
int autoswitch;
|
int autoswitch;
|
||||||
parser >> 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 ) {
|
else if( Command.action == GLFW_RELEASE ) {
|
||||||
// impulse switches return automatically to neutral position
|
// impulse switches return automatically to neutral position
|
||||||
if( Train->mvOccupied->PantSwitchType == "impulse" ) {
|
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(
|
Train->mvOccupied->OperatePantographValve(
|
||||||
end::front,
|
end::front,
|
||||||
operation_t::none,
|
operation_t::none,
|
||||||
@@ -2211,7 +2211,7 @@ void TTrain::OnCommand_pantographtogglerear( TTrain *Train, command_data const &
|
|||||||
else if( Command.action == GLFW_RELEASE ) {
|
else if( Command.action == GLFW_RELEASE ) {
|
||||||
// impulse switches return automatically to neutral position
|
// impulse switches return automatically to neutral position
|
||||||
if( Train->mvOccupied->PantSwitchType == "impulse" ) {
|
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(
|
Train->mvOccupied->OperatePantographValve(
|
||||||
end::rear,
|
end::rear,
|
||||||
operation_t::none,
|
operation_t::none,
|
||||||
@@ -2232,7 +2232,8 @@ void TTrain::OnCommand_pantographraisefront( TTrain *Train, command_data const &
|
|||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// 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(
|
Train->mvOccupied->OperatePantographValve(
|
||||||
end::front,
|
end::front,
|
||||||
( Train->mvOccupied->PantSwitchType == "impulse" ?
|
( Train->mvOccupied->PantSwitchType == "impulse" ?
|
||||||
@@ -2258,7 +2259,8 @@ void TTrain::OnCommand_pantographraiserear( TTrain *Train, command_data const &C
|
|||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// 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(
|
Train->mvOccupied->OperatePantographValve(
|
||||||
end::rear,
|
end::rear,
|
||||||
( Train->mvOccupied->PantSwitchType == "impulse" ?
|
( Train->mvOccupied->PantSwitchType == "impulse" ?
|
||||||
@@ -2289,7 +2291,8 @@ void TTrain::OnCommand_pantographlowerfront( TTrain *Train, command_data const &
|
|||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// 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(
|
Train->mvOccupied->OperatePantographValve(
|
||||||
end::front,
|
end::front,
|
||||||
( Train->mvOccupied->PantSwitchType == "impulse" ?
|
( Train->mvOccupied->PantSwitchType == "impulse" ?
|
||||||
@@ -2319,7 +2322,8 @@ void TTrain::OnCommand_pantographlowerrear( TTrain *Train, command_data const &C
|
|||||||
|
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
// 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(
|
Train->mvOccupied->OperatePantographValve(
|
||||||
end::rear,
|
end::rear,
|
||||||
( Train->mvOccupied->PantSwitchType == "impulse" ?
|
( 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
|
// only reacting to press, so the switch doesn't flip back and forth if key is held down
|
||||||
auto const state {
|
auto const state {
|
||||||
Train->mvPantographUnit->PantsValve.is_enabled
|
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 ) {
|
if( state ) {
|
||||||
OnCommand_pantographlowerselected( Train, Command );
|
OnCommand_pantographlowerselected( Train, Command );
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user