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

Set dp branch as trunk

This commit is contained in:
ShaXbee
2015-04-03 13:34:06 +00:00
commit 45f4c0d98a
132 changed files with 94789 additions and 0 deletions

882
McZapkie/Mover.hpp Normal file
View File

@@ -0,0 +1,882 @@
// Borland C++ Builder
// Copyright (c) 1995, 1999 by Borland International
// All rights reserved
// (DO NOT EDIT: machine generated header) '_mover.pas' rev: 5.00
//Ra: eee... tam, sam siê generuje b³êdnie i trzeba rêcznie poprawiaæ!
#ifndef _moverHPP
#define _moverHPP
#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Oerlikon_ESt.hpp> // Pascal unit
#include <hamulce.hpp> // Pascal unit
#include <SysUtils.hpp> // Pascal unit
#include <mctools.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit
//-- user supplied -----------------------------------------------------------
namespace _mover
{
//-- type declarations -------------------------------------------------------
struct TLocation
{
double X;
double Y;
double Z;
} ;
struct TRotation
{
double Rx;
double Ry;
double Rz;
} ;
struct TDimension
{
double W;
double L;
double H;
} ;
struct TCommand
{
AnsiString Command;
double Value1;
double Value2;
TLocation Location;
} ;
struct TTrackShape
{
double R;
double Len;
double dHtrack;
double dHrail;
} ;
struct TTrackParam
{
double Width;
double friction;
Byte CategoryFlag;
Byte QualityFlag;
Byte DamageFlag;
double Velmax;
} ;
struct TTractionParam
{
double TractionVoltage;
double TractionFreq;
double TractionMaxCurrent;
double TractionResistivity;
} ;
#pragma option push -b-
enum TBrakeSystem { Individual, Pneumatic, ElectroPneumatic };
#pragma option pop
#pragma option push -b-
enum TBrakeSubSystem { ss_None, ss_W, ss_K, ss_KK, ss_Hik, ss_ESt, ss_KE, ss_LSt, ss_MT, ss_Dako };
#pragma option pop
#pragma option push -b-
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
};
#pragma option pop
#pragma option push -b-
enum TBrakeHandle { NoHandle, West, FV4a, M394, M254, FVel1, FVel6, D2, Knorr, FD1, BS2, testH, St113
};
#pragma option pop
#pragma option push -b-
enum TLocalBrake { NoBrake, ManualBrake, PneumaticBrake, HydraulicBrake };
#pragma option pop
typedef double TBrakeDelayTable[4];
struct TBrakePressure
{
double PipePressureVal;
double BrakePressureVal;
double FlowSpeedVal;
TBrakeSystem BrakeType;
} ;
typedef TBrakePressure TBrakePressureTable[13];
#pragma option push -b-
enum TEngineTypes { None, Dumb, WheelsDriven, ElectricSeriesMotor, ElectricInductionMotor, DieselEngine,
SteamEngine, DieselElectric };
#pragma option pop
#pragma option push -b-
enum TPowerType { NoPower, BioPower, MechPower, ElectricPower, SteamPower };
#pragma option pop
#pragma option push -b-
enum TFuelType { Undefined, Coal, Oil };
#pragma option pop
struct TGrateType
{
TFuelType FuelType;
double GrateSurface;
double FuelTransportSpeed;
double IgnitionTemperature;
double MaxTemperature;
} ;
struct TBoilerType
{
double BoilerVolume;
double BoilerHeatSurface;
double SuperHeaterSurface;
double MaxWaterVolume;
double MinWaterVolume;
double MaxPressure;
} ;
struct TCurrentCollector
{
int CollectorsNo;
double MinH;
double MaxH;
double CSW;
double MinV;
double MaxV;
double InsetV;
double MinPress;
double MaxPress;
} ;
#pragma option push -b-
enum TPowerSource { NotDefined, InternalSource, Transducer, Generator, Accumulator, CurrentCollector,
PowerCable, Heater };
#pragma option pop
struct _mover__1
{
double MaxCapacity;
TPowerSource RechargeSource;
} ;
struct _mover__2
{
TPowerType PowerTrans;
double SteamPressure;
} ;
struct _mover__3
{
TGrateType Grate;
TBoilerType Boiler;
} ;
struct TPowerParameters
{
double MaxVoltage;
double MaxCurrent;
double IntR;
TPowerSource SourceType;
union
{
struct
{
_mover__3 RHeater;
};
struct
{
_mover__2 RPowerCable;
};
struct
{
TCurrentCollector CollectorParameters;
};
struct
{
_mover__1 RAccumulator;
};
struct
{
TEngineTypes GeneratorEngine;
};
struct
{
double InputVoltage;
};
struct
{
TPowerType PowerType;
};
};
} ;
struct TScheme
{
Byte Relay;
double R;
Byte Bn;
Byte Mn;
bool AutoSwitch;
Byte ScndAct;
} ;
typedef TScheme TSchemeTable[65];
struct TDEScheme
{
double RPM;
double GenPower;
double Umax;
double Imax;
} ;
typedef TDEScheme TDESchemeTable[33];
struct TShuntScheme
{
double Umin;
double Umax;
double Pmin;
double Pmax;
} ;
typedef TShuntScheme TShuntSchemeTable[33];
struct TMPTRelay
{
double Iup;
double Idown;
} ;
typedef TMPTRelay TMPTRelayTable[8];
struct TMotorParameters
{
double mfi;
double mIsat;
double mfi0;
double fi;
double Isat;
double fi0;
bool AutoSwitch;
} ;
struct TSecuritySystem
{
Byte SystemType;
double AwareDelay;
double AwareMinSpeed;
double SoundSignalDelay;
double EmergencyBrakeDelay;
Byte Status;
double SystemTimer;
double SystemSoundCATimer;
double SystemSoundSHPTimer;
double SystemBrakeCATimer;
double SystemBrakeSHPTimer;
double SystemBrakeCATestTimer;
int VelocityAllowed;
int NextVelocityAllowed;
bool RadioStop;
} ;
struct TTransmision
{
Byte NToothM;
Byte NToothW;
double Ratio;
} ;
#pragma option push -b-
enum TCouplerType { NoCoupler, Articulated, Bare, Chain, Screw, Automatic };
#pragma option pop
class DELPHICLASS T_MoverParameters;
struct TCoupling
{
double SpringKB;
double SpringKC;
double beta;
double DmaxB;
double FmaxB;
double DmaxC;
double FmaxC;
TCouplerType CouplerType;
Byte CouplingFlag;
int AllowedFlag;
bool Render;
double CoupleDist;
T_MoverParameters* Connected;
Byte ConnectedNr;
double CForce;
double Dist;
bool CheckCollision;
} ;
class PASCALIMPLEMENTATION T_MoverParameters : public System::TObject
{
typedef System::TObject inherited;
public:
double dMoveLen;
AnsiString filename;
Byte CategoryFlag;
AnsiString TypeName;
int TrainType;
TEngineTypes EngineType;
TPowerParameters EnginePowerSource;
TPowerParameters SystemPowerSource;
TPowerParameters HeatingPowerSource;
TPowerParameters AlterHeatPowerSource;
TPowerParameters LightPowerSource;
TPowerParameters AlterLightPowerSource;
double Vmax;
double Mass;
double Power;
double Mred;
double TotalMass;
double HeatingPower;
double LightPower;
double BatteryVoltage;
bool Battery;
bool EpFuse;
bool Signalling;
bool DoorSignalling;
bool Radio;
double NominalBatteryVoltage;
TDimension Dim;
double Cx;
double Floor;
double WheelDiameter;
double WheelDiameterL;
double WheelDiameterT;
double TrackW;
double AxleInertialMoment;
AnsiString AxleArangement;
Byte NPoweredAxles;
Byte NAxles;
Byte BearingType;
double ADist;
double BDist;
Byte NBpA;
int SandCapacity;
TBrakeSystem BrakeSystem;
TBrakeSubSystem BrakeSubsystem;
TBrakeValve BrakeValve;
TBrakeHandle BrakeHandle;
TBrakeHandle BrakeLocHandle;
double MBPM;
Hamulce::TBrake* Hamulec;
Hamulce::THandle* Handle;
Hamulce::THandle* LocHandle;
Hamulce::TReservoir* Pipe;
Hamulce::TReservoir* Pipe2;
TLocalBrake LocalBrake;
TBrakePressure BrakePressureTable[13];
TBrakePressure BrakePressureActual;
Byte ASBType;
Byte TurboTest;
double MaxBrakeForce;
double MaxBrakePress[5];
double P2FTrans;
double TrackBrakeForce;
Byte BrakeMethod;
double HighPipePress;
double LowPipePress;
double DeltaPipePress;
double CntrlPipePress;
double BrakeVolume;
double BrakeVVolume;
double VeselVolume;
int BrakeCylNo;
double BrakeCylRadius;
double BrakeCylDist;
double BrakeCylMult[3];
Byte LoadFlag;
double BrakeCylSpring;
double BrakeSlckAdj;
double BrakeRigEff;
double RapidMult;
int BrakeValveSize;
AnsiString BrakeValveParams;
double Spg;
double MinCompressor;
double MaxCompressor;
double CompressorSpeed;
double BrakeDelay[4];
Byte BrakeCtrlPosNo;
Byte MainCtrlPosNo;
Byte ScndCtrlPosNo;
bool ScndInMain;
bool MBrake;
TSecuritySystem SecuritySystem;
TScheme RList[65];
int RlistSize;
TMotorParameters MotorParam[11];
TTransmision Transmision;
double NominalVoltage;
double WindingRes;
double u;
double CircuitRes;
int IminLo;
int IminHi;
int ImaxLo;
int ImaxHi;
double nmax;
double InitialCtrlDelay;
double CtrlDelay;
double CtrlDownDelay;
Byte FastSerialCircuit;
Byte AutoRelayType;
bool CoupledCtrl;
bool IsCoupled;
Byte DynamicBrakeType;
Byte RVentType;
double RVentnmax;
double RVentCutOff;
int CompressorPower;
int SmallCompressorPower;
double dizel_Mmax;
double dizel_nMmax;
double dizel_Mnmax;
double dizel_nmax;
double dizel_nominalfill;
double dizel_Mstand;
double dizel_nmax_cutoff;
double dizel_nmin;
double dizel_minVelfullengage;
double dizel_AIM;
double dizel_engageDia;
double dizel_engageMaxForce;
double dizel_engagefriction;
double AnPos;
bool AnalogCtrl;
bool AnMainCtrl;
bool ShuntModeAllow;
bool ShuntMode;
bool Flat;
double Vhyp;
TDEScheme DElist[33];
double Vadd;
TMPTRelay MPTRelay[8];
Byte RelayType;
TShuntScheme SST[33];
double PowerCorRatio;
double Ftmax;
double eimc[21];
int MaxLoad;
AnsiString LoadAccepted;
AnsiString LoadQuantity;
double OverLoadFactor;
double LoadSpeed;
double UnLoadSpeed;
Byte DoorOpenCtrl;
Byte DoorCloseCtrl;
double DoorStayOpen;
bool DoorClosureWarning;
double DoorOpenSpeed;
double DoorCloseSpeed;
double DoorMaxShiftL;
double DoorMaxShiftR;
Byte DoorOpenMethod;
bool ScndS;
TLocation Loc;
TRotation Rot;
AnsiString Name;
TCoupling Couplers[2];
double HVCouplers[2][2];
int ScanCounter;
bool EventFlag;
Byte SoundFlag;
double DistCounter;
double V;
double Vel;
double AccS;
double AccN;
double AccV;
double nrot;
double EnginePower;
double dL;
double Fb;
double Ff;
double FTrain;
double FStand;
double FTotal;
double UnitBrakeForce;
double Ntotal;
bool SlippingWheels;
bool SandDose;
double Sand;
double BrakeSlippingTimer;
double dpBrake;
double dpPipe;
double dpMainValve;
double dpLocalValve;
double ScndPipePress;
double BrakePress;
double LocBrakePress;
double PipeBrakePress;
double PipePress;
double EqvtPipePress;
double Volume;
double CompressedVolume;
double PantVolume;
double Compressor;
bool CompressorFlag;
bool PantCompFlag;
bool CompressorAllow;
bool ConverterFlag;
bool ConverterAllow;
int BrakeCtrlPos;
double BrakeCtrlPosR;
double BrakeCtrlPos2;
Byte LocalBrakePos;
Byte ManualBrakePos;
double LocalBrakePosA;
Byte BrakeStatus;
bool EmergencyBrakeFlag;
Byte BrakeDelayFlag;
Byte BrakeDelays;
bool DynamicBrakeFlag;
double LimPipePress;
double ActFlowSpeed;
Byte DamageFlag;
Byte DerailReason;
TCommand CommandIn;
AnsiString CommandOut;
AnsiString CommandLast;
double ValueOut;
TTrackShape RunningShape;
TTrackParam RunningTrack;
double OffsetTrackH;
double OffsetTrackV;
bool Mains;
Byte MainCtrlPos;
Byte ScndCtrlPos;
int ActiveDir;
int CabNo;
int DirAbsolute;
int ActiveCab;
double LastSwitchingTime;
bool DepartureSignal;
bool InsideConsist;
TTractionParam RunningTraction;
double enrot;
double Im;
double Itot;
double IHeating;
double ITraction;
double TotalCurrent;
double Mm;
double Mw;
double Fw;
double Ft;
int Imin;
int Imax;
double Voltage;
Byte MainCtrlActualPos;
Byte ScndCtrlActualPos;
bool DelayCtrlFlag;
double LastRelayTime;
bool AutoRelayFlag;
bool FuseFlag;
bool ConvOvldFlag;
bool StLinFlag;
bool ResistorsFlag;
double RventRot;
bool UnBrake;
double PantPress;
bool s_CAtestebrake;
double dizel_fill;
double dizel_engagestate;
double dizel_engage;
double dizel_automaticgearstatus;
bool dizel_enginestart;
double dizel_engagedeltaomega;
double eimv[21];
double PulseForce;
double PulseForceTimer;
int PulseForceCount;
double eAngle;
int Load;
AnsiString LoadType;
Byte LoadStatus;
double LastLoadChangeTime;
bool DoorBlocked;
bool DoorLeftOpened;
bool DoorRightOpened;
bool PantFrontUp;
bool PantRearUp;
bool PantFrontSP;
bool PantRearSP;
int PantFrontStart;
int PantRearStart;
double PantFrontVolt;
double PantRearVolt;
AnsiString PantSwitchType;
AnsiString ConvSwitchType;
bool Heating;
int DoubleTr;
bool PhysicActivation;
double FrictConst1;
double FrictConst2s;
double FrictConst2d;
double TotalMassxg;
double __fastcall GetTrainsetVoltage(void);
bool __fastcall Physic_ReActivation(void);
double __fastcall LocalBrakeRatio(void);
double __fastcall ManualBrakeRatio(void);
double __fastcall PipeRatio(void);
double __fastcall RealPipeRatio(void);
double __fastcall BrakeVP(void);
bool __fastcall DynamicBrakeSwitch(bool Switch);
bool __fastcall SendCtrlBroadcast(AnsiString CtrlCommand, double ctrlvalue);
bool __fastcall SendCtrlToNext(AnsiString CtrlCommand, double ctrlvalue, double dir);
bool __fastcall CabActivisation(void);
bool __fastcall CabDeactivisation(void);
bool __fastcall IncMainCtrl(int CtrlSpeed);
bool __fastcall DecMainCtrl(int CtrlSpeed);
bool __fastcall IncScndCtrl(int CtrlSpeed);
bool __fastcall DecScndCtrl(int CtrlSpeed);
bool __fastcall AddPulseForce(int Multipler);
bool __fastcall SandDoseOn(void);
bool __fastcall SecuritySystemReset(void);
void __fastcall SecuritySystemCheck(double dt);
bool __fastcall BatterySwitch(bool State);
bool __fastcall EpFuseSwitch(bool State);
bool __fastcall IncBrakeLevelOld(void);
bool __fastcall DecBrakeLevelOld(void);
bool __fastcall IncLocalBrakeLevel(Byte CtrlSpeed);
bool __fastcall DecLocalBrakeLevel(Byte CtrlSpeed);
bool __fastcall IncLocalBrakeLevelFAST(void);
bool __fastcall DecLocalBrakeLevelFAST(void);
bool __fastcall IncManualBrakeLevel(Byte CtrlSpeed);
bool __fastcall DecManualBrakeLevel(Byte CtrlSpeed);
bool __fastcall EmergencyBrakeSwitch(bool Switch);
bool __fastcall AntiSlippingBrake(void);
bool __fastcall BrakeReleaser(Byte state);
bool __fastcall SwitchEPBrake(Byte state);
bool __fastcall AntiSlippingButton(void);
bool __fastcall IncBrakePress(double &brake, double PressLimit, double dp);
bool __fastcall DecBrakePress(double &brake, double PressLimit, double dp);
bool __fastcall BrakeDelaySwitch(Byte BDS);
bool __fastcall IncBrakeMult(void);
bool __fastcall DecBrakeMult(void);
void __fastcall UpdateBrakePressure(double dt);
void __fastcall UpdatePipePressure(double dt);
void __fastcall CompressorCheck(double dt);
//void __fastcall UpdatePantVolume(double dt);
void __fastcall UpdateScndPipePressure(double dt);
void __fastcall UpdateBatteryVoltage(double dt);
double __fastcall GetDVc(double dt);
void __fastcall ComputeConstans(void);
double __fastcall ComputeMass(void);
double __fastcall Adhesive(double staticfriction);
double __fastcall TractionForce(double dt);
double __fastcall FrictionForce(double R, Byte TDamage);
double __fastcall BrakeForce(const TTrackParam &Track);
double __fastcall CouplerForce(Byte CouplerN, double dt);
void __fastcall CollisionDetect(Byte CouplerN, double dt);
double __fastcall ComputeRotatingWheel(double WForce, double dt, double n);
bool __fastcall SetInternalCommand(AnsiString NewCommand, double NewValue1, double NewValue2);
double __fastcall GetExternalCommand(AnsiString &Command);
bool __fastcall RunCommand(AnsiString command, double CValue1, double CValue2);
bool __fastcall RunInternalCommand(void);
void __fastcall PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2, const TLocation
&NewLocation);
bool __fastcall DirectionBackward(void);
bool __fastcall MainSwitch(bool State);
bool __fastcall ConverterSwitch(bool State);
bool __fastcall CompressorSwitch(bool State);
bool __fastcall FuseOn(void);
bool __fastcall FuseFlagCheck(void);
void __fastcall FuseOff(void);
int __fastcall ShowCurrent(Byte AmpN);
double __fastcall v2n(void);
double __fastcall current(double n, double U);
double __fastcall Momentum(double I);
double __fastcall MomentumF(double I, double Iw, Byte SCP);
bool __fastcall CutOffEngine(void);
bool __fastcall MaxCurrentSwitch(bool State);
bool __fastcall ResistorsFlagCheck(void);
bool __fastcall MinCurrentSwitch(bool State);
bool __fastcall AutoRelaySwitch(bool State);
bool __fastcall AutoRelayCheck(void);
bool __fastcall dizel_EngageSwitch(double state);
bool __fastcall dizel_EngageChange(double dt);
bool __fastcall dizel_AutoGearCheck(void);
double __fastcall dizel_fillcheck(Byte mcp);
double __fastcall dizel_Momentum(double dizel_fill, double n, double dt);
bool __fastcall dizel_Update(double dt);
bool __fastcall LoadingDone(double LSpeed, AnsiString LoadInit);
void __fastcall ComputeTotalForce(double dt, double dt1, bool FullVer);
double __fastcall ComputeMovement(double dt, double dt1, const TTrackShape &Shape, TTrackParam &Track
, TTractionParam &ElectricTraction, const TLocation &NewLoc, TRotation &NewRot);
double __fastcall FastComputeMovement(double dt, const TTrackShape &Shape, TTrackParam &Track, const
TLocation &NewLoc, TRotation &NewRot);
bool __fastcall ChangeOffsetH(double DeltaOffset);
__fastcall T_MoverParameters(double VelInitial, AnsiString TypeNameInit, AnsiString NameInit, int LoadInitial
, AnsiString LoadTypeInitial, int Cab);
bool __fastcall LoadChkFile(AnsiString chkpath);
bool __fastcall CheckLocomotiveParameters(bool ReadyFlag, int Dir);
AnsiString __fastcall EngineDescription(int what);
bool __fastcall DoorLeft(bool State);
bool __fastcall DoorRight(bool State);
bool __fastcall DoorBlockedFlag(void);
bool __fastcall PantFront(bool State);
bool __fastcall PantRear(bool State);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall T_MoverParameters(void) : System::TObject() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~T_MoverParameters(void) { }
#pragma option pop
};
//-- var, const, procedure ---------------------------------------------------
static const bool Go = true;
static const bool Hold = false;
static const Shortint ResArraySize = 0x40;
static const Shortint MotorParametersArraySize = 0xa;
static const Shortint maxcc = 0x4;
static const Shortint LocalBrakePosNo = 0xa;
static const Shortint MainBrakeMaxPos = 0xa;
static const Shortint ManualBrakePosNo = 0x14;
static const Shortint dtrack_railwear = 0x2;
static const Shortint dtrack_freerail = 0x4;
static const Shortint dtrack_thinrail = 0x8;
static const Shortint dtrack_railbend = 0x10;
static const Shortint dtrack_plants = 0x20;
static const Shortint dtrack_nomove = 0x40;
static const Byte dtrack_norail = 0x80;
static const Shortint dtrain_thinwheel = 0x1;
static const Shortint dtrain_loadshift = 0x1;
static const Shortint dtrain_wheelwear = 0x2;
static const Shortint dtrain_bearing = 0x4;
static const Shortint dtrain_coupling = 0x8;
static const Shortint dtrain_ventilator = 0x10;
static const Shortint dtrain_loaddamage = 0x10;
static const Shortint dtrain_engine = 0x20;
static const Shortint dtrain_loaddestroyed = 0x20;
static const Shortint dtrain_axle = 0x40;
static const Byte dtrain_out = 0x80;
#define p_elengproblem (1.000000E-02)
#define p_elengdamage (1.000000E-01)
#define p_coupldmg (2.000000E-02)
#define p_derail (1.000000E-03)
#define p_accn (1.000000E-01)
#define p_slippdmg (1.000000E-03)
static const Shortint ctrain_virtual = 0x0;
static const Shortint ctrain_coupler = 0x1;
static const Shortint ctrain_pneumatic = 0x2;
static const Shortint ctrain_controll = 0x4;
static const Shortint ctrain_power = 0x8;
static const Shortint ctrain_passenger = 0x10;
static const Shortint ctrain_scndpneumatic = 0x20;
static const Shortint ctrain_heating = 0x40;
static const Byte ctrain_depot = 0x80;
static const Shortint dbrake_none = 0x0;
static const Shortint dbrake_passive = 0x1;
static const Shortint dbrake_switch = 0x2;
static const Shortint dbrake_reversal = 0x4;
static const Shortint dbrake_automatic = 0x8;
static const Shortint s_waiting = 0x1;
static const Shortint s_aware = 0x2;
static const Shortint s_active = 0x4;
static const Shortint s_CAalarm = 0x8;
static const Shortint s_SHPalarm = 0x10;
static const Shortint s_CAebrake = 0x20;
static const Shortint s_SHPebrake = 0x40;
static const Byte s_CAtest = 0x80;
static const Shortint sound_none = 0x0;
static const Shortint sound_loud = 0x1;
static const Shortint sound_couplerstretch = 0x2;
static const Shortint sound_bufferclamp = 0x4;
static const Shortint sound_bufferbump = 0x8;
static const Shortint sound_relay = 0x10;
static const Shortint sound_manyrelay = 0x20;
static const Shortint sound_brakeacc = 0x40;
extern PACKAGE bool PhysicActivationFlag;
static const Shortint dt_Default = 0x0;
static const Shortint dt_EZT = 0x1;
static const Shortint dt_ET41 = 0x2;
static const Shortint dt_ET42 = 0x4;
static const Shortint dt_PseudoDiesel = 0x8;
static const Shortint dt_ET22 = 0x10;
static const Shortint dt_SN61 = 0x20;
static const Shortint dt_EP05 = 0x40;
static const Byte dt_ET40 = 0x80;
static const Word dt_181 = 0x100;
static const Shortint eimc_s_dfic = 0x0;
static const Shortint eimc_s_dfmax = 0x1;
static const Shortint eimc_s_p = 0x2;
static const Shortint eimc_s_cfu = 0x3;
static const Shortint eimc_s_cim = 0x4;
static const Shortint eimc_s_icif = 0x5;
static const Shortint eimc_f_Uzmax = 0x7;
static const Shortint eimc_f_uzh = 0x8;
static const Shortint eimc_f_DU = 0x9;
static const Shortint eimc_f_I0 = 0xa;
static const Shortint eimc_f_cfu = 0xb;
static const Shortint eimc_p_F0 = 0xd;
static const Shortint eimc_p_a1 = 0xe;
static const Shortint eimc_p_Pmax = 0xf;
static const Shortint eimc_p_Fh = 0x10;
static const Shortint eimc_p_Ph = 0x11;
static const Shortint eimc_p_Vh0 = 0x12;
static const Shortint eimc_p_Vh1 = 0x13;
static const Shortint eimc_p_Imax = 0x14;
static const Shortint eimv_FMAXMAX = 0x0;
static const Shortint eimv_Fmax = 0x1;
static const Shortint eimv_ks = 0x2;
static const Shortint eimv_df = 0x3;
static const Shortint eimv_fp = 0x4;
static const Shortint eimv_U = 0x5;
static const Shortint eimv_pole = 0x6;
static const Shortint eimv_Ic = 0x7;
static const Shortint eimv_If = 0x8;
static const Shortint eimv_M = 0x9;
static const Shortint eimv_Fr = 0xa;
static const Shortint eimv_Ipoj = 0xb;
static const Shortint eimv_Pm = 0xc;
static const Shortint eimv_Pe = 0xd;
static const Shortint eimv_eta = 0xe;
static const Shortint eimv_fkr = 0xf;
static const Shortint eimv_Uzsmax = 0x10;
static const Shortint eimv_Pmax = 0x11;
static const Shortint eimv_Fzad = 0x12;
static const Shortint eimv_Imax = 0x13;
extern PACKAGE double __fastcall Distance(const TLocation &Loc1, const TLocation &Loc2, const TDimension
&Dim1, const TDimension &Dim2);
} /* namespace _mover */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace _mover;
#endif
#pragma option pop // -w-
#pragma option pop // -Vx
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // _mover

