This commit is contained in:
f1iwq2
2020-03-21 14:23:29 +01:00
parent aad1d73eb9
commit 2791b86c8f
21 changed files with 570 additions and 157 deletions

View File

@@ -8,7 +8,8 @@ uses
UnitPilote in 'UnitPilote.pas' {FormPilote},
UnitSimule in 'UnitSimule.pas' {FormSimulation},
UnitTCO in 'UnitTCO.pas' {FormTCO},
UnitConfig in 'UnitConfig.pas' {FormConfig};
UnitConfig in 'UnitConfig.pas' {FormConfig},
UnitConfigTCO in 'UnitConfigTCO.pas' {FormConfigTCO};
{$R *.res}
@@ -20,5 +21,6 @@ begin
Application.CreateForm(TFormSimulation, FormSimulation);
Application.CreateForm(TFormTCO, FormTCO);
Application.CreateForm(TFormConfig, FormConfig);
Application.CreateForm(TFormConfigTCO, FormConfigTCO);
Application.Run;
end.

Binary file not shown.

View File

@@ -2,7 +2,7 @@ object FormConfig: TFormConfig
Left = 316
Top = 238
Width = 598
Height = 332
Height = 340
Caption = 'Configuration g'#233'n'#233'rale'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
@@ -15,8 +15,8 @@ object FormConfig: TFormConfig
PixelsPerInch = 96
TextHeight = 13
object Label6: TLabel
Left = 104
Top = 232
Left = 128
Top = 248
Width = 332
Height = 13
Caption =
@@ -81,19 +81,19 @@ object FormConfig: TFormConfig
Left = 280
Top = 8
Width = 290
Height = 137
Height = 153
Caption = 'Acc'#232's USB - S'#233'rie '#224' l'#39'interface vers la centrale LENZ'
TabOrder = 1
object Label3: TLabel
Left = 16
Top = 32
Top = 56
Width = 128
Height = 13
Caption = 'Protocole s'#233'rie USB (COM)'
end
object Label4: TLabel
Left = 16
Top = 56
Top = 80
Width = 126
Height = 26
Caption = 'Temporisation d'#39'envoi des octets de la trame (ms)'
@@ -101,15 +101,29 @@ object FormConfig: TFormConfig
end
object Label5: TLabel
Left = 16
Top = 88
Top = 112
Width = 152
Height = 26
Caption = 'Temporisation d'#39'attente de la r'#233'ponse de l'#39'interface (x 100 ms)'
WordWrap = True
end
object Label9: TLabel
Left = 8
Top = 16
Width = 249
Height = 13
Caption = 'Ces param'#232'tres sont utilis'#233's en fonctionnement sans '
end
object Label10: TLabel
Left = 8
Top = 32
Width = 40
Height = 13
Caption = 'CDM rail'
end
object EditcomUSB: TEdit
Left = 160
Top = 32
Top = 56
Width = 121
Height = 21
TabStop = False
@@ -118,7 +132,7 @@ object FormConfig: TFormConfig
end
object EditTempoOctetUSB: TEdit
Left = 232
Top = 64
Top = 88
Width = 49
Height = 21
TabStop = False
@@ -127,7 +141,7 @@ object FormConfig: TFormConfig
end
object EditTempoReponse: TEdit
Left = 232
Top = 96
Top = 120
Width = 49
Height = 21
TabStop = False
@@ -137,7 +151,7 @@ object FormConfig: TFormConfig
end
object Button1: TButton
Left = 112
Top = 264
Top = 272
Width = 105
Height = 25
Caption = 'Appliquer et Fermer'
@@ -148,26 +162,40 @@ object FormConfig: TFormConfig
Left = 8
Top = 104
Width = 265
Height = 81
Height = 105
Caption = 'Acc'#232's r'#233'seau '#224' l'#39'interface vers la centrale LENZ'
TabOrder = 3
object Label7: TLabel
Left = 14
Top = 24
Top = 56
Width = 95
Height = 13
Caption = 'Adresse IP interface'
end
object Label8: TLabel
Left = 14
Top = 50
Top = 82
Width = 82
Height = 13
Caption = 'Port de l'#39'interface'
end
object Label11: TLabel
Left = 8
Top = 16
Width = 249
Height = 13
Caption = 'Ces param'#232'tres sont utilis'#233's en fonctionnement sans '
end
object Label12: TLabel
Left = 8
Top = 32
Width = 40
Height = 13
Caption = 'CDM rail'
end
object EditIPLenz: TEdit
Left = 176
Top = 24
Top = 56
Width = 81
Height = 21
TabStop = False
@@ -176,7 +204,7 @@ object FormConfig: TFormConfig
end
object EditportLenz: TEdit
Left = 176
Top = 48
Top = 80
Width = 81
Height = 21
TabStop = False
@@ -186,7 +214,7 @@ object FormConfig: TFormConfig
end
object GroupBox4: TGroupBox
Left = 280
Top = 152
Top = 168
Width = 289
Height = 73
Caption = 'Ent'#234'te des trames vers l'#39'interface'
@@ -217,8 +245,8 @@ object FormConfig: TFormConfig
end
end
object Button2: TButton
Left = 336
Top = 264
Left = 352
Top = 272
Width = 113
Height = 25
Caption = 'Fermer sans appliquer'

View File

@@ -33,6 +33,10 @@ type
Label6: TLabel;
LabelInfo: TLabel;
Button2: TButton;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure FormActivate(Sender: TObject);

BIN
UnitConfigTCO.dcu Normal file

Binary file not shown.

95
UnitConfigTCO.dfm Normal file
View File

@@ -0,0 +1,95 @@
object FormConfigTCO: TFormConfigTCO
Left = 542
Top = 389
Width = 405
Height = 251
Caption = 'Configuration du TCO'
Color = clBtnFace
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
OldCreateOrder = False
PixelsPerInch = 96
TextHeight = 13
object Label1: TLabel
Left = 8
Top = 16
Width = 83
Height = 13
Caption = 'Taille des cellules'
end
object Label2: TLabel
Left = 160
Top = 16
Width = 5
Height = 13
Caption = 'x'
end
object Label3: TLabel
Left = 16
Top = 56
Width = 156
Height = 13
Caption = 'Nombre de cellules en horizontal:'
end
object Label4: TLabel
Left = 16
Top = 80
Width = 145
Height = 13
Caption = 'Nombre de cellules en vertical:'
end
object LabelNbCellX: TLabel
Left = 176
Top = 56
Width = 96
Height = 20
Caption = 'LabelNbCellX'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -16
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
end
object LabelNbCellY: TLabel
Left = 176
Top = 80
Width = 96
Height = 20
Caption = 'LabelNbCellX'
Font.Charset = DEFAULT_CHARSET
Font.Color = clWindowText
Font.Height = -16
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
end
object ButtonOK: TButton
Left = 168
Top = 176
Width = 75
Height = 25
Caption = 'OK'
TabOrder = 0
OnClick = ButtonOKClick
end
object Edit1: TEdit
Left = 104
Top = 16
Width = 41
Height = 21
TabOrder = 1
Text = 'EditTailleCellX'
end
object Edit2: TEdit
Left = 176
Top = 16
Width = 41
Height = 21
TabOrder = 2
Text = 'EditTailleCellY'
end
end

