mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 09:19:18 +02:00
leak rate as .fiz parameter, support for low and high horn buttons, brake .fiz parsing fix
This commit is contained in:
@@ -659,6 +659,7 @@ public:
|
|||||||
double CompressorSpeed = 0.0;
|
double CompressorSpeed = 0.0;
|
||||||
/*cisnienie wlaczania, zalaczania sprezarki, wydajnosc sprezarki*/
|
/*cisnienie wlaczania, zalaczania sprezarki, wydajnosc sprezarki*/
|
||||||
TBrakeDelayTable BrakeDelay; /*opoznienie hamowania/odhamowania t/o*/
|
TBrakeDelayTable BrakeDelay; /*opoznienie hamowania/odhamowania t/o*/
|
||||||
|
double AirLeakRate{ 0.01 }; // base rate of air leak from brake system components ( 0.001 = 1 l/sec )
|
||||||
int BrakeCtrlPosNo = 0; /*ilosc pozycji hamulca*/
|
int BrakeCtrlPosNo = 0; /*ilosc pozycji hamulca*/
|
||||||
/*nastawniki:*/
|
/*nastawniki:*/
|
||||||
int MainCtrlPosNo = 0; /*ilosc pozycji nastawnika*/
|
int MainCtrlPosNo = 0; /*ilosc pozycji nastawnika*/
|
||||||
|
|||||||
@@ -2843,8 +2843,7 @@ void TMoverParameters::UpdateBrakePressure(double dt)
|
|||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
void TMoverParameters::CompressorCheck(double dt)
|
void TMoverParameters::CompressorCheck(double dt)
|
||||||
{
|
{
|
||||||
// TODO: expose leak rate as a parameter to the .fiz file
|
CompressedVolume = std::max( 0.0, CompressedVolume - dt * AirLeakRate * 0.1 ); // nieszczelności: 0.001=1l/s
|
||||||
CompressedVolume = std::max( 0.0, CompressedVolume - dt * 0.001 ); // nieszczelności: 0.001=1l/s
|
|
||||||
|
|
||||||
// if (CompressorSpeed>0.0) then //ten warunek został sprawdzony przy wywołaniu funkcji
|
// if (CompressorSpeed>0.0) then //ten warunek został sprawdzony przy wywołaniu funkcji
|
||||||
if (VeselVolume > 0)
|
if (VeselVolume > 0)
|
||||||
@@ -2968,8 +2967,10 @@ void TMoverParameters::CompressorCheck(double dt)
|
|||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
void TMoverParameters::UpdatePipePressure(double dt)
|
void TMoverParameters::UpdatePipePressure(double dt)
|
||||||
{
|
{
|
||||||
// TODO: expose leak rate as a parameter to the .fiz file
|
if( PipePress > 1.0 ) {
|
||||||
PipePress = std::max( 0.0, PipePress - dt * 0.001 ); // nieszczelności: 0.001=1l/s
|
Pipe->Flow( -(PipePress)* AirLeakRate * dt );
|
||||||
|
Pipe->Act();
|
||||||
|
}
|
||||||
|
|
||||||
const double LBDelay = 100;
|
const double LBDelay = 100;
|
||||||
const double kL = 0.5;
|
const double kL = 0.5;
|
||||||
@@ -3187,8 +3188,10 @@ void TMoverParameters::UpdatePipePressure(double dt)
|
|||||||
// *************************************************************************************************
|
// *************************************************************************************************
|
||||||
void TMoverParameters::UpdateScndPipePressure(double dt)
|
void TMoverParameters::UpdateScndPipePressure(double dt)
|
||||||
{
|
{
|
||||||
// TODO: expose leak rate as a parameter to the .fiz file
|
if( ScndPipePress > 1.0 ) {
|
||||||
ScndPipePress = std::max( 0.0, ScndPipePress - dt * 0.001 ); // nieszczelności: 0.001=0.1l/s
|
Pipe2->Flow( -(ScndPipePress)* AirLeakRate * dt );
|
||||||
|
Pipe2->Act();
|
||||||
|
}
|
||||||
|
|
||||||
const double Spz = 0.5067;
|
const double Spz = 0.5067;
|
||||||
TMoverParameters *c;
|
TMoverParameters *c;
|
||||||
@@ -6494,6 +6497,11 @@ void TMoverParameters::LoadFIZ_Brake( std::string const &line ) {
|
|||||||
lookup->second :
|
lookup->second :
|
||||||
1;
|
1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( true == extract_value( AirLeakRate, "AirLeakRate", line, "" ) ) {
|
||||||
|
// the parameter is provided in form of a multiplier, where 1.0 means the default rate of 0.001
|
||||||
|
AirLeakRate *= 0.01;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMoverParameters::LoadFIZ_Doors( std::string const &line ) {
|
void TMoverParameters::LoadFIZ_Doors( std::string const &line ) {
|
||||||
@@ -6705,8 +6713,10 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// mbpm
|
// mbpm
|
||||||
extract_value( MBPM, "MaxBPMass", line, "" );
|
if( true == extract_value( MBPM, "MaxBPMass", line, "" ) ) {
|
||||||
// MBPM *= 1000;
|
// NOTE: only convert the value from tons to kilograms if the entry is present in the config file
|
||||||
|
MBPM *= 1000.0;
|
||||||
|
}
|
||||||
|
|
||||||
// asbtype
|
// asbtype
|
||||||
std::string asb;
|
std::string asb;
|
||||||
|
|||||||
30
Train.cpp
30
Train.cpp
@@ -2742,7 +2742,8 @@ void TTrain::OnCommand_departureannounce( TTrain *Train, command_data const &Com
|
|||||||
|
|
||||||
void TTrain::OnCommand_hornlowactivate( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_hornlowactivate( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
if( Train->ggHornButton.SubModel == nullptr ) {
|
if( ( Train->ggHornButton.SubModel == nullptr )
|
||||||
|
&& ( Train->ggHornLowButton.SubModel == nullptr ) ) {
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
WriteLog( "Horn button is missing, or wasn't defined" );
|
WriteLog( "Horn button is missing, or wasn't defined" );
|
||||||
}
|
}
|
||||||
@@ -2759,11 +2760,13 @@ void TTrain::OnCommand_hornlowactivate( TTrain *Train, command_data const &Comma
|
|||||||
Train->mvControlled->WarningSignal &= ~2;
|
Train->mvControlled->WarningSignal &= ~2;
|
||||||
}
|
}
|
||||||
// audio feedback
|
// audio feedback
|
||||||
if( Train->ggHornButton.GetValue() > -0.5 ) {
|
if( ( Train->ggHornButton.GetValue() > -0.5 )
|
||||||
|
|| ( Train->ggHornLowButton.GetValue() < 0.5 ) ) {
|
||||||
Train->play_sound( Train->dsbSwitch );
|
Train->play_sound( Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggHornButton.UpdateValue( -1.0 );
|
Train->ggHornButton.UpdateValue( -1.0 );
|
||||||
|
Train->ggHornLowButton.UpdateValue( 1.0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( Command.action == GLFW_RELEASE ) {
|
else if( Command.action == GLFW_RELEASE ) {
|
||||||
@@ -2771,17 +2774,20 @@ void TTrain::OnCommand_hornlowactivate( TTrain *Train, command_data const &Comma
|
|||||||
// NOTE: we turn off both low and high horn, due to unreliability of release event when shift key is involved
|
// NOTE: we turn off both low and high horn, due to unreliability of release event when shift key is involved
|
||||||
Train->mvControlled->WarningSignal &= ~( 1 | 2 );
|
Train->mvControlled->WarningSignal &= ~( 1 | 2 );
|
||||||
// audio feedback
|
// audio feedback
|
||||||
if( Train->ggHornButton.GetValue() < -0.5 ) {
|
if( ( Train->ggHornButton.GetValue() < -0.5 )
|
||||||
|
|| ( Train->ggHornLowButton.GetValue() > 0.5 ) ) {
|
||||||
Train->play_sound( Train->dsbSwitch );
|
Train->play_sound( Train->dsbSwitch );
|
||||||
}
|
}
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggHornButton.UpdateValue( 0.0 );
|
Train->ggHornButton.UpdateValue( 0.0 );
|
||||||
|
Train->ggHornLowButton.UpdateValue( 0.0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TTrain::OnCommand_hornhighactivate( TTrain *Train, command_data const &Command ) {
|
void TTrain::OnCommand_hornhighactivate( TTrain *Train, command_data const &Command ) {
|
||||||
|
|
||||||
if( Train->ggHornButton.SubModel == nullptr ) {
|
if( ( Train->ggHornButton.SubModel == nullptr )
|
||||||
|
&& ( Train->ggHornHighButton.SubModel == nullptr ) ) {
|
||||||
if( Command.action == GLFW_PRESS ) {
|
if( Command.action == GLFW_PRESS ) {
|
||||||
WriteLog( "Horn button is missing, or wasn't defined" );
|
WriteLog( "Horn button is missing, or wasn't defined" );
|
||||||
}
|
}
|
||||||
@@ -2803,6 +2809,7 @@ void TTrain::OnCommand_hornhighactivate( TTrain *Train, command_data const &Comm
|
|||||||
}
|
}
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggHornButton.UpdateValue( 1.0 );
|
Train->ggHornButton.UpdateValue( 1.0 );
|
||||||
|
Train->ggHornHighButton.UpdateValue( 1.0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( Command.action == GLFW_RELEASE ) {
|
else if( Command.action == GLFW_RELEASE ) {
|
||||||
@@ -2815,6 +2822,7 @@ void TTrain::OnCommand_hornhighactivate( TTrain *Train, command_data const &Comm
|
|||||||
}
|
}
|
||||||
// visual feedback
|
// visual feedback
|
||||||
Train->ggHornButton.UpdateValue( 0.0 );
|
Train->ggHornButton.UpdateValue( 0.0 );
|
||||||
|
Train->ggHornButton.UpdateValue( 0.0 );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -7399,6 +7407,8 @@ bool TTrain::Update( double const Deltatime )
|
|||||||
ggSignallingButton.Update();
|
ggSignallingButton.Update();
|
||||||
ggNextCurrentButton.Update();
|
ggNextCurrentButton.Update();
|
||||||
ggHornButton.Update();
|
ggHornButton.Update();
|
||||||
|
ggHornLowButton.Update();
|
||||||
|
ggHornHighButton.Update();
|
||||||
ggUniversal1Button.Update();
|
ggUniversal1Button.Update();
|
||||||
ggUniversal2Button.Update();
|
ggUniversal2Button.Update();
|
||||||
ggUniversal3Button.Update();
|
ggUniversal3Button.Update();
|
||||||
@@ -8169,6 +8179,8 @@ void TTrain::clear_cab_controls()
|
|||||||
ggSandButton.Clear();
|
ggSandButton.Clear();
|
||||||
ggAntiSlipButton.Clear();
|
ggAntiSlipButton.Clear();
|
||||||
ggHornButton.Clear();
|
ggHornButton.Clear();
|
||||||
|
ggHornLowButton.Clear();
|
||||||
|
ggHornHighButton.Clear();
|
||||||
ggNextCurrentButton.Clear();
|
ggNextCurrentButton.Clear();
|
||||||
ggUniversal1Button.Clear();
|
ggUniversal1Button.Clear();
|
||||||
ggUniversal2Button.Clear();
|
ggUniversal2Button.Clear();
|
||||||
@@ -8759,7 +8771,15 @@ bool TTrain::initialize_gauge(cParser &Parser, std::string const &Label, int con
|
|||||||
// dzwignia syreny
|
// dzwignia syreny
|
||||||
ggHornButton.Load(Parser, DynamicObject->mdKabina);
|
ggHornButton.Load(Parser, DynamicObject->mdKabina);
|
||||||
}
|
}
|
||||||
else if (Label == "fuse_bt:")
|
else if( Label == "hornlow_bt:" ) {
|
||||||
|
// dzwignia syreny
|
||||||
|
ggHornLowButton.Load( Parser, DynamicObject->mdKabina );
|
||||||
|
}
|
||||||
|
else if( Label == "hornhigh_bt:" ) {
|
||||||
|
// dzwignia syreny
|
||||||
|
ggHornHighButton.Load( Parser, DynamicObject->mdKabina );
|
||||||
|
}
|
||||||
|
else if( Label == "fuse_bt:" )
|
||||||
{
|
{
|
||||||
// bezp. nadmiarowy
|
// bezp. nadmiarowy
|
||||||
ggFuseButton.Load(Parser, DynamicObject->mdKabina);
|
ggFuseButton.Load(Parser, DynamicObject->mdKabina);
|
||||||
|
|||||||
2
Train.h
2
Train.h
@@ -261,6 +261,8 @@ public: // reszta może by?publiczna
|
|||||||
|
|
||||||
// ABu 090305 - syrena i prad nastepnego czlonu
|
// ABu 090305 - syrena i prad nastepnego czlonu
|
||||||
TGauge ggHornButton;
|
TGauge ggHornButton;
|
||||||
|
TGauge ggHornLowButton;
|
||||||
|
TGauge ggHornHighButton;
|
||||||
TGauge ggNextCurrentButton;
|
TGauge ggNextCurrentButton;
|
||||||
// ABu 090305 - uniwersalne przyciski
|
// ABu 090305 - uniwersalne przyciski
|
||||||
TGauge ggUniversal1Button;
|
TGauge ggUniversal1Button;
|
||||||
|
|||||||
Reference in New Issue
Block a user