293
McZapkie/Oerlikon_ESt.hpp Normal file
View File

@@ -0,0 +1,293 @@
// Borland C++ Builder
// Copyright (c) 1995, 1999 by Borland International
// All rights reserved
// (DO NOT EDIT: machine generated header) 'Oerlikon_ESt.pas' rev: 5.00
#ifndef Oerlikon_EStHPP
#define Oerlikon_EStHPP
#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <hamulce.hpp> // Pascal unit
#include <friction.hpp> // Pascal unit
#include <SysUtils.hpp> // Pascal unit
#include <mctools.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit
//-- user supplied -----------------------------------------------------------
namespace Oerlikon_est
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS TPrzekladnik;
class PASCALIMPLEMENTATION TPrzekladnik : public Hamulce::TReservoir
{
typedef Hamulce::TReservoir inherited;
public:
Hamulce::TReservoir* *BrakeRes;
Hamulce::TReservoir* *Next;
virtual void __fastcall Update(double dt);
public:
#pragma option push -w-inl
/* TReservoir.Create */ inline __fastcall TPrzekladnik(void) : Hamulce::TReservoir() { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TPrzekladnik(void) { }
#pragma option pop
};
class DELPHICLASS TRura;
class PASCALIMPLEMENTATION TRura : public TPrzekladnik
{
typedef TPrzekladnik inherited;
public:
virtual double __fastcall P(void);
virtual void __fastcall Update(double dt);
public:
#pragma option push -w-inl
/* TReservoir.Create */ inline __fastcall TRura(void) : TPrzekladnik() { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TRura(void) { }
#pragma option pop
};
class DELPHICLASS TPrzeciwposlizg;
class PASCALIMPLEMENTATION TPrzeciwposlizg : public TRura
{
typedef TRura inherited;
private:
bool Poslizg;
public:
void __fastcall SetPoslizg(bool flag);
virtual void __fastcall Update(double dt);
public:
#pragma option push -w-inl
/* TReservoir.Create */ inline __fastcall TPrzeciwposlizg(void) : TRura() { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TPrzeciwposlizg(void) { }
#pragma option pop
};
class DELPHICLASS TRapid;
class PASCALIMPLEMENTATION TRapid : public TPrzekladnik
{
typedef TPrzekladnik inherited;
private:
bool RapidStatus;
double RapidMult;
double DN;
double DL;
public:
void __fastcall SetRapidParams(double mult, double size);
void __fastcall SetRapidStatus(bool rs);
virtual void __fastcall Update(double dt);
public:
#pragma option push -w-inl
/* TReservoir.Create */ inline __fastcall TRapid(void) : TPrzekladnik() { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TRapid(void) { }
#pragma option pop
};
class DELPHICLASS TPrzekCiagly;
class PASCALIMPLEMENTATION TPrzekCiagly : public TPrzekladnik
{
typedef TPrzekladnik inherited;
private:
double Mult;
public:
void __fastcall SetMult(double m);
virtual void __fastcall Update(double dt);
public:
#pragma option push -w-inl
/* TReservoir.Create */ inline __fastcall TPrzekCiagly(void) : TPrzekladnik() { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TPrzekCiagly(void) { }
#pragma option pop
};
class DELPHICLASS TPrzek_PZZ;
class PASCALIMPLEMENTATION TPrzek_PZZ : public TPrzekladnik
{
typedef TPrzekladnik inherited;
private:
double LBP;
public:
void __fastcall SetLBP(double P);
virtual void __fastcall Update(double dt);
public:
#pragma option push -w-inl
/* TReservoir.Create */ inline __fastcall TPrzek_PZZ(void) : TPrzekladnik() { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TPrzek_PZZ(void) { }
#pragma option pop
};
class DELPHICLASS TPrzekZalamany;
class PASCALIMPLEMENTATION TPrzekZalamany : public TPrzekladnik
{
typedef TPrzekladnik inherited;
public:
#pragma option push -w-inl
/* TReservoir.Create */ inline __fastcall TPrzekZalamany(void) : TPrzekladnik() { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TPrzekZalamany(void) { }
#pragma option pop
};
class DELPHICLASS TPrzekED;
class PASCALIMPLEMENTATION TPrzekED : public TRura
{
typedef TRura inherited;
private:
double MaxP;
public:
void __fastcall SetP(double P);
virtual void __fastcall Update(double dt);
public:
#pragma option push -w-inl
/* TReservoir.Create */ inline __fastcall TPrzekED(void) : TRura() { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TPrzekED(void) { }
#pragma option pop
};
class DELPHICLASS TNESt3;
class PASCALIMPLEMENTATION TNESt3 : public Hamulce::TBrake
{
typedef Hamulce::TBrake inherited;
private:
double Nozzles[11];
Hamulce::TReservoir* CntrlRes;
double BVM;
bool Zamykajacy;
bool Przys_blok;
Hamulce::TReservoir* Miedzypoj;
TPrzekladnik* Przekladniki[3];
bool RapidStatus;
bool RapidStaly;
double LoadC;
double TareM;
double LoadM;
double TareBP;
double HBG300;
double Podskok;
bool autom;
double LBP;
public:
virtual double __fastcall GetPF(double PP, double dt, double Vel);
void __fastcall EStParams(double i_crc);
virtual void __fastcall Init(double PP, double HPP, double LPP, double BP, Byte BDF);
virtual double __fastcall GetCRP(void);
void __fastcall CheckState(double BCP, double &dV1);
void __fastcall CheckReleaser(double dt);
double __fastcall CVs(double bp);
double __fastcall BVs(double BCP);
void __fastcall SetSize(int size, AnsiString params);
void __fastcall PLC(double mass);
void __fastcall SetLP(double TM, double LM, double TBP);
virtual void __fastcall ForceEmptiness(void);
void __fastcall SetLBP(double P);
public:
#pragma option push -w-inl
/* TBrake.Create */ inline __fastcall TNESt3(double i_mbp, double i_bcr, double i_bcd, double i_brc
, Byte i_bcn, Byte i_BD, Byte i_mat, Byte i_ba, Byte i_nbpa) : Hamulce::TBrake(i_mbp, i_bcr, i_bcd
, i_brc, i_bcn, i_BD, i_mat, i_ba, i_nbpa) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TNESt3(void) { }
#pragma option pop
};
//-- var, const, procedure ---------------------------------------------------
static const Shortint dMAX = 0xa;
static const Shortint dON = 0x0;
static const Shortint dOO = 0x1;
static const Shortint dTN = 0x2;
static const Shortint dTO = 0x3;
static const Shortint dP = 0x4;
static const Shortint dSd = 0x5;
static const Shortint dSm = 0x6;
static const Shortint dPd = 0x7;
static const Shortint dPm = 0x8;
static const Shortint dPO = 0x9;
static const Shortint dPT = 0xa;
static const Shortint p_none = 0x0;
static const Shortint p_rapid = 0x1;
static const Shortint p_pp = 0x2;
static const Shortint p_al2 = 0x3;
static const Shortint p_ppz = 0x4;
static const Shortint P_ed = 0x5;
extern PACKAGE double __fastcall d2A(double d);
} /* namespace Oerlikon_est */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Oerlikon_est;
#endif
#pragma option pop // -w-
#pragma option pop // -Vx
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // Oerlikon_ESt

797
McZapkie/Oerlikon_ESt.pas Normal file
View File

@@ -0,0 +1,797 @@
unit Oerlikon_ESt; {fizyka hamulcow Oerlikon ESt dla symulatora}
(*
MaSzyna EU07 - SPKS
Brakes. Oerlikon ESt.
Copyright (C) 2007-2014 Maciej Cierniak
*)
(*
(C) youBy
Co jest:
- glowny przyrzad rozrzadczy
- napelniacz zbiornika pomocniczego
- napelniacz zbiornika sterujacego
- zawor podskoku
- nibyprzyspieszacz
- tylko 16",14",12",10"
- nieprzekladnik rura
- przekladnik 1:1
- przekladniki AL2
- przeciwposlizgi
- rapid REL2
- HGB300
- inne srednice
Co brakuje:
- dobry przyspieszacz
- mozliwosc zasilania z wysokiego cisnienia ESt4
- ep: EP1 i EP2
- samoczynne ep
- PZZ dla dodatkowego
*)
interface
uses mctools,sysutils,friction,hamulce;//,klasy_ham;
CONST
dMAX=10; //dysze
dON = 0; //osobowy napelnianie (+ZP)
dOO = 1; //osobowy oproznianie
dTN = 2; //towarowy napelnianie (+ZP)
dTO = 3; //towarowy oproznianie
dP = 4; //zbiornik pomocniczy
dSd = 5; //zbiornik sterujacy
dSm = 6; //zbiornik sterujacy
dPd = 7; //duzy przelot zamykajcego
dPm = 8; //maly przelot zamykajacego
dPO = 9; //zasilanie pomocniczego O
dPT =10; //zasilanie pomocniczego T
//przekladniki
p_none = 0;
p_rapid = 1;
p_pp = 2;
p_al2 = 3;
p_ppz = 4;
P_ed = 5;
TYPE
TPrzekladnik= class(TReservoir) //przekladnik (powtarzacz)
private
public
BrakeRes: PReservoir;
Next: PReservoir;
procedure Update(dt:real); virtual;
end;
TRura= class(TPrzekladnik) //nieprzekladnik, rura laczaca
private
public
function P: real; override;
procedure Update(dt:real); override;
end;
TPrzeciwposlizg= class(TRura) //przy napelnianiu - rura, przy poslizgu - upust
private
Poslizg: boolean;
public
procedure SetPoslizg(flag: boolean);
procedure Update(dt:real); override;
end;
TRapid= class(TPrzekladnik) //przekladnik dwustopniowy
private
RapidStatus: boolean; //status rapidu
RapidMult: real; //przelozenie (w dol)
// Komora2: real;
DN,DL: real; //srednice dysz napelniania i luzowania
public
procedure SetRapidParams(mult: real; size: real);
procedure SetRapidStatus(rs: boolean);
procedure Update(dt:real); override;
end;
TPrzekCiagly= class(TPrzekladnik) //AL2
private
Mult: real;
public
procedure SetMult(m: real);
procedure Update(dt:real); override;
end;
TPrzek_PZZ= class(TPrzekladnik) //podwojny zawor zwrotny
private
LBP: real;
public
procedure SetLBP(P: real);
procedure Update(dt:real); override;
end;
TPrzekZalamany= class(TPrzekladnik) //Knicksventil
private
public
end;
TPrzekED= class(TRura) //przy napelnianiu - rura, przy hamowaniu - upust
private
MaxP: real;
public
procedure SetP(P: real);
procedure Update(dt:real); override;
end;
TNESt3= class(TBrake)
private
Nozzles: array[0..dMAX] of real; //dysze
CntrlRes: TReservoir; //zbiornik steruj¹cy
BVM: real; //przelozenie PG-CH
// ValveFlag: byte; //polozenie roznych zaworkow
Zamykajacy: boolean; //pamiec zaworka zamykajacego
// Przys_wlot: boolean; //wlot do komory przyspieszacza
Przys_blok: boolean; //blokada przyspieszacza
Miedzypoj: TReservoir; //pojemnosc posrednia (urojona) do napelniania ZP i ZS
Przekladniki: array[1..3] of TPrzekladnik;
RapidStatus: boolean;
RapidStaly: boolean;
LoadC: real;
TareM, LoadM: real; //masa proznego i pelnego
TareBP: real; //cisnienie dla proznego
HBG300: real; //zawor ograniczajacy cisnienie
Podskok: real; //podskok preznosci poczatkowej
// HPBR: real; //zasilanie ZP z wysokiego cisnienia
autom: boolean; //odluzniacz samoczynny
LBP: real; //cisnienie hamulca pomocniczego
public
function GetPF(PP, dt, Vel: real): real; override; //przeplyw miedzy komora wstepna i PG
procedure EStParams(i_crc: real); //parametry charakterystyczne dla ESt
procedure Init(PP, HPP, LPP, BP: real; BDF: byte); override;
function GetCRP: real; override;
procedure CheckState(BCP: real; var dV1: real); //glowny przyrzad rozrzadczy
procedure CheckReleaser(dt: real); //odluzniacz
function CVs(bp: real): real; //napelniacz sterujacego
function BVs(BCP: real): real; //napelniacz pomocniczego
procedure SetSize(size: integer; params: string); //ustawianie dysz (rozmiaru ZR), przekladniki
procedure PLC(mass: real); //wspolczynnik cisnienia przystawki wazacej
procedure SetLP(TM, LM, TBP: real); //parametry przystawki wazacej
procedure ForceEmptiness(); override; //wymuszenie bycia pustym
procedure SetLBP(P: real); //cisnienie z hamulca pomocniczego
end;
function d2A(d: real):real;
implementation
function d2A(d: real):real;
begin
d2A:=(d*d)*0.7854/1000;
end;
// ------ RURA ------
function TRura.P: real;
begin
P:=Next.P;
end;
procedure TRura.Update(dt: real);
begin
Next.Flow(dVol);
dVol:=0;
end;
// ------ PRZECIWPOSLIG ------
procedure TPrzeciwposlizg.SetPoslizg(flag: boolean);
begin
Poslizg:=flag;
end;
procedure TPrzeciwposlizg.Update(dt: real);
begin
if (Poslizg) then
begin
BrakeRes.Flow(dVol);
Next.Flow(PF(Next.P,0,d2A(10))*dt);
end
else
Next.Flow(dVol);
dVol:=0;
end;
// ------ PRZEKLADNIK ------
procedure TPrzekladnik.Update(dt: real);
var BCP, BVP, dV: real;
begin
BCP:=Next.P;
BVP:=BrakeRes.P;
if(BCP>P)then
dV:=-PFVd(BCP,0,d2A(10),P)*dt
else
if(BCP<P)then
dV:=PFVa(BVP,BCP,d2A(10),P)*dt
else dV:=0;
Next.Flow(dV);
if dV>0 then
BrakeRes.Flow(-dV);
end;
// ------ PRZEKLADNIK RAPID ------
procedure TRapid.SetRapidParams(mult: real; size: real);
begin
RapidMult:=mult;
RapidStatus:=false;
if (size>0.1) then //dopasowywanie srednicy przekladnika
begin
DN:=D2A(size*0.4);
DL:=D2A(size*0.4);
end
else
begin
DN:=D2A(5);
DL:=D2A(5);
end;
end;
procedure TRapid.SetRapidStatus(rs: boolean);
begin
RapidStatus:=rs;
end;
procedure TRapid.Update(dt: real);
var BCP, BVP, dV, ActMult: real;
begin
BVP:=BrakeRes.P;
BCP:=Next.P;
if(RapidStatus)then
begin
ActMult:=RapidMult;
end
else
begin
ActMult:=1;
end;
if(BCP*RapidMult>P*actMult)then
dV:=-PFVd(BCP,0,DL,P*actMult/RapidMult)*dt
else
if(BCP*RapidMult<P*ActMult)then
dV:=PFVa(BVP,BCP,DN,P*actMult/RapidMult)*dt
else dV:=0;
Next.Flow(dV);
if dV>0 then
BrakeRes.Flow(-dV);
end;
// ------ PRZEK£ADNIK CI¥G£Y ------
procedure TPrzekCiagly.SetMult(m:real);
begin
Mult:=m;
end;
procedure TPrzekCiagly.Update(dt: real);
var BCP, BVP, dV: real;
begin
BVP:=BrakeRes.P;
BCP:=Next.P;
if(BCP>P*Mult)then
dV:=-PFVd(BCP,0,d2A(8),P*Mult)*dt
else
if(BCP<P*Mult)then
dV:=PFVa(BVP,BCP,d2A(8),P*Mult)*dt
else dV:=0;
Next.Flow(dV);
if dV>0 then
BrakeRes.Flow(-dV);
end;
// ------ PRZEK£ADNIK CI¥G£Y ------
procedure TPrzek_PZZ.SetLBP(P:real);
begin
LBP:=P;
end;
procedure TPrzek_PZZ.Update(dt: real);
var BCP, BVP, dV, Pgr: real;
begin
BVP:=BrakeRes.P;
BCP:=Next.P;
Pgr:=Max0R(LBP,P);
if(BCP>Pgr)then
dV:=-PFVd(BCP,0,d2A(8),Pgr)*dt
else
if(BCP<Pgr)then
dV:=PFVa(BVP,BCP,d2A(8),Pgr)*dt
else dV:=0;
Next.Flow(dV);
if dV>0 then
BrakeRes.Flow(-dV);
end;
// ------ PRZECIWPOSLIG ------
procedure TPrzekED.SetP(P: real);
begin
MaxP:=P;
end;
procedure TPrzekED.Update(dt: real);
begin
if Next.P>MaxP then
begin
BrakeRes.Flow(dVol);
Next.Flow(PFVd(Next.P,0,d2A(10)*dt,MaxP));
end
else
Next.Flow(dVol);
dVol:=0;
end;
// ------ OERLIKON EST NA BOGATO ------
function TNESt3.GetPF(PP, dt, Vel: real): real; //przeplyw miedzy komora wstepna i PG
var dv, dv1, temp:real;
VVP, BVP, BCP, CVP, MPP, nastG: real;
i: byte;
begin
BVP:=BrakeRes.P;
VVP:=ValveRes.P;
// BCP:=BrakeCyl.P;
BCP:=Przekladniki[1].P;
CVP:=CntrlRes.P-0.0;
MPP:=Miedzypoj.P;
dV1:=0;
nastG:=(BrakeDelayFlag and bdelay_G);
//sprawdzanie stanu
CheckState(BCP, dV1);
CheckReleaser(dt);
//luzowanie
if(BrakeStatus and b_hld)=b_off then
dV:=PF(0,BCP,Nozzles[dTO]*nastG+(1-nastG)*Nozzles[dOO])*dt*(0.1+4.9*Min0R(0.2,BCP-((CVP-0.05-VVP)*BVM+0.1)))
else dV:=0;
// BrakeCyl.Flow(-dV);
Przekladniki[1].Flow(-dV);
if((BrakeStatus and b_on)=b_on)and(Przekladniki[1].P*HBG300<MaxBP)then
dV:=PF(BVP,BCP,Nozzles[dTN]*(nastG+2*Byte(BCP<Podskok))+Nozzles[dON]*(1-nastG))*dt*(0.1+4.9*Min0R(0.2,(CVP-0.05-VVP)*BVM-BCP))
else dV:=0;
// BrakeCyl.Flow(-dV);
Przekladniki[1].Flow(-dV);
BrakeRes.Flow(dV);
for i:=1 to 3 do
begin
Przekladniki[i].Update(dt);
if (Przekladniki[i] is TRapid) then
begin
RapidStatus:=(((BrakeDelayFlag and bdelay_R)=bdelay_R) and ((Abs(Vel)>70) or ((RapidStatus) and (Abs(Vel)>50)) or (RapidStaly)));
(Przekladniki[i] as TRapid).SetRapidStatus(RapidStatus);
end
else
if (Przekladniki[i] is TPrzeciwposlizg) then
(Przekladniki[i] as TPrzeciwposlizg).SetPoslizg((BrakeStatus and b_asb)=b_asb)
else
if (Przekladniki[i] is TPrzekED) then
if (Vel<-15) then
(Przekladniki[i] as TPrzekED).SetP(0)
else (Przekladniki[i] as TPrzekED).SetP(MaxBP*3)
else
if (Przekladniki[i] is TPrzekCiagly) then
(Przekladniki[i] as TPrzekCiagly).SetMult(LoadC)
else
if (Przekladniki[i] is TPrzek_PZZ) then
(Przekladniki[i] as TPrzek_PZZ).SetLBP(LBP);
end;
//przeplyw testowy miedzypojemnosci
dV:=PF(MPP,VVP,BVs(BCP))+PF(MPP,CVP,CVs(BCP));
if(MPP-0.05>BVP)then
dV:=dV+PF(MPP-0.05,BVP,Nozzles[dPT]*nastG+(1-nastG)*Nozzles[dPO]);
if MPP>VVP then dV:=dV+PF(MPP,VVP,d2A(5));
Miedzypoj.Flow(dV*dt*0.15);
//przeplyw ZS <-> PG
temp:=CVs(BCP);
dV:=PF(CVP,MPP,temp)*dt;
CntrlRes.Flow(+dV);
ValveRes.Flow(-0.02*dV);
dV1:=dV1+0.98*dV;
//przeplyw ZP <-> MPJ
if(MPP-0.05>BVP)then
dV:=PF(BVP,MPP-0.05,Nozzles[dPT]*nastG+(1-nastG)*Nozzles[dPO])*dt
else dV:=0;
BrakeRes.Flow(dV);
dV1:=dV1+dV*0.98;
ValveRes.Flow(-0.02*dV);
//przeplyw PG <-> rozdzielacz
dV:=PF(PP,VVP,0.005)*dt; //0.01
ValveRes.Flow(-dV);
ValveRes.Act;
BrakeCyl.Act;
BrakeRes.Act;
CntrlRes.Act;
Miedzypoj.Act;
Przekladniki[1].Act;
Przekladniki[2].Act;
Przekladniki[3].Act;
GetPF:=dV-dV1;
end;
procedure TNESt3.EStParams(i_crc: real); //parametry charakterystyczne dla ESt
begin
end;
procedure TNESt3.Init(PP, HPP, LPP, BP: real; BDF: byte);
begin
ValveRes.CreatePress(1*PP);
BrakeCyl.CreatePress(1*BP);
BrakeRes.CreatePress(1*PP);
CntrlRes:=TReservoir.Create;
CntrlRes.CreateCap(15);
CntrlRes.CreatePress(1*HPP);
BrakeStatus:=Byte(BP>1)*1;
Miedzypoj:=TReservoir.Create;
Miedzypoj.CreateCap(5);
Miedzypoj.CreatePress(PP);
BVM:=1/(HPP-0.05-LPP)*MaxBP;
BrakeDelayFlag:=BDF;
Zamykajacy:=false;
if not ((FM is TDisk1) or (FM is TDisk2)) then //jesli zeliwo to schodz
RapidStaly:=false
else
RapidStaly:=true;
end;
function TNESt3.GetCRP: real;
begin
GetCRP:=CntrlRes.P;
// GetCRP:=Przekladniki[1].P;
// GetCRP:=Miedzypoj.P;
end;
procedure TNESt3.CheckState(BCP: real; var dV1: real); //glowny przyrzad rozrzadczy
var VVP, BVP, CVP, MPP: real;
begin
BVP:=BrakeRes.P; //-> tu ma byc komora rozprezna
VVP:=ValveRes.P;
CVP:=CntrlRes.P;
MPP:=Miedzypoj.P;
if(BCP<0.25)and(VVP+0.08>CVP)then Przys_blok:=false;
//sprawdzanie stanu
// if ((BrakeStatus and 1)=1)and(BCP>0.25)then
if(VVP+0.01+BCP/BVM<CVP-0.05)and(Przys_blok)then
BrakeStatus:=(BrakeStatus or 3) //hamowanie stopniowe
else if(VVP-0.01+(BCP-0.1)/BVM>CVP-0.05) then
BrakeStatus:=(BrakeStatus and 252) //luzowanie
else if(VVP+BCP/BVM>CVP-0.05) then
BrakeStatus:=(BrakeStatus and 253) //zatrzymanie napelaniania
else if(VVP+(BCP-0.1)/BVM<CVP-0.05)and(BCP>0.25)then //zatrzymanie luzowania
BrakeStatus:=(BrakeStatus or 1);
if (BrakeStatus and 1)=0 then
SoundFlag:=SoundFlag or sf_CylU;
if(VVP+0.10<CVP)and(BCP<0.25)then //poczatek hamowania
if (not Przys_blok) then
begin
ValveRes.CreatePress(0.1*VVP);
SoundFlag:=SoundFlag or sf_Acc;
ValveRes.Act;
Przys_blok:=true;
end;
if(BCP>0.5)then
Zamykajacy:=true
else if(VVP-0.6<MPP) then
Zamykajacy:=false;
end;
procedure TNESt3.CheckReleaser(dt: real); //odluzniacz
var
VVP, CVP: real;
begin
VVP:=ValveRes.P;
CVP:=CntrlRes.P;
//odluzniacz automatyczny
if(BrakeStatus and b_rls=b_rls)then
begin
CntrlRes.Flow(+PF(CVP,0,0.02)*dt);
if(CVP<VVP+0.3)or(not autom)then
BrakeStatus:=BrakeStatus and 247;
end;
end;
function TNESt3.CVs(bp: real): real; //napelniacz sterujacego
var CVP, MPP: real;
begin
CVP:=CntrlRes.P;
MPP:=Miedzypoj.P;
//przeplyw ZS <-> PG
if(MPP<CVP-0.17)then
CVS:=0
else
if(MPP>CVP-0.08)then
CVs:=Nozzles[dSD]
else
CVs:=Nozzles[dSm];
end;
function TNESt3.BVs(BCP: real): real; //napelniacz pomocniczego
var CVP, MPP: real;
begin
CVP:=CntrlRes.P;
MPP:=Miedzypoj.P;
//przeplyw ZP <-> rozdzielacz
if(MPP<CVP-0.3)then
BVs:=Nozzles[dP]
else
if(BCP<0.5) then
if(Zamykajacy)then
BVs:=Nozzles[dPm] //1.25
else
BVs:=Nozzles[dPD]
else
BVs:=0;
end;
procedure TNESt3.PLC(mass: real);
begin
LoadC:=1+Byte(Mass<LoadM)*((TareBP+(MaxBP-TareBP)*(mass-TareM)/(LoadM-TareM))/MaxBP-1);
end;
procedure TNESt3.ForceEmptiness();
begin
ValveRes.CreatePress(0);
BrakeRes.CreatePress(0);
Miedzypoj.CreatePress(0);
CntrlRes.CreatePress(0);
BrakeStatus:=0;
ValveRes.Act();
BrakeRes.Act();
Miedzypoj.Act();
CntrlRes.Act();
end;
procedure TNESt3.SetLP(TM, LM, TBP: real);
begin
TareM:=TM;
LoadM:=LM;
TareBP:=TBP;
end;
procedure TNESt3.SetLBP(P: real);
begin
LBP:=P;
end;
procedure TNESt3.SetSize(size: integer; params: string); //ustawianie dysz (rozmiaru ZR)
const
dNO1l = 1.250;
dNT1l = 0.510;
dOO1l = 0.907;
dOT1l = 0.524;
var
i:integer;
begin
if Pos('ESt3',params)>0 then
begin
Podskok:=0.7;
Przekladniki[1]:=TRura.Create;
Przekladniki[3]:=TRura.Create;
end
else
begin
Podskok:=-1;
Przekladniki[1]:=TRapid.Create;
if Pos('-s216',params)>0 then
(Przekladniki[1] as TRapid).SetRapidParams(2,16)
else
(Przekladniki[1] as TRapid).SetRapidParams(2,0);
Przekladniki[3]:=TPrzeciwposlizg.Create;
if Pos('-ED',params)>0 then
begin
Przekladniki[3].Free();
(Przekladniki[1] as TRapid).SetRapidParams(2,18);
Przekladniki[3]:=TPrzekED.Create;
end;
end;
if Pos('AL2',params)>0 then
Przekladniki[2]:=TPrzekCiagly.Create
else
if Pos('PZZ',params)>0 then
Przekladniki[2]:=TPrzek_PZZ.Create
else
Przekladniki[2]:=TRura.Create;
if (Pos('3d',params)+Pos('4d',params)>0) then autom:=false else autom:=true;
if (Pos('HBG300',params)>0) then HBG300:=1 else HBG300:=0;
case size of
16:
begin //dON,dOO,dTN,dTO,dP,dS
Nozzles[dON]:=5.0;//5.0;
Nozzles[dOO]:=3.4;//3.4;
Nozzles[dTN]:=2.0;
Nozzles[dTO]:=1.75;
Nozzles[dP]:=3.8;
Nozzles[dPd]:=2.70;
Nozzles[dPm]:=1.25;
Nozzles[dPO]:=Nozzles[dON];
Nozzles[dPT]:=Nozzles[dTN];
end;
14:
begin //dON,dOO,dTN,dTO,dP,dS
Nozzles[dON]:=4.3;
Nozzles[dOO]:=2.85;
Nozzles[dTN]:=1.83;
Nozzles[dTO]:=1.57;
Nozzles[dP]:=3.4;
Nozzles[dPd]:=2.20;
Nozzles[dPm]:=1.10;
Nozzles[dPO]:=Nozzles[dON];
Nozzles[dPT]:=Nozzles[dTN];
end;
12:
begin //dON,dOO,dTN,dTO,dP,dS
Nozzles[dON]:=3.7;
Nozzles[dOO]:=2.50;
Nozzles[dTN]:=1.65;
Nozzles[dTO]:=1.39;
Nozzles[dP]:=2.65;
Nozzles[dPd]:=1.80;
Nozzles[dPm]:=0.85;
Nozzles[dPO]:=Nozzles[dON];
Nozzles[dPT]:=Nozzles[dTN];
end;
10:
begin //dON,dOO,dTN,dTO,dP,dS
Nozzles[dON]:=3.1;
Nozzles[dOO]:=2.0;
Nozzles[dTN]:=1.35;
Nozzles[dTO]:=1.13;
Nozzles[dP]:=1.6;
Nozzles[dPd]:=1.55;
Nozzles[dPm]:=0.7;
Nozzles[dPO]:=Nozzles[dON];
Nozzles[dPT]:=Nozzles[dTN];
end;
200:
begin //dON,dOO,dTN,dTO,dP,dS
Nozzles[dON]:=dNO1l;
Nozzles[dOO]:=dOO1l/1.15;
Nozzles[dTN]:=dNT1l;
Nozzles[dTO]:=dOT1l;
Nozzles[dP]:=7.4;
Nozzles[dPd]:=5.3;
Nozzles[dPm]:=2.5;
Nozzles[dPO]:=7.28;
Nozzles[dPT]:=2.96;
end;
375:
begin //dON,dOO,dTN,dTO,dP,dS
Nozzles[dON]:=dNO1l;
Nozzles[dOO]:=dOO1l/1.15;
Nozzles[dTN]:=dNT1l;
Nozzles[dTO]:=dOT1l;
Nozzles[dP]:=13.0;
Nozzles[dPd]:=9.6;
Nozzles[dPm]:=4.4;
Nozzles[dPO]:=9.92;
Nozzles[dPT]:=3.99;
end;
150:
begin //dON,dOO,dTN,dTO,dP,dS
Nozzles[dON]:=dNO1l;
Nozzles[dOO]:=dOO1l;
Nozzles[dTN]:=dNT1l;
Nozzles[dTO]:=dOT1l;
Nozzles[dP]:=5.8;
Nozzles[dPd]:=4.1;
Nozzles[dPm]:=1.9;
Nozzles[dPO]:=6.33;
Nozzles[dPT]:=2.58;
end;
100:
begin //dON,dOO,dTN,dTO,dP,dS
Nozzles[dON]:=dNO1l;
Nozzles[dOO]:=dOO1l;
Nozzles[dTN]:=dNT1l;
Nozzles[dTO]:=dOT1l;
Nozzles[dP]:=4.2;
Nozzles[dPd]:=2.9;
Nozzles[dPm]:=1.4;
Nozzles[dPO]:=5.19;
Nozzles[dPT]:=2.14;
end;
else
begin
Nozzles[dON]:=0;
Nozzles[dOO]:=0;
Nozzles[dTN]:=0;
Nozzles[dTO]:=0;
Nozzles[dP]:=0;
Nozzles[dPd]:=0;
Nozzles[dPm]:=0;
end;
end;
Nozzles[dSd]:=1.1;
Nozzles[dSm]:=0.9;
//przeliczanie z mm^2 na l/m
for i:=0 to dMAX do
begin
Nozzles[i]:=d2A(Nozzles[i]); //(/1000^2*pi/4*1000)
end;
for i:=1 to 3 do
begin
Przekladniki[i].BrakeRes:=@BrakeRes;
Przekladniki[i].CreateCap(i);
Przekladniki[i].CreatePress(BrakeCyl.P);
if i<3 then
Przekladniki[i].Next:=@Przekladniki[i+1]
else
Przekladniki[i].Next:=@BrakeCyl;
end
end;
end.

484
McZapkie/Unit1.pas Normal file
View File

@@ -0,0 +1,484 @@
unit Unit1;
interface
uses
ai_driver,mtable,mover,mctools,Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Label2: TLabel;
Label3: TLabel;
Timer1: TTimer;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Button7: TButton;
Button8: TButton;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Button9: TButton;
Button10: TButton;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Button11: TButton;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
lczas: TLabel;
Label28: TLabel;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
Button12: TButton;
BStart: TButton;
Label35: TLabel;
Label36: TLabel;
Label37: TLabel;
Label38: TLabel;
Button13: TButton;
Label39: TLabel;
Label40: TLabel;
Label41: TLabel;
Label42: TLabel;
Label43: TLabel;
Button14: TButton;
Button15: TButton;
Label44: TLabel;
Label45: TLabel;
Label46: TLabel;
Label47: TLabel;
BMains: TButton;
Label48: TLabel;
Label49: TLabel;
Label50: TLabel;
Panel1: TPanel;
Label1: TLabel;
OpenDialog1: TOpenDialog;
Edit1: TEdit;
GroupBox1: TGroupBox;
CheckBox1: TCheckBox;
BSInc: TButton;
BSDec: TButton;
Label51: TLabel;
Label52: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button12Click(Sender: TObject);
procedure BStartClick(Sender: TObject);
procedure Button13MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button14Click(Sender: TObject);
procedure Button15Click(Sender: TObject);
procedure BMainsClick(Sender: TObject);
procedure CheckBox1Click(Sender: TObject);
procedure BSIncClick(Sender: TObject);
procedure BSDecClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
const
mtno=30;
tno:integer=0;
var
Form1: TForm1;
loc:TMoverParameters;
wagony:array[1..mtno] of TMoverParameters;
mechanik: TController;
pociag: TTrainParameters;
couplerflag:byte;
l0,l0p:TLocation;
ll:array[1..mtno] of TLocation;
r0:TRotation;
rr:array[1..mtno] of TRotation;
Shape:TTrackShape; Track:TTrackParam;
ExternalVoltage:real;
ActualTime:real;
fout: text;
OK:boolean;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
var typename,path:string;slashpos:byte;
begin
couplerflag:=strtoint(Edit1.Text);
if tno>0 then
wagony[tno]:=TMoverParameters.Create;
OpenDialog1.Execute;
path:='';
typename:=OpenDialog1.Filename;
repeat
slashpos:=pos('\',typename);
if slashpos>0 then
typename:=copy(typename,slashpos+1,length(typename));
until slashpos=0;
path:=copy(opendialog1.filename,1,length(opendialog1.filename)-length(typename));
typename:=Copy(typename,1,Pos('.chk',typename)-1);
if tno=0 then
begin
loc.Init(l0,r0,0,typename,'lokomotywa',0,'',1);
OK:=loc.loadchkfile(path) and loc.CheckLocomotiveParameters(Go);
if OK then
begin
Label1.Caption:=loc.TypeName;
case loc.AutoRelayType of
2: CheckBox1.Enabled:=True;
1: CheckBox1.Checked:=True;
end;
end;
end
else
begin
wagony[tno].Init(ll[tno],rr[tno],0,typename,IntToStr(tno),0,'',0);
OK:=OK and (wagony[tno].loadchkfile(path) and wagony[tno].CheckLocomotiveParameters(Go));
if OK then
begin
Label1.Caption:=Label1.Caption+' '+wagony[tno].TypeName;
if tno=1 then
ll[tno].x:=loc.Loc.x-loc.Dim.L/2-wagony[tno].Dim.L/2
else
ll[tno].x:=wagony[tno-1].Loc.x-wagony[tno-1].Dim.L/2-wagony[tno].Dim.L/2;
wagony[tno].loc:=ll[tno];
if tno=1 then
begin
OK:=OK and loc.attach(2,@wagony[1],couplerflag);
OK:=OK and wagony[1].attach(1,@loc,couplerflag);
end
else
begin
OK:=OK and wagony[tno-1].attach(2,@wagony[tno],couplerflag);
OK:=OK and wagony[tno].attach(1,@wagony[tno-1],couplerflag);
end
end;
end;
if OK then
begin
BStart.Enabled:=True;
if tno=mtno then button1.enabled:=false
else inc(tno);
Label49.Caption:='ilosc pojazdow '+inttostr(tno);
end
else
begin
Label1.Caption:=inttostr(conversionerror)+' '+inttostr(linecount);
Button1.Enabled:=False;
end;
end;
procedure TForm1.Button2Click(Sender: TObject);
var iw:integer;
begin
if Timer1.Enabled then
begin
Timer1.Enabled:=False;
CloseFile(fout);
end;
mechanik.CloseLog;
mechanik.free;
loc.Free;
for iw:=1 to tno do
wagony[iw].Free;
Close;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var dl,dt:real; iw:integer;
begin
dt:=Timer1.Interval/1000;
ActualTime:=ActualTime+dt;
if l0.x>200 then Shape.R:=1000;
if l0.x>1000 then Shape.R:=-500;
if l0.x>1500 then Shape.R:=0;
if l0.x>2000 then Shape.R:=1500;
if l0.x>2200 then Shape.R:=3000;
if l0.x>2400 then Shape.R:=0;
loc.ComputeTotalForce(dt);
for iw:=1 to tno do
wagony[iw].ComputeTotalForce(dt);
dl:=loc.ComputeMovement(dt,Shape,Track,ExternalVoltage,l0,r0);
l0.x:=l0.x+dl;
for iw:=1 to tno do
begin
dl:=wagony[iw].ComputeMovement(dt,Shape,Track,ExternalVoltage,ll[iw],rr[iw]);
ll[iw].x:=ll[iw].x+dl;
end;
mechanik.UpdateSituation(dt);
l0p.x:=500; l0p.y:=2; l0.z:=0;
if (l0.x>-1) and (l0.x<5) then
loc.PutCommand('SetVelocity',60,-1,l0p);
if (l0.x>499) and (l0.x<505) then
loc.PutCommand('SetVelocity',-1,-1,l0);
l0p.x:=3600;
if (l0.x>2985) and (l0.x<3005) then
loc.PutCommand('SetVelocity',-1,0,l0p);
if (l0.x>3600) and (l0.x<3615) then
loc.PutCommand('SetVelocity',0,0,l0);
if (l0.x>3430) and (loc.Vel<0.01) and (mechanik.GetCurrentOrder=Obey_train) then
loc.PutCommand('SetVelocity',0,0,l0);
if (loc.power>0) then
begin
Label2.Caption:='I0='+r2s(Loc.Im,0)+' A';
Label3.Caption:=r2s(Loc.Ft/1000,0)+' kN';
Label13.Caption:=IntToStr(Loc.MainCtrlPos);
Label18.Caption:=IntToStr(Loc.ScndCtrlPos);
Label20.Caption:=IntToStr(Loc.MainCtrlActualPos);
Label21.Caption:=IntToStr(Loc.ScndCtrlActualPos);
end
else
for iw:=1 to tno do
if wagony[iw].power>0 then
begin
Label2.Caption:='I'+IntToStr(iw)+'='+r2s(wagony[iw].Im,0)+' A';
Label3.Caption:=r2s(wagony[iw].Ft/1000,0)+' kN';
Label13.Caption:=IntToStr(wagony[iw].MainCtrlPos);
Label18.Caption:=IntToStr(wagony[iw].ScndCtrlPos);
Label20.Caption:=IntToStr(wagony[iw].MainCtrlActualPos);
Label21.Caption:=IntToStr(wagony[iw].ScndCtrlActualPos);
end;
Label4.Caption:=r2s(l0.x,0)+' m';
Label5.Caption:=r2s(Sign(Loc.V)*Loc.Vel,0)+' km/h';
Label6.Caption:=r2s(Loc.AccS,0)+' m/ss';
Label9.Caption:=r2s(Loc.Fb/1000,0)+' kN';
Label10.Caption:=r2s(Loc.Compressor,0)+' MPa';
Label11.Caption:=r2s(Loc.PipePress,0)+' MPa';
Label12.Caption:=r2s(Loc.BrakePress,0)+' MPa';
Label14.Caption:=IntToStr(Loc.BrakeCtrlPos);
Label15.Caption:=IntToStr(Loc.LocalBrakePos);
Label16.Caption:=IntToStr(Loc.showcurrent(1));
Label17.Caption:=IntToStr(Loc.showcurrent(2));
if loc.SlippingWheels then
Label19.Caption:='Poslizg!'
else Label19.Caption:=' ';
Label22.Caption:=r2s(ll[1].x,0)+' m';
if tno>=1 then
begin
Label23.Caption:=r2s(Sign(wagony[1].V)*wagony[1].Vel,0)+' km/h';
Label24.Caption:=r2s(Distance(loc.loc,wagony[1].loc,loc.dim,wagony[1].dim),0)+' m';
end;
Label25.Caption:=r2s(loc.nrot,0)+' 1/s';
Label28.Caption:=r2s(ll[2].x,0)+' m';
if tno>=2 then
Label29.Caption:=r2s(sign(wagony[2].V)*wagony[2].Vel,0)+' km/h';
Label30.Caption:=r2s(loc.dpLocalValve/dt,0)+' MPa/s';
Label31.Caption:=r2s(loc.dpBrake/dt,0)+' MPa/s';
Label32.Caption:=r2s(loc.dpMainValve/dt,0)+' MPa/s';
Label33.Caption:=r2s(loc.dpPipe/dt,0)+' MPa/s';
if tno>0 then Label34.Caption:=r2s(wagony[tno].PipePress,0)+' MPa';
Label35.Caption:=r2s(ll[3].x,0)+' m';
if tno>0 then Label36.Caption:=r2s(sign(wagony[tno].V)*wagony[tno].Vel,0)+' km/h';
if tno>0 then Label37.Caption:=r2s(wagony[tno].couplers[1].cforce/1000,0)+' kN';
if tno>0 then Label38.Caption:=r2s(wagony[tno].brakepress,0)+' MPa';
Label39.Caption:=r2s(loc.enginePower/1000,0)+' kW';
Label40.Caption:=i2s(trunc(loc.Rventrot*60))+' /min';
Label41.Visible:=loc.SandDose;
Label42.Caption:=r2s(mechanik.accdesired,0)+' m/ss';
Label43.Caption:=r2s(mechanik.veldesired,0)+' km/h';
if tno>0 then Label44.Caption:=r2s(ll[tno].x,0)+' m';
Label45.Caption:=inttostr(loc.activedir);
Label46.Caption:=inttostr(ord(mechanik.orderlist[mechanik.orderpos]));
Label47.Caption:=inttostr(mechanik.orderpos);
Label48.Caption:=inttostr(ord(loc.mains));
{ if tno>0 then Label51.Caption:=wagony[1].CommandIn.Command;
if tno>0 then Label52.Caption:=r2s(wagony[1].CommandIn.Value1,0);
}
Label51.Caption:=loc.CommandIn.Command;
Label52.Caption:=r2s(loc.CommandIn.Value1,0);
Lczas.Caption:=r2s(actualtime,0)+' s';
writeln(fout,Actualtime,' ',{loc.v-wag.v,}loc.UnitBrakeForce,' ',loc.dpMainValve,{' ',loc.dpLocalValve,}' ',loc.accs,' ',loc.couplers[2].cforce,' ',{,l1.x}' '{,Distance(loc.loc,wagony[1].loc,loc.dim,wagony[1].dim)});
end;
procedure TForm1.FormCreate(Sender: TObject);
var iw:integer;
begin
Timer1.Enabled:=False;
tno:=0;
assignfile(fout,'log.dat');
rewrite(fout);
ActualTime:=0;
loc:=TMoverParameters.Create;
Shape.R:=0; Shape.Len:=10000; Shape.dHtrack:=0; Shape.dHrail:=0;
Track.Width:=1435; Track.friction:=0.15; Track.CategoryFlag:=1;
Track.QualityFlag:=25; Track.DamageFlag:=0;
Track.VelMax:=120;
ExternalVoltage:=3000;
l0.x:=0; l0.y:=0; l0.z:=0;
r0.rx:=0; r0.ry:=0; r0.rz:=0;
for iw:=1 to mtno do
begin
rr[iw].rx:=0; rr[iw].ry:=0; rr[iw].rz:=0;
ll[iw].x:=0; ll[iw].y:=0; ll[iw].z:=0;
end;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
loc.incbrakelevel;
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
loc.decbrakelevel;
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
loc.inclocalbrakelevel(1);
end;
procedure TForm1.Button8Click(Sender: TObject);
begin
loc.declocalbrakelevel(1);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
loc.incmainctrl(1);
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
loc.decmainctrl(1);
end;
procedure TForm1.Button9Click(Sender: TObject);
begin
loc.DirectionForward;
end;
procedure TForm1.Button10Click(Sender: TObject);
begin
loc.DirectionBackward;
end;
procedure TForm1.Button11Click(Sender: TObject);
begin
loc.FuseOn;
end;
procedure TForm1.Button12Click(Sender: TObject);
begin
Loc.AntiSlippingBrake;
end;
procedure TForm1.BStartClick(Sender: TObject);
begin
tno:=tno-1;
Button1.Enabled:=False;
Edit1.Enabled:=False;
Timer1.Enabled:=True;
mechanik:=TController.Create;
pociag:=TTrainParameters.Create;
pociag.init('Testowy Express',100);
mechanik.init(l0,r0,HumanDriver,@loc,@pociag,Aggressive);
BStart.Enabled:=False;
Button14.enabled:=True;
Button15.enabled:=True;
end;
procedure TForm1.Button13MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
loc.SandDoseOn;
end;
procedure TForm1.Button14Click(Sender: TObject);
begin
mechanik.SetVelocity(30,120);
end;
procedure TForm1.Button15Click(Sender: TObject);
begin
mechanik.AIControllFlag:=not mechanik.AIControllFlag;
if not loc.mains then
begin
mechanik.ChangeOrder(Prepare_Engine);
mechanik.JumpToNextOrder;
mechanik.ChangeOrder(Obey_train);
mechanik.JumpToNextOrder;
mechanik.ChangeOrder(Release_engine);
mechanik.JumpToFirstOrder;
mechanik.SetVelocity(60,120);
end;
end;
procedure TForm1.BMainsClick(Sender: TObject);
begin
loc.MainSwitch;
end;
procedure TForm1.CheckBox1Click(Sender: TObject);
begin
loc.autorelayswitch;
end;
procedure TForm1.BSIncClick(Sender: TObject);
begin
loc.incscndctrl(1);
end;
procedure TForm1.BSDecClick(Sender: TObject);
begin
loc.decscndctrl(1);
end;
end.

880
McZapkie/_Mover.hpp Normal file
View File

@@ -0,0 +1,880 @@
// Borland C++ Builder
// Copyright (c) 1995, 1999 by Borland International
// All rights reserved
// (DO NOT EDIT: machine generated header) '_mover.pas' rev: 5.00
#ifndef _moverHPP
#define _moverHPP
#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <Oerlikon_ESt.hpp> // Pascal unit
#include <hamulce.hpp> // Pascal unit
#include <SysUtils.hpp> // Pascal unit
#include <mctools.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit
//-- user supplied -----------------------------------------------------------
namespace _mover
{
//-- type declarations -------------------------------------------------------
struct TLocation
{
double X;
double Y;
double Z;
} ;
struct TRotation
{
double Rx;
double Ry;
double Rz;
} ;
struct TDimension
{
double W;
double L;
double H;
} ;
struct TCommand
{
AnsiString Command;
double Value1;
double Value2;
TLocation Location;
} ;
struct TTrackShape
{
double R;
double Len;
double dHtrack;
double dHrail;
} ;
struct TTrackParam
{
double Width;
double friction;
Byte CategoryFlag;
Byte QualityFlag;
Byte DamageFlag;
double Velmax;
} ;
struct TTractionParam
{
double TractionVoltage;
double TractionFreq;
double TractionMaxCurrent;
double TractionResistivity;
} ;
#pragma option push -b-
enum TBrakeSystem { Individual, Pneumatic, ElectroPneumatic };
#pragma option pop
#pragma option push -b-
enum TBrakeSubSystem { ss_None, ss_W, ss_K, ss_KK, ss_Hik, ss_ESt, ss_KE, ss_LSt, ss_MT, ss_Dako };
#pragma option pop
#pragma option push -b-
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
};
#pragma option pop
#pragma option push -b-
enum TBrakeHandle { NoHandle, West, FV4a, M394, M254, FVel1, FVel6, D2, Knorr, FD1, BS2, testH, St113
};
#pragma option pop
#pragma option push -b-
enum TLocalBrake { NoBrake, ManualBrake, PneumaticBrake, HydraulicBrake };
#pragma option pop
typedef double TBrakeDelayTable[4];
struct TBrakePressure
{
double PipePressureVal;
double BrakePressureVal;
double FlowSpeedVal;
TBrakeSystem BrakeType;
} ;
typedef TBrakePressure TBrakePressureTable[13];
#pragma option push -b-
enum TEngineTypes { None, Dumb, WheelsDriven, ElectricSeriesMotor, ElectricInductionMotor, DieselEngine,
SteamEngine, DieselElectric };
#pragma option pop
#pragma option push -b-
enum TPowerType { NoPower, BioPower, MechPower, ElectricPower, SteamPower };
#pragma option pop
#pragma option push -b-
enum TFuelType { Undefined, Coal, Oil };
#pragma option pop
struct TGrateType
{
TFuelType FuelType;
double GrateSurface;
double FuelTransportSpeed;
double IgnitionTemperature;
double MaxTemperature;
} ;
struct TBoilerType
{
double BoilerVolume;
double BoilerHeatSurface;
double SuperHeaterSurface;
double MaxWaterVolume;
double MinWaterVolume;
double MaxPressure;
} ;
struct TCurrentCollector
{
int CollectorsNo;
double MinH;
double MaxH;
double CSW;
double MinV;
double MaxV;
double InsetV;
double MinPress;
double MaxPress;
} ;
#pragma option push -b-
enum TPowerSource { NotDefined, InternalSource, Transducer, Generator, Accumulator, CurrentCollector,
PowerCable, Heater };
#pragma option pop
struct _mover__1
{
double MaxCapacity;
TPowerSource RechargeSource;
} ;
struct _mover__2
{
TPowerType PowerTrans;
double SteamPressure;
} ;
struct _mover__3
{
TGrateType Grate;
TBoilerType Boiler;
} ;
struct TPowerParameters
{
double MaxVoltage;
double MaxCurrent;
double IntR;
TPowerSource SourceType;
union
{
struct
{
_mover__3 RHeater;
};
struct
{
_mover__2 RPowerCable;
};
struct
{
TCurrentCollector CollectorParameters;
};
struct
{
_mover__1 RAccumulator;
};
struct
{
TEngineTypes GeneratorEngine;
};
struct
{
double InputVoltage;
};
struct
{
TPowerType PowerType;
};
};
} ;
struct TScheme
{
Byte Relay;
double R;
Byte Bn;
Byte Mn;
bool AutoSwitch;
Byte ScndAct;
} ;
typedef TScheme TSchemeTable[65];
struct TDEScheme
{
double RPM;
double GenPower;
double Umax;
double Imax;
} ;
typedef TDEScheme TDESchemeTable[33];
struct TShuntScheme
{
double Umin;
double Umax;
double Pmin;
double Pmax;
} ;
typedef TShuntScheme TShuntSchemeTable[33];
struct TMPTRelay
{
double Iup;
double Idown;
} ;
typedef TMPTRelay TMPTRelayTable[8];
struct TMotorParameters
{
double mfi;
double mIsat;
double mfi0;
double fi;
double Isat;
double fi0;
bool AutoSwitch;
} ;
struct TSecuritySystem
{
Byte SystemType;
double AwareDelay;
double AwareMinSpeed;
double SoundSignalDelay;
double EmergencyBrakeDelay;
Byte Status;
double SystemTimer;
double SystemSoundCATimer;
double SystemSoundSHPTimer;
double SystemBrakeCATimer;
double SystemBrakeSHPTimer;
double SystemBrakeCATestTimer;
int VelocityAllowed;
int NextVelocityAllowed;
bool RadioStop;
} ;
struct TTransmision
{
Byte NToothM;
Byte NToothW;
double Ratio;
} ;
#pragma option push -b-
enum TCouplerType { NoCoupler, Articulated, Bare, Chain, Screw, Automatic };
#pragma option pop
class DELPHICLASS T_MoverParameters;
struct TCoupling;
class PASCALIMPLEMENTATION T_MoverParameters : public System::TObject
{
typedef System::TObject inherited;
public:
double dMoveLen;
AnsiString filename;
Byte CategoryFlag;
AnsiString TypeName;
int TrainType;
TEngineTypes EngineType;
TPowerParameters EnginePowerSource;
TPowerParameters SystemPowerSource;
TPowerParameters HeatingPowerSource;
TPowerParameters AlterHeatPowerSource;
TPowerParameters LightPowerSource;
TPowerParameters AlterLightPowerSource;
double Vmax;
double Mass;
double Power;
double Mred;
double TotalMass;
double HeatingPower;
double LightPower;
double BatteryVoltage;
bool Battery;
bool EpFuse;
bool Signalling;
bool DoorSignalling;
bool Radio;
double NominalBatteryVoltage;
TDimension Dim;
double Cx;
double Floor;
double WheelDiameter;
double WheelDiameterL;
double WheelDiameterT;
double TrackW;
double AxleInertialMoment;
AnsiString AxleArangement;
Byte NPoweredAxles;
Byte NAxles;
Byte BearingType;
double ADist;
double BDist;
Byte NBpA;
int SandCapacity;
TBrakeSystem BrakeSystem;
TBrakeSubSystem BrakeSubsystem;
TBrakeValve BrakeValve;
TBrakeHandle BrakeHandle;
TBrakeHandle BrakeLocHandle;
double MBPM;
Hamulce::TBrake* Hamulec;
Hamulce::THandle* Handle;
Hamulce::THandle* LocHandle;
Hamulce::TReservoir* Pipe;
Hamulce::TReservoir* Pipe2;
TLocalBrake LocalBrake;
TBrakePressure BrakePressureTable[13];
TBrakePressure BrakePressureActual;
Byte ASBType;
Byte TurboTest;
double MaxBrakeForce;
double MaxBrakePress[5];
double P2FTrans;
double TrackBrakeForce;
Byte BrakeMethod;
double HighPipePress;
double LowPipePress;
double DeltaPipePress;
double CntrlPipePress;
double BrakeVolume;
double BrakeVVolume;
double VeselVolume;
int BrakeCylNo;
double BrakeCylRadius;
double BrakeCylDist;
double BrakeCylMult[3];
Byte LoadFlag;
double BrakeCylSpring;
double BrakeSlckAdj;
double BrakeRigEff;
double RapidMult;
int BrakeValveSize;
AnsiString BrakeValveParams;
double Spg;
double MinCompressor;
double MaxCompressor;
double CompressorSpeed;
double BrakeDelay[4];
Byte BrakeCtrlPosNo;
Byte MainCtrlPosNo;
Byte ScndCtrlPosNo;
bool ScndInMain;
bool MBrake;
TSecuritySystem SecuritySystem;
TScheme RList[65];
int RlistSize;
TMotorParameters MotorParam[11];
TTransmision Transmision;
double NominalVoltage;
double WindingRes;
double u;
double CircuitRes;
int IminLo;
int IminHi;
int ImaxLo;
int ImaxHi;
double nmax;
double InitialCtrlDelay;
double CtrlDelay;
double CtrlDownDelay;
Byte FastSerialCircuit;
Byte AutoRelayType;
bool CoupledCtrl;
bool IsCoupled;
Byte DynamicBrakeType;
Byte RVentType;
double RVentnmax;
double RVentCutOff;
int CompressorPower;
int SmallCompressorPower;
double dizel_Mmax;
double dizel_nMmax;
double dizel_Mnmax;
double dizel_nmax;
double dizel_nominalfill;
double dizel_Mstand;
double dizel_nmax_cutoff;
double dizel_nmin;
double dizel_minVelfullengage;
double dizel_AIM;
double dizel_engageDia;
double dizel_engageMaxForce;
double dizel_engagefriction;
double AnPos;
bool AnalogCtrl;
bool AnMainCtrl;
bool ShuntModeAllow;
bool ShuntMode;
bool Flat;
double Vhyp;
TDEScheme DElist[33];
double Vadd;
TMPTRelay MPTRelay[8];
Byte RelayType;
TShuntScheme SST[33];
double PowerCorRatio;
double Ftmax;
double eimc[21];
int MaxLoad;
AnsiString LoadAccepted;
AnsiString LoadQuantity;
double OverLoadFactor;
double LoadSpeed;
double UnLoadSpeed;
Byte DoorOpenCtrl;
Byte DoorCloseCtrl;
double DoorStayOpen;
bool DoorClosureWarning;
double DoorOpenSpeed;
double DoorCloseSpeed;
double DoorMaxShiftL;
double DoorMaxShiftR;
Byte DoorOpenMethod;
bool ScndS;
TLocation Loc;
TRotation Rot;
AnsiString Name;
TCoupling Couplers[2];
double HVCouplers[2][2];
int ScanCounter;
bool EventFlag;
Byte SoundFlag;
double DistCounter;
double V;
double Vel;
double AccS;
double AccN;
double AccV;
double nrot;
double EnginePower;
double dL;
double Fb;
double Ff;
double FTrain;
double FStand;
double FTotal;
double UnitBrakeForce;
double Ntotal;
bool SlippingWheels;
bool SandDose;
double Sand;
double BrakeSlippingTimer;
double dpBrake;
double dpPipe;
double dpMainValve;
double dpLocalValve;
double ScndPipePress;
double BrakePress;
double LocBrakePress;
double PipeBrakePress;
double PipePress;
double EqvtPipePress;
double Volume;
double CompressedVolume;
double PantVolume;
double Compressor;
bool CompressorFlag;
bool PantCompFlag;
bool CompressorAllow;
bool ConverterFlag;
bool ConverterAllow;
int BrakeCtrlPos;
double BrakeCtrlPosR;
double BrakeCtrlPos2;
Byte LocalBrakePos;
Byte ManualBrakePos;
double LocalBrakePosA;
Byte BrakeStatus;
bool EmergencyBrakeFlag;
Byte BrakeDelayFlag;
Byte BrakeDelays;
bool DynamicBrakeFlag;
double LimPipePress;
double ActFlowSpeed;
Byte DamageFlag;
Byte DerailReason;
TCommand CommandIn;
AnsiString CommandOut;
AnsiString CommandLast;
double ValueOut;
TTrackShape RunningShape;
TTrackParam RunningTrack;
double OffsetTrackH;
double OffsetTrackV;
bool Mains;
Byte MainCtrlPos;
Byte ScndCtrlPos;
int ActiveDir;
int CabNo;
int DirAbsolute;
int ActiveCab;
double LastSwitchingTime;
bool DepartureSignal;
bool InsideConsist;
TTractionParam RunningTraction;
double enrot;
double Im;
double Itot;
double IHeating;
double ITraction;
double TotalCurrent;
double Mm;
double Mw;
double Fw;
double Ft;
int Imin;
int Imax;
double Voltage;
Byte MainCtrlActualPos;
Byte ScndCtrlActualPos;
bool DelayCtrlFlag;
double LastRelayTime;
bool AutoRelayFlag;
bool FuseFlag;
bool ConvOvldFlag;
bool StLinFlag;
bool ResistorsFlag;
double RventRot;
bool UnBrake;
double PantPress;
bool s_CAtestebrake;
double dizel_fill;
double dizel_engagestate;
double dizel_engage;
double dizel_automaticgearstatus;
bool dizel_enginestart;
double dizel_engagedeltaomega;
double eimv[21];
double PulseForce;
double PulseForceTimer;
int PulseForceCount;
double eAngle;
int Load;
AnsiString LoadType;
Byte LoadStatus;
double LastLoadChangeTime;
bool DoorBlocked;
bool DoorLeftOpened;
bool DoorRightOpened;
bool PantFrontUp;
bool PantRearUp;
bool PantFrontSP;
bool PantRearSP;
int PantFrontStart;
int PantRearStart;
double PantFrontVolt;
double PantRearVolt;
AnsiString PantSwitchType;
AnsiString ConvSwitchType;
bool Heating;
int DoubleTr;
bool PhysicActivation;
double FrictConst1;
double FrictConst2s;
double FrictConst2d;
double TotalMassxg;
double __fastcall GetTrainsetVoltage(void);
bool __fastcall Physic_ReActivation(void);
double __fastcall LocalBrakeRatio(void);
double __fastcall ManualBrakeRatio(void);
double __fastcall PipeRatio(void);
double __fastcall RealPipeRatio(void);
double __fastcall BrakeVP(void);
bool __fastcall DynamicBrakeSwitch(bool Switch);
bool __fastcall SendCtrlBroadcast(AnsiString CtrlCommand, double ctrlvalue);
bool __fastcall SendCtrlToNext(AnsiString CtrlCommand, double ctrlvalue, double dir);
bool __fastcall CabActivisation(void);
bool __fastcall CabDeactivisation(void);
bool __fastcall IncMainCtrl(int CtrlSpeed);
bool __fastcall DecMainCtrl(int CtrlSpeed);
bool __fastcall IncScndCtrl(int CtrlSpeed);
bool __fastcall DecScndCtrl(int CtrlSpeed);
bool __fastcall AddPulseForce(int Multipler);
bool __fastcall SandDoseOn(void);
bool __fastcall SecuritySystemReset(void);
void __fastcall SecuritySystemCheck(double dt);
bool __fastcall BatterySwitch(bool State);
bool __fastcall EpFuseSwitch(bool State);
bool __fastcall IncBrakeLevelOld(void);
bool __fastcall DecBrakeLevelOld(void);
bool __fastcall IncLocalBrakeLevel(Byte CtrlSpeed);
bool __fastcall DecLocalBrakeLevel(Byte CtrlSpeed);
bool __fastcall IncLocalBrakeLevelFAST(void);
bool __fastcall DecLocalBrakeLevelFAST(void);
bool __fastcall IncManualBrakeLevel(Byte CtrlSpeed);
bool __fastcall DecManualBrakeLevel(Byte CtrlSpeed);
bool __fastcall EmergencyBrakeSwitch(bool Switch);
bool __fastcall AntiSlippingBrake(void);
bool __fastcall BrakeReleaser(Byte state);
bool __fastcall SwitchEPBrake(Byte state);
bool __fastcall AntiSlippingButton(void);
bool __fastcall IncBrakePress(double &brake, double PressLimit, double dp);
bool __fastcall DecBrakePress(double &brake, double PressLimit, double dp);
bool __fastcall BrakeDelaySwitch(Byte BDS);
bool __fastcall IncBrakeMult(void);
bool __fastcall DecBrakeMult(void);
void __fastcall UpdateBrakePressure(double dt);
void __fastcall UpdatePipePressure(double dt);
void __fastcall CompressorCheck(double dt);
void __fastcall UpdateScndPipePressure(double dt);
double __fastcall GetDVc(double dt);
void __fastcall ComputeConstans(void);
double __fastcall ComputeMass(void);
double __fastcall Adhesive(double staticfriction);
double __fastcall TractionForce(double dt);
double __fastcall FrictionForce(double R, Byte TDamage);
double __fastcall BrakeForce(const TTrackParam &Track);
double __fastcall CouplerForce(Byte CouplerN, double dt);
void __fastcall CollisionDetect(Byte CouplerN, double dt);
double __fastcall ComputeRotatingWheel(double WForce, double dt, double n);
bool __fastcall SetInternalCommand(AnsiString NewCommand, double NewValue1, double NewValue2);
double __fastcall GetExternalCommand(AnsiString &Command);
bool __fastcall RunCommand(AnsiString command, double CValue1, double CValue2);
bool __fastcall RunInternalCommand(void);
void __fastcall PutCommand(AnsiString NewCommand, double NewValue1, double NewValue2, const TLocation
&NewLocation);
bool __fastcall DirectionBackward(void);
bool __fastcall MainSwitch(bool State);
bool __fastcall ConverterSwitch(bool State);
bool __fastcall CompressorSwitch(bool State);
bool __fastcall FuseOn(void);
bool __fastcall FuseFlagCheck(void);
void __fastcall FuseOff(void);
int __fastcall ShowCurrent(Byte AmpN);
double __fastcall v2n(void);
double __fastcall current(double n, double U);
double __fastcall Momentum(double I);
double __fastcall MomentumF(double I, double Iw, Byte SCP);
bool __fastcall CutOffEngine(void);
bool __fastcall MaxCurrentSwitch(bool State);
bool __fastcall ResistorsFlagCheck(void);
bool __fastcall MinCurrentSwitch(bool State);
bool __fastcall AutoRelaySwitch(bool State);
bool __fastcall AutoRelayCheck(void);
bool __fastcall dizel_EngageSwitch(double state);
bool __fastcall dizel_EngageChange(double dt);
bool __fastcall dizel_AutoGearCheck(void);
double __fastcall dizel_fillcheck(Byte mcp);
double __fastcall dizel_Momentum(double dizel_fill, double n, double dt);
bool __fastcall dizel_Update(double dt);
bool __fastcall LoadingDone(double LSpeed, AnsiString LoadInit);
void __fastcall ComputeTotalForce(double dt, double dt1, bool FullVer);
double __fastcall ComputeMovement(double dt, double dt1, const TTrackShape &Shape, TTrackParam &Track
, TTractionParam &ElectricTraction, const TLocation &NewLoc, TRotation &NewRot);
double __fastcall FastComputeMovement(double dt, const TTrackShape &Shape, TTrackParam &Track, const
TLocation &NewLoc, TRotation &NewRot);
bool __fastcall ChangeOffsetH(double DeltaOffset);
__fastcall T_MoverParameters(double VelInitial, AnsiString TypeNameInit, AnsiString NameInit, int LoadInitial
, AnsiString LoadTypeInitial, int Cab);
bool __fastcall LoadChkFile(AnsiString chkpath);
bool __fastcall CheckLocomotiveParameters(bool ReadyFlag, int Dir);
AnsiString __fastcall EngineDescription(int what);
bool __fastcall DoorLeft(bool State);
bool __fastcall DoorRight(bool State);
bool __fastcall DoorBlockedFlag(void);
bool __fastcall PantFront(bool State);
bool __fastcall PantRear(bool State);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall T_MoverParameters(void) : System::TObject() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~T_MoverParameters(void) { }
#pragma option pop
};
struct TCoupling
{
double SpringKB;
double SpringKC;
double beta;
double DmaxB;
double FmaxB;
double DmaxC;
double FmaxC;
TCouplerType CouplerType;
Byte CouplingFlag;
int AllowedFlag;
bool Render;
double CoupleDist;
T_MoverParameters* Connected;
Byte ConnectedNr;
double CForce;
double Dist;
bool CheckCollision;
} ;
//-- var, const, procedure ---------------------------------------------------
static const bool Go = true;
static const bool Hold = false;
static const Shortint ResArraySize = 0x40;
static const Shortint MotorParametersArraySize = 0xa;
static const Shortint maxcc = 0x4;
static const Shortint LocalBrakePosNo = 0xa;
static const Shortint MainBrakeMaxPos = 0xa;
static const Shortint ManualBrakePosNo = 0x14;
static const Shortint dtrack_railwear = 0x2;
static const Shortint dtrack_freerail = 0x4;
static const Shortint dtrack_thinrail = 0x8;
static const Shortint dtrack_railbend = 0x10;
static const Shortint dtrack_plants = 0x20;
static const Shortint dtrack_nomove = 0x40;
static const Byte dtrack_norail = 0x80;
static const Shortint dtrain_thinwheel = 0x1;
static const Shortint dtrain_loadshift = 0x1;
static const Shortint dtrain_wheelwear = 0x2;
static const Shortint dtrain_bearing = 0x4;
static const Shortint dtrain_coupling = 0x8;
static const Shortint dtrain_ventilator = 0x10;
static const Shortint dtrain_loaddamage = 0x10;
static const Shortint dtrain_engine = 0x20;
static const Shortint dtrain_loaddestroyed = 0x20;
static const Shortint dtrain_axle = 0x40;
static const Byte dtrain_out = 0x80;
#define p_elengproblem (1.000000E-02)
#define p_elengdamage (1.000000E-01)
#define p_coupldmg (2.000000E-02)
#define p_derail (1.000000E-03)
#define p_accn (1.000000E-01)
#define p_slippdmg (1.000000E-03)
static const Shortint ctrain_virtual = 0x0;
static const Shortint ctrain_coupler = 0x1;
static const Shortint ctrain_pneumatic = 0x2;
static const Shortint ctrain_controll = 0x4;
static const Shortint ctrain_power = 0x8;
static const Shortint ctrain_passenger = 0x10;
static const Shortint ctrain_scndpneumatic = 0x20;
static const Shortint ctrain_heating = 0x40;
static const Byte ctrain_depot = 0x80;
static const Shortint dbrake_none = 0x0;
static const Shortint dbrake_passive = 0x1;
static const Shortint dbrake_switch = 0x2;
static const Shortint dbrake_reversal = 0x4;
static const Shortint dbrake_automatic = 0x8;
static const Shortint s_waiting = 0x1;
static const Shortint s_aware = 0x2;
static const Shortint s_active = 0x4;
static const Shortint s_CAalarm = 0x8;
static const Shortint s_SHPalarm = 0x10;
static const Shortint s_CAebrake = 0x20;
static const Shortint s_SHPebrake = 0x40;
static const Byte s_CAtest = 0x80;
static const Shortint sound_none = 0x0;
static const Shortint sound_loud = 0x1;
static const Shortint sound_couplerstretch = 0x2;
static const Shortint sound_bufferclamp = 0x4;
static const Shortint sound_bufferbump = 0x8;
static const Shortint sound_relay = 0x10;
static const Shortint sound_manyrelay = 0x20;
static const Shortint sound_brakeacc = 0x40;
extern PACKAGE bool PhysicActivationFlag;
static const Shortint dt_Default = 0x0;
static const Shortint dt_EZT = 0x1;
static const Shortint dt_ET41 = 0x2;
static const Shortint dt_ET42 = 0x4;
static const Shortint dt_PseudoDiesel = 0x8;
static const Shortint dt_ET22 = 0x10;
static const Shortint dt_SN61 = 0x20;
static const Shortint dt_EP05 = 0x40;
static const Byte dt_ET40 = 0x80;
static const Word dt_181 = 0x100;
static const Shortint eimc_s_dfic = 0x0;
static const Shortint eimc_s_dfmax = 0x1;
static const Shortint eimc_s_p = 0x2;
static const Shortint eimc_s_cfu = 0x3;
static const Shortint eimc_s_cim = 0x4;
static const Shortint eimc_s_icif = 0x5;
static const Shortint eimc_f_Uzmax = 0x7;
static const Shortint eimc_f_Uzh = 0x8;
static const Shortint eimc_f_DU = 0x9;
static const Shortint eimc_f_I0 = 0xa;
static const Shortint eimc_f_cfu = 0xb;
static const Shortint eimc_p_F0 = 0xd;
static const Shortint eimc_p_a1 = 0xe;
static const Shortint eimc_p_Pmax = 0xf;
static const Shortint eimc_p_Fh = 0x10;
static const Shortint eimc_p_Ph = 0x11;
static const Shortint eimc_p_Vh0 = 0x12;
static const Shortint eimc_p_Vh1 = 0x13;
static const Shortint eimc_p_Imax = 0x14;
static const Shortint eimv_FMAXMAX = 0x0;
static const Shortint eimv_Fmax = 0x1;
static const Shortint eimv_ks = 0x2;
static const Shortint eimv_df = 0x3;
static const Shortint eimv_fp = 0x4;
static const Shortint eimv_U = 0x5;
static const Shortint eimv_pole = 0x6;
static const Shortint eimv_Ic = 0x7;
static const Shortint eimv_If = 0x8;
static const Shortint eimv_M = 0x9;
static const Shortint eimv_Fr = 0xa;
static const Shortint eimv_Ipoj = 0xb;
static const Shortint eimv_Pm = 0xc;
static const Shortint eimv_Pe = 0xd;
static const Shortint eimv_eta = 0xe;
static const Shortint eimv_fkr = 0xf;
static const Shortint eimv_Uzsmax = 0x10;
static const Shortint eimv_Pmax = 0x11;
static const Shortint eimv_Fzad = 0x12;
static const Shortint eimv_Imax = 0x13;
extern PACKAGE double __fastcall Distance(const TLocation &Loc1, const TLocation &Loc2, const TDimension
&Dim1, const TDimension &Dim2);
} /* namespace _mover */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace _mover;
#endif
#pragma option pop // -w-
#pragma option pop // -Vx
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // _mover

7380
McZapkie/_mover.pas Normal file

File diff suppressed because it is too large Load Diff

232
McZapkie/friction.hpp Normal file
View File

@@ -0,0 +1,232 @@
// Borland C++ Builder
// Copyright (c) 1995, 1999 by Borland International
// All rights reserved
// (DO NOT EDIT: machine generated header) 'friction.pas' rev: 5.00
#ifndef frictionHPP
#define frictionHPP
#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <SysUtils.hpp> // Pascal unit
#include <mctools.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit
//-- user supplied -----------------------------------------------------------
namespace Friction
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS TFricMat;
class PASCALIMPLEMENTATION TFricMat : public System::TObject
{
typedef System::TObject inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TFricMat(void) : System::TObject() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TFricMat(void) { }
#pragma option pop
};
class DELPHICLASS TP10Bg;
class PASCALIMPLEMENTATION TP10Bg : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TP10Bg(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TP10Bg(void) { }
#pragma option pop
};
class DELPHICLASS TP10Bgu;
class PASCALIMPLEMENTATION TP10Bgu : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TP10Bgu(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TP10Bgu(void) { }
#pragma option pop
};
class DELPHICLASS TP10yBg;
class PASCALIMPLEMENTATION TP10yBg : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TP10yBg(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TP10yBg(void) { }
#pragma option pop
};
class DELPHICLASS TP10yBgu;
class PASCALIMPLEMENTATION TP10yBgu : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TP10yBgu(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TP10yBgu(void) { }
#pragma option pop
};
class DELPHICLASS TP10;
class PASCALIMPLEMENTATION TP10 : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TP10(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TP10(void) { }
#pragma option pop
};
class DELPHICLASS TFR513;
class PASCALIMPLEMENTATION TFR513 : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TFR513(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TFR513(void) { }
#pragma option pop
};
class DELPHICLASS TFR510;
class PASCALIMPLEMENTATION TFR510 : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TFR510(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TFR510(void) { }
#pragma option pop
};
class DELPHICLASS TCosid;
class PASCALIMPLEMENTATION TCosid : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TCosid(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TCosid(void) { }
#pragma option pop
};
class DELPHICLASS TDisk1;
class PASCALIMPLEMENTATION TDisk1 : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TDisk1(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TDisk1(void) { }
#pragma option pop
};
class DELPHICLASS TDisk2;
class PASCALIMPLEMENTATION TDisk2 : public TFricMat
{
typedef TFricMat inherited;
public:
virtual double __fastcall GetFC(double N, double Vel);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TDisk2(void) : TFricMat() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TDisk2(void) { }
#pragma option pop
};
//-- var, const, procedure ---------------------------------------------------
} /* namespace Friction */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Friction;
#endif
#pragma option pop // -w-
#pragma option pop // -Vx
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // friction

174
McZapkie/friction.pas Normal file
View File

@@ -0,0 +1,174 @@
unit friction; {wspolczynnik tarcia roznych materialow}
(*
MaSzyna EU07 - SPKS
Friction coefficient.
Copyright (C) 2007-2013 Maciej Cierniak
*)
(*
(C) youBy
Co brakuje:
- hamulce tarczowe
- kompozyty
*)
(*
Zrobione:
1) zadeklarowane niektore typy
2) wzor jubaja na tarcie wstawek Bg i Bgu z zeliwa P10
3) hamulec tarczowy marki 152A ;)
*)
interface
//uses hamulce;
uses mctools,sysutils;
TYPE
TFricMat = class
public
function GetFC(N, Vel: real): real; virtual;
end;
TP10Bg = class(TFricMat)
public
function GetFC(N, Vel: real): real; override;
end;
TP10Bgu = class(TFricMat)
public
function GetFC(N, Vel: real): real; override;
end;
TP10yBg = class(TFricMat)
public
function GetFC(N, Vel: real): real; override;
end;
TP10yBgu = class(TFricMat)
public
function GetFC(N, Vel: real): real; override;
end;
TP10 = class(TFricMat)
public
function GetFC(N, Vel: real): real; override;
end;
TFR513 = class(TFricMat)
public
function GetFC(N, Vel: real): real; override;
end;
TFR510 = class(TFricMat)
public
function GetFC(N, Vel: real): real; override;
end;
TCosid = class(TFricMat)
public
function GetFC(N, Vel: real): real; override;
end;
TDisk1 = class(TFricMat)
public
function GetFC(N, Vel: real): real; override;
end;
TDisk2 = class(TFricMat)
public
function GetFC(N, Vel: real): real; override;
end;
implementation
function TFricMat.GetFC(N, Vel: real): real;
begin
GetFC:=1;
end;
function TP10Bg.GetFC(N, Vel: real): real;
begin
// GetFC:=0.60*((1.6*N+100)/(8.0*N+100))*((Vel+100)/(5*Vel+100))*(1.0032-0.0007*N-0.0001*N*N);
// GetFC:=47/(2*Vel+100)*(2.145-0.0538*N+0.00074*N*N-0.00000536*N*N*N)/2.145;
// GetFC:=46/(2*Vel+100)*(11.33-0.105*N)/(11.33+0.179*N);
// GetFC:=49/(2*Vel+100)*(13.08-0.083*N)/(12.94+0.285*N);
//if Vel<20 then Vel:=20;
// Vel:= Vel-20;
// GetFC:=0.52*((1*Vel+100)/(5.0*Vel+100))*(13.08-0.083*N)/(12.94+0.285*N);
// GetFC:=Min0R(0.67*(1*(277-2.66*Vel)/(100+2.1*Vel)+0.23*(-686+8.27*Vel)/(100+1.16*Vel))*(13.08-0.083*N)/(12.94+0.285*N),0.4);
GetFC:=exp(-0.022*N)*(0.19-0.095*exp(-Vel/25.7))+0.384*exp(-Vel/25.7)-0.028;
end;
function TP10Bgu.GetFC(N, Vel: real): real;
begin
// GetFC:=0.60*((1.6*N+100)/(8.0*N+100))*((Vel+100)/(5*Vel+100));
// GetFC:=47/(2*Vel+100)*(2.137-0.0514*N+0.000832*N*N-0.00000604*N*N*N)/2.137;
// GetFC:=0.49*100/(2*Vel+100)*(11.33-0.013*N)/(11.33+0.280*N);
// GetFC:=0.52*((Vel+100)/(5.0*Vel+100))*(11.33-0.013*N)/(11.33+0.280*N);
//if Vel<20 then Vel:=20;
// Vel:= Vel-20;
// GetFC:=0.52*((0.0*Vel+120)/(5*Vel+100))*(11.33-0.013*N)/(11.33+0.280*N);
// GetFC:=0.49*100/(3*Vel+100)*(11.33-0.013*N)/(11.33+0.280*N);
// GetFC:=Min0R(0.67*(1*(277-2.66*Vel)/(100+2.1*Vel)+0.23*(-686+8.27*Vel)/(100+1.16*Vel))*(11.33-0.013*N)/(11.33+0.280*N),0.4);
GetFC:=exp(-0.017*N)*(0.18-0.09*exp(-Vel/25.7))+0.381*exp(-Vel/25.7)-0.022;//0.05*exp(-0.2*N);
end;
function TP10yBg.GetFC(N, Vel: real): real;
var A,C,u0, V0: real;
begin
A:=2.135*exp(-0.03726*N)-0.5;
C:=0.353-A*0.029;
u0:=0.41-C;
V0:=25.7+20*A;
GetFC:=(u0+C*exp(-Vel/V0));
end;
function TP10yBgu.GetFC(N, Vel: real): real;
var A,C,u0, V0: real;
begin
A:=1.68*exp(-0.02735*N)-0.5;
C:=0.353-A*0.044;
u0:=0.41-C;
V0:=25.7+21*A;
GetFC:=(u0+C*exp(-Vel/V0));
end;
function TP10.GetFC(N, Vel: real): real;
begin
GetFC:=0.60*((1.6*N+100)/(8.0*N+100))*((Vel+100)/(5*Vel+100));
// GetFC:=43/(2*Vel+100)*(2.145-0.0538*N+0.00074*N*N-0.00000536*N*N*N)/2.145
end;
function TFR513.GetFC(N, Vel: real): real;
begin
GetFC:=0.3-Vel*0.00081;
// GetFC:=43/(2*Vel+100)*(2.145-0.0538*N+0.00074*N*N-0.00000536*N*N*N)/2.145
end;
function TCosid.GetFC(N, Vel: real): real;
begin
GetFC:=0.27;
end;
function TDisk1.GetFC(N, Vel: real): real;
begin
GetFC:=0.2375+0.000885*N-0.000345*N*N;
end;
function TDisk2.GetFC(N, Vel: real): real;
begin
GetFC:=0.27;
end;
function TFR510.GetFC(N, Vel: real): real;
begin
GetFC:=0.15;
end;
end.

841
McZapkie/hamulce.hpp Normal file
View File

@@ -0,0 +1,841 @@
// Borland C++ Builder
// Copyright (c) 1995, 1999 by Borland International
// All rights reserved
// (DO NOT EDIT: machine generated header) 'hamulce.pas' rev: 5.00
#ifndef hamulceHPP
#define hamulceHPP
#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <friction.hpp> // Pascal unit
#include <SysUtils.hpp> // Pascal unit
#include <mctools.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit
//-- user supplied -----------------------------------------------------------
namespace Hamulce
{
//-- type declarations -------------------------------------------------------
class DELPHICLASS TReservoir;
class PASCALIMPLEMENTATION TReservoir : public System::TObject
{
typedef System::TObject inherited;
protected:
double Cap;
double Vol;
double dVol;
public:
__fastcall TReservoir(void);
void __fastcall CreateCap(double Capacity);
void __fastcall CreatePress(double Press);
virtual double __fastcall pa(void);
virtual double __fastcall P(void);
void __fastcall Flow(double dv);
void __fastcall Act(void);
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TReservoir(void) { }
#pragma option pop
};
typedef TReservoir* *PReservoir;
class DELPHICLASS TBrakeCyl;
class PASCALIMPLEMENTATION TBrakeCyl : public TReservoir
{
typedef TReservoir inherited;
public:
virtual double __fastcall pa(void);
virtual double __fastcall P(void);
public:
#pragma option push -w-inl
/* TReservoir.Create */ inline __fastcall TBrakeCyl(void) : TReservoir() { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TBrakeCyl(void) { }
#pragma option pop
};
class DELPHICLASS TBrake;
class PASCALIMPLEMENTATION TBrake : public System::TObject
{
typedef System::TObject inherited;
protected:
TReservoir* BrakeCyl;
TReservoir* BrakeRes;
TReservoir* ValveRes;
Byte BCN;
double BCM;
double BCA;
Byte BrakeDelays;
Byte BrakeDelayFlag;
Friction::TFricMat* FM;
double MaxBP;
Byte BA;
Byte NBpA;
double SizeBR;
double SizeBC;
bool DCV;
double ASBP;
Byte BrakeStatus;
Byte SoundFlag;
public:
__fastcall TBrake(double i_mbp, double i_bcr, double i_bcd, double i_brc, Byte i_bcn, Byte i_BD, Byte
i_mat, Byte i_ba, Byte i_nbpa);
virtual double __fastcall GetFC(double Vel, double N);
virtual double __fastcall GetPF(double PP, double dt, double Vel);
double __fastcall GetBCF(void);
virtual double __fastcall GetHPFlow(double HP, double dt);
virtual double __fastcall GetBCP(void);
double __fastcall GetBRP(void);
double __fastcall GetVRP(void);
virtual double __fastcall GetCRP(void);
virtual void __fastcall Init(double PP, double HPP, double LPP, double BP, Byte BDF);
bool __fastcall SetBDF(Byte nBDF);
void __fastcall Releaser(Byte state);
virtual void __fastcall SetEPS(double nEPS);
void __fastcall ASB(Byte state);
Byte __fastcall GetStatus(void);
void __fastcall SetASBP(double press);
virtual void __fastcall ForceEmptiness(void);
Byte __fastcall GetSoundFlag(void);
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TBrake(void) { }
#pragma option pop
};
class DELPHICLASS TWest;
class PASCALIMPLEMENTATION TWest : public TBrake
{
typedef TBrake inherited;
private:
double LBP;
double dVP;
double EPS;
double TareM;
double LoadM;
double TareBP;
double LoadC;
public:
void __fastcall SetLBP(double P);
virtual double __fastcall GetPF(double PP, double dt, double Vel);
virtual void __fastcall Init(double PP, double HPP, double LPP, double BP, Byte BDF);
virtual double __fastcall GetHPFlow(double HP, double dt);
void __fastcall PLC(double mass);
virtual void __fastcall SetEPS(double nEPS);
void __fastcall SetLP(double TM, double LM, double TBP);
public:
#pragma option push -w-inl
/* TBrake.Create */ inline __fastcall TWest(double i_mbp, double i_bcr, double i_bcd, double i_brc,
Byte i_bcn, Byte i_BD, Byte i_mat, Byte i_ba, Byte i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn
, i_BD, i_mat, i_ba, i_nbpa) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TWest(void) { }
#pragma option pop
};
class DELPHICLASS TESt;
class PASCALIMPLEMENTATION TESt : public TBrake
{
typedef TBrake inherited;
private:
TReservoir* CntrlRes;
double BVM;
public:
virtual double __fastcall GetPF(double PP, double dt, double Vel);
void __fastcall EStParams(double i_crc);
virtual void __fastcall Init(double PP, double HPP, double LPP, double BP, Byte BDF);
virtual double __fastcall GetCRP(void);
void __fastcall CheckState(double BCP, double &dV1);
void __fastcall CheckReleaser(double dt);
double __fastcall CVs(double bp);
double __fastcall BVs(double BCP);
public:
#pragma option push -w-inl
/* TBrake.Create */ inline __fastcall TESt(double i_mbp, double i_bcr, double i_bcd, double i_brc,
Byte i_bcn, Byte i_BD, Byte i_mat, Byte i_ba, Byte i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn
, i_BD, i_mat, i_ba, i_nbpa) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TESt(void) { }
#pragma option pop
};
class DELPHICLASS TESt3;
class PASCALIMPLEMENTATION TESt3 : public TESt
{
typedef TESt inherited;
private:
double CylFlowSpeed[2][2];
public:
virtual double __fastcall GetPF(double PP, double dt, double Vel);
public:
#pragma option push -w-inl
/* TBrake.Create */ inline __fastcall TESt3(double i_mbp, double i_bcr, double i_bcd, double i_brc,
Byte i_bcn, Byte i_BD, Byte i_mat, Byte i_ba, Byte i_nbpa) : TESt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn
, i_BD, i_mat, i_ba, i_nbpa) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TESt3(void) { }
#pragma option pop
};
class DELPHICLASS TESt3AL2;
class PASCALIMPLEMENTATION TESt3AL2 : public TESt3
{
typedef TESt3 inherited;
private:
double TareM;
double LoadM;
double TareBP;
double LoadC;
public:
TReservoir* ImplsRes;
virtual double __fastcall GetPF(double PP, double dt, double Vel);
void __fastcall PLC(double mass);
void __fastcall SetLP(double TM, double LM, double TBP);
virtual void __fastcall Init(double PP, double HPP, double LPP, double BP, Byte BDF);
public:
#pragma option push -w-inl
/* TBrake.Create */ inline __fastcall TESt3AL2(double i_mbp, double i_bcr, double i_bcd, double i_brc
, Byte i_bcn, Byte i_BD, Byte i_mat, Byte i_ba, Byte i_nbpa) : TESt3(i_mbp, i_bcr, i_bcd, i_brc, i_bcn
, i_BD, i_mat, i_ba, i_nbpa) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TESt3AL2(void) { }
#pragma option pop
};
class DELPHICLASS TESt4R;
class PASCALIMPLEMENTATION TESt4R : public TESt
{
typedef TESt inherited;
private:
bool RapidStatus;
double RapidTemp;
public:
TReservoir* ImplsRes;
virtual double __fastcall GetPF(double PP, double dt, double Vel);
virtual void __fastcall Init(double PP, double HPP, double LPP, double BP, Byte BDF);
public:
#pragma option push -w-inl
/* TBrake.Create */ inline __fastcall TESt4R(double i_mbp, double i_bcr, double i_bcd, double i_brc
, Byte i_bcn, Byte i_BD, Byte i_mat, Byte i_ba, Byte i_nbpa) : TESt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn
, i_BD, i_mat, i_ba, i_nbpa) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TESt4R(void) { }
#pragma option pop
};
class DELPHICLASS TLSt;
class PASCALIMPLEMENTATION TLSt : public TESt4R
{
typedef TESt4R inherited;
private:
double CylFlowSpeed[2][2];
double LBP;
double RM;
double EDFlag;
public:
void __fastcall SetLBP(double P);
void __fastcall SetRM(double RMR);
virtual double __fastcall GetPF(double PP, double dt, double Vel);
virtual double __fastcall GetHPFlow(double HP, double dt);
virtual void __fastcall Init(double PP, double HPP, double LPP, double BP, Byte BDF);
virtual double __fastcall GetEDBCP(void);
void __fastcall SetED(double EDstate);
public:
#pragma option push -w-inl
/* TBrake.Create */ inline __fastcall TLSt(double i_mbp, double i_bcr, double i_bcd, double i_brc,
Byte i_bcn, Byte i_BD, Byte i_mat, Byte i_ba, Byte i_nbpa) : TESt4R(i_mbp, i_bcr, i_bcd, i_brc, i_bcn
, i_BD, i_mat, i_ba, i_nbpa) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TLSt(void) { }
#pragma option pop
};
class DELPHICLASS TEStED;
class PASCALIMPLEMENTATION TEStED : public TLSt
{
typedef TLSt inherited;
private:
double Nozzles[11];
bool Zamykajacy;
bool Przys_blok;
TReservoir* Miedzypoj;
public:
virtual void __fastcall Init(double PP, double HPP, double LPP, double BP, Byte BDF);
virtual double __fastcall GetPF(double PP, double dt, double Vel);
virtual double __fastcall GetEDBCP(void);
public:
#pragma option push -w-inl
/* TBrake.Create */ inline __fastcall TEStED(double i_mbp, double i_bcr, double i_bcd, double i_brc
, Byte i_bcn, Byte i_BD, Byte i_mat, Byte i_ba, Byte i_nbpa) : TLSt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn
, i_BD, i_mat, i_ba, i_nbpa) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TEStED(void) { }
#pragma option pop
};
class DELPHICLASS TEStEP2;
class PASCALIMPLEMENTATION TEStEP2 : public TLSt
{
typedef TLSt inherited;
private:
double TareM;
double LoadM;
double TareBP;
double LoadC;
double EPS;
public:
virtual double __fastcall GetPF(double PP, double dt, double Vel);
virtual void __fastcall Init(double PP, double HPP, double LPP, double BP, Byte BDF);
void __fastcall PLC(double mass);
virtual void __fastcall SetEPS(double nEPS);
void __fastcall SetLP(double TM, double LM, double TBP);
public:
#pragma option push -w-inl
/* TBrake.Create */ inline __fastcall TEStEP2(double i_mbp, double i_bcr, double i_bcd, double i_brc
, Byte i_bcn, Byte i_BD, Byte i_mat, Byte i_ba, Byte i_nbpa) : TLSt(i_mbp, i_bcr, i_bcd, i_brc, i_bcn
, i_BD, i_mat, i_ba, i_nbpa) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TEStEP2(void) { }
#pragma option pop
};
class DELPHICLASS TCV1;
class PASCALIMPLEMENTATION TCV1 : public TBrake
{
typedef TBrake inherited;
private:
TReservoir* CntrlRes;
double BVM;
public:
virtual double __fastcall GetPF(double PP, double dt, double Vel);
virtual void __fastcall Init(double PP, double HPP, double LPP, double BP, Byte BDF);
virtual double __fastcall GetCRP(void);
void __fastcall CheckState(double BCP, double &dV1);
double __fastcall CVs(double bp);
double __fastcall BVs(double BCP);
public:
#pragma option push -w-inl
/* TBrake.Create */ inline __fastcall TCV1(double i_mbp, double i_bcr, double i_bcd, double i_brc,
Byte i_bcn, Byte i_BD, Byte i_mat, Byte i_ba, Byte i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn
, i_BD, i_mat, i_ba, i_nbpa) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TCV1(void) { }
#pragma option pop
};
class DELPHICLASS TCV1R;
class PASCALIMPLEMENTATION TCV1R : public TCV1
{
typedef TCV1 inherited;
private:
TReservoir* ImplsRes;
bool RapidStatus;
public:
#pragma option push -w-inl
/* TBrake.Create */ inline __fastcall TCV1R(double i_mbp, double i_bcr, double i_bcd, double i_brc,
Byte i_bcn, Byte i_BD, Byte i_mat, Byte i_ba, Byte i_nbpa) : TCV1(i_mbp, i_bcr, i_bcd, i_brc, i_bcn
, i_BD, i_mat, i_ba, i_nbpa) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TCV1R(void) { }
#pragma option pop
};
class DELPHICLASS TCV1L_TR;
class PASCALIMPLEMENTATION TCV1L_TR : public TCV1
{
typedef TCV1 inherited;
private:
TReservoir* ImplsRes;
double LBP;
public:
virtual double __fastcall GetPF(double PP, double dt, double Vel);
virtual void __fastcall Init(double PP, double HPP, double LPP, double BP, Byte BDF);
void __fastcall SetLBP(double P);
virtual double __fastcall GetHPFlow(double HP, double dt);
public:
#pragma option push -w-inl
/* TBrake.Create */ inline __fastcall TCV1L_TR(double i_mbp, double i_bcr, double i_bcd, double i_brc
, Byte i_bcn, Byte i_BD, Byte i_mat, Byte i_ba, Byte i_nbpa) : TCV1(i_mbp, i_bcr, i_bcd, i_brc, i_bcn
, i_BD, i_mat, i_ba, i_nbpa) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TCV1L_TR(void) { }
#pragma option pop
};
class DELPHICLASS TKE;
class PASCALIMPLEMENTATION TKE : public TBrake
{
typedef TBrake inherited;
private:
bool RapidStatus;
TReservoir* ImplsRes;
TReservoir* CntrlRes;
TReservoir* Brak2Res;
double BVM;
double TareM;
double LoadM;
double TareBP;
double LoadC;
double RM;
double LBP;
public:
void __fastcall SetRM(double RMR);
virtual double __fastcall GetPF(double PP, double dt, double Vel);
virtual void __fastcall Init(double PP, double HPP, double LPP, double BP, Byte BDF);
virtual double __fastcall GetHPFlow(double HP, double dt);
virtual double __fastcall GetCRP(void);
void __fastcall CheckState(double BCP, double &dV1);
void __fastcall CheckReleaser(double dt);
double __fastcall CVs(double bp);
double __fastcall BVs(double BCP);
void __fastcall PLC(double mass);
void __fastcall SetLP(double TM, double LM, double TBP);
void __fastcall SetLBP(double P);
public:
#pragma option push -w-inl
/* TBrake.Create */ inline __fastcall TKE(double i_mbp, double i_bcr, double i_bcd, double i_brc, Byte
i_bcn, Byte i_BD, Byte i_mat, Byte i_ba, Byte i_nbpa) : TBrake(i_mbp, i_bcr, i_bcd, i_brc, i_bcn,
i_BD, i_mat, i_ba, i_nbpa) { }
#pragma option pop
public:
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TKE(void) { }
#pragma option pop
};
class DELPHICLASS THandle;
class PASCALIMPLEMENTATION THandle : public System::TObject
{
typedef System::TObject inherited;
public:
bool Time;
bool TimeEP;
double Sounds[5];
virtual double __fastcall GetPF(double i_bcp, double pp, double hp, double dt, double ep);
virtual void __fastcall Init(double press);
virtual double __fastcall GetCP(void);
virtual void __fastcall SetReductor(double nAdj);
virtual double __fastcall GetSound(Byte i);
virtual double __fastcall GetPos(Byte i);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall THandle(void) : System::TObject() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~THandle(void) { }
#pragma option pop
};
class DELPHICLASS TFV4a;
class PASCALIMPLEMENTATION TFV4a : public THandle
{
typedef THandle inherited;
private:
double CP;
double TP;
double RP;
public:
virtual double __fastcall GetPF(double i_bcp, double pp, double hp, double dt, double ep);
virtual void __fastcall Init(double press);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TFV4a(void) : THandle() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TFV4a(void) { }
#pragma option pop
};
class DELPHICLASS TFV4aM;
class PASCALIMPLEMENTATION TFV4aM : public THandle
{
typedef THandle inherited;
private:
double CP;
double TP;
double RP;
double XP;
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);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TFV4aM(void) : THandle() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TFV4aM(void) { }
#pragma option pop
};
class DELPHICLASS TM394;
class PASCALIMPLEMENTATION TM394 : public THandle
{
typedef THandle inherited;
private:
double CP;
double RedAdj;
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 GetCP(void);
virtual double __fastcall GetPos(Byte i);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TM394(void) : THandle() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TM394(void) { }
#pragma option pop
};
class DELPHICLASS TH14K1;
class PASCALIMPLEMENTATION TH14K1 : public THandle
{
typedef THandle inherited;
private:
double CP;
double RedAdj;
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 GetCP(void);
virtual double __fastcall GetPos(Byte i);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TH14K1(void) : THandle() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TH14K1(void) { }
#pragma option pop
};
class DELPHICLASS TSt113;
class PASCALIMPLEMENTATION TSt113 : public TH14K1
{
typedef TH14K1 inherited;
private:
double EPS;
public:
virtual double __fastcall GetPF(double i_bcp, double pp, double hp, double dt, double ep);
virtual double __fastcall GetCP(void);
virtual double __fastcall GetPos(Byte i);
virtual void __fastcall Init(double press);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TSt113(void) : TH14K1() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TSt113(void) { }
#pragma option pop
};
class DELPHICLASS Ttest;
class PASCALIMPLEMENTATION Ttest : public THandle
{
typedef THandle inherited;
private:
double CP;
public:
virtual double __fastcall GetPF(double i_bcp, double pp, double hp, double dt, double ep);
virtual void __fastcall Init(double press);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall Ttest(void) : THandle() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~Ttest(void) { }
#pragma option pop
};
class DELPHICLASS TFD1;
class PASCALIMPLEMENTATION TFD1 : public THandle
{
typedef THandle inherited;
private:
double MaxBP;
double BP;
public:
virtual double __fastcall GetPF(double i_bcp, double pp, double hp, double dt, double ep);
virtual void __fastcall Init(double press);
virtual double __fastcall GetCP(void);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TFD1(void) : THandle() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TFD1(void) { }
#pragma option pop
};
class DELPHICLASS TH1405;
class PASCALIMPLEMENTATION TH1405 : public THandle
{
typedef THandle inherited;
private:
double MaxBP;
double BP;
public:
virtual double __fastcall GetPF(double i_bcp, double pp, double hp, double dt, double ep);
virtual void __fastcall Init(double press);
virtual double __fastcall GetCP(void);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TH1405(void) : THandle() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TH1405(void) { }
#pragma option pop
};
class DELPHICLASS TFVel6;
class PASCALIMPLEMENTATION TFVel6 : public THandle
{
typedef THandle inherited;
private:
double EPS;
public:
virtual double __fastcall GetPF(double i_bcp, double pp, double hp, double dt, double ep);
virtual double __fastcall GetCP(void);
virtual double __fastcall GetPos(Byte i);
virtual double __fastcall GetSound(Byte i);
virtual void __fastcall Init(double press);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TFVel6(void) : THandle() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TFVel6(void) { }
#pragma option pop
};
//-- var, const, procedure ---------------------------------------------------
static const Shortint LocalBrakePosNo = 0xa;
static const Shortint MainBrakeMaxPos = 0xa;
static const Shortint bdelay_G = 0x1;
static const Shortint bdelay_P = 0x2;
static const Shortint bdelay_R = 0x4;
static const Shortint bdelay_M = 0x8;
static const Byte bdelay_GR = 0x80;
static const Shortint b_off = 0x0;
static const Shortint b_hld = 0x1;
static const Shortint b_on = 0x2;
static const Shortint b_rfl = 0x4;
static const Shortint b_rls = 0x8;
static const Shortint b_ep = 0x10;
static const Shortint b_asb = 0x20;
static const Byte b_dmg = 0x80;
static const Shortint df_on = 0x1;
static const Shortint df_off = 0x2;
static const Shortint df_br = 0x4;
static const Shortint df_vv = 0x8;
static const Shortint df_bc = 0x10;
static const Shortint df_cv = 0x20;
static const Shortint df_PP = 0x40;
static const Byte df_RR = 0x80;
static const Shortint s_fv4a_b = 0x0;
static const Shortint s_fv4a_u = 0x1;
static const Shortint s_fv4a_e = 0x2;
static const Shortint s_fv4a_x = 0x3;
static const Shortint s_fv4a_t = 0x4;
static const Shortint bp_P10 = 0x0;
static const Shortint bp_P10Bg = 0x2;
static const Shortint bp_P10Bgu = 0x1;
static const Shortint bp_LLBg = 0x4;
static const Shortint bp_LLBgu = 0x3;
static const Shortint bp_LBg = 0x6;
static const Shortint bp_LBgu = 0x5;
static const Shortint bp_KBg = 0x8;
static const Shortint bp_KBgu = 0x7;
static const Shortint bp_D1 = 0x9;
static const Shortint bp_D2 = 0xa;
static const Shortint bp_FR513 = 0xb;
static const Shortint bp_Cosid = 0xc;
static const Shortint bp_PKPBg = 0xd;
static const Shortint bp_PKPBgu = 0xe;
static const Byte bp_MHS = 0x80;
static const Shortint bp_P10yBg = 0xf;
static const Shortint bp_P10yBgu = 0x10;
static const Shortint sf_Acc = 0x1;
static const Shortint sf_BR = 0x2;
static const Shortint sf_CylB = 0x4;
static const Shortint sf_CylU = 0x8;
static const Shortint sf_rel = 0x10;
static const Shortint sf_ep = 0x20;
static const Shortint bh_MIN = 0x0;
static const Shortint bh_MAX = 0x1;
static const Shortint bh_FS = 0x2;
static const Shortint bh_RP = 0x3;
static const Shortint bh_NP = 0x4;
static const Shortint bh_MB = 0x5;
static const Shortint bh_FB = 0x6;
static const Shortint bh_EB = 0x7;
static const Shortint bh_EPR = 0x8;
static const Shortint bh_EPN = 0x9;
static const Shortint bh_EPB = 0xa;
#define SpgD (7.917000E-01)
#define SpO (5.067000E-01)
extern PACKAGE double BPT[9][2];
extern PACKAGE double BPT_394[7][2];
static const Shortint i_bcpno = 0x6;
extern PACKAGE double __fastcall PF(double P1, double P2, double S, double DP);
extern PACKAGE double __fastcall PF1(double P1, double P2, double S);
extern PACKAGE double __fastcall PFVa(double PH, double PL, double S, double LIM, double DP);
extern PACKAGE double __fastcall PFVd(double PH, double PL, double S, double LIM, double DP);
} /* namespace Hamulce */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Hamulce;
#endif
#pragma option pop // -w-
#pragma option pop // -Vx
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // hamulce