39
UnitConfigTCO.pas Normal file
View File

@@ -0,0 +1,39 @@
unit UnitConfigTCO;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;
type
TFormConfigTCO = class(TForm)
ButtonOK: TButton;
Label1: TLabel;
Edit1: TEdit;
Edit2: TEdit;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
LabelNbCellX: TLabel;
LabelNbCellY: TLabel;
procedure ButtonOKClick(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
var
FormConfigTCO: TFormConfigTCO;
implementation
{$R *.dfm}
procedure TFormConfigTCO.ButtonOKClick(Sender: TObject);
begin
close;
end;
end.

Binary file not shown.

View File

@@ -1,6 +1,6 @@
object FormDebug: TFormDebug
Left = 217
Top = 167
Left = 241
Top = 150
BorderStyle = bsSingle
Caption = 'Fen'#234'tre de d'#233'bug'
ClientHeight = 639
@@ -80,7 +80,7 @@ object FormDebug: TFormDebug
end
object MemoEvtDet: TMemo
Left = 552
Top = 368
Top = 376
Width = 233
Height = 221
Color = clBlack
@@ -117,7 +117,7 @@ object FormDebug: TFormDebug
end
object CheckAffSig: TCheckBox
Left = 448
Top = 48
Top = 32
Width = 297
Height = 17
Caption = 'Affichage du fonctionnement des signaux'
@@ -132,7 +132,7 @@ object FormDebug: TFormDebug
end
object ButtonRazTampon: TButton
Left = 688
Top = 592
Top = 600
Width = 97
Height = 33
Caption = 'Raz Tampon Ev'#232'nements'
@@ -201,9 +201,9 @@ object FormDebug: TFormDebug
end
object RichEdit: TRichEdit
Left = 552
Top = 120
Width = 225
Height = 241
Top = 136
Width = 233
Height = 233
HideScrollBars = False
PopupMenu = PopupMenuRE
ScrollBars = ssVertical
@@ -233,6 +233,38 @@ object FormDebug: TFormDebug
TabOrder = 13
OnClick = CheckBoxActClick
end
object CheckBoxEvtDetAig: TCheckBox
Left = 448
Top = 48
Width = 281
Height = 17
Caption = 'Affichage des '#233'v'#232'nements d'#233'tecteurs et aiguillages'
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentFont = False
TabOrder = 14
OnClick = CheckBoxEvtDetAigClick
end
object CheckBoxAffFD: TCheckBox
Left = 448
Top = 112
Width = 297
Height = 17
Caption = 'Affichage des fronts descendants des d'#233'tecteurs'
Color = clWindow
Font.Charset = DEFAULT_CHARSET
Font.Color = clBlack
Font.Height = -11
Font.Name = 'MS Sans Serif'
Font.Style = []
ParentColor = False
ParentFont = False
TabOrder = 15
OnClick = CheckBoxAffFDClick
end
object SaveDialog: TSaveDialog
Left = 760
Top = 56

View File

@@ -28,6 +28,8 @@ type
copier1: TMenuItem;
ButtonRazLog: TButton;
CheckBoxAct: TCheckBox;
CheckBoxEvtDetAig: TCheckBox;
CheckBoxAffFD: TCheckBox;
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject);
procedure ButtonEcrLogClick(Sender: TObject);
@@ -42,20 +44,24 @@ type
procedure copier1Click(Sender: TObject);
procedure ButtonRazLogClick(Sender: TObject);
procedure CheckBoxActClick(Sender: TObject);
procedure CheckBoxEvtDetAigClick(Sender: TObject);
procedure CheckBoxAffFDClick(Sender: TObject);
private
{ Déclarations privées }
public
{ Déclarations publiques }
end;
Const Max_Event_det_tick = 10000;
Const
Max_Event_det_tick=10000;
Max_event_det=400;
var
FormDebug: TFormDebug;
NivDebug : integer;
AffSignal,AffAffect,initform : boolean;
AffSignal,AffAffect,initform,AffFD : boolean;
N_event_det : integer; // index du dernier évènement (de 1 à 20)
event_det : array[1..20] of integer;
event_det : array[1..Max_event_det] of integer;
// tick 1/10s,détecteur
N_Event_tick : integer ; // dernier index
@@ -142,7 +148,7 @@ begin
rewrite(fte);
writeln(fte,s);
with MemoDebug do
for i:=1 to Lines.Count do
for i:=0 to Lines.Count do
begin
writeln(fte,Lines[i]);
end;
@@ -207,27 +213,36 @@ procedure TFormDebug.ButtonAffEvtChronoClick(Sender: TObject);
var i,j,etat : integer;
s : string;
begin
MemoDebug.Clear;
if N_event_tick=0 then
begin
AfficheDebug('Il n''y a aucun évènement détecteur ou aiguillage',clyellow);
exit;
end;
s:='Evts chronologiques det aig du '+DateToStr(date)+' '+TimeToStr(Time)+' '+s;
AfficheDebug(s,clLime);
for i:=1 to N_Event_tick do
begin
//for j:=1 to 1100 do
begin
j:=event_det_tick[i].detecteur;
etat:=event_det_tick[i].etat;
if etat<>-1 then
if j<>-1 then
begin
s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick)+' Det='+IntToSTR(j)+'='+intToSTR(etat);
AfficheDebug(s,clyellow);
end;
end;
etat:=event_det_tick[i].aiguillage;
if etat<>-1 then
j:=event_det_tick[i].aiguillage;
if j<>-1 then
begin
s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick)+' Aig='+IntToSTR(etat)+'='+intToSTR(event_det_tick[i].etat);
s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick)+' Aig='+IntToSTR(j)+'='+intToSTR(event_det_tick[i].etat);
AfficheDebug(s,clyellow);
end;
end;
AfficheDebug('-----------------------------',cllime);
end;
@@ -266,4 +281,14 @@ begin
AffActionneur:=CheckBoxAct.Checked;
end;
procedure TFormDebug.CheckBoxEvtDetAigClick(Sender: TObject);
begin
AffAigDet:=CheckBoxEvtDetAig.checked;
end;
procedure TFormDebug.CheckBoxAffFDClick(Sender: TObject);
begin
AffFD:=CheckBoxAffFD.checked;
end;
end.

Binary file not shown.

View File

