16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 22:09:19 +02:00

Poprawione do końca pliku.

This commit is contained in:
firleju
2016-09-30 06:49:11 +02:00
parent e63efabe15
commit 5f7d4cc34b
2 changed files with 366 additions and 331 deletions

View File

@@ -2367,28 +2367,22 @@ bool TFV4aM::EQ(double pos, double i_pos)
//---FV4a/M--- nowonapisany kran bez poprawki IC
double TMHZ_EN57::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
{ double result;/*?*//*SUB-FUNCTION TO BE EXTRACTED*/double LPP_RP(double pos) //cisnienie z zaokraglonej pozycji;
{ double result;
if( pos>8.5 )
LPP_RP =5.0-0.15*pos-0.35;else if( pos>0.5 )
LPP_RP =5.0-0.15*pos-0.1;else
LPP_RP =5.0;return result;
}
/*?*//*SUB-FUNCTION TO BE EXTRACTED*/bool EQ(double pos, double i_pos)
{ bool result;
EQ =( pos<=i_pos+0.5 )&&( pos>i_pos-0.5 );
return result;
}
{
static int const LBDelay = 100;
static double/*?*/ const LBDelay = 100;
double LimPP; double dpPipe; double dpMainValve; double ActFlowSpeed; double DP;
double LimPP;
double dpPipe;
double dpMainValve;
double ActFlowSpeed;
double DP;
double pom;
Byte i;
{ long i_end = 5 ; for( i = 0 ; i < i_end ; ++i )
Sounds[ i ] =0;}
{
long i_end = 5;
for (i = 0; i < i_end; ++i)
Sounds[i] = 0;
}
DP = 0;
i_bcp = Max0R(Min0R(i_bcp, 9.999), -0.999); // na wszelki wypadek, zeby nie wyszlo poza zakres
@@ -2408,25 +2402,33 @@ return result;
LimPP = Min0R(LPP_RP(i_bcp) + TP * 0.08 + RedAdj, HP); // pozycja + czasowy lub zasilanie
ActFlowSpeed = 4;
if( ( EQ( i_bcp, -1 ) ) ) pom =Min0R( HP, 5.4+RedAdj );else pom =Min0R( CP, HP );
if ((EQ(i_bcp, -1)))
pom = Min0R(HP, 5.4 + RedAdj);
else
pom = Min0R(CP, HP);
if ((LimPP > CP)) // podwyzszanie szybkie
CP =CP+60*Min0R( abs( LimPP-CP ), 0.05 )*PR( CP, LimPP )*dt //zbiornik sterujacy;else
CP = CP + 60 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy;
else
CP = CP + 13 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy
LimPP = pom; // cp
if (EQ(i_bcp, -1))
dpPipe =HP;else
dpPipe = HP;
else
dpPipe = Min0R(HP, LimPP);
if (dpPipe > PP)
dpMainValve =-PFVa( HP, PP, ActFlowSpeed*1.0/( LBDelay ), dpPipe, 0.4 );else
dpMainValve = -PFVa(HP, PP, ActFlowSpeed * 1.0 / (LBDelay), dpPipe, 0.4);
else
dpMainValve = PFVd(PP, 0, ActFlowSpeed * 1.0 / (LBDelay), dpPipe, 0.4);
if (EQ(i_bcp, -1))
{
if( ( TP<5 ) ) TP =TP+dt; //5/10
if( ( TP<1 ) ) TP =TP-0.5*dt; //5/10
if ((TP < 5))
TP = TP + dt; // 5/10
if ((TP < 1))
TP = TP - 0.5 * dt; // 5/10
}
if ((EQ(i_bcp, 10)) || (EQ(i_bcp, -2)))
@@ -2441,16 +2443,17 @@ return result;
else
{
if (dpMainValve > 0)
Sounds[ s_fv4a_b ] =dpMainValve;else
Sounds[s_fv4a_b] = dpMainValve;
else
Sounds[s_fv4a_u] = -dpMainValve;
}
if ((i_bcp < 1.5))
RP =Max0R( 0, 0.125*i_bcp );else
RP = Max0R(0, 0.125 * i_bcp);
else
RP = Min0R(1, 0.125 * i_bcp - 0.125);
GetPF =dpMainValve*dt;
return result;
return dpMainValve * dt;
}
void TMHZ_EN57::Init(double Press)
@@ -2468,46 +2471,63 @@ void TMHZ_EN57::SetReductor(double nAdj)
}
double TMHZ_EN57::GetSound(Byte i)
{ double result;
{
if (i > 4)
GetSound =0;else
GetSound =Sounds[ i ];
return result;
return 0;
else
return Sounds[i];
}
double TMHZ_EN57::GetPos(Byte i)
{ double result;
static double const table[11] = ( -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 );
{
static double const table[11] = { -2, 10, -1, 0, 0, 2, 9, 10, 0, 0, 0 };
GetPos =table[ i ];
return result;
return table[i];
}
double TMHZ_EN57::GetCP()
{ double result;
GetCP =RP;
return result;
{
return RP;
}
double TMHZ_EN57::GetEP(double pos)
{ double result;
{
if (pos < 9.5)
GetEP =Min0R( Max0R( 0, 0.125*pos ), 1 );else
GetEP =0;
return result;
return Min0R(Max0R(0, 0.125 * pos), 1);
else
return 0;
}
double TMHZ_EN57::LPP_RP(double pos) // cisnienie z zaokraglonej pozycji;
{
if (pos > 8.5)
return 5.0 - 0.15 * pos - 0.35;
else if (pos > 0.5)
return 5.0 - 0.15 * pos - 0.1;
else
return 5.0;
}
bool TMHZ_EN57::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)
{ double result;
static double/*?*/ const LBDelay = 65;
{
static int const LBDelay = 65;
double LimPP; double dpPipe; double dpMainValve; double ActFlowSpeed;
double LimPP;
double dpPipe;
double dpMainValve;
double ActFlowSpeed;
int BCP;
BCP =Round( i_bcp );
if( BCP<-1 ) BCP =1;
BCP = lround(i_bcp);
if (BCP < -1)
BCP = 1;
LimPP = Min0R(BPT_394[BCP][1], HP);
ActFlowSpeed = BPT_394[BCP][0];
@@ -2517,11 +2537,15 @@ double TM394::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
LimPP = LimPP + RedAdj;
if ((BCP != 2))
if (CP < LimPP)
CP =CP+4*Min0R( abs( LimPP-CP ), 0.05 )*PR( CP, LimPP )*dt //zbiornik sterujacy
// cp:=cp+6*(2+Byte(bcp<0))*Min0R(abs(Limpp-cp),0.05)*PR(cp,Limpp)*dt //zbiornik sterujacy;else
if( BCP==0 )
CP =CP-0.2*dt*1.0/100;else
CP =CP+4*( 1+Byte( BCP!=3 )+Byte( BCP>4 ) )*Min0R( abs( LimPP-CP ), 0.05 )*PR( CP, LimPP )*dt; //zbiornik sterujacy
CP = CP + 4 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt; // zbiornik sterujacy
// cp:=cp+6*(2+Byte(bcp<0))*Min0R(abs(Limpp-cp),0.05)*PR(cp,Limpp)*dt //zbiornik
// sterujacy;
else if (BCP == 0)
CP = CP - 0.2 * dt * 1.0 / 100;
else
CP = CP +
4 * (1 + Byte(BCP != 3) + Byte(BCP > 4)) * Min0R(abs(LimPP - CP), 0.05) *
PR(CP, LimPP) * dt; // zbiornik sterujacy
LimPP = CP;
dpPipe = Min0R(HP, LimPP);
@@ -2532,17 +2556,12 @@ double TM394::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
dpMainValve = PF(dpPipe, PP, ActFlowSpeed * 1.0 / (LBDelay)) * dt;
if (BCP == -1)
// begin
dpMainValve = PF(HP, PP, (ActFlowSpeed)*1.0 / (LBDelay)) * dt;
// end;
if (BCP == i_bcpno)
// begin
dpMainValve = PF(0, PP, (ActFlowSpeed)*1.0 / (LBDelay)) * dt;
// end;
GetPF =dpMainValve;
return result;
return dpMainValve;
}
void TM394::Init(double Press)
@@ -2559,36 +2578,41 @@ void TM394::SetReductor(double nAdj)
}
double TM394::GetCP()
{ double result;
GetCP = CP;
return result;
{
return CP;
}
double TM394::GetPos(Byte i)
{ double result;
static double const table[11] = ( -1, 5, -1, 0, 1, 2, 4, 5, 0, 0, 0 );
{
static double const table[11] = { -1, 5, -1, 0, 1, 2, 4, 5, 0, 0, 0 };
GetPos =table[ i ];
return result;
return table[i];
}
//---H14K1-- Knorr
double TH14K1::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
{ double result;
static double/*?*/ const LBDelay = 100; //szybkosc + zasilanie sterujacego
static double const BPT_K[ /*?*//*-1..4*/ (4)-(-1)+1 ][2] = ( ( 10 , 0 ) , ( 4 , 1 ) , ( 0 , 1 ) , ( 4 , 0 ) , ( 4 , -1 ) , ( 15 , -1 ) );
static double/*?*/ const NomPress = 5.0;
{
static int const LBDelay = 100; // szybkosc + zasilanie sterujacego
static double const BPT_K[/*?*/ /*-1..4*/ (4) - (-1) + 1][2] =
{ (10, 0), (4, 1), (0, 1), (4, 0), (4, -1), (15, -1) };
static double const NomPress = 5.0;
double LimPP; double dpPipe; double dpMainValve; double ActFlowSpeed;
double LimPP;
double dpPipe;
double dpMainValve;
double ActFlowSpeed;
int BCP;
BCP =Round( i_bcp );
if( i_bcp<-1 ) BCP =1;
BCP = lround(i_bcp);
if (i_bcp < -1)
BCP = 1;
LimPP = BPT_K[BCP][1];
if (LimPP < 0)
LimPP =0.5*PP;else if( LimPP>0 )
LimPP =PP;else
LimPP = 0.5 * PP;
else if (LimPP > 0)
LimPP = PP;
else
LimPP = CP;
ActFlowSpeed = BPT_K[BCP][0];
@@ -2605,8 +2629,7 @@ double TH14K1::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
if (BCP == i_bcpno)
dpMainValve = PF(0, PP, (ActFlowSpeed)*1.0 / (LBDelay)) * dt;
GetPF =dpMainValve;
return result;
return dpMainValve;
}
void TH14K1::Init(double Press)
@@ -2623,42 +2646,48 @@ void TH14K1::SetReductor(double nAdj)
}
double TH14K1::GetCP()
{ double result;
GetCP = CP;
return result;
{
return CP;
}
double TH14K1::GetPos(Byte i)
{ double result;
static double const table[11] = ( -1, 4, -1, 0, 1, 2, 3, 4, 0, 0, 0 );
{
static double const table[11] = { -1, 4, -1, 0, 1, 2, 3, 4, 0, 0, 0 };
GetPos =table[ i ];
return result;
return table[i];
}
//---St113-- Knorr EP
double TSt113::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
{ double result;
static double/*?*/ const LBDelay = 100; //szybkosc + zasilanie sterujacego
static double const BPT_K[ /*?*//*-1..4*/ (4)-(-1)+1 ][2] = ( ( 10 , 0 ) , ( 4 , 1 ) , ( 0 , 1 ) , ( 4 , 0 ) , ( 4 , -1 ) , ( 15 , -1 ) );
static double const BEP_K[ /*?*//*-1..5*/ (5)-(-1)+1 ] = ( 0 , -1 , 1 , 0 , 0 , 0 , 0 );
static double/*?*/ const NomPress = 5.0;
{
static int const LBDelay = 100; // szybkosc + zasilanie sterujacego
static double const BPT_K[/*?*/ /*-1..4*/ (4) - (-1) + 1][2] =
{ (10, 0), (4, 1), (0, 1), (4, 0), (4, -1), (15, -1) };
static double const BEP_K[/*?*/ /*-1..5*/ (5) - (-1) + 1] = { 0, -1, 1, 0, 0, 0, 0 };
static double const NomPress = 5.0;
double LimPP; double dpPipe; double dpMainValve; double ActFlowSpeed;
double LimPP;
double dpPipe;
double dpMainValve;
double ActFlowSpeed;
int BCP;
BCP =Round( i_bcp );
BCP = lround(i_bcp);
EPS = BEP_K[BCP];
if( BCP>0 ) BCP =BCP-1;
if (BCP > 0)
BCP = BCP - 1;
if( BCP<-1 ) BCP =1;
if (BCP < -1)
BCP = 1;
LimPP = BPT_K[BCP][1];
if (LimPP < 0)
LimPP =0.5*PP;else if( LimPP>0 )
LimPP =PP;else
LimPP = 0.5 * PP;
else if (LimPP > 0)
LimPP = PP;
else
LimPP = CP;
ActFlowSpeed = BPT_K[BCP][0];
@@ -2675,22 +2704,19 @@ double TSt113::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
if (BCP == i_bcpno)
dpMainValve = PF(0, PP, (ActFlowSpeed)*1.0 / (LBDelay)) * dt;
GetPF =dpMainValve;
return result;
return dpMainValve;
}
double TSt113::GetCP()
{ double result;
GetCP =EPS;
return result;
{
return EPS;
}
double TSt113::GetPos(Byte i)
{ double result;
static double const table[11] = ( -1, 5, -1, 0, 2, 3, 4, 5, 0, 0, 1 );
{
static double const table[11] = { -1, 5, -1, 0, 2, 3, 4, 5, 0, 0, 1 };
GetPos =table[ i ];
return result;
return table[i];
}
void TSt113::Init(double Press)
@@ -2702,18 +2728,23 @@ void TSt113::Init(double Press)
//--- test ---
double Ttest::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
{ double result;
static double/*?*/ const LBDelay = 100;
{
double result;
static int const LBDelay = 100;
double LimPP; double dpPipe; double dpMainValve; double ActFlowSpeed;
double LimPP;
double dpPipe;
double dpMainValve;
double ActFlowSpeed;
LimPP = BPT[lround(i_bcp)][1];
ActFlowSpeed = BPT[lround(i_bcp)][0];
LimPP =BPT[ Round( i_bcp ) ][ 1 ];
ActFlowSpeed =BPT[ Round( i_bcp ) ][ 0 ];
if ((i_bcp == i_bcpno))
LimPP = 0.0;
if( ( i_bcp==i_bcpno ) ) LimPP =0.0;
if( ( i_bcp==-1 ) ) LimPP =7;
if ((i_bcp == -1))
LimPP = 7;
CP = CP + 20 * Min0R(abs(LimPP - CP), 0.05) * PR(CP, LimPP) * dt * 1.0 / 1;
@@ -2722,13 +2753,12 @@ double Ttest::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
dpMainValve = PF(dpPipe, PP, ActFlowSpeed * 1.0 / (LBDelay)) * dt;
if( ( Round( i_bcp )==i_bcpno ) )
if ((lround(i_bcp) == i_bcpno))
{
dpMainValve = PF(0, PP, (ActFlowSpeed)*1.0 / (LBDelay)) * dt;
}
GetPF =dpMainValve;
return result;
return dpMainValve;
}
void Ttest::Init(double Press)
@@ -2736,19 +2766,20 @@ void Ttest::Init(double Press)
CP = Press;
}
//---FD1---
double TFD1::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
{ double result; double DP; double temp;
{
double DP;
double temp;
// MaxBP:=4;
// temp:=Min0R(i_bcp*MaxBP,Min0R(5.0,HP));
temp = Min0R(i_bcp * MaxBP, HP); // 0011
DP =10*Min0R( abs( temp-BP ), 0.1 )*PF( temp, BP, 0.0006*( 2+Byte( temp>BP ) ) )*dt*Speed;
DP =
10 * Min0R(abs(temp - BP), 0.1) * PF(temp, BP, 0.0006 * (2 + Byte(temp > BP))) * dt * Speed;
BP = BP - DP;
GetPF =-DP;
return result;
return -DP;
}
void TFD1::Init(double Press)
@@ -2761,9 +2792,8 @@ void TFD1::Init(double Press)
}
double TFD1::GetCP()
{ double result;
GetCP =BP;
return result;
{
return BP;
}
void TFD1::SetSpeed(double nSpeed)
@@ -2771,11 +2801,13 @@ void TFD1::SetSpeed(double nSpeed)
Speed = nSpeed;
}
//---KNORR---
double TH1405::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
{ double result; double DP; double temp; double A;
{
double DP;
double temp;
double A;
PP = Min0R(PP, MaxBP);
if (i_bcp > 0.5)
@@ -2792,8 +2824,7 @@ double TH1405::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
}
DP = PF(temp, BP, A) * dt;
BP = BP - DP;
GetPF =-DP;
return result;
return -DP;
}
void TH1405::Init(double Press)
@@ -2805,65 +2836,70 @@ void TH1405::Init(double Press)
}
double TH1405::GetCP()
{ double result;
GetCP =BP;
return result;
{
return BP;
}
//---FVel6---
double TFVel6::GetPF(double i_bcp, double PP, double HP, double dt, double ep)
{ double result;
static double/*?*/ const LBDelay = 100;
{
static int const LBDelay = 100;
double LimPP; double dpPipe; double dpMainValve; double ActFlowSpeed;
double LimPP;
double dpPipe;
double dpMainValve;
double ActFlowSpeed;
LimPP = Min0R(5 * Byte(i_bcp < 3.5), HP);
if ((i_bcp >= 3.5) && ((i_bcp < 4.3) || (i_bcp > 5.5)))
ActFlowSpeed =0;else if( ( i_bcp>4.3 ) && ( i_bcp<4.8 ) )
ActFlowSpeed =4*( i_bcp-4.3 ) //konsultacje wawa1 - bylo 8;else if( ( i_bcp<4 ) )
ActFlowSpeed =2;else
ActFlowSpeed = 0;
else if ((i_bcp > 4.3) && (i_bcp < 4.8))
ActFlowSpeed = 4 * (i_bcp - 4.3); // konsultacje wawa1 - bylo 8;
else if ((i_bcp < 4))
ActFlowSpeed = 2;
else
ActFlowSpeed = 4;
dpMainValve = PF(LimPP, PP, ActFlowSpeed * 1.0 / (LBDelay)) * dt;
Sounds[s_fv4a_e] = 0;
Sounds[s_fv4a_u] = 0;
Sounds[s_fv4a_b] = 0;
if( ( i_bcp<3.5 ) ) Sounds[ s_fv4a_u ] =-dpMainValve;else
if( ( i_bcp<4.8 ) ) Sounds[ s_fv4a_b ] =dpMainValve;else
if( ( i_bcp<5.5 ) ) Sounds[ s_fv4a_e ] =dpMainValve;
if ((i_bcp < 3.5))
Sounds[s_fv4a_u] = -dpMainValve;
else if ((i_bcp < 4.8))
Sounds[s_fv4a_b] = dpMainValve;
else if ((i_bcp < 5.5))
Sounds[s_fv4a_e] = dpMainValve;
GetPF =dpMainValve;
if ((i_bcp < -0.5))
EPS =-1;else if( ( i_bcp>0.5 )&&( i_bcp<4.7 ) )
EPS =1;else
EPS = -1;
else if ((i_bcp > 0.5) && (i_bcp < 4.7))
EPS = 1;
else
EPS = 0;
// EPS:=i_bcp*Byte(i_bcp<2)
return result;
return dpMainValve;
}
double TFVel6::GetCP()
{ double result;
GetCP =EPS;
return result;
{
return EPS;
}
double TFVel6::GetPos(Byte i)
{ double result;
static double const table[11] = ( -1, 6, -1, 0, 6, 4, 4.7, 5, -1, 0, 1 );
{
static double const table[11] = { -1, 6, -1, 0, 6, 4, 4.7, 5, -1, 0, 1 };
GetPos =table[ i ];
return result;
return table[i];
}
double TFVel6::GetSound(Byte i)
{ double result;
{
if (i > 2)
GetSound =0;else
GetSound =Sounds[ i ];
return result;
return 0;
else
return Sounds[i];
}
void TFVel6::Init(double Press)
@@ -2872,6 +2908,4 @@ void TFVel6::Init(double Press)
TimeEP = true;
}
//END

View File

@@ -541,6 +541,7 @@ private:
double CP; double TP; double RP; //zbiornik steruj¹cy, czasowy, redukcyjny
double RedAdj; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
bool Fala;
double LPP_RP(double pos);
bool EQ(double pos, double i_pos);
public:
@@ -608,7 +609,7 @@ public:
class TH14K1: public HANDLE
{
private:
protected:
double CP; //zbiornik steruj¹cy, czasowy, redukcyjny
double RedAdj; //dostosowanie reduktora cisnienia (krecenie kapturkiem)