3014
McZapkie/hamulce.pas Normal file

File diff suppressed because it is too large Load Diff

61
McZapkie/klasy_ham.pas Normal file
View File

@@ -0,0 +1,61 @@
unit klasy_ham; {fizyka hamulcow dla symulatora}
(*
MaSzyna EU07 - SPKS
Brakes. Basic classes.
Copyright (C) 2007-2013 Maciej Cierniak
*)
interface
uses mctools,sysutils;
//CONST;
TYPE
TRurka= class //bezposrednie polaczenie, co wleci to wyleci
private
Vol: real;
Cap: real;
public
function Update(dt: real);
procedure Flow(dV: real);
end;
PRurka= ^TRurka;
TTrojnik= class(TRurka)
private
Wyjscie1: PRurka;
Wyjscie2: PRurka;
Wyjscie3: PRurka;
public
end;
TZbiornik= class(TRurka)
private
Wyjscie_jeden: PRurka;
public
end;
TPowtarzacz= class(TRurka)
private
public
end;
TPrzekladnik= class(TPowtarzacz)
private
public
end;
function PF(P1,P2,S:real):real;
implementation
end.

95
McZapkie/mctools.hpp Normal file
View File

@@ -0,0 +1,95 @@
// Borland C++ Builder
// Copyright (c) 1995, 1999 by Borland International
// All rights reserved
// (DO NOT EDIT: machine generated header) 'mctools.pas' rev: 5.00
#ifndef mctoolsHPP
#define mctoolsHPP
#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit
//-- user supplied -----------------------------------------------------------
namespace Mctools
{
//-- type declarations -------------------------------------------------------
typedef Set<char, 0, 255> TableChar;
//-- var, const, procedure ---------------------------------------------------
#define _EOL (System::Set<char, 0, 255> () << '\xa' << '\xd' )
static const char _SPACE = '\x20';
#define _Spacesigns (System::Set<char, 0, 255> () << '\x9' << '\xa' << '\xd' << '\x29' << '\x2a' << '\x2d' \
<< '\x49' << '\x4a' << '\x4d' << '\x69' << '\x6a' << '\x6d' << '\x89' << '\x8a' << '\x8d' << '\xa9' \
<< '\xaa' << '\xad' << '\xc9' << '\xca' << '\xcd' << '\xe9' << '\xea' << '\xed' )
static const Shortint CutLeft = 0xffffffff;
static const Shortint CutRight = 0x1;
static const Shortint CutBoth = 0x0;
extern PACKAGE int ConversionError;
extern PACKAGE int LineCount;
extern PACKAGE bool DebugModeFlag;
extern PACKAGE bool FreeFlyModeFlag;
extern PACKAGE double Xmin;
extern PACKAGE double Ymin;
extern PACKAGE double Xmax;
extern PACKAGE double Ymax;
extern PACKAGE double Xaspect;
extern PACKAGE double Yaspect;
extern PACKAGE double Hstep;
extern PACKAGE double Vstep;
extern PACKAGE int Vsize;
extern PACKAGE int Hsize;
extern PACKAGE AnsiString __fastcall Ups(AnsiString s);
extern PACKAGE AnsiString __fastcall b2s(Byte b);
extern PACKAGE AnsiString __fastcall i2s(int i);
extern PACKAGE AnsiString __fastcall l2s(int l);
extern PACKAGE AnsiString __fastcall r2s(double r, Byte SWidth);
extern PACKAGE Byte __fastcall s2b(AnsiString s);
extern PACKAGE int __fastcall s2i(AnsiString s);
extern PACKAGE int __fastcall s2l(AnsiString s);
extern PACKAGE double __fastcall s2r(AnsiString s);
extern PACKAGE Byte __fastcall s2bE(AnsiString s);
extern PACKAGE int __fastcall s2iE(AnsiString s);
extern PACKAGE int __fastcall s2lE(AnsiString s);
extern PACKAGE double __fastcall s2rE(AnsiString s);
extern PACKAGE Byte __fastcall Max0(Byte x1, Byte x2);
extern PACKAGE Byte __fastcall Min0(Byte x1, Byte x2);
extern PACKAGE double __fastcall Max0R(double x1, double x2);
extern PACKAGE double __fastcall Min0R(double x1, double x2);
extern PACKAGE int __fastcall Sign(double x);
extern PACKAGE bool __fastcall TestFlag(int Flag, int Value);
extern PACKAGE bool __fastcall SetFlag(Byte &Flag, int Value);
extern PACKAGE bool __fastcall iSetFlag(int &Flag, int Value);
extern PACKAGE bool __fastcall FuzzyLogic(double Test, double Threshold, double Probability);
extern PACKAGE bool __fastcall FuzzyLogicAI(double Test, double Threshold, double Probability);
extern PACKAGE AnsiString __fastcall ReadWord(TextFile &infile);
extern PACKAGE AnsiString __fastcall Cut_Space(AnsiString s, int Just);
extern PACKAGE AnsiString __fastcall ExtractKeyWord(AnsiString InS, AnsiString KeyWord);
extern PACKAGE AnsiString __fastcall DUE(AnsiString S);
extern PACKAGE AnsiString __fastcall DWE(AnsiString S);
extern PACKAGE AnsiString __fastcall Ld2Sp(AnsiString S);
extern PACKAGE AnsiString __fastcall Tab2Sp(AnsiString S);
extern PACKAGE void __fastcall ComputeArc(double X0, double Y0, double Xn, double Yn, double R, double
L, double dL, double &phi, double &Xout, double &Yout);
extern PACKAGE void __fastcall ComputeALine(double X0, double Y0, double Xn, double Yn, double L, double
R, double &Xout, double &Yout);
extern PACKAGE double __fastcall Xhor(double h);
extern PACKAGE double __fastcall Yver(double v);
extern PACKAGE int __fastcall Horiz(double X);
extern PACKAGE int __fastcall Vert(double Y);
extern PACKAGE void __fastcall ClearPendingExceptions(void);
} /* namespace Mctools */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Mctools;
#endif
#pragma option pop // -w-
#pragma option pop // -Vx
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // mctools