@@ -1,6 +1,6 @@
object FormPrinc: TFormPrinc
Left = 25
Top = 101
Left = 55
Top = 196
AutoSize = True
BorderStyle = bsSingle
Caption = 'Client TCP-IP CDM Rail ou USB - syst'#232'me LENZ'
@@ -1246,7 +1246,7 @@ object FormPrinc: TFormPrinc
end
object BoutonRaf: TButton
Left = 912
Top = 16
Top = 8
Width = 89
Height = 33
Caption = 'Rafraichissement'
@@ -1345,7 +1345,7 @@ object FormPrinc: TFormPrinc
end
object ButtonTest: TButton
Left = 912
Top = 96
Top = 88
Width = 89
Height = 33
Caption = 'Demande '#233'tat r'#233'trosignalisation'
@@ -1391,7 +1391,7 @@ object FormPrinc: TFormPrinc
end
object ButtonAffDebug: TButton
Left = 912
Top = 56
Top = 48
Width = 89
Height = 33
Caption = 'Affiche debug'
@@ -1411,13 +1411,24 @@ object FormPrinc: TFormPrinc
OnClick = ButtonRepriseClick
end
object Button2: TButton
Left = 992
Left = 1008
Top = 96
Width = 97
Height = 25
Caption = 'Demande '#233'tat CTS'
Caption = 'Simu D'#233'tecteur 513'
TabOrder = 12
Visible = False
OnClick = Button2Click
end
object ButtonArretSimu: TButton
Left = 912
Top = 128
Width = 89
Height = 33
Caption = 'Arret simulation'
TabOrder = 13
Visible = False
OnClick = ButtonArretSimuClick
end
object Timer1: TTimer
Interval = 100
@@ -1465,6 +1476,10 @@ object FormPrinc: TFormPrinc
Caption = 'Codification des feux'
OnClick = Codificationdesfeux1Click
end
object Codificationdesactionneurs1: TMenuItem
Caption = 'Codification des actionneurs'
OnClick = Codificationdesactionneurs1Click
end
object N5: TMenuItem
Caption = '-'
end

View File

