mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 20:59:19 +02:00
13
DynObj.cpp
13
DynObj.cpp
@@ -2591,8 +2591,11 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
// inaczej
|
||||
// if (NoVoltTime>0.02) //tu można ograniczyć czas rozłączenia
|
||||
// if (DebugModeFlag) //logowanie nie zawsze
|
||||
if (MoverParameters->Mains)
|
||||
if ((MoverParameters->Mains) &&
|
||||
((MoverParameters->EngineType != ElectricInductionMotor)
|
||||
|| (MoverParameters->GetTrainsetVoltage() < 0.1f)))
|
||||
{ // Ra 15-01: logować tylko, jeśli WS załączony
|
||||
// yB 16-03: i nie jest to asynchron zasilany z daleka
|
||||
// if (MoverParameters->PantFrontUp&&pants)
|
||||
// Ra 15-01: bezwzględne współrzędne pantografu nie są dostępne,
|
||||
// więc lepiej się tego nie zaloguje
|
||||
@@ -2722,9 +2725,13 @@ bool TDynamicObject::Update(double dt, double dt1)
|
||||
if (((MoverParameters->ShuntMode) && (Frj < 0.0015 * masa)) ||
|
||||
(MoverParameters->V * MoverParameters->DirAbsolute < -0.2))
|
||||
{
|
||||
Fzad = Max0R(0.5 * masa, Fzad);
|
||||
Fzad = Max0R(MoverParameters->StopBrakeDecc * masa, Fzad);
|
||||
}
|
||||
FzadED = Min0R(Fzad, FmaxED);
|
||||
|
||||
if (MoverParameters->BrakeHandle == MHZ_EN57?MoverParameters->BrakeOpModeFlag & bom_MED:MoverParameters->EpFuse)
|
||||
FzadED = Min0R(Fzad, FmaxED);
|
||||
else
|
||||
FzadED = 0;
|
||||
FzadPN = Fzad - FrED;
|
||||
//np = 0;
|
||||
bool* PrzekrF = new bool[np];
|
||||
|
||||
@@ -154,6 +154,7 @@ struct TCurrentCollector
|
||||
double CSW;
|
||||
double MinV;
|
||||
double MaxV;
|
||||
double OVP;
|
||||
double InsetV;
|
||||
double MinPress;
|
||||
double MaxPress;
|
||||
@@ -432,6 +433,7 @@ public:
|
||||
Byte Lights[2][16];
|
||||
bool ScndInMain;
|
||||
bool MBrake;
|
||||
double StopBrakeDecc;
|
||||
TSecuritySystem SecuritySystem;
|
||||
TScheme RList[65];
|
||||
int RlistSize;
|
||||
@@ -565,6 +567,8 @@ public:
|
||||
bool EmergencyBrakeFlag;
|
||||
Byte BrakeDelayFlag;
|
||||
Byte BrakeDelays;
|
||||
Byte BrakeOpModeFlag;
|
||||
Byte BrakeOpModes;
|
||||
bool DynamicBrakeFlag;
|
||||
double LimPipePress;
|
||||
double ActFlowSpeed;
|
||||
@@ -883,6 +887,10 @@ static const Shortint eimv_Pmax = 0x11;
|
||||
static const Shortint eimv_Fzad = 0x12;
|
||||
static const Shortint eimv_Imax = 0x13;
|
||||
static const Shortint eimv_Fful = 0x14;
|
||||
static const Shortint bom_PS = 0x1;
|
||||
static const Shortint bom_PN = 0x2;
|
||||
static const Shortint bom_EP = 0x4;
|
||||
static const Shortint bom_MED = 0x8;
|
||||
extern PACKAGE double __fastcall Distance(const TLocation &Loc1, const TLocation &Loc2, const TDimension
|
||||
&Dim1, const TDimension &Dim2);
|
||||
|
||||
|
||||
@@ -152,6 +152,7 @@ struct TCurrentCollector
|
||||
double CSW;
|
||||
double MinV;
|
||||
double MaxV;
|
||||
double OVP;
|
||||
double InsetV;
|
||||
double MinPress;
|
||||
double MaxPress;
|
||||
@@ -410,6 +411,7 @@ public:
|
||||
Byte Lights[2][16];
|
||||
bool ScndInMain;
|
||||
bool MBrake;
|
||||
double StopBrakeDecc;
|
||||
TSecuritySystem SecuritySystem;
|
||||
TScheme RList[65];
|
||||
int RlistSize;
|
||||
@@ -543,6 +545,8 @@ public:
|
||||
bool EmergencyBrakeFlag;
|
||||
Byte BrakeDelayFlag;
|
||||
Byte BrakeDelays;
|
||||
Byte BrakeOpModeFlag;
|
||||
Byte BrakeOpModes;
|
||||
bool DynamicBrakeFlag;
|
||||
double LimPipePress;
|
||||
double ActFlowSpeed;
|
||||
@@ -880,6 +884,10 @@ static const Shortint eimv_Pmax = 0x11;
|
||||
static const Shortint eimv_Fzad = 0x12;
|
||||
static const Shortint eimv_Imax = 0x13;
|
||||
static const Shortint eimv_Fful = 0x14;
|
||||
static const Shortint bom_PS = 0x1;
|
||||
static const Shortint bom_PN = 0x2;
|
||||
static const Shortint bom_EP = 0x4;
|
||||
static const Shortint bom_MED = 0x8;
|
||||
extern PACKAGE double __fastcall Distance(const TLocation &Loc1, const TLocation &Loc2, const TDimension
|
||||
&Dim1, const TDimension &Dim2);
|
||||
|
||||
|
||||
@@ -209,6 +209,10 @@ CONST
|
||||
eimv_Imax=19;
|
||||
eimv_Fful=20;
|
||||
|
||||
bom_PS = 1;
|
||||
bom_PN = 2;
|
||||
bom_EP = 4;
|
||||
bom_MED = 8;
|
||||
|
||||
TYPE
|
||||
{ogolne}
|
||||
@@ -294,6 +298,7 @@ TYPE
|
||||
MinH,MaxH: real; //zakres ruchu pantografu, nigdzie nie używany
|
||||
CSW: real; //szerokość części roboczej (styku) ślizgacza
|
||||
MinV,MaxV: real; //minimalne i maksymalne akceptowane napięcie
|
||||
OVP: real; //czy jest przekaznik nadnapieciowy
|
||||
InsetV: real; //minimalne napięcie wymagane do załączenia
|
||||
MinPress: real; //minimalne ciśnienie do załączenia WS
|
||||
MaxPress: real; //maksymalne ciśnienie za reduktorem
|
||||
@@ -492,6 +497,7 @@ TYPE
|
||||
Lights: array [0..1] of array [1..16] of byte;
|
||||
ScndInMain: boolean; {zaleznosc bocznika od nastawnika}
|
||||
MBrake: boolean; {Czy jest hamulec reczny}
|
||||
StopBrakeDecc: real;
|
||||
SecuritySystem: TSecuritySystem;
|
||||
|
||||
{-sekcja parametrow dla lokomotywy elektrycznej}
|
||||
@@ -632,6 +638,8 @@ TYPE
|
||||
EmergencyBrakeFlag: boolean; {hamowanie nagle}
|
||||
BrakeDelayFlag: byte; {nastawa opoznienia ham. osob/towar/posp/exp 0/1/2/4}
|
||||
BrakeDelays: byte; {nastawy mozliwe do uzyskania}
|
||||
BrakeOpModeFlag: byte; {nastawa trybu pracy PS/PN/EP/MED 1/2/4/8}
|
||||
BrakeOpModes: byte; {nastawy mozliwe do uzyskania}
|
||||
DynamicBrakeFlag: boolean; {czy wlaczony hamulec elektrodymiczny}
|
||||
// NapUdWsp: integer;
|
||||
LimPipePress: real; {stabilizator cisnienia}
|
||||
@@ -1130,6 +1138,12 @@ function T_MoverParameters.BrakeRatio: real;
|
||||
function T_MoverParameters.LocalBrakeRatio: real;
|
||||
var LBR:real;
|
||||
begin
|
||||
if BrakeHandle=MHZ_EN57 then
|
||||
if (BrakeOpModeFlag>=bom_EP) then
|
||||
LBR:=(Handle as TMHZ_EN57).GetEP(BrakeCtrlPosR)
|
||||
else
|
||||
LBR:=0
|
||||
else
|
||||
if LocalBrakePosNo>0 then
|
||||
LBR:=LocalBrakePos/LocalBrakePosNo
|
||||
else
|
||||
@@ -2281,7 +2295,17 @@ end;
|
||||
function T_MoverParameters.BrakeDelaySwitch(BDS:byte): boolean;
|
||||
begin
|
||||
// if BrakeCtrlPosNo>0 then
|
||||
if Hamulec.SetBDF(BDS) then
|
||||
if BrakeHandle=MHZ_EN57 then
|
||||
begin
|
||||
if (BDS<>BrakeOpModeFlag) and ((BDS and BrakeOpModes) > 0) then
|
||||
begin
|
||||
BrakeOpModeFlag:=BDS;
|
||||
BrakeDelaySwitch:=true;
|
||||
end
|
||||
else
|
||||
BrakeDelaySwitch:=false;
|
||||
end
|
||||
else if Hamulec.SetBDF(BDS) then
|
||||
begin
|
||||
BrakeDelayFlag:=BDS;
|
||||
BrakeDelaySwitch:=true;
|
||||
@@ -2467,7 +2491,12 @@ with BrakePressureTable[BrakeCtrlPos] do
|
||||
temp:=ScndPipePress;
|
||||
Handle.SetReductor(BrakeCtrlPos2);
|
||||
|
||||
dpMainValve:=Handle.GetPF(BrakeCtrlPosR, PipePress, temp, dt, EqvtPipePress);
|
||||
if (BrakeOpModeFlag<>bom_PS) then
|
||||
if (BrakeOpModeFlag<bom_EP) or (Handle.GetPos(bh_EB)-0.5<BrakeCtrlPosR) or (BrakeHandle<>MHZ_EN57) then
|
||||
dpMainValve:=Handle.GetPF(BrakeCtrlPosR, PipePress, temp, dt, EqvtPipePress)
|
||||
else
|
||||
dpMainValve:=Handle.GetPF(0, PipePress, temp, dt, EqvtPipePress);
|
||||
|
||||
if (dpMainValve<0){and(PipePressureVal>0.01)} then {50}
|
||||
if Compressor>ScndPipePress then
|
||||
begin
|
||||
@@ -4145,7 +4174,7 @@ begin
|
||||
// dec(MainCtrlActualPos);
|
||||
FuseOff; {wywalanie bezpiecznika z powodu przetezenia silnikow}
|
||||
if (Mains) then //nie wchodzić w funkcję bez potrzeby
|
||||
if (Abs(Voltage)<EnginePowerSource.CollectorParameters.MinV) or (Abs(Voltage)>EnginePowerSource.CollectorParameters.MaxV) then
|
||||
if (Abs(Voltage)<EnginePowerSource.CollectorParameters.MinV) or (Abs(Voltage)*EnginePowerSource.CollectorParameters.OVP>EnginePowerSource.CollectorParameters.MaxV) then
|
||||
if MainSwitch(false) then
|
||||
EventFlag:=true; //wywalanie szybkiego z powodu niewłaściwego napięcia
|
||||
|
||||
@@ -4337,7 +4366,7 @@ begin
|
||||
ElectricInductionMotor:
|
||||
begin
|
||||
if (Mains) then //nie wchodzić w funkcję bez potrzeby
|
||||
if (Abs(Voltage)<EnginePowerSource.CollectorParameters.MinV) or (Abs(Voltage)>EnginePowerSource.CollectorParameters.MaxV+100) then
|
||||
if (Abs(Voltage)<EnginePowerSource.CollectorParameters.MinV) or (Abs(Voltage)>EnginePowerSource.CollectorParameters.MaxV+200) then
|
||||
begin
|
||||
MainSwitch(false);
|
||||
end;
|
||||
@@ -4346,7 +4375,9 @@ begin
|
||||
begin
|
||||
|
||||
dtrans:=(Hamulec as TLSt).GetEDBCP;
|
||||
if ((dtrans<0.25) and (LocHandle.GetCP<0.25) and (AnPos<0.01)) or ((ShuntModeAllow) and (LocalBrakePos=0)) then
|
||||
if ((DoorLeftOpened)or(DoorRightOpened)) then
|
||||
DynamicBrakeFlag:=true
|
||||
else if ((dtrans<0.25) and (LocHandle.GetCP<0.25) and (AnPos<0.01)) or ((dtrans<0.25) and (ShuntModeAllow) and (LocalBrakePos=0)) then
|
||||
DynamicBrakeFlag:=false
|
||||
else if (((BrakePress>0.25) and (dtrans>0.25) or (LocHandle.GetCP>0.25))) or (AnPos>0.02) then
|
||||
DynamicBrakeFlag:=true;
|
||||
@@ -4391,8 +4422,8 @@ begin
|
||||
dmoment:=eimv[eimv_Fful];
|
||||
// else
|
||||
// dmoment:=eimc[eimc_p_F0]*0.99;
|
||||
if (abs((PosRatio+9.66*dizel_fill)*dmoment*100)>Adhesive(RunningTrack.friction)*TotalMassxg) then begin PosRatio:=0; tmp:=4; SandDoseOn; end;//przeciwposlizg
|
||||
if (abs((PosRatio+9.80*dizel_fill)*dmoment*100)>Adhesive(RunningTrack.friction)*TotalMassxg) then begin PosRatio:=0; tmp:=9; SandDoseOn; end;//przeciwposlizg
|
||||
if (abs((PosRatio+9.66*dizel_fill)*dmoment*100)>0.95*Adhesive(RunningTrack.friction)*TotalMassxg) then begin PosRatio:=0; tmp:=4; SandDoseOn; end;//przeciwposlizg
|
||||
if (abs((PosRatio+9.80*dizel_fill)*dmoment*100)>0.95*Adhesive(RunningTrack.friction)*TotalMassxg) then begin PosRatio:=0; tmp:=9; SandDoseOn; end;//przeciwposlizg
|
||||
if (SlippingWheels) then begin PosRatio:=-PosRatio*0; tmp:=9; SandDoseOn; end;//przeciwposlizg
|
||||
|
||||
dizel_fill:=dizel_fill+Max0R(Min0R(PosRatio-dizel_fill,0.1),-0.1)*2*(tmp{2{+4*byte(PosRatio<dizel_fill)})*dt; //wartość zadana/procent czegoś
|
||||
@@ -4445,7 +4476,7 @@ begin
|
||||
else if (Voltage<EnginePowerSource.CollectorParameters.MaxV) then
|
||||
Vadd:=Vadd*(1-dt)
|
||||
else
|
||||
Vadd:=Max0R(Vadd*(1-0.2*dt),0.02*(Voltage-EnginePowerSource.CollectorParameters.MaxV));
|
||||
Vadd:=Max0R(Vadd*(1-0.2*dt),0.007*(Voltage-(EnginePowerSource.CollectorParameters.MaxV-100)));
|
||||
Itot:=eimv[eimv_Ipoj]*(0.01+Min0R(0.99,0.99-Vadd));
|
||||
|
||||
|
||||
@@ -4950,7 +4981,7 @@ var b:byte;
|
||||
const Vepsilon=1e-5; Aepsilon=1e-3; //ASBSpeed=0.8;
|
||||
begin
|
||||
TotalCurrent:=0;
|
||||
hvc:=Max0R(PantFrontVolt,PantRearVolt);
|
||||
hvc:=Max0R(Max0R(PantFrontVolt,PantRearVolt),ElectricTraction.TractionVoltage);
|
||||
for b:=0 to 1 do //przekazywanie napiec
|
||||
if ((Couplers[b].CouplingFlag and ctrain_power) = ctrain_power)or(((Couplers[b].CouplingFlag and ctrain_heating) = ctrain_heating)and(Heating)) then
|
||||
begin
|
||||
@@ -5740,6 +5771,7 @@ begin
|
||||
for b:=0 to 25 do
|
||||
eimc[b]:=0;
|
||||
eimc[eimc_p_eped]:=1.5;
|
||||
StopBrakeDecc:=0;
|
||||
|
||||
ScndInMain:=false;
|
||||
|
||||
@@ -6039,6 +6071,7 @@ Hamulec.SetASBP(MaxBrakePress[4]);
|
||||
|
||||
case BrakeHandle of
|
||||
FV4a: Handle := TFV4aM.Create;
|
||||
MHZ_EN57: Handle := TMHZ_EN57.Create;
|
||||
FVel6: Handle := TFVel6.Create;
|
||||
testH: Handle := Ttest.Create;
|
||||
M394: Handle := TM394.Create;
|
||||
@@ -6157,6 +6190,12 @@ end;
|
||||
if(TestFlag(BrakeDelays,bdelay_R))and not(TestFlag(BrakeDelays,bdelay_G))then
|
||||
BrakeDelayFlag:=bdelay_R;
|
||||
|
||||
//ustawianie PS/PN/EP/MED
|
||||
BrakeOpModeFlag:=bom_PN;
|
||||
if (BrakeOpModes and bom_PS)>0 then BrakeOpModeFlag:=bom_PS;
|
||||
// if (BrakeOpModes and bom_EP)>0 then BrakeOpModeFlag:=bom_EP;
|
||||
// if (BrakeOpModes and bom_MED)>0 then BrakeOpModeFlag:=bom_MED;
|
||||
//
|
||||
//yB: jesli pojazdy nie maja zadeklarowanych czasow, to wsadz z przepisow +-16,(6)%
|
||||
for b:=1 to 4 do
|
||||
begin
|
||||
@@ -6440,6 +6479,11 @@ function PowerDecode(s:string): TPowerType;
|
||||
MaxH:=s2rE(DUE(ExtractKeyWord(lines,'MaxH=')));
|
||||
CSW:=s2rE(DUE(ExtractKeyWord(lines,'CSW='))); //szerokość części roboczej
|
||||
MaxV:=s2rE(DUE(ExtractKeyWord(lines,'MaxVoltage=')));
|
||||
s:=ExtractKeyWord(lines,'OverVoltProt='); //przekaźnik nadnapięciowy
|
||||
if s='Yes' then
|
||||
OVP:=1
|
||||
else
|
||||
OVP:=0;
|
||||
s:=ExtractKeyWord(lines,'MinV='); //napięcie rozłączające WS
|
||||
if s='' then
|
||||
MinV:=0.5*MaxV //gdyby parametr nie podany
|
||||
@@ -6968,6 +7012,10 @@ begin
|
||||
else if s='GPR+Mg' then BrakeDelays:=bdelay_G+bdelay_P+bdelay_R+bdelay_M
|
||||
else if s='PR+Mg' then BrakeDelays:=bdelay_P+bdelay_R+bdelay_M;
|
||||
|
||||
s:=DUE(ExtractKeyWord(lines,'BrakeOpModes='));
|
||||
if s='PN' then BrakeOpModes:=bom_PS+bom_PN
|
||||
else if s='PNEPMED' then BrakeOpModes:=bom_PS+bom_PN+bom_EP+bom_MED;
|
||||
|
||||
{ else if s='DPR+Mg' then begin Brakedelays:=bdelay_R; BrakeMethod:=3; end
|
||||
else if s='DGPR+Mg' then begin Brakedelays:=bdelay_G+bdelay_R; BrakeMethod:=3; end
|
||||
else if s='DGPR' then begin Brakedelays:=bdelay_G+bdelay_R; BrakeMethod:=1; end
|
||||
@@ -6979,6 +7027,7 @@ begin
|
||||
if s='FV4a' then BrakeHandle:=FV4a
|
||||
else if s='test' then BrakeHandle:=testH
|
||||
else if s='D2' then BrakeHandle:=D2
|
||||
else if s='MHZ_EN57' then BrakeHandle:=MHZ_EN57
|
||||
else if s='M394' then BrakeHandle:=M394
|
||||
else if s='Knorr' then BrakeHandle:=Knorr
|
||||
else if s='Westinghouse' then BrakeHandle:=West
|
||||
@@ -7059,6 +7108,8 @@ begin
|
||||
FastSerialCircuit:=1
|
||||
else
|
||||
FastSerialCircuit:=0;
|
||||
s:=ExtractKeyWord(lines,'SBD=');
|
||||
StopBrakeDecc:=s2r(DUE(s));
|
||||
|
||||
if BrakeCtrlPosNo>0 then
|
||||
for i:=0 to BrakeCtrlPosNo+1 do
|
||||
|
||||
@@ -590,6 +590,37 @@ public:
|
||||
};
|
||||
|
||||
|
||||
class DELPHICLASS TMHZ_EN57;
|
||||
class PASCALIMPLEMENTATION TMHZ_EN57 : public THandle
|
||||
{
|
||||
typedef THandle inherited;
|
||||
|
||||
private:
|
||||
double CP;
|
||||
double TP;
|
||||
double RP;
|
||||
double RedAdj;
|
||||
bool Fala;
|
||||
|
||||
public:
|
||||
virtual double __fastcall GetPF(double i_bcp, double pp, double hp, double dt, double ep);
|
||||
virtual void __fastcall Init(double press);
|
||||
virtual void __fastcall SetReductor(double nAdj);
|
||||
virtual double __fastcall GetSound(Byte i);
|
||||
virtual double __fastcall GetPos(Byte i);
|
||||
virtual double __fastcall GetCP(void);
|
||||
double __fastcall GetEP(double pos);
|
||||
public:
|
||||
#pragma option push -w-inl
|
||||
/* TObject.Create */ inline __fastcall TMHZ_EN57(void) : THandle() { }
|
||||
#pragma option pop
|
||||
#pragma option push -w-inl
|
||||
/* TObject.Destroy */ inline __fastcall virtual ~TMHZ_EN57(void) { }
|
||||
#pragma option pop
|
||||
|
||||
};
|
||||
|
||||
|
||||
class DELPHICLASS TM394;
|
||||
class PASCALIMPLEMENTATION TM394 : public THandle
|
||||
{
|
||||
|
||||
@@ -296,7 +296,7 @@ TYPE
|
||||
public
|
||||
procedure Init(PP, HPP, LPP, BP: real; BDF: byte); override;
|
||||
function GetPF(PP, dt, Vel: real): real; override; //przeplyw miedzy komora wstepna i PG
|
||||
function GetEDBCP: real; override; //cisnienie tylko z hamulca zasadniczego, uzywane do hamulca ED w EP09
|
||||
function GetEDBCP: real; override; //cisnienie tylko z hamulca zasadniczego, uzywane do hamulca ED
|
||||
procedure PLC(mass: real); //wspolczynnik cisnienia przystawki wazacej
|
||||
procedure SetLP(TM, LM, TBP: real); //parametry przystawki wazacej
|
||||
end;
|
||||
@@ -418,6 +418,22 @@ TYPE
|
||||
function GetPos(i: byte): real; override;
|
||||
end;
|
||||
|
||||
TMHZ_EN57= class(THandle)
|
||||
private
|
||||
CP, TP, RP: real; //zbiornik sterujšcy, czasowy, redukcyjny
|
||||
RedAdj: real; //dostosowanie reduktora cisnienia (krecenie kapturkiem)
|
||||
Fala: boolean;
|
||||
public
|
||||
function GetPF(i_bcp:real; pp, hp, dt, ep: real): real; override;
|
||||
procedure Init(press: real); override;
|
||||
procedure SetReductor(nAdj: real); override;
|
||||
function GetSound(i: byte): real; override;
|
||||
function GetPos(i: byte): real; override;
|
||||
function GetCP: real; override;
|
||||
function GetEP(pos: real): real;
|
||||
end;
|
||||
|
||||
|
||||
{ FBS2= class(THandle)
|
||||
private
|
||||
CP, TP, RP: real; //zbiornik sterujšcy, czasowy, redukcyjny
|
||||
@@ -707,7 +723,7 @@ var VtoC: real; //stosunek cisnienia do objetosci
|
||||
const
|
||||
VS = 0.005;
|
||||
pS = 0.05;
|
||||
VD = 1.40;
|
||||
VD = 1.10;
|
||||
cD = 1;
|
||||
pD = VD-cD;
|
||||
begin
|
||||
@@ -2674,6 +2690,142 @@ begin
|
||||
GetPos:=table[i];
|
||||
end;
|
||||
|
||||
//---FV4a/M--- nowonapisany kran bez poprawki IC
|
||||
|
||||
function TMHZ_EN57.GetPF(i_bcp:real; pp, hp, dt, ep: real): real;
|
||||
function LPP_RP(pos: real): real; //cisnienie z zaokraglonej pozycji;
|
||||
begin
|
||||
if pos>8.5 then
|
||||
LPP_RP:=5.0-0.15*pos-0.35
|
||||
else if pos>0.5 then
|
||||
LPP_RP:=5.0-0.15*pos-0.1
|
||||
else
|
||||
LPP_RP:=5.0
|
||||
end;
|
||||
function EQ(pos: real; i_pos: real): boolean;
|
||||
begin
|
||||
EQ:=(pos<=i_pos+0.5)and(pos>i_pos-0.5);
|
||||
end;
|
||||
const
|
||||
LBDelay = 100;
|
||||
var
|
||||
LimPP, dpPipe, dpMainValve, ActFlowSpeed, dp: real;
|
||||
pom: real;
|
||||
i: byte;
|
||||
begin
|
||||
|
||||
for i:=0 to 4 do
|
||||
Sounds[i]:=0;
|
||||
dp:=0;
|
||||
|
||||
i_bcp:=Max0R(Min0R(i_bcp,9.999),-0.999); //na wszelki wypadek, zeby nie wyszlo poza zakres
|
||||
|
||||
if(tp>0)then
|
||||
begin
|
||||
dp:=0.045;
|
||||
if EQ(i_bcp,0) then
|
||||
tp:=tp-dp*dt;
|
||||
Sounds[s_fv4a_t]:=dp;
|
||||
end
|
||||
else
|
||||
begin
|
||||
tp:=0;
|
||||
end;
|
||||
|
||||
Limpp:=Min0R(LPP_RP(i_bcp)+tp*0.08+RedAdj,HP); //pozycja + czasowy lub zasilanie
|
||||
ActFlowSpeed:=4;
|
||||
|
||||
if(EQ(i_bcp,-1))then pom:=Min0R(HP,5.4+RedAdj) else pom:=Min0R(cp,HP);
|
||||
|
||||
if(Limpp>cp)then //podwyzszanie szybkie
|
||||
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) then
|
||||
dpPipe:=HP
|
||||
else
|
||||
dpPipe:=Min0R(HP,Limpp);
|
||||
|
||||
if dpPipe>pp then
|
||||
dpMainValve:=-PFVa(HP,pp,ActFlowSpeed/(LBDelay),dpPipe,0.4)
|
||||
else
|
||||
dpMainValve:=PFVd(pp,0,ActFlowSpeed/(LBDelay),dpPipe,0.4);
|
||||
|
||||
if EQ(i_bcp,-1) then
|
||||
begin
|
||||
if(tp<5)then tp:=tp+dt; //5/10
|
||||
if(tp<1)then tp:=tp-0.5*dt; //5/10
|
||||
end;
|
||||
|
||||
if(EQ(i_bcp,10))or(EQ(i_bcp,-2))then
|
||||
begin
|
||||
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;
|
||||
end
|
||||
else
|
||||
begin
|
||||
if dpMainValve>0 then
|
||||
Sounds[s_fv4a_b]:=dpMainValve
|
||||
else
|
||||
Sounds[s_fv4a_u]:=-dpMainValve;
|
||||
end;
|
||||
|
||||
if (i_bcp<1.5) then
|
||||
RP:=Max0R(0,0.125*i_bcp)
|
||||
else
|
||||
RP:=Min0R(1,0.125*i_bcp-0.125);
|
||||
|
||||
GetPF:=dpMainValve*dt;
|
||||
end;
|
||||
|
||||
procedure TMHZ_EN57.Init(press: real);
|
||||
begin
|
||||
CP:= press;
|
||||
TP:= 0;
|
||||
RP:= 0;
|
||||
Time:=false;
|
||||
TimeEP:=false;
|
||||
end;
|
||||
|
||||
procedure TMHZ_EN57.SetReductor(nAdj: real);
|
||||
begin
|
||||
RedAdj:= nAdj;
|
||||
end;
|
||||
|
||||
function TMHZ_EN57.GetSound(i: byte): real;
|
||||
begin
|
||||
if i>4 then
|
||||
GetSound:=0
|
||||
else
|
||||
GetSound:=Sounds[i];
|
||||
end;
|
||||
|
||||
function TMHZ_EN57.GetPos(i: byte): real;
|
||||
const
|
||||
table: array[0..10] of real = (-2,10,-1,0,0,2,9,10,0,0,0);
|
||||
begin
|
||||
GetPos:=table[i];
|
||||
end;
|
||||
|
||||
function TMHZ_EN57.GetCP: real;
|
||||
begin
|
||||
GetCP:=RP;
|
||||
end;
|
||||
|
||||
function TMHZ_EN57.GetEP(pos: real): real;
|
||||
begin
|
||||
if pos<9.5 then
|
||||
GetEP:=Min0R(Max0R(0,0.125*pos),1)
|
||||
else
|
||||
GetEP:=0;
|
||||
end;
|
||||
|
||||
//---M394--- Matrosow
|
||||
|
||||
function TM394.GetPF(i_bcp:real; pp, hp, dt, ep: real): real;
|
||||
|
||||
Reference in New Issue
Block a user