497
McZapkie/mctools.pas Normal file
View File

@@ -0,0 +1,497 @@
unit mctools;
{rozne takie duperele do operacji na stringach w paszczalu, pewnie w delfi sa lepsze}
{konwersja zmiennych na stringi, funkcje matematyczne, logiczne, lancuchowe, I/O etc}
interface
const
{Ra: te sta³e nie s¹ u¿ywane...
_FileName = ['a'..'z','A'..'Z',':','\','.','*','?','0'..'9','_','-'];
_RealNum = ['0'..'9','-','+','.','E','e'];
_Integer = ['0'..'9','-']; //Ra: to siê gryzie z STLport w Builder 6
_Plus_Int = ['0'..'9'];
_All = [' '..'þ'];
_Delimiter= [',',';']+_EOL;
_Delimiter_Space=_Delimiter+[' '];
}
_EOL = [#13,#10];
_SPACE = ' ';
_Spacesigns=[' ']+[#9]+_EOL;
CutLeft=-1; CutRight=1; CutBoth=0; {Cut_Space}
var
ConversionError: integer=0;
LineCount: integer=0;
DebugModeFlag: boolean=False;
FreeFlyModeFlag: boolean=False;
type
TableChar = Set Of Char; {MCTUTIL}
{konwersje}
function b2s(b:byte):string;
function i2s(i:integer):string;
function l2s(l:longint):string;
function r2s(r:real; SWidth:byte):string;
function s2b(s:string):byte;
function s2i(s:string):integer;
function s2l(s:string):longint;
function s2r(s:string):real;
function s2bE(s:string):byte;
function s2iE(s:string):integer;
function s2lE(s:string):longint;
function s2rE(s:string):real;
{funkcje matematyczne}
function Max0(x1,x2:byte) : byte;
function Min0(x1,x2:byte) : byte;
function Max0R(x1,x2:real) : real;
function Min0R(x1,x2:real) : real;
function Sign(x:real) : integer;
{funkcje logiczne}
function TestFlag(Flag:integer; Value:integer):boolean;
function SetFlag(var Flag:byte; Value:integer):boolean;
function iSetFlag(var Flag:integer; Value:integer):boolean;
function FuzzyLogic(Test,Threshold,Probability:real):boolean;
{jesli Test>Threshold to losowanie}
function FuzzyLogicAI(Test,Threshold,Probability:real):boolean;
{to samo ale zawsze niezaleznie od DebugFlag}
{operacje na stringach}
Function ReadWord(var infile:text):string; {czyta slowo z wiersza pliku tekstowego}
Function Ups (s:string ): string ;
Function Cut_Space(s:string; Just:integer) : string;
Function ExtractKeyWord(InS:String; KeyWord:string) : String; {wyciaga slowo kluczowe i lancuch do pierwszej spacji}
Function DUE(S:String) : String; {Delete Until Equal sign}
Function DWE(S:String) : String; {Delete While Equal sign}
Function Ld2Sp(S:String): String; {Low dash to Space sign}
Function Tab2Sp(S:String): String; {Tab to Space sign}
{procedury, zmienne i funkcje graficzne}
procedure ComputeArc(X0,Y0,Xn,Yn,R,L:real;dL:real; var phi,Xout,Yout:real);
{wylicza polozenie Xout Yout i orientacje phi punktu na elemencie dL luku}
procedure ComputeALine(X0,Y0,Xn,Yn,L,R:real; var Xout,Yout:real);
var
Xmin,Ymin,Xmax,Ymax:real;
Xaspect,Yaspect:real;
Hstep,Vstep: real;
Vsize,Hsize:integer;
function Xhor( h:real) :real;
{ Converts horizontal screen coordinate into real X-coordinate. }
function Yver( v:real) :real;
{ Converts vertical screen coordinate into real Y-coordinate. }
function Horiz(X:real):longint;
function Vert(Y:real):longint;
procedure ClearPendingExceptions;
{------------------------------------------------}
Implementation
{================================================}
function Ups (s:string ): string ;
var
jatka : integer; swy:string;
begin
swy:='';
for jatka:=1 to length(s) do swy:=swy+UpCase(s[jatka]);
Ups:=swy;
end; {=Ups=}
function b2s(b:byte):string;
var
s:string;
begin
Str(b:2,s);
b2s:=s;
end; {=b2s=}
function i2s(i:integer):string;
var
s:string;
begin
Str(i:3,s);
i2s:=s;
end; {=i2s=}
function l2s(l:longint):string;
var
s:string;
begin
Str(l:4,s);
l2s:=s;
end; {=l2s=}
function r2s(r:real; SWidth:byte):string;
var
s:string;
absr:real; {rr:integer;}
begin
absr:=Abs(r);
if SWidth<8 then SWidth:=8;
if absr > 0.0001 then
begin {rr:=(Round(ln(1/absr)/ln(10)-1+Swidth/2));}
if absr < 100 then
Str(r:Swidth:(Round(ln(1/absr)/ln(10)-1+Swidth/2)),s)
else Str(r:Swidth:1,s)
end
else Str(r:Swidth,s);
{ if r>0 then s:=insert('+'s,3);}
r2s:=s;
end; {=r2s=}
function s2b(s:string):byte;
var e:integer;
b:byte;
begin
Val(s,b,e);
s2b:=b;
end;
function s2i(s:string):integer;
var e:integer;
i:integer;
begin
Val(s,i,e);
s2i:=i;
end;
function s2l(s:string):longint;
var e:integer;
l:longint;
begin
Val(s,l,e);
s2l:=l;
end;
function s2r(s:string):real;
var e:integer;
r:real;
begin
Val(s,r,e);
s2r:=r;
end;
function s2bE(s:string):byte;
var e:integer;
b:byte;
begin
s2bE:=0;
Val(s,b,e);
if e>0 then
ConversionError:=e
else s2bE:=b;
end;
function s2iE(s:string):integer;
var e:integer;
i:integer;
begin
s2iE:=0;
Val(s,i,e);
if e>0 then
ConversionError:=e
else s2iE:=i;
end;
function s2lE(s:string):longint;
var e:integer;
l:longint;
begin
s2lE:=0;
Val(s,l,e);
if e>0 then
ConversionError:=e
else s2lE:=l;
end;
function s2rE(s:string):real;
var e:integer;
r:real;
begin
s2rE:=0;
Val(s,r,e);
if e>0 then
ConversionError:=e
else s2rE:=r;
end;
function Max0(x1,x2:byte) : byte;
begin
if x1>x2 then
Max0:=x1
else
Max0:=x2;
end;
function Min0(x1,x2:byte) : byte;
begin
if x1<x2 then
Min0:=x1
else
Min0:=x2;
end;
function Max0R(x1,x2:real) : real;
begin
if x1>x2 then
Max0R:=x1
else
Max0R:=x2;
end;
function Min0R(x1,x2:real) : real;
begin
if x1<x2 then
Min0R:=x1
else
Min0R:=x2;
end;
function Sign(x:real) : integer;
begin
Sign:=0;
if x>0 then Sign:=1;
if x<0 then Sign:=-1;
end;
function TestFlag(Flag:integer; Value:integer):boolean;
begin
if (Flag and Value)=Value then
TestFlag:=True
else TestFlag:=False;
end;
function SetFlag(var Flag:byte; Value:integer):boolean;
begin
SetFlag:=False;
if Value>0 then
if (Flag and Value)=0 then
begin
Flag:=Flag+Value;
SetFlag:=True
end;
if Value<0 then
if (Flag and Abs(Value))=Abs(Value) then
begin
Flag:=Flag+Value;
SetFlag:=True
end;
end;
function iSetFlag(var Flag:integer; Value:integer):boolean;
begin
iSetFlag:=False;
if Value>0 then
if (Flag and Value)=0 then
begin
Flag:=Flag+Value;
iSetFlag:=True; //true, gdy by³o wczeœniej 0 i zosta³o ustawione
end;
if Value<0 then
if (Flag and Abs(Value))=Abs(Value) then
begin
Flag:=Flag+Value; //Value jest ujemne, czyli zerowanie flagi
iSetFlag:=True; //true, gdy by³o wczeœniej 1 i zosta³o wyzerowane
end;
end;
function FuzzyLogic(Test,Threshold,Probability:real):boolean;
begin
if (Test>Threshold) and (not DebugModeFlag) then
FuzzyLogic:=(Random<Probability*Threshold/Test) {im wiekszy Test tym wieksza szansa}
else FuzzyLogic:=False;
end;
function FuzzyLogicAI(Test,Threshold,Probability:real):boolean;
begin
if (Test>Threshold) then
FuzzyLogicAI:=(Random<Probability*Threshold/Test) {im wiekszy Test tym wieksza szansa}
else FuzzyLogicAI:=False;
end;
Function ReadWord(var infile:text):string;
var s:string; c:char; nextword:boolean;
begin
s:='';
nextword:=False;
while (not eof(infile)) and (not nextword) do
begin
read(infile,c);
if c in _SpaceSigns then
if s<>'' then
nextword:=True;
if not (c in _Spacesigns) then
s:=s+c;
end;
ReadWord:=s;
end;
Function Cut_Space(s:string; Just:integer) : string;
var ii:byte;
begin
case Just of
CutLeft : begin
ii:=0;
while (ii<length(s)) and (s[ii+1]=_SPACE) do
inc(ii);
S:=Copy(s,ii+1,length(s)-ii);
end;
CutRight: begin
ii:=length(s);
while(ii>0) and (s[ii]=_SPACE) do
dec(ii);
S:=Copy(s,1,ii);
end;
CutBoth : begin
S:=Cut_Space(S,CutLeft);
S:=Cut_Space(S,CutRight);
end;
end;
Cut_Space:=S;
end;
{Cut_Space}
Function ExtractKeyWord(InS:String; KeyWord:string) : String;
var s:string; kwp:byte;
begin
Ins:=Ins+' ';
kwp:=Pos(KeyWord,InS);
if kwp>0 then
begin
s:=Copy(InS,kwp,Length(Ins));
s:=Copy(s,1,Pos(' ',s)-1);
end
else s:='';
ExtractKeyWord:=s;
end;
Function DUE(S:String) : String; {Delete Until Equal sign}
begin
DUE:=Copy(S,Pos('=',S)+1,Length(S));
end;
Function DWE(S:String) : String; {Delete While Equal sign}
var ep:byte;
begin
ep:=Pos('=',S);
if ep>0 then
DWE:=Copy(S,1,ep-1)
else DWE:=S;
end;
Function Ld2Sp(S:String): String; {Low dash to Space sign}
var b:byte; s2:string;
begin
s2:='';
for b:=1 to length(S) do
if S[b]='_' then
s2:=s2+' '
else
s2:=s2+S[b];
Ld2Sp:=s2;
end;
Function Tab2Sp(S:String): String; {Tab to Space sign}
var b:byte; s2:string;
begin
s2:='';
for b:=1 to length(S) do
if S[b]=#9 then
s2:=s2+' '
else
s2:=s2+S[b];
Tab2Sp:=s2;
end;
procedure ComputeArc(X0,Y0,Xn,Yn,R,L:real;dL:real; var phi,Xout,Yout:real);
{wylicza polozenie Xout Yout i orientacje phi punktu na elemencie dL luku}
var dX,dY,Xc,Yc,gamma,alfa,AbsR:real;
begin
if (R<>0) and (L<>0) then
begin
AbsR:=Abs(R);
dX:=Xn-X0;
dY:=Yn-Y0;
if dX<>0 then gamma:=arctan(dY/dX)
else if dY>0 then gamma:=Pi/2
else gamma:=3*Pi/2;
alfa:=L/R;
phi:=gamma-(alfa+Pi*Round(R/AbsR))/2;
Xc:=X0-AbsR*cos(phi);
Yc:=Y0-AbsR*sin(phi);
phi:=phi+alfa*dL/L;
Xout:=AbsR*cos(phi)+Xc;
Yout:=AbsR*sin(phi)+Yc;
end;
end;
procedure ComputeALine(X0,Y0,Xn,Yn,L,R:real; var Xout,Yout:real);
var dX,dY,gamma,alfa:real;
{ pX,pY : real;}
begin
alfa:=0; //ABu: bo nie bylo zainicjowane
dX:=Xn-X0;
dY:=Yn-Y0;
if dX<>0 then gamma:=arctan(dY/dX)
else if dY>0 then gamma:=Pi/2
else gamma:=3*Pi/2;
if R<>0 then alfa:=L/R;
Xout:=X0+L*cos(alfa/2-gamma);
Yout:=Y0+L*sin(alfa/2-gamma);
end;
{graficzne:}
function Xhor( h:real) :real;
begin
Xhor:= h*Hstep + Xmin;
end;
function Yver( v:real) :real;
begin
Yver:= (Vsize-v)*Vstep + Ymin;
end;
function Horiz(X:real):longint;
begin
x:= (x-Xmin) / Hstep;
if x > -MaxInt then
if x < MaxInt then Horiz:=Round(x)
else Horiz:= MaxInt
else Horiz:= -MaxInt;
end;
function Vert(Y:real):longint;
begin
y:= (y-Ymin) / Vstep;
if y > -MaxInt then
if y < MaxInt then Vert:=Vsize-Round(y)
else Vert:= MaxInt
else Vert:= -MaxInt
end;
procedure ClearPendingExceptions;
//resetuje b³êdy FPU, wymagane dla Trunc()
asm
FNCLEX
end;
end.

127
McZapkie/mtable.hpp Normal file
View File

@@ -0,0 +1,127 @@
// Borland C++ Builder
// Copyright (c) 1995, 1999 by Borland International
// All rights reserved
// (DO NOT EDIT: machine generated header) 'mtable.pas' rev: 5.00
#ifndef mtableHPP
#define mtableHPP
#pragma delphiheader begin
#pragma option push -w-
#pragma option push -Vx
#include <SysUtils.hpp> // Pascal unit
#include <mctools.hpp> // Pascal unit
#include <SysInit.hpp> // Pascal unit
#include <System.hpp> // Pascal unit
//-- user supplied -----------------------------------------------------------
namespace Mtable
{
//-- type declarations -------------------------------------------------------
struct TMTableLine
{
double km;
double vmax;
AnsiString StationName;
AnsiString StationWare;
Byte TrackNo;
int Ah;
int Am;
int Dh;
int Dm;
double tm;
int WaitTime;
} ;
typedef TMTableLine TMTable[101];
class DELPHICLASS TTrainParameters;
typedef TTrainParameters* *PTrainParameters;
class PASCALIMPLEMENTATION TTrainParameters : public System::TObject
{
typedef System::TObject inherited;
public:
AnsiString TrainName;
double TTVmax;
AnsiString Relation1;
AnsiString Relation2;
double BrakeRatio;
AnsiString LocSeries;
double LocLoad;
TMTableLine TimeTable[101];
int StationCount;
int StationIndex;
AnsiString NextStationName;
double LastStationLatency;
int Direction;
double __fastcall CheckTrainLatency(void);
AnsiString __fastcall ShowRelation();
double __fastcall WatchMTable(double DistCounter);
AnsiString __fastcall NextStop();
bool __fastcall IsStop(void);
bool __fastcall IsTimeToGo(double hh, double mm);
bool __fastcall UpdateMTable(double hh, double mm, AnsiString NewName);
__fastcall TTrainParameters(AnsiString NewTrainName);
void __fastcall NewName(AnsiString NewTrainName);
bool __fastcall LoadTTfile(AnsiString scnpath, int iPlus, double vMax);
bool __fastcall DirectionChange(void);
void __fastcall StationIndexInc(void);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TTrainParameters(void) : System::TObject() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TTrainParameters(void) { }
#pragma option pop
};
class DELPHICLASS TMTableTime;
class PASCALIMPLEMENTATION TMTableTime : public System::TObject
{
typedef System::TObject inherited;
public:
double GameTime;
int dd;
int hh;
int mm;
int srh;
int srm;
int ssh;
int ssm;
double mr;
void __fastcall UpdateMTableTime(double deltaT);
__fastcall TMTableTime(int InitH, int InitM, int InitSRH, int InitSRM, int InitSSH, int InitSSM);
public:
#pragma option push -w-inl
/* TObject.Create */ inline __fastcall TMTableTime(void) : System::TObject() { }
#pragma option pop
#pragma option push -w-inl
/* TObject.Destroy */ inline __fastcall virtual ~TMTableTime(void) { }
#pragma option pop
};
//-- var, const, procedure ---------------------------------------------------
static const Shortint MaxTTableSize = 0x64;
static const char hrsd = '\x2e';
extern PACKAGE TMTableTime* GlobalTime;
} /* namespace Mtable */
#if !defined(NO_IMPLICIT_NAMESPACE_USE)
using namespace Mtable;
#endif
#pragma option pop // -w-
#pragma option pop // -Vx
#pragma delphiheader end.
//-- end unit ----------------------------------------------------------------
#endif // mtable

521
McZapkie/mtable.pas Normal file
View File

@@ -0,0 +1,521 @@
unit mtable;
interface uses mctools,sysutils;
const MaxTTableSize=100; //mo¿na by to robiæ dynamicznie
hrsd= '.';
Type
//Ra: pozycja zerowa rozk³adu chyba nie ma sensu
//Ra: numeracja przystanków jest 1..StationCount
TMTableLine=record
km:real; //kilometraz linii
vmax:real; //predkosc rozkladowa przed przystankiem
//StationName:string[32]; //nazwa stacji ('_' zamiast spacji)
//StationWare:string[32]; //typ i wyposazenie stacji, oddz. przecinkami}
StationName:string; //nazwa stacji ('_' zamiast spacji)
StationWare:string; //typ i wyposazenie stacji, oddz. przecinkami}
TrackNo:byte; //ilosc torow szlakowych
Ah,Am:integer; //godz. i min. przyjazdu, -1 gdy bez postoju
Dh,Dm:integer; //godz. i min. odjazdu
tm:real; //czas jazdy do tej stacji w min. (z kolumny)
WaitTime:integer; //czas postoju (liczony plus 6 sekund)
end;
TMTable = array[0..MaxTTableSize] of TMTableLine;
PTrainParameters= ^TTrainParameters;
TTrainParameters = class(TObject)
TrainName:string;
TTVmax:real;
Relation1,Relation2: string; //nazwy stacji danego odcinka
BrakeRatio: real;
LocSeries: string; //seria (typ) pojazdu
LocLoad: real;
TimeTable: TMTable;
StationCount: integer; //iloœæ przystanków (0-techniczny)
StationIndex: integer; //numer najbli¿szego (aktualnego) przystanku
NextStationName: string;
LastStationLatency: real;
Direction: integer; {kierunek jazdy w/g kilometrazu}
function CheckTrainLatency: real;
{todo: str hh:mm to int i z powrotem}
function ShowRelation: string;
function WatchMTable(DistCounter:real): real;
function NextStop:string;
function IsStop:boolean;
function IsTimeToGo(hh,mm:real):boolean;
function UpdateMTable(hh,mm:real; NewName: string): boolean;
constructor Init(NewTrainName:string);
procedure NewName(NewTrainName:string);
function LoadTTfile(scnpath:string;iPlus:Integer;vMax:real):boolean;
function DirectionChange():boolean;
procedure StationIndexInc();
end;
TMTableTime = class(TObject)
GameTime: real;
dd,hh,mm: integer;
srh,srm : integer; {wschod slonca}
ssh,ssm : integer; {zachod slonca}
mr:real;
procedure UpdateMTableTime(deltaT:real);
constructor Init(InitH,InitM,InitSRH,InitSRM,InitSSH,InitSSM:integer);
end;
var GlobalTime: TMTableTime;
implementation
function CompareTime(t1h,t1m,t2h,t2m:real):real; {roznica czasu w minutach}
//zwraca ró¿nicê czasu
//jeœli pierwsza jest aktualna, a druga rozk³adowa, to ujemna oznacza opó¿nienie
//na d³u¿sz¹ metê trzeba uwzglêdniæ datê, jakby opó¿nienia mia³y przekraczaæ 12h (towarowych)
var
t:real;
begin
if (t2h<0) then
CompareTime:=0
else
begin
t:=(t2h-t1h)*60+t2m-t1m; //jeœli t2=00:05, a t1=23:50, to ró¿nica wyjdzie ujemna
if (t<-720) then //jeœli ró¿nica przekracza 12h na minus
t:=t+1440 //to dodanie doby minut
else
if (t>720) then //jeœli przekracza 12h na plus
t:=t-1440; //to odjêcie doby minut
CompareTime:=t;
end;
end;
function TTrainParameters.CheckTrainLatency: real;
begin
if (LastStationLatency>1.0) or (LastStationLatency<-1.0) then
CheckTrainLatency:=LastStationLatency {spoznienie + lub do przodu - z tolerancja 1 min}
else
CheckTrainLatency:=0
end;
function TTrainParameters.WatchMTable(DistCounter:real): real;
{zwraca odlegloϾ do najblizszej stacji z zatrzymaniem}
var dist:real;
begin
if Direction=1 then
dist:=TimeTable[StationIndex].km-TimeTable[0].km-DistCounter
else
dist:=TimeTable[0].km-TimeTable[StationIndex].km-DistCounter;
WatchMTable:=dist;
end;
function TTrainParameters.NextStop:string;
//pobranie nazwy nastêpnego miejsca zatrzymania
begin
if StationIndex<=StationCount
then
NextStop:='PassengerStopPoint:'+NextStationName //nazwa nastêpnego przystanku
else
NextStop:='[End of route]'; //¿e niby koniec
end;
function TTrainParameters.IsStop:boolean;
//zapytanie, czy zatrzymywaæ na nastêpnym punkcie rozk³adu
begin
if (StationIndex<StationCount) then
IsStop:=TimeTable[StationIndex].Ah>=0 //-1 to brak postoju
else
IsStop:=true; //na ostatnim siê zatrzymaæ zawsze
end;
function TTrainParameters.UpdateMTable(hh,mm:real;NewName:string):boolean;
{odfajkowanie dojechania do stacji (NewName) i przeliczenie opóŸnienia}
var OK:boolean;
begin
OK:=false;
if StationIndex<=StationCount then //Ra: "<=", bo ostatni przystanek jest traktowany wyj¹tkowo
begin
if NewName=NextStationName then //jeœli dojechane do nastêpnego
begin //Ra: wywo³anie mo¿e byæ powtarzane, jak stoi na W4
if TimeTable[StationIndex+1].km-TimeTable[StationIndex].km<0 then //to jest bez sensu
Direction:=-1
else
Direction:=1; //prowizorka bo moze byc zmiana kilometrazu
//ustalenie, czy opóŸniony (porównanie z czasem odjazdu)
LastStationLatency:=CompareTime(hh,mm,TimeTable[StationIndex].Dh,TimeTable[StationIndex].Dm);
//inc(StationIndex); //przejœcie do nastêpnej pozycji StationIndex<=StationCount
if StationIndex<StationCount then //Ra: "<", bo dodaje 1 przy przejœciu do nastêpnej stacji
begin //jeœli nie ostatnia stacja
NextStationName:=TimeTable[StationIndex+1].StationName; //zapamiêtanie nazwy
TTVmax:=TimeTable[StationIndex+1].vmax; //Ra: nowa prêdkoœæ rozk³adowa na kolejnym odcinku
end
else //gdy ostatnia stacja
NextStationName:=''; //nie ma nastêpnej stacji
OK:=true;
end;
end;
UpdateMTable:=OK; {czy jest nastepna stacja}
end;
procedure TTrainParameters.StationIndexInc();
begin
Inc(StationIndex); //przejœcie do nastêpnej pozycji StationIndex<=StationCount
end;
function TTrainParameters.IsTimeToGo(hh,mm:real):boolean;
//sprawdzenie, czy mo¿na ju¿ odjechaæ z aktualnego zatrzymania
//StationIndex to numer nastêpnego po dodarciu do aktualnego
begin
if (StationIndex<1) then
IsTimeToGo:=true //przed pierwsz¹ jechaæ
else if (StationIndex<StationCount) then
begin //oprócz ostatniego przystanku
if (TimeTable[StationIndex].Ah<0) then //odjazd z poprzedniego
IsTimeToGo:=true //czas przyjazdu nie by³ podany - przelot
else
IsTimeToGo:=CompareTime(hh,mm,TimeTable[StationIndex].Dh,TimeTable[StationIndex].Dm)<=0;
end
else //gdy rozk³ad siê skoñczy³
IsTimeToGo:=false; //dalej nie jechaæ
end;
function TTrainParameters.ShowRelation:string;
{zwraca informacjê o relacji}
begin
//if (Relation1=TimeTable[1].StationName) and (Relation2=TimeTable[StationCount].StationName)
if (Relation1<>'') and (Relation2<>'')
then ShowRelation:=Relation1+' - '+Relation2
else ShowRelation:='';
end;
constructor TTrainParameters.Init(NewTrainName:string);
{wstêpne ustawienie parametrów rozk³adu jazdy}
begin
NewName(NewTrainName);
end;
procedure TTrainParameters.NewName(NewTrainName:string);
{wstêpne ustawienie parametrów rozk³adu jazdy}
var i:integer;
begin
TrainName:=NewTrainName;
StationCount:=0;
StationIndex:=0;
NextStationName:='nowhere';
LastStationLatency:=0;
Direction:=1;
Relation1:=''; Relation2:='';
for i:=0 to MaxTTableSize do
with timeTable[i] do
begin
km:=0; vmax:=-1; StationName:='nowhere'; StationWare:='';
TrackNo:=1; Ah:=-1; Am:=-1; Dh:=-1; Dm:=-1; tm:=0; WaitTime:=0;
end;
TTVmax:=100; {wykasowac}
end;
function TTrainParameters.LoadTTfile(scnpath:string;iPlus:Integer;vMax:real):boolean;
//wczytanie pliku-tabeli z rozk³adem przesuniêtym o (fPlus); (vMax) nie ma znaczenia
var
lines,s:string;
fin:text;
EndTable:boolean;
vActual:real;
i,time:Integer; //do zwiêkszania czasu
procedure UpdateVelocity(StationCount:integer;vActual:real);
//zapisywanie prêdkoœci maksymalnej do wczeœniejszych odcinków
//wywo³ywane z numerem ostatniego przetworzonego przystanku
var i:integer;
begin
i:=StationCount;
//TTVmax:=vActual; {PROWIZORKA!!!}
while (i>=0) and (TimeTable[i].vmax=-1) do
begin
TimeTable[i].vmax:=vActual; //prêdkoœæ dojazdu do przystanku i
dec(i); //ewentualnie do poprzedniego te¿
end;
end;
begin
ClearPendingExceptions;
ConversionError:=0;
EndTable:=False;
if (TrainName='') then
begin //jeœli pusty rozk³ad
//UpdateVelocity(StationCount,vMax); //ograniczenie do prêdkoœci startowej
end
else
begin
ConversionError:=666;
vActual:=-1;
s:=scnpath+TrainName+'.txt';
//Ra 2014-09: ustaliæ zasady wyznaczenia pierwotnego pliku przy przesuniêtych rozk³adach (kolejny poci¹g dostaje numer +2)
assignfile(fin,s);
s:='';
{$I-}
reset(fin);
{$I+}
if IOresult<>0 then
begin
vMax:=s2r(TrainName); //nie ma pliku ale jest liczba
if (vMax>10)and(vMax<200) then
begin
TTVmax:=vMax; //Ra 2014-07: zamiast rozk³adu mo¿na podaæ Vmax
UpdateVelocity(StationCount,vMax); //ograniczenie do prêdkoœci startowej
ConversionError:=0;
end
else
ConversionError:=-8; {Ra: ten b³¹d jest niepotrzebny}
end
else
begin {analiza rozk³adu jazdy}
ConversionError:=0;
while not (eof(fin) or (ConversionError<>0) or EndTable) do
begin
readln(fin,lines); {wczytanie linii}
if Pos('___________________',lines)>0 then {linia pozioma górna}
if ReadWord(fin)='[' then {lewy pion}
if ReadWord(fin)='Rodzaj' then {"Rodzaj i numer pociagu"}
repeat
until (ReadWord(fin)='|') or (eof(fin)); {œrodkowy pion}
s:=ReadWord(fin); {nazwa poci¹gu}
//if LowerCase(s)<>ExtractFileName(TrainName) then {musi byæ taka sama, jak nazwa pliku}
//ConversionError:=-7 {b³¹d niezgodnoœci}
TrainName:=s; //nadanie nazwy z pliku TXT (bez œcie¿ki do pliku)
//else
begin {czytaj naglowek}
repeat
until (Pos('_______|',ReadWord(fin))>0) or eof(fin);
repeat
until (ReadWord(fin)='[') or (eof(fin)); {pierwsza linia z relacj¹}
repeat
s:=ReadWord(fin);
until (s<>'|') or eof(fin);
if s<>'|' then Relation1:=s
else ConversionError:=-5;
repeat
until (Readword(fin)='Relacja') or (eof(fin)); {druga linia z relacj¹}
repeat
until (ReadWord(fin)='|') or (eof(fin));
Relation2:=ReadWord(fin);
repeat
until Readword(fin)='Wymagany';
repeat
until (ReadWord(fin)='|') or (eoln(fin));
s:=ReadWord(fin);
s:=Copy(s,1,Pos('%',s)-1);
BrakeRatio:=s2rE(s);
repeat
until Readword(fin)='Seria';
repeat
until (ReadWord(fin)='|') or (eof(fin));
LocSeries:=ReadWord(fin);
LocLoad:=s2rE(ReadWord(fin));
repeat
until (Pos('[______________',ReadWord(fin))>0) or (eof(fin));
while not eof(fin) and not EndTable do
begin
inc(StationCount);
repeat
s:=ReadWord(fin);
until (s='[') or (eof(fin));
with TimeTable[StationCount] do
begin
if s='[' then
s:=ReadWord(fin)
else ConversionError:=-4;
if Pos('|',s)=0 then
begin
km:=s2rE(s);
s:=ReadWord(fin);
end;
if Pos('|_____|',s)>0 then {zmiana predkosci szlakowej}
UpdateVelocity(StationCount,vActual)
else
begin
s:=ReadWord(fin);
if Pos('|',s)=0 then
vActual:=s2rE(s);
end;
while Pos('|',s)=0 do
s:=Readword(fin);
StationName:=ReadWord(fin);
repeat
s:=ReadWord(fin);
until (s='1') or (s='2') or eof(fin);
TrackNo:=s2bE(s);
s:=ReadWord(fin);
if s<>'|' then
begin
if Pos(hrsd,s)>0 then
begin
ah:=s2iE(Copy(s,1,Pos(hrsd,s)-1)); //godzina przyjazdu
am:=s2iE(Copy(s,Pos(hrsd,s)+1,Length(s))); //minuta przyjazdu
end
else
begin
ah:=TimeTable[StationCount-1].ah; //godzina z poprzedniej pozycji
am:=s2iE(s); //bo tylko minuty podane
end;
end;
repeat
s:=ReadWord(fin);
until (s<>'|') or (eof(fin));
if s<>']' then
tm:=s2rE(s);
repeat
s:=ReadWord(fin);
until (s='[') or eof(fin);
s:=ReadWord(fin);
if Pos('|',s)=0 then
begin
{tu s moze byc miejscem zmiany predkosci szlakowej}
s:=ReadWord(fin);
end;
if Pos('|_____|',s)>0 then {zmiana predkosci szlakowej}
UpdateVelocity(StationCount,vActual)
else
begin
s:=ReadWord(fin);
if Pos('|',s)=0 then
vActual:=s2rE(s);
end;
while Pos('|',s)=0 do
s:=Readword(fin);
StationWare:=ReadWord(fin);
repeat
s:=ReadWord(fin);
until (s='1') or (s='2') or eof(fin);
TrackNo:=s2bE(s);
s:=ReadWord(fin);
if s<>'|' then
begin
if Pos(hrsd,s)>0 then
begin
dh:=s2iE(Copy(s,1,Pos(hrsd,s)-1)); //godzina odjazdu
dm:=s2iE(Copy(s,Pos(hrsd,s)+1,Length(s))); //minuta odjazdu
end
else
begin
dh:=TimeTable[StationCount-1].dh; //godzina z poprzedniej pozycji
dm:=s2iE(s); //bo tylko minuty podane
end;
end
else
begin
dh:=ah; //odjazd o tej samej, co przyjazd (dla ostatniego te¿)
dm:=am; //bo s¹ u¿ywane do wyliczenia opóŸnienia po dojechaniu
end;
if (ah>=0) then
WaitTime:=Trunc(CompareTime(ah,am,dh,dm)+0.1);
repeat
s:=ReadWord(fin);
until (s<>'|') or (eof(fin));
if s<>']' then
tm:=s2rE(s);
repeat
s:=ReadWord(fin);
until (Pos('[',s)>0) or eof(fin);
if Pos('_|_',s)=0 then
s:=Readword(fin);
if Pos('|',s)=0 then
begin
{tu s moze byc miejscem zmiany predkosci szlakowej}
s:=ReadWord(fin);
end;
if Pos('|_____|',s)>0 then {zmiana predkosci szlakowej}
UpdateVelocity(StationCount,vActual)
else
begin
s:=ReadWord(fin);
if Pos('|',s)=0 then
vActual:=s2rE(s);
end;
while Pos('|',s)=0 do
s:=Readword(fin);
while (Pos(']',s)=0) do
s:=ReadWord(fin);
if Pos('_|_',s)>0 then EndTable:=True;
end; {timetableline}
end;
end;
end; {while eof}
close(fin);
end;
end;
if ConversionError=0 then
begin
if (TimeTable[1].StationName=Relation1) then //jeœli nazwa pierwszego zgodna z relacj¹
if (TimeTable[1].Ah<0) then //a nie podany czas przyjazdu
begin //to mamy zatrzymanie na pierwszym, a nie przelot
TimeTable[1].Ah:=TimeTable[1].Dh;
TimeTable[1].Am:=TimeTable[1].Dm;
end
//NextStationName:=TimeTable[1].StationName;
{ TTVmax:=TimeTable[1].vmax; }
end;
if (iPlus<>0) then //je¿eli jest przesuniêcie rozk³adu
for i:=1 to StationCount do //bez with, bo ciê¿ko siê przenosi na C++
begin
if (TimeTable[i].Ah>=0) then
begin
time:=iPlus+TimeTable[i].Ah*60+TimeTable[i].Am; //nowe minuty
TimeTable[i].Am:=time mod 60;
TimeTable[i].Ah:=(time div 60) mod 60;
end;
if (TimeTable[i].Dh>=0) then
begin
time:=iPlus+TimeTable[i].Dh*60+TimeTable[i].Dm; //nowe minuty
TimeTable[i].Dm:=time mod 60;
TimeTable[i].Dh:=(time div 60) mod 60;
end;
end;
LoadTTfile:=(ConversionError=0);
end;
procedure TMTableTime.UpdateMTableTime(deltaT:real);
//dodanie czasu (deltaT) w sekundach, z przeliczeniem godziny
begin
mr:=mr+deltaT; //dodawanie sekund
while mr>60.0 do //przeliczenie sekund do w³aœciwego przedzia³u
begin
mr:=mr-60.0;
inc(mm);
end;
while mm>59 do //przeliczenie minut do w³aœciwego przedzia³u
begin
mm:=mm-60;
inc(hh);
end;
while hh>23 do //przeliczenie godzin do w³aœciwego przedzia³u
begin
hh:=hh-24;
inc(dd); //zwiêkszenie numeru dnia
end;
GameTime:=GameTime+deltaT;
end;
constructor TMTableTime.Init(InitH,InitM,InitSRH,InitSRM,InitSSH,InitSSM:integer);
begin
GameTime:=0.0;
dd:=0;
hh:=InitH;
mm:=InitM;
srh:=InitSRH;
srm:=InitSRM;
ssh:=InitSSH;
ssm:=InitSSM;
end;
function TTrainParameters.DirectionChange():boolean;
//sprawdzenie, czy po zatrzymaniu wykonaæ kolejne komendy
begin
DirectionChange:=false; //przed pierwsz¹ bez zmiany
if (StationIndex>0) and (StationIndex<StationCount) then //dla ostatniej stacji nie
if (Pos('@',TimeTable[StationIndex].StationWare)>0) then
DirectionChange:=true;
end;
END.

338
McZapkie/unit2.pas Normal file
View File

@@ -0,0 +1,338 @@
unit Unit1;
interface
uses
ai_driver,mtable,mover,mctools,Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, ExtCtrls;
type
TForm1 = class(TForm)
Button1: TButton;
Label1: TLabel;
Button2: TButton;
Button3: TButton;
Button4: TButton;
Button5: TButton;
Button6: TButton;
Label2: TLabel;
Label3: TLabel;
Timer1: TTimer;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
Label8: TLabel;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Button7: TButton;
Button8: TButton;
Label12: TLabel;
Label13: TLabel;
Label14: TLabel;
Label15: TLabel;
Button9: TButton;
Button10: TButton;
Label16: TLabel;
Label17: TLabel;
Label18: TLabel;
Label19: TLabel;
Button11: TButton;
Label20: TLabel;
Label21: TLabel;
Label22: TLabel;
Label23: TLabel;
Label24: TLabel;
Label25: TLabel;
lczas: TLabel;
Label26: TLabel;
Label27: TLabel;
Label28: TLabel;
Label29: TLabel;
Label30: TLabel;
Label31: TLabel;
Label32: TLabel;
Label33: TLabel;
Label34: TLabel;
Button12: TButton;
BStart: TButton;
Label35: TLabel;
Label36: TLabel;
Label37: TLabel;
Label38: TLabel;
Button13: TButton;
Label39: TLabel;
Label40: TLabel;
Label41: TLabel;
Button14: TButton;
Button15: TButton;
Label42: TLabel;
Label43: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Timer1Timer(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure Button5Click(Sender: TObject);
procedure Button6Click(Sender: TObject);
procedure Button7Click(Sender: TObject);
procedure Button8Click(Sender: TObject);
procedure Button3Click(Sender: TObject);
procedure Button4Click(Sender: TObject);
procedure Button9Click(Sender: TObject);
procedure Button10Click(Sender: TObject);
procedure Button11Click(Sender: TObject);
procedure Button12Click(Sender: TObject);
procedure BStartClick(Sender: TObject);
procedure Button13MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure Button14Click(Sender: TObject);
procedure Button15Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
loc,wag,wag2,wag3:TMoverParameters;
mechanik: TController;
pociag: TTrainParameters;
l0,l1,l2,l3:TLocation;
r0,r1,r2,r3:TRotation;
Shape:TTrackShape; Track:TTrackParam;
ExternalVoltage:real;
ActualTime:real;
fout: text;
implementation
{$R *.DFM}
procedure TForm1.Button1Click(Sender: TObject);
begin
assignfile(fout,'log.dat');
rewrite(fout);
ActualTime:=0;
loc:=TMoverParameters.Create;
wag:=TMoverParameters.Create;
wag2:=TMoverParameters.Create;
wag3:=TMoverParameters.Create;
mechanik:=TController.Create;
pociag:=TTrainParameters.Create;
Shape.R:=0; Shape.Len:=10000; Shape.dHtrack:=0; Shape.dHrail:=0;
Track.Width:=1435; Track.friction:=0.15; Track.CategoryFlag:=1;
Track.QualityFlag:=25; Track.DamageFlag:=0;
Track.VelMax:=120;
ExternalVoltage:=3000;
l0.x:=0; l0.y:=0; l0.z:=0;
l1.x:=-14.0235; l1.y:=0; l1.z:=0;
l2.x:=-27.3634; l2.y:=0; l2.z:=0;
l3.x:=-40.7032; l3.y:=0; l3.z:=0;
r0.rx:=0; r0.ry:=0; r0.rz:=0;
r1.rx:=0; r1.ry:=0; r1.rz:=0;
r2.rx:=0; r2.ry:=0; r2.rz:=0;
r3.rx:=0; r3.ry:=0; r3.rz:=0;
{ loc.Init(l1,r1,0,'en57','456',0,'Human',1); }
loc.Init(l0,r0,60,'eu07','456',0,'',1);
wag.Init(l1,r1,60,'Falns_440v','52-51-342027-2',30,'',0);
wag2.Init(l2,r2,60,'Falns_440v','52-51-322311-5',30,'',0);
wag3.Init(l3,r3,60,'Falns_440v','52-51-410025-3',30,'',0);
pociag.init('Testowy Express',100);
mechanik.init(l1,r1,True,@loc,@pociag,Aggressive);
if (loc.loadchkfile('') and wag.loadchkfile('') and wag2.loadchkfile('') and wag3.loadchkfile(''))
and (loc.CheckLocomotiveParameters(Go) and wag.CheckLocomotiveParameters(Go) and wag2.CheckLocomotiveParameters(Go) and wag3.CheckLocomotiveParameters(Go)) then
begin
Label1.Caption:='OK';
loc.attach(2,@wag,3);
wag.attach(1,@loc,3);
wag.attach(2,@wag2,3);
wag2.attach(1,@wag,3);
wag2.attach(2,@wag3,3);
wag3.attach(1,@wag2,3);
Timer1.Enabled:=True;
end
else Label1.Caption:=inttostr(conversionerror)+' '+inttostr(linecount);
Button1.Visible:=False;
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
if Timer1.Enabled then
begin
Timer1.Enabled:=False;
CloseFile(fout);
end;
loc.Free;
wag.Free;
wag2.free;
wag3.free;
mechanik.free;
Close;
end;
procedure TForm1.Timer1Timer(Sender: TObject);
var dl,dt:real;
begin
dt:=Timer1.Interval/1000;
ActualTime:=ActualTime+dt;
loc.ComputeTotalForce(dt,Shape,Track,ExternalVoltage);
wag.ComputeTotalForce(dt,Shape,Track,ExternalVoltage);
wag2.ComputeTotalForce(dt,Shape,Track,ExternalVoltage);
wag3.ComputeTotalForce(dt,Shape,Track,ExternalVoltage);
dl:=loc.ComputeMovement(dt,Shape,Track,ExternalVoltage,l0,r0);
l0.x:=l0.x+dl;
dl:=wag.ComputeMovement(dt,Shape,Track,ExternalVoltage,l1,r1);
l1.x:=l1.x+dl;
dl:=wag2.ComputeMovement(dt,Shape,Track,ExternalVoltage,l2,r2);
l2.x:=l2.x+dl;
dl:=wag3.ComputeMovement(dt,Shape,Track,ExternalVoltage,l3,r3);
l3.x:=l3.x+dl;
if l0.x<500 then mechanik.UpdateSituation(500-l0.x,dt)
else
if l0.x<2500 then mechanik.UpdateSituation(-1,dt)
else
if l0.x<3500 then mechanik.UpdateSituation(3500-l0.x,dt);
if (l0.x>499) and (l0.x<505) then
mechanik.SetVelocity(-1,-1,0);
if (l0.x>2499) and (l0.x<2510) then
mechanik.SetVelocity(-1,0,0);
Label2.Caption:=r2s(Loc.Im,0)+' A';
Label3.Caption:=r2s(Loc.Ft/1000,0)+' kN';
Label4.Caption:=r2s(l0.x,0)+' m';
Label5.Caption:=r2s(Sign(Loc.V)*Loc.Vel,0)+' km/h';
Label6.Caption:=r2s(Loc.AccS,0)+' m/ss';
Label7.Caption:=r2s(Loc.couplers[1].cforce/1000,0)+' kN';
Label8.Caption:=r2s(Loc.couplers[2].cforce/1000,0)+' kN';
Label9.Caption:=r2s(Loc.Fb/1000,0)+' kN';
Label10.Caption:=r2s(Loc.Compressor,0)+' MPa';
Label11.Caption:=r2s(Loc.PipePress,0)+' MPa';
Label12.Caption:=r2s(Loc.BrakePress,0)+' MPa';
Label13.Caption:=IntToStr(Loc.MainCtrlPos);
Label14.Caption:=IntToStr(Loc.BrakeCtrlPos);
Label15.Caption:=IntToStr(Loc.LocalBrakePos);
Label16.Caption:=IntToStr(Loc.showcurrent(1));
Label17.Caption:=IntToStr(Loc.showcurrent(2));
Label18.Caption:=IntToStr(Loc.ScndCtrlPos);
if loc.SlippingWheels then
Label19.Caption:='Poslizg!'
else Label19.Caption:=' ';
Label20.Caption:=IntToStr(Loc.MainCtrlActualPos);
Label21.Caption:=IntToStr(Loc.ScndCtrlActualPos);
Label22.Caption:=r2s(l1.x,0)+' m';
Label23.Caption:=r2s(Sign(wag.V)*wag.Vel,0)+' km/h';
Label24.Caption:=r2s(Distance(loc.loc,wag.loc,loc.dim,wag.dim),0)+' m';
Label25.Caption:=r2s(loc.nrot,0)+' 1/s';
Label26.Caption:=r2s(wag.couplers[1].cforce/1000,0)+' kN';
Label27.Caption:=r2s(wag.couplers[2].cforce/1000,0)+' kN';
Label28.Caption:=r2s(l2.x,0)+' m';
Label29.Caption:=r2s(sign(wag2.V)*wag2.Vel,0)+' km/h';
Label30.Caption:=r2s(loc.dpLocalValve/dt,0)+' MPa/s';
Label31.Caption:=r2s(loc.dpBrake/dt,0)+' MPa/s';
Label32.Caption:=r2s(loc.dpMainValve/dt,0)+' MPa/s';
Label33.Caption:=r2s(loc.dpPipe/dt,0)+' MPa/s';
Label34.Caption:=r2s(wag2.PipePress,0)+' MPa';
Label35.Caption:=r2s(l3.x,0)+' m';
Label36.Caption:=r2s(sign(wag3.V)*wag3.Vel,0)+' km/h';
Label37.Caption:=r2s(wag3.couplers[1].cforce/1000,0)+' kN';
Label38.Caption:=r2s(wag3.brakepress,0)+' MPa';
Label39.Caption:=r2s(loc.enginePower/1000,0)+' kW';
Label40.Caption:=i2s(trunc(loc.Rventrot*60))+' /min';
Label41.Visible:=loc.SandDose;
Label42.Caption:=r2s(mechanik.accdesired,0)+' m/ss';
Label43.Caption:=r2s(mechanik.veldesired,0)+' km/h';
Lczas.Caption:=r2s(actualtime,0)+' s';
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
Timer1.Enabled:=False;
end;
procedure TForm1.Button5Click(Sender: TObject);
begin
loc.incbrakelevel(1);
end;
procedure TForm1.Button6Click(Sender: TObject);
begin
loc.decbrakelevel(1);
end;
procedure TForm1.Button7Click(Sender: TObject);
begin
loc.inclocalbrakelevel(1);
end;
procedure TForm1.Button8Click(Sender: TObject);
begin
loc.declocalbrakelevel(1);
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
loc.incmainctrl(1);
end;
procedure TForm1.Button4Click(Sender: TObject);
begin
loc.decmainctrl(1);
end;
procedure TForm1.Button9Click(Sender: TObject);
begin
loc.DirectionForward;
end;
procedure TForm1.Button10Click(Sender: TObject);
begin
loc.DirectionBackward;
end;
procedure TForm1.Button11Click(Sender: TObject);
begin
loc.FuseOn;
end;
procedure TForm1.Button12Click(Sender: TObject);
begin
Loc.AntiSlippingBrake;
end;
procedure TForm1.BStartClick(Sender: TObject);
begin
loc.activedir:=1;
{ if mechanik.OrderDirectionChange(1) then }
mechanik.SetVelocity(60,0,0);
end;
procedure TForm1.Button13MouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
loc.SandDoseOn;
end;
procedure TForm1.Button14Click(Sender: TObject);
begin
mechanik.SetVelocity(30,120,0);
end;
procedure TForm1.Button15Click(Sender: TObject);
begin
mechanik.SetVelocity(0,120,0);
end;
end.