@@ -86,6 +86,8 @@ type
Label1: TLabel;
LabelNbTrains: TLabel;
ButtonLitCV: TButton;
Codificationdesactionneurs1: TMenuItem;
ButtonArretSimu: TButton;
procedure FormCreate(Sender: TObject);
procedure MSCommUSBLenzComm(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
@@ -135,6 +137,9 @@ type
procedure Quitter1Click(Sender: TObject);
procedure ConfigClick(Sender: TObject);
procedure ButtonLitCVClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Codificationdesactionneurs1Click(Sender: TObject);
procedure ButtonArretSimuClick(Sender: TObject);
private
{ Déclarations privées }
@@ -202,11 +207,11 @@ TMA = (valide,devalide);
var ancien_tablo_signalCplx,EtatsignalCplx : array[0..MaxAcc] of word;
AvecInitAiguillages,tempsCli,combine,NbreFeux,pasreponse,AdrDevie,precedent ,
AvecInitAiguillages,tempsCli,combine,NbreFeux,pasreponse,AdrDevie,
NombreImages,signalCpx,branche_trouve,Indexbranche_trouve,Actuel,Signal_suivant,
Nbre_recu_cdm,Tempo_chgt_feux,Adj1,Adj2,NbrePN : integer;
Hors_tension2,traceSign,TraceZone,Ferme,parSocket,ackCdm,
NackCDM,MsgSim,succes,recu_cv,AffActionneur,
NackCDM,MsgSim,succes,recu_cv,AffActionneur,AffAigDet,
TraceListe,clignotant,nack,Maj_feux_cours,configNulle : boolean;
branche : array [1..100] of string;
@@ -218,7 +223,7 @@ const
GrisF=$414141;
clOrange=$0077FF;
Feu_X=50;Feu_Y=91;
Max_Simule=1000;
Max_Simule=10000;
couleurTrain : array[1..8] of Tcolor = (clYellow,clLime,clOrange,clAqua,clFuchsia,clLtGray,clred,clWhite);
var
@@ -230,7 +235,7 @@ var
entete,suffixe,ConfStCom : string;
maxaiguillage,detecteur_chgt,Temps,TpsRecuCom,Tempo_init,Suivant,TypeGen,
NbreImagePligne,NbreBranches,Index2_det,branche_det,Index_det,
I_simule,maxTablo_act,NbreVoies : integer;
I_simule,maxTablo_act,NbreVoies,AdresseFeuSuivant : integer;
Ancien_detecteur,detecteur : array[0..1024] of boolean; // anciens état des détecteurs et adresses des détecteurs et leur état
Adresse_detecteur : array[0..60] of integer; // adresses des détecteurs par index
mem : array[0..1024] of boolean ; // mémoire des états des détecteurs
@@ -281,7 +286,7 @@ var
aiguillageB : array[0..MaxAcc] of Taiguillage;
// dessin des feux
// signaux
feux : array[1..MaxAcc] of record
adresse, aspect : integer; // adresse du feu, aspect (2 feux..9 feux 12=direction 2 feux .. 16=direction 6 feux)
Img : TImage; // Pointeur sur structure TImage du feu
@@ -3887,7 +3892,12 @@ begin
// on part de l'actuel pour retomber sur le précédent
if BrancheN[branche_trouve_actuel,indexBranche_actuel-1].Adresse=prec then // c'est l'autre sens
begin
if NivDebug=3 then AfficheDebug('40 - trouvé détecteur '+intToSTR(adr)+' en + ',clwhite);
if NivDebug=3 then AfficheDebug('40 - trouvé détecteur '+intToSTR(adr)+' en + ',clwhite);
Prec:=Adr;
Aprec:=a;
A:='Z';
Adr:=BrancheN[branche_trouve_actuel,indexBranche_actuel+1].Adresse;
typeGen:=BrancheN[branche_trouve_actuel,indexBranche_actuel+1].Btype;
if NivDebug=3 then
begin
s:='41 - Le suivant est :'+intToSTR(adr);
@@ -3899,7 +3909,12 @@ begin
end;
if BrancheN[branche_trouve_actuel,indexBranche_actuel+1].Adresse=prec then
begin
if NivDebug=3 then AfficheDebug('42 - trouvé détecteur '+intToSTR(adr)+' en - ',clwhite);
if NivDebug=3 then AfficheDebug('42 - trouvé détecteur '+intToSTR(adr)+' en - ',clwhite);
Prec:=Adr;
Aprec:=a;
A:='Z';
Adr:=BrancheN[branche_trouve_actuel,indexBranche_actuel-1].Adresse;
typeGen:=BrancheN[branche_trouve_actuel,indexBranche_actuel-1].Btype;
if NivDebug=3 then
begin
s:='43 - Le suivant est :'+intToSTR(adr);
@@ -4584,11 +4599,29 @@ begin
BisFonc:=1;
//typeGen:=0; //?
repeat
Adr:=suivant_alg3(AdrPrec,BisPrec,AdrFonc,BisFonc,1);
Adr:=suivant_alg3(AdrPrec,BisPrec,AdrFonc,BisFonc,1);
if Adr>9997 then
begin
detecteur_suivant_el:=Adr;
exit;
end;
if NivDebug=3 then
begin
s:='trouvé 2: Adr='+intToSTR(Adr);
case typeGen of
1 : s:=s+' detecteur';
2 : s:=s+' aiguillage';
3 : s:=s+' aiguillage bis';
exit;
end;
AfficheDebug(s,clorange);
end;
trouve_element(Adr,typeGen);
Btype:=BrancheN[branche_trouve,IndexBranche_trouve].BType;
BisSuiv:=Btype; // si aiguillage bis
if (NivDebug=3) then
begin
s:='Suivant='+intToSTR(Adr);
case Btype of
1 : s:=s+' detecteur';
2 : s:=s+' aiguillage';
3 : s:=s+' aiguillage bis';
@@ -4662,6 +4695,7 @@ end;
else AfficheDebug('Le signal '+IntToSTR(adresse)+' ne doit pas être au carré',clYellow);
end;
carre_signal:=AdrSuiv=9998;
end;
// renvoie l'état du signal suivant
@@ -4684,6 +4718,7 @@ begin
AfficheDebug(s,clred);
etat_signal_suivant:=0;
exit;
end;
if i=0 then
begin
@@ -4695,6 +4730,7 @@ begin
Etat:=0;
j:=0;
num_feu:=0;
prec:=Feux[i].Adr_det1; // détecteur sur le courant
if prec=0 then
begin
@@ -4723,12 +4759,14 @@ begin
else
begin
AdrSuiv:=suivant_alg3(prec,TypePrec,actuel,TypeActuel,1);
prec:=actuel;TypePrec:=TypeActuel;
actuel:=AdrSuiv;TypeActuel:=typeGen;
end;
if (AdrSuiv=9999) then
begin
Etat_signal_suivant:=0;
AdresseFeuSuivant:=0;
exit;
end;
if (AdrSuiv=0) then
begin
@@ -4752,6 +4790,7 @@ begin
end;
if (AdrFeu<>0) then // si l'adresse est <>0
begin
if (Feux[i].Adr_el_suiv1<>prec) then // le feu est-il dans le bon sens de progression?
begin
// oui
inc(num_feu);
@@ -4764,6 +4803,7 @@ begin
begin
if NivDebug=3 then AfficheDebug('Trouvé feu '+intToSTR(AdrFeu)+' mais dans le mauvais sens',clOrange);
AdrFeu:=0;
end;
end;
end;
until (j=10) or ((AdrFeu<>0) and (num_feu=rang));
@@ -4885,13 +4925,14 @@ begin
begin
// Affiche('i='+intToSTR(i),clyellow);
dec(i,2); // i correspond au nombre de feux à allumer
pilote_direction(Adr,i);
end;
end;
// renvoie vrai si une mémoire de zone est occupée du signal courant au signal suivant
// adresse=adresse du signal
function test_memoire_zones(adresse : integer) : boolean;
function test_memoire_zones(adresse : integer) : boolean;
var
AdrSuiv,prec,TypePrec,TypeActuel,ife,actuel,AdrDet,Etat,AdrFeu,i,j,PresTrain01,PrecInitial : integer;
Pres_train,sort : boolean;
@@ -4942,7 +4983,6 @@ begin
begin
prec:=feux[i].Adr_det4;
actuel:=feux[i].Adr_el_suiv4;
if feux[i].Btype_suiv4=1 then TypeActuel:=1;
if feux[i].Btype_suiv4=1 then TypeActuel:=1;
if feux[i].Btype_suiv4=2 then TypeActuel:=2;
if feux[i].Btype_suiv4=4 then TypeActuel:=2; // aiguillage triple
@@ -4950,44 +4990,41 @@ begin
end; // détecteur sur le signal courant
TypePrec:=1;
if (prec=0) then
begin
test_memoire_zones:=Pres_train;
exit;
end;
PrecInitial:=Prec;
repeat
inc(j);
// à la première itération, si "actuel" est déja un détecteur, ne pas faire de recherche sur le suivant
// et chaîner mémoire de zone
if (j=1) and (Typeactuel=1) then // si détecteur
begin
//AfficheDebug('C''est un détecteur',clred);
repeat
inc(j);
actuel:=prec;
// à la première itération, si "actuel" est déja un détecteur, ne pas faire de recherche sur le suivant
// et chaîner mémoire de zone
if (j=1) and (Typeactuel=1) then // si détecteur
begin
if Pres_Train and (NivDebug=3) then Affiche('Présence train de '+intToSTR(prec)+' à '+intToSTR(actuel),clyellow);
Pres_train:=MemZone[Prec,actuel];
if Pres_Train and (NivDebug=3) then Affiche('Présence train de '+intToSTR(prec)+' à '+intToSTR(actuel),clyellow);
end
begin
AdrSuiv:=suivant_alg3(prec,TypePrec,actuel,TypeActuel,1);
else
begin
AdrSuiv:=suivant_alg3(prec,TypePrec,actuel,TypeActuel,1);
prec:=actuel;TypePrec:=TypeActuel;
actuel:=AdrSuiv;TypeActuel:=typeGen;
end;
if NivDebug=3 then AfficheDebug('A suivant='+IntToSTR(adrsuiv),clred);
if actuel=0 then
if AdrSuiv=0 then
begin
// si c'est un buttoir
test_memoire_zones:=false;
if NivDebug=3 then AfficheDebug('sortie car buttoir',clyellow);
exit;
exit;
end;
// si le suivant est un détecteur comporte t-il un signal?
AdrFeu:=0;
// si le suivant est un détecteur ; contrôler mémoire de zone et comporte t-il un signal?
AdrFeu:=0;
if (TypeActuel=1) then // détecteur
begin
if (NivDebug=3) and MemZone[PrecInitial][actuel] then AfficheDebug('Présence train de '+intToSTR(PrecInitial)+' à '+intToSTR(actuel),clyellow);
Pres_train:=MemZone[PrecInitial][actuel] or Pres_train; // mémoire de zone
@@ -5020,7 +5057,7 @@ begin
//if (traceDet) {sprintf(Affiche,"Trouvé détecteur %d mais sans signal\r\n",AdrSuiv,Etat);Display(Affiche);
AdrFeu:=0;
end;
end
end
else
begin
if (NivDebug=3) then AfficheDebug('Trouvé aiguillage '+intToSTR(AdrSuiv),clyellow);
@@ -5195,6 +5232,7 @@ begin
calcul_zones_det:=0;exit;
end;
// étape 2 : on a trouvé le sens de progression, trouver le détecteur suivant
if (Adr=det2) then
begin
// trouvé la route si j=2 : - si j=3 : +
@@ -5205,22 +5243,25 @@ begin
AdrPrec:=detecteur_suivant_El(det2,1,det1,1);
// le train vient de det1, quitte det2 et va vers Adr
// il faut vérifier si le détecteur précédent à été mis à 1 puis à 0 (on cherche 0)
//s:='Test route pour prec='+intToSTR(AdrPrec)+' det1='+intToSTR(det1)+' det2='+IntToSTR(det2) ;
//FormDebug.MemoDet.lines.add(s);
if traceListe then AfficheDebug(s,clyellow);
// trouver l'index du détecteur (det1) à 0
if traceListe then AfficheDebug('trouve_index_det_chrono('+intToSTR(det1)+',0,'+intToSTR(N_event_tick)+')',clYellow);
i:=trouve_index_det_chrono(det1,0,N_Event_tick);
if TraceListe then AfficheDebug('Index det='+intToSTR(i),clyellow);
// et trouver l'index du détecteur précédent à 0 avant l'index i
if traceListe then AfficheDebug('trouve_index_det_chrono('+intToSTR(AdrPrec)+',0,'+intToSTR(i-1)+')',clYellow);
i:=trouve_index_det_chrono(AdrPrec,0,i-1);
i:=trouve_index_det_chrono(AdrPrec,0,i-1);
if TraceListe then AfficheDebug('Index prec='+intToSTR(i),clyellow);
if TraceListe then AfficheDebug('Index prec='+intToSTR(i),clyellow);
t:=event_det_tick[i].traite; // détecteur précédent déja traité ?
if (i=0) or t then
begin
begin
if (i=0) and TraceListe then AfficheDebug('La mémoire préc '+intToSTR(AdrPrec)+'=0 donc route non valide',clyellow);
if t and TraceListe then AfficheDebug('La mémoire préc '+intToSTR(AdrPrec)+' a déja été traitée donc route non valide',clyellow);
calcul_zones_det:=0;exit;
@@ -5281,6 +5322,7 @@ begin
With FormDebug.RichEdit do
begin
s:='train '+IntToSTR(Train_Courant)+' '+intToStr(det1)+' à '+intToStr(det2)+' => Mem '+IntToSTR(det2)+' à '+IntTOStr(AdrSuiv);
Lines.Add(s);
RE_ColorLine(FormDebug.RichEdit,lines.count,CouleurTrain[((Train_Courant - 1) mod 8)+1 ]);
end;
@@ -5342,6 +5384,7 @@ begin
if (modele>10) then
begin
//Affiche('Signal directionnel '+IntToSTR(AdrFeu),clyellow);
Signal_direction(AdrFeu);
exit;
end;
@@ -5483,7 +5526,7 @@ begin
if (TestBit(etat,rappel_60)) or (testBit(etat,rappel_30)) or (testBit(etat,carre)) or (testBit(etat,semaphore))
then Maj_Etat_Signal(AdrFeu,jaune)
else
begin
begin
// sinon si signal suivant=jaune
if (TestBit(etat,jaune)) then Maj_Etat_Signal(AdrFeu,jaune_cli);
end;
@@ -5784,11 +5827,20 @@ begin
procedure Event_Detecteur(Adresse : integer;etat : boolean);
var i,trainAdj1,TrainAdj2,TrainActuel,Etat01 : integer;
s : string;
begin
if Etat then Etat01:=1 else Etat01:=0;
begin
if Etat then Etat01:=1 else Etat01:=0;
// vérifier si l'état du détecteur est déja stocké, car on peut reçevoir plusieurs évènements pour le même détecteur dans le même état
// on reçoit un doublon dans deux index consécutifs.
if N_Event_tick>=1 then
begin
if (event_det_tick[N_event_tick].etat=etat01) and (event_det_tick[N_event_tick].detecteur=Adresse) then
begin
//Affiche(IntToSTR(Adresse)+' déja stocké',clorange);
exit; // déja stocké
end;
end;
if Traceliste then AfficheDebug('--------------------- détecteur '+intToSTR(Adresse)+' à '+intToSTR(etat01)+'-----------------------------',clOrange);
if AffAigDet then
begin
s:='Evt Det '+intToSTR(adresse)+'='+intToSTR(etat01);
@@ -5796,15 +5848,6 @@ begin
AfficheDebug(s,clyellow);
end;
//if etat then Mem[Adresse]:=true; // mémoriser l'état à 1
ancien_detecteur[Adresse]:=detecteur[Adresse];
detecteur[Adresse]:=etat;
detecteur_chgt:=Adresse;
// mise a jour du tableau evt de fronts descendants
if ancien_detecteur[Adresse] and not(detecteur[Adresse]) and (N_Event_det<20) then
begin
//if etat then Mem[Adresse]:=true; // mémoriser l'état à 1
ancien_detecteur[Adresse]:=detecteur[Adresse];
@@ -5814,9 +5857,31 @@ begin
// stocke les changements d'état des détecteurs dans le tableau chronologique
if (N_Event_tick<Max_Event_det_tick) then
begin
inc(N_Event_tick);
inc(N_Event_tick);
// event_det_tick[N_event_tick].train:=0;
event_det_tick[N_event_tick].tick:=tick;
event_det_tick[N_event_tick].detecteur:=Adresse;
event_det_tick[N_event_tick].etat:=etat01;
// Affiche('stockage de '+intToSTR(N_event_tick)+' '+IntToSTR(Adresse)+' à '+intToSTR(etat01),clyellow);
end;
// mise a jour du tableau evt de fronts descendants
if ancien_detecteur[Adresse] and not(detecteur[Adresse]) and (N_Event_det<Max_event_det) then
begin
// si le FD du détecteur a déjà été stocké à l'index précédent ne pas en tenir compte
if event_det[N_event_det]<>Adresse then
begin
if AffFD then AfficheDebug('index='+intToSTR(N_event_tick)+' FD '+intToSTR(Adresse),clyellow);
inc(N_event_det);
event_det[N_event_det]:=Adresse;
if not(configNulle) then calcul_zones; // en avant les calculs
end;
end;
if (N_event_det>=Max_event_det) then
begin
Affiche('Débordement d''évènements FD - Raz tampon',clred);
N_event_det:=0;
FormDebug.MemoEvtDet.lines.add('Raz sur débordement');
end;
@@ -5859,9 +5924,17 @@ end;
end;
event_det_tick[N_event_tick].train:=N_trains;
end;
end;
}
end;
// évènement d'aiguillage
procedure Event_Aig(adresse,pos : integer);
var s: string;
begin
aiguillage[adresse].position:=pos;
if (N_Event_tick<Max_Event_det_tick) then
begin
if AffAigDet then
begin
s:='Aig '+intToSTR(adresse)+'='+intToSTR(pos);
@@ -6004,25 +6077,21 @@ begin
end;
end;
// état de l'aiguillage
// état de l'aiguillage
if bitsITT=$00 then // module d'aiguillages, N=1
begin
adraig:=((adresse * 4)+1 ); // *4 car N=1, c'est le "poids fort"
if (valeur and $C)=$8 then
aiguillage[adraig+3].position:=2 ; // état aiguillage haut
begin
Event_Aig(adraig+3,2);
if trace then begin s:='accessoire '+intToSTR(adraig+3)+'=2';Affiche(s,clYellow);end;
end;
if (valeur and $C)=$4 then
aiguillage[adraig+3].position:=1 ; // état aiguillage haut
begin
Event_Aig(adraig+3,1);
if trace then begin s:='accessoire '+intToSTR(adraig+3)+'=1';Affiche(s,clYellow);end;
end;
if (valeur and $3)=$2 then
aiguillage[adraig+2].position:=2; // état aiguillage bas
begin
Event_Aig(adraig+2,2);
if trace then begin s:='accessoire '+intToSTR(adraig+2)+'=2';Affiche(s,clYellow);end;
@@ -6064,25 +6133,21 @@ begin
Event_detecteur(i,(valeur and $1) = $1);
end;
end;
end;
if bitsITT=$00 then // module d'aiguillages
begin
adraig:=(adresse * 4)+1;
if (valeur and $C)=$8 then
aiguillage[adraig+1].position:=2 ; // état aiguillage haut
begin
Event_Aig(adraig+1,2);
if trace then begin s:='accessoire '+intToSTR(adraig+1)+'=2';Affiche(s,clYellow);end;
end;
if (valeur and $C)=$4 then
aiguillage[adraig+1].position:=1 ; // état aiguillage haut
begin
Event_Aig(adraig+1,1);
if trace then begin s:='accessoire '+intToSTR(adraig+1)+'=1';Affiche(s,clYellow);end;
end;
if (valeur and $3)=$2 then
aiguillage[adraig].position:=2; // état aiguillage bas
begin
Event_Aig(adraig,2);
if trace then begin s:='accessoire '+intToSTR(adraig)+'=2';Affiche(s,clYellow);end;
@@ -6554,8 +6619,8 @@ begin
//EnumerateDevices;
//for i:=1 to NumLine do
//begin
// if pos('Ports',Line[i])<>0 then Affiche(Line[i],clyellow);
//end;
// if pos('Ports',Line[i])<>0 then Affiche(Line[i],clyellow);
//end;
//essai
// event_det[1]:=527;
// event_det[2]:=520;
@@ -6567,14 +6632,13 @@ begin
//maj_feu(201);
// formdebug.Show;
//AfficheDet:=true;
//NivDebug:=3;
//NivDebug:=3;
//Aiguille_deviee(462);
//aiguillageB[1].Position:=1;
//i:=suivant_alg3(553,1,1,3,1);
//Affichedebug(intToSTr(i),clred);
//Affiche(IntToSTR(calcul_zones_det(522,514)),clyellow);
//i:=detecteur_suivant_El(514,1,518,1); // donne l'élément suivant de AdrPrec à AdrFonc et dans Bis si c'est un aig bis
//i:=detecteur_suivant_El(514,1,518,1); // donne l'élément suivant de AdrPrec à AdrFonc et dans Bis si c'est un aig bis
//i:=etat_signal_suivant(1001,1);
// Affiche(IntToSTR(detecteur_suivant(25,2,529,1)),clyellow);
@@ -6726,29 +6790,44 @@ begin
begin
A:=Tablo_actionneur[RangActCours].actionneur;
s:=Tablo_actionneur[RangActCours].train;
Affiche('Actionneur '+intToSTR(a)+' F'+IntToSTR(Tablo_actionneur[RangActCours].fonction)+':0',clyellow);
Affiche('Actionneur '+intToSTR(a)+' F'+IntToSTR(Tablo_actionneur[RangActCours].fonction)+':0',clyellow);
envoie_fonction_CDM(Tablo_actionneur[RangActCours].fonction,0,s);
end;
end;
end;
//simulation
if (index_simule<>0) then
begin
if not(MsgSim) then
begin
Affiche('Simulation en cours ',Cyan);MsgSim:=true;
N_Event_tick:=0;
N_event_det:=0;
N_trains:=0;
FormDebug.MemoEvtDet.Clear;
FormDebug.Richedit.Clear;
end;
while tick=Tablo_simule[i_simule+1].tick do
while tick=Tablo_simule[i_simule+1].tick do
begin
inc(I_simule);
// evt détecteur ?
if Tablo_simule[i_simule].detecteur<>0 then
begin
// if i_simule=164 then
// begin
// if Tablo_simule[i_simule].detecteur=538 then Affiche('création evt 538 index '+intToSTR(i_simule),clorange);
// end;
Affiche('Simulation tick='+IntToSTR(tick)+' det='+intToSTR(Tablo_simule[i_simule].detecteur)+'='+IntToSTR(Tablo_simule[i_simule].etat),Cyan);
Event_Detecteur(Tablo_simule[i_simule].detecteur, Tablo_simule[i_simule].etat=1); // créer évt détecteur
Affiche('Simulation '+intToSTR(I_simule)+' Tick='+IntToSTR(tick)+' det='+intToSTR(Tablo_simule[i_simule].detecteur)+'='+IntToSTR(Tablo_simule[i_simule].etat),Cyan);
Event_Detecteur(Tablo_simule[i_simule].detecteur, Tablo_simule[i_simule].etat=1); // créer évt détecteur
end;
// evt aiguillage ?
if Tablo_simule[i_simule].aiguillage<>0 then
begin
Affiche('Simulation '+intToSTR(I_simule)+' Tick='+IntToSTR(tick)+' aig='+intToSTR(Tablo_simule[i_simule].aiguillage)+'='+IntToSTR(Tablo_simule[i_simule].etat),Cyan);
Event_Aig(Tablo_simule[i_simule].Aiguillage,Tablo_simule[i_simule].etat); // créer évt aiguillage
end;
end;
if i_Simule>=Index_simule then
@@ -6957,8 +7036,8 @@ begin
procedure TFormPrinc.AffEtatDetecteurs(Sender: TObject);
var j,adr,NBranche : integer;
s : string;
begin
s : string;
begin
for j:=1 to NDetecteurs do
begin
s:='Dét '+intToSTR(Adresse_detecteur[j])+'=';
@@ -7006,11 +7085,9 @@ begin
if aiguillage[i].modele=1 then s:=s+' Pointe=';
if aiguillage[i].modele=2 then s:=s+' TJD: centre TJD=';
if aiguillage[i].modele=3 then s:=s+' TJS:';
if aiguillage[i].modele=4 then s:=s+' Triple: Pointe=';
s:=s+IntToSTR(aiguillage[i].APointe)+aiguillage[i].APointeB+
' Dévie='+IntToSTR(aiguillage[i].ADevie)+aiguillage[i].ADevieB+
if aiguillage[i].modele=4 then s:=s+' Triple: Pointe=';
s:=s+IntToSTR(aiguillage[i].APointe)+aiguillage[i].APointeB+
' Dévie='+IntToSTR(aiguillage[i].ADevie)+aiguillage[i].ADevieB+
' Droit='+IntToSTR(aiguillage[i].ADroit)+aiguillage[i].ADroitB;
if aiguillage[i].modele=4 then s:=s+' Dévié2='+intToSTR(aiguillage[i].ADevie2)+aiguillage[i].ADevie2B;
if aiguillage[i].vitesse<>0 then s:=s+' Vitesse déviée='+intToSTR(aiguillage[i].vitesse);
@@ -7026,12 +7103,9 @@ begin
if aiguillageB[i].modele=1 then s:=s+' Pointe=';
if aiguillageB[i].modele=2 then s:=s+' TJD: centre TJD=';
if aiguillageB[i].modele=3 then s:=s+' TJS:';
if aiguillageB[i].modele=4 then s:=s+' Triple: Pointe=';
s:=s+IntToSTR(aiguillageB[i].APointe)+aiguillageB[i].APointeB+
' Dévie='+IntToSTR(aiguillageB[i].ADevie)+aiguillageB[i].ADevieB+
' Droit='+IntToSTR(aiguillageB[i].ADroit)+aiguillageB[i].ADroitB;
if aiguillageB[i].modele=4 then s:=s+' Triple: Pointe=';
s:=s+IntToSTR(aiguillageB[i].APointe)+aiguillageB[i].APointeB+
' Dévie='+IntToSTR(aiguillageB[i].ADevie)+aiguillageB[i].ADevieB+
' Droit='+IntToSTR(aiguillageB[i].ADroit)+aiguillageB[i].ADroitB;
if aiguillageB[i].modele=4 then s:=s+' Dévié2='+intToSTR(aiguillageB[i].ADevie2)+aiguillageB[i].ADevie2B;
if aiguillageB[i].vitesse<>0 then s:=s+' Vitesse déviée='+intToSTR(aiguillageB[i].vitesse);
@@ -7108,14 +7182,14 @@ begin
val(ss,etat,erreur);
//Affiche('Aiguillage CDM'+intToSTR(adr)+'='+IntToStr(etat),clLime);
// conversion en position :
// CDM: 0=droit 1=droite 3=gauche
// logiciel : 1=dévié 2=droit
// logiciel : 1=dévié 2=droit
// aiguillage normal
if aiguillage[adr].modele=1 then
begin
//Affiche('Normal',clyellow);
if etat=0 then etatAig:=2 else etatAig:=1;
Event_Aig(adr,etatAig);
end;
// TJD TJS
@@ -7123,21 +7197,19 @@ begin
begin
//Affiche('TJDS',clyellow);
adr2:=aiguillage[adr].Apointe; // 2eme adresse de la TJD
case etat of
case etat of
1 : begin etatAig:=1;EtatAig2:=2;end;
4 : begin etatAig:=1;EtatAig2:=1;end;
5 : begin etatAig:=2;EtatAig2:=1;end;
0 : begin etatAig:=2;EtatAig2:=2;end;
end;
Event_Aig(adr,etatAig);
Event_Aig(adr2,etatAig2);
end;
end;
if aiguillage[adr].modele=4 then // aiguillage triple
begin
//Affiche('Triple',clyellow);
// état de l'aiguillage 1
if etat=3 then etatAig:=1;
if (etat=0) or (etat=2) then etatAig:=2;
if etat=3 then etatAig:=1;
// état de l'aiguillage 2
@@ -7158,7 +7230,7 @@ begin
j:=pos('CMDACC-ST_DT',recuCDM);
if j<>0 then
begin
i:=posEx('AD=',recuCDM,j);ss:=copy(recuCDM,i+3,10);
i:=posEx('AD=',recuCDM,j);ss:=copy(recuCDM,i+3,10);
val(ss,adr,erreur);
i:=posEx('STATE=',recuCDM,j);ss:=copy(recuCDM,i+6,10);
Delete(recuCDM,j,i+5-j);
@@ -7231,21 +7303,26 @@ begin
procedure TFormPrinc.Codificationdesfeux1Click(Sender: TObject);
var i,j,k,NfeuxDir,adresse : integer;
s : string;
begin
begin
Affiche('Codification interne des feux',Cyan);
for i:=1 to NbreFeux do
begin
// feu de signalisation
s:=IntToSTR(i)+' Adresse='+IntToSTR(feux[i].Adresse);
s:=s+' décodeur='+IntToStr(feux[i].decodeur);
// feu de signalisation
s:=IntToSTR(i)+' Adr='+IntToSTR(feux[i].Adresse);
s:=s+' décodeur='+IntToStr(feux[i].decodeur);
if feux[i].aspect<10 then
begin
s:=s+' SIG Nbre de feux='+IntToSTR(feux[i].aspect)+' ';
s:=s+' El_Suivant1='+IntToSTR(feux[i].Adr_el_suiv1)+' Type suivant1='+intToSTR(feux[i].Btype_suiv1);
case feux[i].Btype_suiv1 of
1 : s:=s+' (détecteur)';
2 : s:=s+' (aiguillage ou TJD-S)';
4 : s:=s+' (aiguillage triple)';
5 : s:=s+' (aiguillage bis)';
end;
if feux[i].decodeur=6 then
if feux[i].decodeur=6 then
s:=s+' Cible unisemaf='+intToSTR(feux[i].Unisemaf);
end
else
@@ -7279,8 +7356,8 @@ begin
Affiche(' verrouillages routes pour trains consécutifs',clLime);
Affiche('Version 1.2 : Renforcement de l''algorithme de suivi des trains',clLime);
Affiche('Version 1.3 : Décodeur Unisemaf fonctionnel - Lecture/écriture des CV',clLime);
Affiche(' Protocoles variables de l''interface',clLime);
Affiche(' Configuration statique modifiable dans menu',clLime);
Affiche(' Protocoles variables de l''interface',clLime);
Affiche(' Configuration statique modifiable dans menu',clLime);
Affiche('Version 1.31 : Correction des positions aiguillages triples et TJD',clLime);
Affiche('Version 1.4 : Gestion des Fx vers les locomotives par actionneurs',clLime);
Affiche('Version 1.41 : Gestion des passages à niveaux par actionneurs',clLime);
@@ -7293,27 +7370,30 @@ procedure TFormPrinc.ChronoDetectClick(Sender: TObject);
Socket: TCustomWinSocket);
begin
parSocket:=False;
end;
procedure TFormPrinc.ChronoDetectClick(Sender: TObject);
var i,j,etat : integer;
s : string;
begin
if N_event_tick=0 then
begin
s : string;
begin
for i:=1 to N_Event_tick do
Affiche('Aucun évenèment détecteur ou aiguillage',clYellow);
end;
for i:=1 to N_Event_tick do
begin
begin
//for j:=1 to 1100 do
begin
j:=event_det_tick[i].detecteur;
if j<>-1 then
begin
s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick);
s:=s+' Det='+IntToSTR(j)+'='+intToSTR(etat);
// s:=s+' Det suiv='+intTostr(event_det_tick[i].suivant);
s:=s+' Det='+IntToSTR(j)+'='+intToSTR(event_det_tick[i].etat);
// s:=s+' Det suiv='+intTostr(event_det_tick[i].suivant);
Affiche(s,clyellow);
end;
end;
end;
j:=event_det_tick[i].aiguillage;
if j<>-1 then
@@ -7324,7 +7404,6 @@ end;
end;
end;
end;
end;
@@ -7492,6 +7571,68 @@ begin
end;
procedure TFormPrinc.ConfigClick(Sender: TObject);
begin
Tformconfig.create(self);
formconfig.showmodal;
formconfig.close;
end;
procedure TFormPrinc.Button2Click(Sender: TObject);
var i : integer;
begin
nivDebug:=3;
//test_memoire_zones(1005);
MemZone[569][538]:=true;
test_memoire_zones(177);
end;
procedure TFormPrinc.Codificationdesactionneurs1Click(Sender: TObject);
var i,adr,etatAct,v,aO,aF : integer;
s,s2 : string;
begin
if (maxTablo_act=0) and (NbrePN=0) then
begin
Affiche('Aucun actionneur déclaré',clYellow);
end;
for i:=1 to maxTablo_act do
begin
s:=Tablo_actionneur[i].train;
etatAct:=Tablo_actionneur[i].etat ;
Adr:=Tablo_actionneur[i].actionneur;
s2:=Tablo_actionneur[i].train;
if (s2<>'') then
begin
Affiche('FonctionF Actionneur='+intToSTR(adr)+' Train='+s2+' F'+IntToSTR(Tablo_actionneur[i].fonction)+':'+intToSTR(etatAct)+
' Temporisation='+intToSTR(tablo_actionneur[i].Tempo),clyellow);
end;
end;
// dans le tableau des PN
for i:=1 to NbrePN do
begin
s:='PN'+intToSTR(i)+' Adresse fermeture PN='+IntToSTR(Tablo_PN[i].AdresseFerme);
s:=s+' Adresse ouverture PN='+IntToSTR(Tablo_PN[i].AdresseOuvre);
Affiche(s,clyellow);
s:=' Commande fermeture='+intToSTR(Tablo_PN[i].commandeFerme);
s:=s+' Commande ouverture='+intToSTR(Tablo_PN[i].commandeOuvre);
s:=s+' Nbre de voies='+intToSTR(Tablo_PN[i].nbVoies);
Affiche(s,clyellow);
for v:=1 to Tablo_PN[i].nbvoies do
begin
s:=' Voie '+IntToSTR(v)+': Actionneur de fermeture='+intToSTR(Tablo_PN[i].voie[v].ActFerme);
s:=s+' Actionneur d''ouverture='+intToSTR(Tablo_PN[i].voie[v].ActOuvre);
Affiche(s,clyellow);
end;
end;
end;
procedure TFormPrinc.ButtonArretSimuClick(Sender: TObject);
begin
Index_Simule:=0; // fin de simulation
I_Simule:=0;
MsgSim:=false;

