build 181223. minor diagnostics enhancements, minor bug fixes

This commit is contained in:
tmj-fstate
2018-12-23 21:12:45 +01:00
parent 0ff7d90d9a
commit 44a104bbd6
5 changed files with 58 additions and 30 deletions

View File

@@ -3805,7 +3805,6 @@ TController::UpdateSituation(double dt) {
fAccGravity = 0.0; // przyspieszenie wynikające z pochylenia
double dy; // składowa styczna grawitacji, w przedziale <0,1>
double AbsAccS = 0;
IsLineBreakerClosed = true; // presume things are in working order
TDynamicObject *p = pVehicles[0]; // pojazd na czole składu
while (p)
{ // sprawdzenie odhamowania wszystkich połączonych pojazdów
@@ -3839,15 +3838,28 @@ TController::UpdateSituation(double dt) {
// ciężar razy składowa styczna grawitacji
fAccGravity -= vehicle->TotalMassxg * dy * ( p->DirectionGet() == iDirection ? 1 : -1 );
}
// test state of main switch in all powered vehicles under control
if( ( vehicle->Power > 0.01 )
&& ( ( vehicle == mvControlling )
|| ( p->PrevC( coupling::control ) != nullptr ) ) ) {
IsLineBreakerClosed = ( IsLineBreakerClosed && vehicle->Mains );
}
p = p->Next(); // pojazd podłączony z tyłu (patrząc od czoła)
}
// test state of main switch in all powered vehicles under control
IsLineBreakerClosed = ( mvOccupied->Power > 0.01 ? mvOccupied->Mains : true );
p = pVehicle;
while( ( true == IsLineBreakerClosed )
&& ( ( p = p->PrevC( coupling::control) ) != nullptr ) ) {
auto const *vehicle { p->MoverParameters };
if( vehicle->Power > 0.01 ) {
IsLineBreakerClosed = ( IsLineBreakerClosed && vehicle->Mains );
}
}
p = pVehicle;
while( ( true == IsLineBreakerClosed )
&& ( ( p = p->NextC( coupling::control ) ) != nullptr ) ) {
auto const *vehicle { p->MoverParameters };
if( vehicle->Power > 0.01 ) {
IsLineBreakerClosed = ( IsLineBreakerClosed && vehicle->Mains );
}
}
if( iDirection ) {
// siłę generują pojazdy na pochyleniu ale działa ona całość składu, więc a=F/m
fAccGravity *= iDirection;

View File

@@ -563,7 +563,7 @@ bool TMoverParameters::DirectionForward()
SendCtrlToNext("Direction", ActiveDir, CabNo);
return true;
}
else if ((ActiveDir == 1) && (MainCtrlPos == 0) && (TrainType == dt_EZT))
else if ((ActiveDir == 1) && (MainCtrlPos == 0) && (TrainType == dt_EZT) && (EngineType == TEngineType::ElectricSeriesMotor))
return MinCurrentSwitch(true); //"wysoki rozruch" EN57
return false;
};
@@ -2389,7 +2389,7 @@ bool TMoverParameters::EpFuseSwitch(bool State)
bool TMoverParameters::DirectionBackward(void)
{
bool DB = false;
if ((ActiveDir == 1) && (MainCtrlPos == 0) && (TrainType == dt_EZT))
if ((ActiveDir == 1) && (MainCtrlPos == 0) && (TrainType == dt_EZT) && (EngineType == TEngineType::ElectricSeriesMotor))
if (MinCurrentSwitch(false))
{
DB = true; //
@@ -2737,6 +2737,7 @@ bool TMoverParameters::MainSwitch( bool const State, range_t const Notify ) {
if( Notify != range_t::local ) {
// pass the command to other vehicles
// TBD: pass the requested state, or the actual state?
SendCtrlToNext(
"MainSwitch",
( State ? 1 : 0 ),
@@ -4626,14 +4627,6 @@ double TMoverParameters::TractionForce( double dt ) {
switch( EngineType ) {
case TEngineType::ElectricSeriesMotor: {
/*
if ((Mains)) // nie wchodzić w funkcję bez potrzeby
if ( (std::max(GetTrainsetVoltage(), std::abs(Voltage)) < EnginePowerSource.CollectorParameters.MinV) ||
(std::max(GetTrainsetVoltage(), std::abs(Voltage)) * EnginePowerSource.CollectorParameters.OVP >
EnginePowerSource.CollectorParameters.MaxV))
if( MainSwitch( false, ( TrainType == dt_EZT ? range_t::unit : range_t::local ) ) ) // TODO: check whether we need to send this EMU-wide
EventFlag = true; // wywalanie szybkiego z powodu niewłaściwego napięcia
*/
// update the state of voltage relays
auto const voltage { std::max( GetTrainsetVoltage(), std::abs( RunningTraction.TractionVoltage ) ) };
NoVoltRelay = ( voltage >= EnginePowerSource.CollectorParameters.MinV );
@@ -4645,6 +4638,18 @@ double TMoverParameters::TractionForce( double dt ) {
break;
}
case TEngineType::ElectricInductionMotor: {
// TODO: check if we can use instead the code for electricseriesmotor
if( ( Mains ) ) {
// nie wchodzić w funkcję bez potrzeby
if( ( std::max( GetTrainsetVoltage(), std::abs( RunningTraction.TractionVoltage ) ) < EnginePowerSource.CollectorParameters.MinV )
|| ( std::max( GetTrainsetVoltage(), std::abs( RunningTraction.TractionVoltage ) ) > EnginePowerSource.CollectorParameters.MaxV + 200 ) ) {
MainSwitch( false, ( TrainType == dt_EZT ? range_t::unit : range_t::local ) ); // TODO: check whether we need to send this EMU-wide
}
}
break;
}
case TEngineType::DieselElectric: {
// TODO: move this to the auto relay check when the electric engine code paths are unified
StLinFlag = MotorConnectorsCheck();
@@ -5061,13 +5066,6 @@ double TMoverParameters::TractionForce( double dt ) {
case TEngineType::ElectricInductionMotor:
{
if( ( Mains ) ) {
// nie wchodzić w funkcję bez potrzeby
if( ( std::max( std::abs( Voltage ), GetTrainsetVoltage() ) < EnginePowerSource.CollectorParameters.MinV )
|| ( std::max( std::abs( Voltage ), GetTrainsetVoltage() ) > EnginePowerSource.CollectorParameters.MaxV + 200 ) ) {
MainSwitch( false, ( TrainType == dt_EZT ? range_t::unit : range_t::local ) ); // TODO: check whether we need to send this EMU-wide
}
}
if( true == Mains ) {
//tempomat
if (ScndCtrlPosNo > 1)

View File

@@ -173,10 +173,26 @@ int TSubModel::Load( cParser &parser, TModel3d *Model, /*int Pos,*/ bool dynamic
/*
iVboPtr = Pos; // pozycja w VBO
*/
if (!parser.expectToken("type:"))
ErrorLog("Bad model: expected submodel type definition not found while loading model \"" + Model->NameGet() + "\"" );
auto token { parser.getToken<std::string>() };
if( token != "type:" ) {
std::string errormessage {
"Bad model: expected submodel type definition not found while loading model \"" + Model->NameGet() + "\""
+ "\ncurrent model data stream content: \"" };
auto count { 10 };
while( ( true == parser.getTokens() )
&& ( false == ( token = parser.peek() ).empty() )
&& ( token != "parent:" ) ) {
// skip data until next submodel, dump first few tokens in the error message
if( --count > 0 ) {
errormessage += token + " ";
}
}
errormessage += "(...)\"";
ErrorLog( errormessage );
return 0;
}
{
std::string type = parser.getToken<std::string>();
auto const type { parser.getToken<std::string>() };
if (type == "mesh")
eType = GL_TRIANGLES; // submodel - trójkaty
else if (type == "point")
@@ -189,7 +205,6 @@ int TSubModel::Load( cParser &parser, TModel3d *Model, /*int Pos,*/ bool dynamic
eType = TP_STARS; // wiele punktów świetlnych
};
parser.ignoreToken();
std::string token;
parser.getTokens(1, false); // nazwa submodelu bez zmieny na małe
parser >> token;
Name(token);

View File

@@ -479,6 +479,9 @@ drivermouse_input::default_bindings() {
{ "brakeprofiler_sw:", {
user_command::brakeactingspeedsetrapid,
user_command::brakeactingspeedsetpassenger } },
{ "brakeopmode_sw:", {
user_command::trainbrakeoperationmodeincrease,
user_command::trainbrakeoperationmodedecrease } },
{ "maxcurrent_sw:", {
user_command::motoroverloadrelaythresholdtoggle,
user_command::none } },

View File

@@ -1,5 +1,5 @@
#pragma once
#define VERSION_MAJOR 18
#define VERSION_MINOR 1216
#define VERSION_MINOR 1223
#define VERSION_REVISION 0