mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-09-01 12:49:18 +02:00
Merge branch 'tmj-dev' into milek-dev
This commit is contained in:
@@ -355,7 +355,7 @@ enum TBrakeSystem { Individual, Pneumatic, ElectroPneumatic };
|
||||
/*podtypy hamulcow zespolonych*/
|
||||
enum TBrakeSubSystem { ss_None, ss_W, ss_K, ss_KK, ss_Hik, ss_ESt, ss_KE, ss_LSt, ss_MT, ss_Dako };
|
||||
enum TBrakeValve { NoValve, W, W_Lu_VI, W_Lu_L, W_Lu_XR, K, Kg, Kp, Kss, Kkg, Kkp, Kks, Hikg1, Hikss, Hikp1, KE, SW, EStED, NESt3, ESt3, LSt, ESt4, ESt3AL2, EP1, EP2, M483, CV1_L_TR, CV1, CV1_R, Other };
|
||||
enum TBrakeHandle { NoHandle, West, FV4a, M394, M254, FVel1, FVel6, D2, Knorr, FD1, BS2, testH, St113, MHZ_P, MHZ_T, MHZ_EN57 };
|
||||
enum TBrakeHandle { NoHandle, West, FV4a, M394, M254, FVel1, FVel6, D2, Knorr, FD1, BS2, testH, St113, MHZ_P, MHZ_T, MHZ_EN57, MHZ_K5P };
|
||||
/*typy hamulcow indywidualnych*/
|
||||
enum TLocalBrake { NoBrake, ManualBrake, PneumaticBrake, HydraulicBrake };
|
||||
/*dla osob/towar: opoznienie hamowania/odhamowania*/
|
||||
@@ -669,6 +669,7 @@ struct heat_data {
|
||||
// bool okienko { true }; // window in the engine compartment
|
||||
// system configuration
|
||||
bool auxiliary_water_circuit { false }; // cooling system has an extra water circuit
|
||||
double fan_speed { 0.075 }; // cooling fan rpm; either fraction of engine rpm, or absolute value if negative
|
||||
// heat exchange factors
|
||||
double kw { 0.35 };
|
||||
double kv { 0.6 };
|
||||
@@ -740,6 +741,7 @@ public:
|
||||
double Mred = 0.0; /*Ra: zredukowane masy wirujące; potrzebne do obliczeń hamowania*/
|
||||
double TotalMass = 0.0; /*wyliczane przez ComputeMass*/
|
||||
double HeatingPower = 0.0;
|
||||
double EngineHeatingRPM { 0.0 }; // guaranteed engine revolutions with heating enabled
|
||||
double LightPower = 0.0; /*moc pobierana na ogrzewanie/oswietlenie*/
|
||||
double BatteryVoltage = 0.0; /*Winger - baterie w elektrykach*/
|
||||
bool Battery = false; /*Czy sa zalavzone baterie*/
|
||||
|
||||
@@ -1614,7 +1614,7 @@ void TMoverParameters::OilPumpCheck( double const Timestep ) {
|
||||
|
||||
OilPump.pressure_target = (
|
||||
enrot > 0.1 ? interpolate( minpressure, OilPump.pressure_maximum, static_cast<float>( clamp( enrot / maxrevolutions, 0.0, 1.0 ) ) ) * OilPump.resource_amount :
|
||||
true == OilPump.is_active ? minpressure :
|
||||
true == OilPump.is_active ? std::min( minpressure + 0.1f, OilPump.pressure_maximum ) : // slight pressure margin to give time to switch off the pump and start the engine
|
||||
0.f );
|
||||
|
||||
if( OilPump.pressure_present < OilPump.pressure_target ) {
|
||||
@@ -3300,7 +3300,7 @@ void TMoverParameters::CompressorCheck(double dt)
|
||||
CompressedVolume +=
|
||||
CompressorSpeed
|
||||
* ( 2.0 * MaxCompressor - Compressor ) / MaxCompressor
|
||||
* ( DElist[ MainCtrlPos ].RPM / DElist[ MainCtrlPosNo ].RPM )
|
||||
* ( ( 60.0 * std::abs( enrot ) ) / DElist[ MainCtrlPosNo ].RPM )
|
||||
* dt;
|
||||
}
|
||||
else {
|
||||
@@ -3465,7 +3465,7 @@ void TMoverParameters::CompressorCheck(double dt)
|
||||
// the compressor is coupled with the diesel engine, engine revolutions affect the output
|
||||
if( false == CompressorGovernorLock ) {
|
||||
auto const enginefactor { (
|
||||
EngineType == DieselElectric ? ( DElist[ MainCtrlPos ].RPM / DElist[ MainCtrlPosNo ].RPM ) :
|
||||
EngineType == DieselElectric ? ( ( 60.0 * std::abs( enrot ) ) / DElist[ MainCtrlPosNo ].RPM ) :
|
||||
EngineType == DieselEngine ? ( std::abs( enrot ) / nmax ) :
|
||||
1.0 ) }; // shouldn't ever get here but, eh
|
||||
CompressedVolume +=
|
||||
@@ -4424,8 +4424,7 @@ double TMoverParameters::CouplerForce(int CouplerN, double dt)
|
||||
// Q: 20160714
|
||||
// oblicza sile trakcyjna lokomotywy (dla elektrowozu tez calkowity prad)
|
||||
// *************************************************************************************************
|
||||
double TMoverParameters::TractionForce(double dt)
|
||||
{
|
||||
double TMoverParameters::TractionForce( double dt ) {
|
||||
double PosRatio, dmoment, dtrans, tmp;
|
||||
|
||||
Ft = 0;
|
||||
@@ -4441,13 +4440,15 @@ double TMoverParameters::TractionForce(double dt)
|
||||
|
||||
if( ( true == Heating )
|
||||
&& ( HeatingPower > 0 )
|
||||
&& ( MainCtrlPosNo > MainCtrlPos ) ) {
|
||||
|
||||
int i = MainCtrlPosNo;
|
||||
while( DElist[ i - 2 ].RPM / 60.0 > tmp ) {
|
||||
--i;
|
||||
}
|
||||
tmp = DElist[ i ].RPM / 60.0;
|
||||
&& ( EngineHeatingRPM > 0 ) ) {
|
||||
// bump engine revolutions up if needed, when heating is on
|
||||
tmp =
|
||||
std::max(
|
||||
tmp,
|
||||
std::min(
|
||||
DElist[ MainCtrlPosNo ].RPM,
|
||||
EngineHeatingRPM )
|
||||
/ 60.0 );
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -4458,8 +4459,8 @@ double TMoverParameters::TractionForce(double dt)
|
||||
enrot = clamp(
|
||||
enrot + ( dt / 1.25 ) * ( // TODO: equivalent of dizel_aim instead of fixed inertia
|
||||
enrot < tmp ?
|
||||
1.0 :
|
||||
-2.0 ), // NOTE: revolutions drop faster than they rise, maybe? TBD: maybe not
|
||||
1.0 :
|
||||
-2.0 ), // NOTE: revolutions drop faster than they rise, maybe? TBD: maybe not
|
||||
0.0, std::max( tmp, enrot ) );
|
||||
if( std::abs( tmp - enrot ) < 0.001 ) {
|
||||
enrot = tmp;
|
||||
@@ -4501,7 +4502,7 @@ double TMoverParameters::TractionForce(double dt)
|
||||
|
||||
case 1: { // manual
|
||||
if( ( ActiveDir != 0 )
|
||||
&& ( RList[ MainCtrlActualPos ].R > RVentCutOff ) ) {
|
||||
&& ( RList[ MainCtrlActualPos ].R > RVentCutOff ) ) {
|
||||
RventRot += ( RVentnmax - RventRot ) * RVentSpeed * dt;
|
||||
}
|
||||
else {
|
||||
@@ -4513,7 +4514,7 @@ double TMoverParameters::TractionForce(double dt)
|
||||
case 2: { // automatic
|
||||
auto const motorcurrent{ std::min<double>( ImaxHi, std::abs( Im ) ) };
|
||||
if( ( std::abs( Itot ) > RVentMinI )
|
||||
&& ( RList[ MainCtrlActualPos ].R > RVentCutOff ) ) {
|
||||
&& ( RList[ MainCtrlActualPos ].R > RVentCutOff ) ) {
|
||||
|
||||
RventRot +=
|
||||
( RVentnmax
|
||||
@@ -4523,7 +4524,7 @@ double TMoverParameters::TractionForce(double dt)
|
||||
* RVentSpeed * dt;
|
||||
}
|
||||
else if( ( DynamicBrakeType == dbrake_automatic )
|
||||
&& ( true == DynamicBrakeFlag ) ) {
|
||||
&& ( true == DynamicBrakeFlag ) ) {
|
||||
RventRot += ( RVentnmax * motorcurrent / ImaxLo - RventRot ) * RVentSpeed * dt;
|
||||
}
|
||||
else {
|
||||
@@ -4577,13 +4578,35 @@ double TMoverParameters::TractionForce(double dt)
|
||||
}
|
||||
}
|
||||
|
||||
switch( EngineType ) {
|
||||
case Dumb: {
|
||||
PosRatio = ( MainCtrlPos + ScndCtrlPos ) / ( MainCtrlPosNo + ScndCtrlPosNo + 0.01 );
|
||||
EnginePower = 1000.0 * Power * PosRatio;
|
||||
break;
|
||||
}
|
||||
case DieselEngine: {
|
||||
EnginePower = ( 2 * dizel_Mstand + dmoment ) * enrot * ( 2.0 * M_PI / 1000.0 );
|
||||
if( MainCtrlPos > 1 ) {
|
||||
// dodatkowe opory z powodu sprezarki}
|
||||
dmoment -= dizel_Mstand * ( 0.2 * enrot / dizel_nmax );
|
||||
}
|
||||
break;
|
||||
}
|
||||
case DieselElectric: {
|
||||
EnginePower = 0; // the actual calculation is done in two steps later in the method
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (ActiveDir != 0)
|
||||
switch (EngineType)
|
||||
{
|
||||
case Dumb:
|
||||
{
|
||||
PosRatio = (MainCtrlPos + ScndCtrlPos) / (MainCtrlPosNo + ScndCtrlPosNo + 0.01);
|
||||
if (Mains && (ActiveDir != 0) && (CabNo != 0))
|
||||
if (Mains && (CabNo != 0))
|
||||
{
|
||||
if (Vel > 0.1)
|
||||
{
|
||||
@@ -4595,7 +4618,6 @@ double TMoverParameters::TractionForce(double dt)
|
||||
}
|
||||
else
|
||||
Ft = 0;
|
||||
EnginePower = 1000.0 * Power * PosRatio;
|
||||
break;
|
||||
} // Dumb
|
||||
|
||||
@@ -4680,11 +4702,6 @@ double TMoverParameters::TractionForce(double dt)
|
||||
|
||||
case DieselEngine:
|
||||
{
|
||||
EnginePower = ( 2 * dizel_Mstand + dmoment ) * enrot * ( 2.0 * M_PI / 1000.0 );
|
||||
if( MainCtrlPos > 1 ) {
|
||||
// dodatkowe opory z powodu sprezarki}
|
||||
dmoment -= dizel_Mstand * ( 0.2 * enrot / dizel_nmax );
|
||||
}
|
||||
Mm = dmoment; //bylo * dizel_engage
|
||||
Mw = Mm * dtrans; // dmoment i dtrans policzone przy okazji enginerotation
|
||||
Fw = Mw * 2.0 / WheelDiameter / NPoweredAxles;
|
||||
@@ -4702,6 +4719,7 @@ double TMoverParameters::TractionForce(double dt)
|
||||
if( ( true == Mains ) && ( MainCtrlPos > 0 ) ) {
|
||||
Voltage = ( SST[ MainCtrlPos ].Umax * AnPos ) + ( SST[ MainCtrlPos ].Umin * ( 1.0 - AnPos ) );
|
||||
// NOTE: very crude way to approximate power generated at current rpm instead of instant top output
|
||||
// NOTE, TODO: doesn't take into account potentially increased revolutions if heating is on, fix it
|
||||
auto const rpmratio { 60.0 * enrot / DElist[ MainCtrlPos ].RPM };
|
||||
tmp = rpmratio * ( SST[ MainCtrlPos ].Pmax * AnPos ) + ( SST[ MainCtrlPos ].Pmin * ( 1.0 - AnPos ) );
|
||||
Ft = tmp * 1000.0 / ( abs( tmpV ) + 1.6 );
|
||||
@@ -4718,6 +4736,7 @@ double TMoverParameters::TractionForce(double dt)
|
||||
if( true == Heating ) { power -= HeatingPower; }
|
||||
if( power < 0.0 ) { power = 0.0; }
|
||||
// NOTE: very crude way to approximate power generated at current rpm instead of instant top output
|
||||
// NOTE, TODO: doesn't take into account potentially increased revolutions if heating is on, fix it
|
||||
auto const currentgenpower { (
|
||||
DElist[ MainCtrlPos ].RPM > 0 ?
|
||||
DElist[ MainCtrlPos ].GenPower * ( 60.0 * enrot / DElist[ MainCtrlPos ].RPM ) :
|
||||
@@ -4833,6 +4852,8 @@ double TMoverParameters::TractionForce(double dt)
|
||||
else {
|
||||
if( AutoRelayFlag ) {
|
||||
|
||||
auto const shuntfieldstate { ScndCtrlPos };
|
||||
|
||||
switch( RelayType ) {
|
||||
|
||||
case 0: {
|
||||
@@ -4978,6 +4999,10 @@ double TMoverParameters::TractionForce(double dt)
|
||||
break;
|
||||
}
|
||||
} // switch RelayType
|
||||
|
||||
if( ScndCtrlPos != shuntfieldstate ) {
|
||||
SetFlag( SoundFlag, ( sound::relay | sound::shuntfield ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -4993,9 +5018,7 @@ double TMoverParameters::TractionForce(double dt)
|
||||
}
|
||||
}
|
||||
if( true == Mains ) {
|
||||
|
||||
//tempomat
|
||||
|
||||
if (ScndCtrlPosNo > 1)
|
||||
{
|
||||
if (ScndCtrlPos != NewSpeed)
|
||||
@@ -5019,7 +5042,6 @@ double TMoverParameters::TractionForce(double dt)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
dtrans = Hamulec->GetEDBCP();
|
||||
if (((DoorLeftOpened) || (DoorRightOpened)))
|
||||
DynamicBrakeFlag = true;
|
||||
@@ -5239,6 +5261,20 @@ double TMoverParameters::TractionForce(double dt)
|
||||
break;
|
||||
}
|
||||
} // case EngineType
|
||||
|
||||
switch( EngineType ) {
|
||||
case DieselElectric: {
|
||||
// rough approximation of extra effort to overcome friction etc
|
||||
auto const rpmratio{ 60.0 * enrot / DElist[ MainCtrlPosNo ].RPM };
|
||||
EnginePower += rpmratio * 0.2 * DElist[ MainCtrlPosNo ].GenPower;
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
return Ft;
|
||||
}
|
||||
|
||||
@@ -5986,6 +6022,18 @@ bool TMoverParameters::dizel_AutoGearCheck(void)
|
||||
case 2:
|
||||
dizel_EngageSwitch(1.0);
|
||||
break;
|
||||
case 3:
|
||||
if (Vel>dizel_minVelfullengage)
|
||||
dizel_EngageSwitch(1.0);
|
||||
else
|
||||
dizel_EngageSwitch(0.5);
|
||||
break;
|
||||
case 4:
|
||||
if (Vel>dizel_minVelfullengage)
|
||||
dizel_EngageSwitch(1.0);
|
||||
else
|
||||
dizel_EngageSwitch(0.66);
|
||||
break;
|
||||
default:
|
||||
if (hydro_TC && hydro_TC_Fill>0.01)
|
||||
dizel_EngageSwitch(1.0);
|
||||
@@ -6125,6 +6173,18 @@ double TMoverParameters::dizel_fillcheck(int mcp)
|
||||
else
|
||||
nreg = dizel_nmin;
|
||||
break;
|
||||
case 3:
|
||||
if ((dizel_automaticgearstatus == 0) && (Vel > dizel_minVelfullengage))
|
||||
nreg = dizel_nmax;
|
||||
else
|
||||
nreg = dizel_nmin;
|
||||
break;
|
||||
case 4:
|
||||
if ((dizel_automaticgearstatus == 0) && (Vel > dizel_minVelfullengage))
|
||||
nreg = dizel_nmax;
|
||||
else
|
||||
nreg = dizel_nmin * 0.75 + dizel_nmax * 0.25;
|
||||
break;
|
||||
default:
|
||||
realfill = 0; // sluczaj
|
||||
break;
|
||||
@@ -6401,7 +6461,7 @@ void TMoverParameters::dizel_Heat( double const dt ) {
|
||||
&& ( dizel_heat.water_aux.config.temp_cooling > 0 )
|
||||
&& ( dizel_heat.temperatura2 > dizel_heat.water_aux.config.temp_cooling - ( dizel_heat.water_aux.is_warm ? 8 : 0 ) ) ) );
|
||||
auto const PTC2 { ( dizel_heat.water_aux.is_warm /*or PTC2p*/ ? 1 : 0 ) };
|
||||
dizel_heat.rpmwz2 = PTC2 * 80 * rpm / ( ( 0.5 * rpm ) + 500 );
|
||||
dizel_heat.rpmwz2 = PTC2 * ( dizel_heat.fan_speed >= 0 ? ( rpm * dizel_heat.fan_speed ) : ( dizel_heat.fan_speed * -1 ) );
|
||||
dizel_heat.zaluzje2 = ( dizel_heat.water_aux.config.shutters ? ( PTC2 == 1 ) : true ); // no shutters is an equivalent to having them open
|
||||
auto const zaluzje2 { ( dizel_heat.zaluzje2 ? 1 : 0 ) };
|
||||
// auxiliary water circuit heat transfer values
|
||||
@@ -6429,7 +6489,7 @@ void TMoverParameters::dizel_Heat( double const dt ) {
|
||||
&& ( dizel_heat.water.config.temp_cooling > 0 )
|
||||
&& ( dizel_heat.temperatura1 > dizel_heat.water.config.temp_cooling - ( dizel_heat.water.is_warm ? 8 : 0 ) ) ) );
|
||||
auto const PTC1 { ( dizel_heat.water.is_warm /*or PTC1p*/ ? 1 : 0 ) };
|
||||
dizel_heat.rpmwz = PTC1 * 80 * rpm / ( ( 0.5 * rpm ) + 500 );
|
||||
dizel_heat.rpmwz = PTC1 * ( dizel_heat.fan_speed >= 0 ? ( rpm * dizel_heat.fan_speed ) : ( dizel_heat.fan_speed * -1 ) );
|
||||
dizel_heat.zaluzje1 = ( dizel_heat.water.config.shutters ? ( PTC1 == 1 ) : true ); // no shutters is an equivalent to having them open
|
||||
auto const zaluzje1 { ( dizel_heat.zaluzje1 ? 1 : 0 ) };
|
||||
// primary water circuit heat transfer values
|
||||
@@ -8030,6 +8090,7 @@ void TMoverParameters::LoadFIZ_Cntrl( std::string const &line ) {
|
||||
{ "test", testH },
|
||||
{ "D2", D2 },
|
||||
{ "MHZ_EN57", MHZ_EN57 },
|
||||
{ "MHZ_K5P", MHZ_K5P },
|
||||
{ "M394", M394 },
|
||||
{ "Knorr", Knorr },
|
||||
{ "Westinghouse", West },
|
||||
@@ -8385,6 +8446,7 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &Input ) {
|
||||
ImaxHi = 2;
|
||||
ImaxLo = 1;
|
||||
}
|
||||
extract_value( EngineHeatingRPM, "HeatingRPM", Input, "" );
|
||||
break;
|
||||
}
|
||||
case ElectricInductionMotor: {
|
||||
@@ -8415,8 +8477,7 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &Input ) {
|
||||
extract_value( eimc[ eimc_p_eped ], "edep", Input, "" );
|
||||
extract_value( EIMCLogForce, "eimclf", Input, "" );
|
||||
|
||||
Flat = ( extract_value( "Flat", Input ) == "1" );
|
||||
|
||||
extract_value( Flat, "Flat", Input, "");
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
@@ -8450,6 +8511,7 @@ void TMoverParameters::LoadFIZ_Engine( std::string const &Input ) {
|
||||
extract_value( dizel_heat.water_aux.config.shutters, "WaterAuxShutters", Input, "" );
|
||||
extract_value( dizel_heat.oil.config.temp_min, "OilMinTemperature", Input, "" );
|
||||
extract_value( dizel_heat.oil.config.temp_max, "OilMaxTemperature", Input, "" );
|
||||
extract_value( dizel_heat.fan_speed, "WaterCoolingFanSpeed", Input, "" );
|
||||
// water heater
|
||||
extract_value( WaterHeater.config.temp_min, "HeaterMinTemperature", Input, "" );
|
||||
extract_value( WaterHeater.config.temp_max, "HeaterMaxTemperature", Input, "" );
|
||||
@@ -8836,6 +8898,9 @@ bool TMoverParameters::CheckLocomotiveParameters(bool ReadyFlag, int Dir)
|
||||
case St113:
|
||||
Handle = std::make_shared<TSt113>();
|
||||
break;
|
||||
case MHZ_K5P:
|
||||
Handle = std::make_shared<TMHZ_K5P>();
|
||||
break;
|
||||
default:
|
||||
Handle = std::make_shared<TDriverHandle>();
|
||||
}
|
||||
@@ -9515,6 +9580,7 @@ bool TMoverParameters::RunCommand( std::string Command, double CValue1, double C
|
||||
else {
|
||||
OK = false;
|
||||
}
|
||||
SendCtrlToNext( Command, CValue1, CValue2, Couplertype );
|
||||
}
|
||||
else if (Command == "Sandbox")
|
||||
{
|
||||
|
||||
@@ -23,6 +23,7 @@ Copyright (C) 2007-2014 Maciej Cierniak
|
||||
static double const DPL = 0.25;
|
||||
double const TFV4aM::pos_table[11] = {-2, 6, -1, 0, -2, 1, 4, 6, 0, 0, 0};
|
||||
double const TMHZ_EN57::pos_table[11] = {-1, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0};
|
||||
double const TMHZ_K5P::pos_table[11] = { -1, 3, -1, 0, 1, 1, 2, 3, 0, 0, 0 };
|
||||
double const TM394::pos_table[11] = {-1, 5, -1, 0, 1, 2, 4, 5, 0, 0, 0};
|
||||
double const TH14K1::BPT_K[6][2] = {{10, 0}, {4, 1}, {0, 1}, {4, 0}, {4, -1}, {15, -1}};
|
||||
double const TH14K1::pos_table[11] = {-1, 4, -1, 0, 1, 2, 3, 4, 0, 0, 0};
|
||||
@@ -2516,7 +2517,7 @@ bool TFV4aM::EQ(double pos, double i_pos)
|
||||
return (pos <= i_pos + 0.5) && (pos > i_pos - 0.5);
|
||||
}
|
||||
|
||||
//---FV4a/M--- nowonapisany kran bez poprawki IC
|
||||
//---MHZ_EN57--- manipulator hamulca zespolonego do EN57
|
||||
|
||||
double TMHZ_EN57::GetPF( double i_bcp, double PP, double HP, double dt, double ep ) {
|
||||
static int const LBDelay = 100;
|
||||
@@ -2656,6 +2657,119 @@ bool TMHZ_EN57::EQ(double pos, double i_pos)
|
||||
return (pos <= i_pos + 0.5) && (pos > i_pos - 0.5);
|
||||
}
|
||||
|
||||
//---MHZ_K5P--- manipulator hamulca zespolonego Knorr 5-ciopozycyjny
|
||||
|
||||
double TMHZ_K5P::GetPF(double i_bcp, double PP, double HP, double dt, double ep) {
|
||||
static int const LBDelay = 100;
|
||||
|
||||
double LimPP;
|
||||
double dpPipe;
|
||||
double dpMainValve;
|
||||
double ActFlowSpeed;
|
||||
double DP;
|
||||
double pom;
|
||||
|
||||
for (int idx = 0; idx < 5; ++idx) {
|
||||
Sounds[idx] = 0;
|
||||
}
|
||||
|
||||
DP = 0;
|
||||
|
||||
i_bcp = Max0R(Min0R(i_bcp, 2.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
|
||||
|
||||
if ((TP > 0))
|
||||
{
|
||||
DP = 0.004;
|
||||
TP = TP - DP * dt;
|
||||
Sounds[s_fv4a_t] = DP;
|
||||
}
|
||||
else
|
||||
{
|
||||
TP = 0;
|
||||
}
|
||||
|
||||
if (EQ(i_bcp, 1)) //odcięcie - nie rób nic
|
||||
LimPP = CP;
|
||||
else if (i_bcp > 1) //hamowanie
|
||||
LimPP = 3.4;
|
||||
else //luzowanie
|
||||
LimPP = 5.0;
|
||||
pom = CP;
|
||||
LimPP = Min0R(LimPP + TP + RedAdj, HP); // pozycja + czasowy lub zasilanie
|
||||
ActFlowSpeed = 4;
|
||||
|
||||
if ((LimPP > CP)) // podwyzszanie szybkie
|
||||
CP = CP + 9 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy;
|
||||
else
|
||||
CP = CP + 9 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy
|
||||
|
||||
LimPP = pom; // cp
|
||||
dpPipe = Min0R(HP, LimPP);
|
||||
|
||||
if (dpPipe > PP)
|
||||
dpMainValve = -PFVa(HP, PP, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
||||
else
|
||||
dpMainValve = PFVd(PP, 0, ActFlowSpeed / LBDelay, dpPipe, 0.4);
|
||||
|
||||
if (EQ(i_bcp, -1))
|
||||
{
|
||||
if ((TP < 1))
|
||||
TP = TP + 0.03 * dt;
|
||||
}
|
||||
|
||||
if (EQ(i_bcp, 3))
|
||||
{
|
||||
DP = PF(0, PP, 2 * ActFlowSpeed / LBDelay);
|
||||
dpMainValve = DP;
|
||||
Sounds[s_fv4a_e] = DP;
|
||||
Sounds[s_fv4a_u] = 0;
|
||||
Sounds[s_fv4a_b] = 0;
|
||||
Sounds[s_fv4a_x] = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (dpMainValve > 0)
|
||||
Sounds[s_fv4a_b] = dpMainValve;
|
||||
else
|
||||
Sounds[s_fv4a_u] = -dpMainValve;
|
||||
}
|
||||
|
||||
return dpMainValve * dt;
|
||||
}
|
||||
|
||||
void TMHZ_K5P::Init(double Press)
|
||||
{
|
||||
CP = Press;
|
||||
}
|
||||
|
||||
void TMHZ_K5P::SetReductor(double nAdj)
|
||||
{
|
||||
RedAdj = nAdj;
|
||||
}
|
||||
|
||||
double TMHZ_K5P::GetSound(int i)
|
||||
{
|
||||
if (i > 4)
|
||||
return 0;
|
||||
else
|
||||
return Sounds[i];
|
||||
}
|
||||
|
||||
double TMHZ_K5P::GetPos(int i)
|
||||
{
|
||||
return pos_table[i];
|
||||
}
|
||||
|
||||
double TMHZ_K5P::GetCP()
|
||||
{
|
||||
return RP;
|
||||
}
|
||||
|
||||
bool TMHZ_K5P::EQ(double pos, double i_pos)
|
||||
{
|
||||
return (pos <= i_pos + 0.5) && (pos > i_pos - 0.5);
|
||||
}
|
||||
|
||||
//---M394--- Matrosow
|
||||
|
||||
double TM394::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
|
||||
|
||||
@@ -591,6 +591,31 @@ class TMHZ_EN57 : public TDriverHandle {
|
||||
{}
|
||||
};
|
||||
|
||||
class TMHZ_K5P : public TDriverHandle {
|
||||
|
||||
private:
|
||||
double CP = 0.0; //zbiornik sterujący
|
||||
double TP = 0.0; //zbiornik czasowy
|
||||
double RP = 0.0; //zbiornik redukcyjny
|
||||
double RedAdj = 0.0; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
|
||||
bool Fala = false;
|
||||
static double const pos_table[11]; //= { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
|
||||
|
||||
bool EQ(double pos, double i_pos);
|
||||
|
||||
public:
|
||||
double GetPF(double i_bcp, double PP, double HP, double dt, double ep)/*override*/;
|
||||
void Init(double Press)/*override*/;
|
||||
void SetReductor(double nAdj)/*override*/;
|
||||
double GetSound(int i)/*override*/;
|
||||
double GetPos(int i)/*override*/;
|
||||
double GetCP()/*override*/;
|
||||
|
||||
inline TMHZ_K5P(void) :
|
||||
TDriverHandle()
|
||||
{}
|
||||
};
|
||||
|
||||
/* FBS2= class(TTDriverHandle)
|
||||
private
|
||||
CP, TP, RP: real; //zbiornik sterujący, czasowy, redukcyjny
|
||||
|
||||
Reference in New Issue
Block a user