Binary file not shown.

View File

@@ -44,6 +44,7 @@ object FormSimulation: TFormSimulation
Height = 21
TabOrder = 1
Text = '1'
OnChange = EditIntervalleChange
OnKeyPress = EditIntervalleKeyPress
end
object OpenDialog: TOpenDialog

View File

@@ -15,6 +15,7 @@ type
procedure ButtonChargeClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure EditIntervalleKeyPress(Sender: TObject; var Key: Char);
procedure EditIntervalleChange(Sender: TObject);
private
{ Déclarations privées }
public
@@ -48,7 +49,6 @@ begin
index_simule:=1;
repeat
readln(fte,s);
i:=pos('Tick=',s);
if i<>0 then
begin
@@ -72,10 +72,10 @@ begin
val(s,k,erreur);
Tablo_simule[index_simule].etat:=k;
s:=IntToSTR(Index_simule)+' Tick='+intToSTR(Tablo_simule[index_simule].tick)+
{s:=IntToSTR(Index_simule)+' Tick='+intToSTR(Tablo_simule[index_simule].tick)+
' Detecteur='+intToSTR(Tablo_simule[index_simule].detecteur)+
'='+intToSTR(Tablo_simule[index_simule].etat);
Affiche(s,ClLime);
Affiche(s,ClLime); }
inc(index_simule);
end;
@@ -95,10 +95,10 @@ begin
val(s,k,erreur);
Tablo_simule[index_simule].etat:=k;
s:=IntToSTR(Index_simule)+' Tick='+intToSTR(Tablo_simule[index_simule].tick)+
{s:=IntToSTR(Index_simule)+' Tick='+intToSTR(Tablo_simule[index_simule].tick)+
' Aiguillage='+intToSTR(Tablo_simule[index_simule].aiguillage)+
'='+intToSTR(Tablo_simule[index_simule].etat);
Affiche(s,ClLime);
Affiche(s,ClLime); }
inc(index_simule);
end;
@@ -110,8 +110,12 @@ begin
Affiche('Intervalle='+intToSTR(intervalle),clyellow);
dec(index_simule);
closeFile(fte);
formprinc.ButtonArretSimu.Visible:=true;
formprinc.ButtonArretSimu.top:=120;
FormSimulation.Close;
end;
end;
@@ -129,4 +133,11 @@ begin
if (intervalle<0) then Intervalle:=1;
end;
procedure TFormSimulation.EditIntervalleChange(Sender: TObject);
var erreur : integer;
begin
Val(EditIntervalle.Text,intervalle,erreur);
if (intervalle<0) then Intervalle:=1;
end;
end.

Binary file not shown.

View File

@@ -1,6 +1,6 @@
object FormTCO: TFormTCO
Left = 333
Top = 121
Left = 205
Top = 235
Width = 928
Height = 681
VertScrollBar.Visible = False
@@ -481,6 +481,15 @@ object FormTCO: TFormTCO
Text = 'EditCellY'
OnKeyPress = EditCellYKeyPress
end
object ButtonConfigTCO: TButton
Left = 576
Top = 8
Width = 113
Height = 25
Caption = 'Configuration TCO'
TabOrder = 10
OnClick = ButtonConfigTCOClick
end
object PopupMenu1: TPopupMenu
Left = 352
Top = 472

View File

@@ -69,6 +69,7 @@ type
EditCellX: TEdit;
EditCellY: TEdit;
Label19: TLabel;
ButtonConfigTCO: TButton;
procedure FormCreate(Sender: TObject);
procedure ImageTCOClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
@@ -155,6 +156,7 @@ type
Shift: TShiftState; X, Y: Integer);
procedure EditCellXKeyPress(Sender: TObject; var Key: Char);
procedure EditCellYKeyPress(Sender: TObject; var Key: Char);
procedure ButtonConfigTCOClick(Sender: TObject);
private
{ Déclarations privées }
@@ -189,6 +191,8 @@ procedure construit_TCO;
implementation
uses UnitConfigTCO;
{$R *.dfm}
@@ -1633,4 +1637,11 @@ begin
end;
procedure TFormTCO.ButtonConfigTCOClick(Sender: TObject);
begin
TformconfigTCO.create(self);
formconfigTCO.showmodal;
formconfigTCO.close;
end;
end.

Binary file not shown.

View File

@@ -22,7 +22,7 @@ var
FormVersion: TFormVersion;
Lance_verif : integer;
Const Version='1.42'; //Version='1.2';// sert à la comparaison de la version publiée
Const Version='1.44'; //Version='1.2';// sert à la comparaison de la version publiée
implementation
@@ -105,7 +105,7 @@ var s,s2,s3,Version_p,Url,LocalFile : string;
V_publie,V_utile : real;
begin
//Affiche('vérifie version',clLime);
// exit ;//&&&&&&&&&&&&&&&&&&
if not(AvecInit) then exit ;
Url:='http://cdmrail.free.fr/ForumCDR/viewtopic.php?f=77&t=3906#p50499';
LocalFile:='page.txt';
trouve_version:=false;