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
+3 -1
View File
@@ -8,7 +8,8 @@ uses
UnitPilote in 'UnitPilote.pas' {FormPilote}, UnitPilote in 'UnitPilote.pas' {FormPilote},
UnitSimule in 'UnitSimule.pas' {FormSimulation}, UnitSimule in 'UnitSimule.pas' {FormSimulation},
UnitTCO in 'UnitTCO.pas' {FormTCO}, UnitTCO in 'UnitTCO.pas' {FormTCO},
UnitConfig in 'UnitConfig.pas' {FormConfig}; UnitConfig in 'UnitConfig.pas' {FormConfig},
UnitConfigTCO in 'UnitConfigTCO.pas' {FormConfigTCO};
{$R *.res} {$R *.res}
@@ -20,5 +21,6 @@ begin
Application.CreateForm(TFormSimulation, FormSimulation); Application.CreateForm(TFormSimulation, FormSimulation);
Application.CreateForm(TFormTCO, FormTCO); Application.CreateForm(TFormTCO, FormTCO);
Application.CreateForm(TFormConfig, FormConfig); Application.CreateForm(TFormConfig, FormConfig);
Application.CreateForm(TFormConfigTCO, FormConfigTCO);
Application.Run; Application.Run;
end. end.
BIN
View File
Binary file not shown.
+47 -19
View File
@@ -2,7 +2,7 @@ object FormConfig: TFormConfig
Left = 316 Left = 316
Top = 238 Top = 238
Width = 598 Width = 598
Height = 332 Height = 340
Caption = 'Configuration g'#233'n'#233'rale' Caption = 'Configuration g'#233'n'#233'rale'
Color = clBtnFace Color = clBtnFace
Font.Charset = DEFAULT_CHARSET Font.Charset = DEFAULT_CHARSET
@@ -15,8 +15,8 @@ object FormConfig: TFormConfig
PixelsPerInch = 96 PixelsPerInch = 96
TextHeight = 13 TextHeight = 13
object Label6: TLabel object Label6: TLabel
Left = 104 Left = 128
Top = 232 Top = 248
Width = 332 Width = 332
Height = 13 Height = 13
Caption = Caption =
@@ -81,19 +81,19 @@ object FormConfig: TFormConfig
Left = 280 Left = 280
Top = 8 Top = 8
Width = 290 Width = 290
Height = 137 Height = 153
Caption = 'Acc'#232's USB - S'#233'rie '#224' l'#39'interface vers la centrale LENZ' Caption = 'Acc'#232's USB - S'#233'rie '#224' l'#39'interface vers la centrale LENZ'
TabOrder = 1 TabOrder = 1
object Label3: TLabel object Label3: TLabel
Left = 16 Left = 16
Top = 32 Top = 56
Width = 128 Width = 128
Height = 13 Height = 13
Caption = 'Protocole s'#233'rie USB (COM)' Caption = 'Protocole s'#233'rie USB (COM)'
end end
object Label4: TLabel object Label4: TLabel
Left = 16 Left = 16
Top = 56 Top = 80
Width = 126 Width = 126
Height = 26 Height = 26
Caption = 'Temporisation d'#39'envoi des octets de la trame (ms)' Caption = 'Temporisation d'#39'envoi des octets de la trame (ms)'
@@ -101,15 +101,29 @@ object FormConfig: TFormConfig
end end
object Label5: TLabel object Label5: TLabel
Left = 16 Left = 16
Top = 88 Top = 112
Width = 152 Width = 152
Height = 26 Height = 26
Caption = 'Temporisation d'#39'attente de la r'#233'ponse de l'#39'interface (x 100 ms)' Caption = 'Temporisation d'#39'attente de la r'#233'ponse de l'#39'interface (x 100 ms)'
WordWrap = True WordWrap = True
end 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 object EditcomUSB: TEdit
Left = 160 Left = 160
Top = 32 Top = 56
Width = 121 Width = 121
Height = 21 Height = 21
TabStop = False TabStop = False
@@ -118,7 +132,7 @@ object FormConfig: TFormConfig
end end
object EditTempoOctetUSB: TEdit object EditTempoOctetUSB: TEdit
Left = 232 Left = 232
Top = 64 Top = 88
Width = 49 Width = 49
Height = 21 Height = 21
TabStop = False TabStop = False
@@ -127,7 +141,7 @@ object FormConfig: TFormConfig
end end
object EditTempoReponse: TEdit object EditTempoReponse: TEdit
Left = 232 Left = 232
Top = 96 Top = 120
Width = 49 Width = 49
Height = 21 Height = 21
TabStop = False TabStop = False
@@ -137,7 +151,7 @@ object FormConfig: TFormConfig
end end
object Button1: TButton object Button1: TButton
Left = 112 Left = 112
Top = 264 Top = 272
Width = 105 Width = 105
Height = 25 Height = 25
Caption = 'Appliquer et Fermer' Caption = 'Appliquer et Fermer'
@@ -148,26 +162,40 @@ object FormConfig: TFormConfig
Left = 8 Left = 8
Top = 104 Top = 104
Width = 265 Width = 265
Height = 81 Height = 105
Caption = 'Acc'#232's r'#233'seau '#224' l'#39'interface vers la centrale LENZ' Caption = 'Acc'#232's r'#233'seau '#224' l'#39'interface vers la centrale LENZ'
TabOrder = 3 TabOrder = 3
object Label7: TLabel object Label7: TLabel
Left = 14 Left = 14
Top = 24 Top = 56
Width = 95 Width = 95
Height = 13 Height = 13
Caption = 'Adresse IP interface' Caption = 'Adresse IP interface'
end end
object Label8: TLabel object Label8: TLabel
Left = 14 Left = 14
Top = 50 Top = 82
Width = 82 Width = 82
Height = 13 Height = 13
Caption = 'Port de l'#39'interface' Caption = 'Port de l'#39'interface'
end 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 object EditIPLenz: TEdit
Left = 176 Left = 176
Top = 24 Top = 56
Width = 81 Width = 81
Height = 21 Height = 21
TabStop = False TabStop = False
@@ -176,7 +204,7 @@ object FormConfig: TFormConfig
end end
object EditportLenz: TEdit object EditportLenz: TEdit
Left = 176 Left = 176
Top = 48 Top = 80
Width = 81 Width = 81
Height = 21 Height = 21
TabStop = False TabStop = False
@@ -186,7 +214,7 @@ object FormConfig: TFormConfig
end end
object GroupBox4: TGroupBox object GroupBox4: TGroupBox
Left = 280 Left = 280
Top = 152 Top = 168
Width = 289 Width = 289
Height = 73 Height = 73
Caption = 'Ent'#234'te des trames vers l'#39'interface' Caption = 'Ent'#234'te des trames vers l'#39'interface'
@@ -217,8 +245,8 @@ object FormConfig: TFormConfig
end end
end end
object Button2: TButton object Button2: TButton
Left = 336 Left = 352
Top = 264 Top = 272
Width = 113 Width = 113
Height = 25 Height = 25
Caption = 'Fermer sans appliquer' Caption = 'Fermer sans appliquer'
+4
View File
@@ -33,6 +33,10 @@ type
Label6: TLabel; Label6: TLabel;
LabelInfo: TLabel; LabelInfo: TLabel;
Button2: TButton; Button2: TButton;
Label9: TLabel;
Label10: TLabel;
Label11: TLabel;
Label12: TLabel;
procedure Button1Click(Sender: TObject); procedure Button1Click(Sender: TObject);
procedure Button2Click(Sender: TObject); procedure Button2Click(Sender: TObject);
procedure FormActivate(Sender: TObject); procedure FormActivate(Sender: TObject);
BIN
View File
Binary file not shown.
+95
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
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.
BIN
View File
Binary file not shown.
+40 -8
View File
@@ -1,6 +1,6 @@
object FormDebug: TFormDebug object FormDebug: TFormDebug
Left = 217 Left = 241
Top = 167 Top = 150
BorderStyle = bsSingle BorderStyle = bsSingle
Caption = 'Fen'#234'tre de d'#233'bug' Caption = 'Fen'#234'tre de d'#233'bug'
ClientHeight = 639 ClientHeight = 639
@@ -80,7 +80,7 @@ object FormDebug: TFormDebug
end end
object MemoEvtDet: TMemo object MemoEvtDet: TMemo
Left = 552 Left = 552
Top = 368 Top = 376
Width = 233 Width = 233
Height = 221 Height = 221
Color = clBlack Color = clBlack
@@ -117,7 +117,7 @@ object FormDebug: TFormDebug
end end
object CheckAffSig: TCheckBox object CheckAffSig: TCheckBox
Left = 448 Left = 448
Top = 48 Top = 32
Width = 297 Width = 297
Height = 17 Height = 17
Caption = 'Affichage du fonctionnement des signaux' Caption = 'Affichage du fonctionnement des signaux'
@@ -132,7 +132,7 @@ object FormDebug: TFormDebug
end end
object ButtonRazTampon: TButton object ButtonRazTampon: TButton
Left = 688 Left = 688
Top = 592 Top = 600
Width = 97 Width = 97
Height = 33 Height = 33
Caption = 'Raz Tampon Ev'#232'nements' Caption = 'Raz Tampon Ev'#232'nements'
@@ -201,9 +201,9 @@ object FormDebug: TFormDebug
end end
object RichEdit: TRichEdit object RichEdit: TRichEdit
Left = 552 Left = 552
Top = 120 Top = 136
Width = 225 Width = 233
Height = 241 Height = 233
HideScrollBars = False HideScrollBars = False
PopupMenu = PopupMenuRE PopupMenu = PopupMenuRE
ScrollBars = ssVertical ScrollBars = ssVertical
@@ -233,6 +233,38 @@ object FormDebug: TFormDebug
TabOrder = 13 TabOrder = 13
OnClick = CheckBoxActClick OnClick = CheckBoxActClick
end 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 object SaveDialog: TSaveDialog
Left = 760 Left = 760
Top = 56 Top = 56
+35 -10
View File
@@ -28,6 +28,8 @@ type
copier1: TMenuItem; copier1: TMenuItem;
ButtonRazLog: TButton; ButtonRazLog: TButton;
CheckBoxAct: TCheckBox; CheckBoxAct: TCheckBox;
CheckBoxEvtDetAig: TCheckBox;
CheckBoxAffFD: TCheckBox;
procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure ButtonEcrLogClick(Sender: TObject); procedure ButtonEcrLogClick(Sender: TObject);
@@ -42,20 +44,24 @@ type
procedure copier1Click(Sender: TObject); procedure copier1Click(Sender: TObject);
procedure ButtonRazLogClick(Sender: TObject); procedure ButtonRazLogClick(Sender: TObject);
procedure CheckBoxActClick(Sender: TObject); procedure CheckBoxActClick(Sender: TObject);
procedure CheckBoxEvtDetAigClick(Sender: TObject);
procedure CheckBoxAffFDClick(Sender: TObject);
private private
{ Déclarations privées } { Déclarations privées }
public public
{ Déclarations publiques } { Déclarations publiques }
end; end;
Const Max_Event_det_tick = 10000; Const
Max_Event_det_tick=10000;
Max_event_det=400;
var var
FormDebug: TFormDebug; FormDebug: TFormDebug;
NivDebug : integer; NivDebug : integer;
AffSignal,AffAffect,initform : boolean; AffSignal,AffAffect,initform,AffFD : boolean;
N_event_det : integer; // index du dernier évènement (de 1 à 20) 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 // tick 1/10s,détecteur
N_Event_tick : integer ; // dernier index N_Event_tick : integer ; // dernier index
@@ -140,9 +146,9 @@ begin
s:=SaveDialog.FileName; s:=SaveDialog.FileName;
assignFile(fte,s); assignFile(fte,s);
rewrite(fte); rewrite(fte);
writeln(fte,s); writeln(fte,s);
with MemoDebug do with MemoDebug do
for i:=1 to Lines.Count do for i:=0 to Lines.Count do
begin begin
writeln(fte,Lines[i]); writeln(fte,Lines[i]);
end; end;
@@ -207,27 +213,36 @@ procedure TFormDebug.ButtonAffEvtChronoClick(Sender: TObject);
var i,j,etat : integer; var i,j,etat : integer;
s : string; s : string;
begin 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 for i:=1 to N_Event_tick do
begin begin
//for j:=1 to 1100 do
begin begin
j:=event_det_tick[i].detecteur; j:=event_det_tick[i].detecteur;
etat:=event_det_tick[i].etat; etat:=event_det_tick[i].etat;
if etat<>-1 then if j<>-1 then
begin begin
s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick)+' Det='+IntToSTR(j)+'='+intToSTR(etat); s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick)+' Det='+IntToSTR(j)+'='+intToSTR(etat);
AfficheDebug(s,clyellow); AfficheDebug(s,clyellow);
end; end;
end; end;
etat:=event_det_tick[i].aiguillage; j:=event_det_tick[i].aiguillage;
if etat<>-1 then if j<>-1 then
begin 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); AfficheDebug(s,clyellow);
end; end;
end; end;
AfficheDebug('-----------------------------',cllime);
end; end;
@@ -266,4 +281,14 @@ begin
AffActionneur:=CheckBoxAct.Checked; AffActionneur:=CheckBoxAct.Checked;
end; end;
procedure TFormDebug.CheckBoxEvtDetAigClick(Sender: TObject);
begin
AffAigDet:=CheckBoxEvtDetAig.checked;
end;
procedure TFormDebug.CheckBoxAffFDClick(Sender: TObject);
begin
AffFD:=CheckBoxAffFD.checked;
end;
end. end.
BIN
View File
Binary file not shown.
+22 -7
View File
@@ -1,6 +1,6 @@
object FormPrinc: TFormPrinc object FormPrinc: TFormPrinc
Left = 25 Left = 55
Top = 101 Top = 196
AutoSize = True AutoSize = True
BorderStyle = bsSingle BorderStyle = bsSingle
Caption = 'Client TCP-IP CDM Rail ou USB - syst'#232'me LENZ' Caption = 'Client TCP-IP CDM Rail ou USB - syst'#232'me LENZ'
@@ -1246,7 +1246,7 @@ object FormPrinc: TFormPrinc
end end
object BoutonRaf: TButton object BoutonRaf: TButton
Left = 912 Left = 912
Top = 16 Top = 8
Width = 89 Width = 89
Height = 33 Height = 33
Caption = 'Rafraichissement' Caption = 'Rafraichissement'
@@ -1345,7 +1345,7 @@ object FormPrinc: TFormPrinc
end end
object ButtonTest: TButton object ButtonTest: TButton
Left = 912 Left = 912
Top = 96 Top = 88
Width = 89 Width = 89
Height = 33 Height = 33
Caption = 'Demande '#233'tat r'#233'trosignalisation' Caption = 'Demande '#233'tat r'#233'trosignalisation'
@@ -1391,7 +1391,7 @@ object FormPrinc: TFormPrinc
end end
object ButtonAffDebug: TButton object ButtonAffDebug: TButton
Left = 912 Left = 912
Top = 56 Top = 48
Width = 89 Width = 89
Height = 33 Height = 33
Caption = 'Affiche debug' Caption = 'Affiche debug'
@@ -1411,13 +1411,24 @@ object FormPrinc: TFormPrinc
OnClick = ButtonRepriseClick OnClick = ButtonRepriseClick
end end
object Button2: TButton object Button2: TButton
Left = 992 Left = 1008
Top = 96 Top = 96
Width = 97 Width = 97
Height = 25 Height = 25
Caption = 'Demande '#233'tat CTS' Caption = 'Simu D'#233'tecteur 513'
TabOrder = 12 TabOrder = 12
Visible = False 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 end
object Timer1: TTimer object Timer1: TTimer
Interval = 100 Interval = 100
@@ -1465,6 +1476,10 @@ object FormPrinc: TFormPrinc
Caption = 'Codification des feux' Caption = 'Codification des feux'
OnClick = Codificationdesfeux1Click OnClick = Codificationdesfeux1Click
end end
object Codificationdesactionneurs1: TMenuItem
Caption = 'Codification des actionneurs'
OnClick = Codificationdesactionneurs1Click
end
object N5: TMenuItem object N5: TMenuItem
Caption = '-' Caption = '-'
end end
+238 -97
View File
@@ -86,6 +86,8 @@ type
Label1: TLabel; Label1: TLabel;
LabelNbTrains: TLabel; LabelNbTrains: TLabel;
ButtonLitCV: TButton; ButtonLitCV: TButton;
Codificationdesactionneurs1: TMenuItem;
ButtonArretSimu: TButton;
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure MSCommUSBLenzComm(Sender: TObject); procedure MSCommUSBLenzComm(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormClose(Sender: TObject; var Action: TCloseAction);
@@ -135,6 +137,9 @@ type
procedure Quitter1Click(Sender: TObject); procedure Quitter1Click(Sender: TObject);
procedure ConfigClick(Sender: TObject); procedure ConfigClick(Sender: TObject);
procedure ButtonLitCVClick(Sender: TObject); procedure ButtonLitCVClick(Sender: TObject);
procedure Button2Click(Sender: TObject);
procedure Codificationdesactionneurs1Click(Sender: TObject);
procedure ButtonArretSimuClick(Sender: TObject);
private private
{ Déclarations privées } { Déclarations privées }
@@ -202,11 +207,11 @@ TMA = (valide,devalide);
var ancien_tablo_signalCplx,EtatsignalCplx : array[0..MaxAcc] of word; 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, NombreImages,signalCpx,branche_trouve,Indexbranche_trouve,Actuel,Signal_suivant,
Nbre_recu_cdm,Tempo_chgt_feux,Adj1,Adj2,NbrePN : integer; Nbre_recu_cdm,Tempo_chgt_feux,Adj1,Adj2,NbrePN : integer;
Hors_tension2,traceSign,TraceZone,Ferme,parSocket,ackCdm, 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; TraceListe,clignotant,nack,Maj_feux_cours,configNulle : boolean;
branche : array [1..100] of string; branche : array [1..100] of string;
@@ -218,7 +223,7 @@ const
GrisF=$414141; GrisF=$414141;
clOrange=$0077FF; clOrange=$0077FF;
Feu_X=50;Feu_Y=91; 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); couleurTrain : array[1..8] of Tcolor = (clYellow,clLime,clOrange,clAqua,clFuchsia,clLtGray,clred,clWhite);
var var
@@ -230,7 +235,7 @@ var
entete,suffixe,ConfStCom : string; entete,suffixe,ConfStCom : string;
maxaiguillage,detecteur_chgt,Temps,TpsRecuCom,Tempo_init,Suivant,TypeGen, maxaiguillage,detecteur_chgt,Temps,TpsRecuCom,Tempo_init,Suivant,TypeGen,
NbreImagePligne,NbreBranches,Index2_det,branche_det,Index_det, 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 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 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 mem : array[0..1024] of boolean ; // mémoire des états des détecteurs
@@ -281,7 +286,7 @@ var
aiguillageB : array[0..MaxAcc] of Taiguillage; aiguillageB : array[0..MaxAcc] of Taiguillage;
// dessin des feux // signaux
feux : array[1..MaxAcc] of record 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) 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 Img : TImage; // Pointeur sur structure TImage du feu
@@ -3887,7 +3892,12 @@ begin
A:='Z'; A:='Z';
Adr:=BrancheN[branche_trouve_actuel,indexBranche_actuel+1].Adresse; Adr:=BrancheN[branche_trouve_actuel,indexBranche_actuel+1].Adresse;
typeGen:=BrancheN[branche_trouve_actuel,indexBranche_actuel+1].Btype; typeGen:=BrancheN[branche_trouve_actuel,indexBranche_actuel+1].Btype;
if NivDebug=3 then AfficheDebug('41 - Le suivant est :'+intToSTR(adr)+'('+intToSTR(Btype)+')',clwhite); if NivDebug=3 then
begin
s:='41 - Le suivant est :'+intToSTR(adr);
if Btype=1 then s:=s+'(bis)';
AfficheDebug(s,clwhite);
end;
suivant_alg3:=adr; suivant_alg3:=adr;
exit; exit;
end; end;
@@ -3899,7 +3909,12 @@ begin
A:='Z'; A:='Z';
Adr:=BrancheN[branche_trouve_actuel,indexBranche_actuel-1].Adresse; Adr:=BrancheN[branche_trouve_actuel,indexBranche_actuel-1].Adresse;
typeGen:=BrancheN[branche_trouve_actuel,indexBranche_actuel-1].Btype; typeGen:=BrancheN[branche_trouve_actuel,indexBranche_actuel-1].Btype;
if NivDebug=3 then AfficheDebug('43 - Le suivant est :'+intToSTR(adr)+'('+intToSTR(TypeGen)+')',clwhite); if NivDebug=3 then
begin
s:='43 - Le suivant est :'+intToSTR(adr);
if typeGen=1 then s:=s+'(bis)';
AfficheDebug(s,clwhite);
end;
suivant_alg3:=adr; suivant_alg3:=adr;
exit; exit;
end; end;
@@ -4584,11 +4599,29 @@ begin
detecteur_suivant_el:=Adr; detecteur_suivant_el:=Adr;
exit; exit;
end; end;
if NivDebug=3 then AfficheDebug('trouvé 2:'+intToSTR(Adr)+' '+intToSTR(typeGen),clorange); 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';
end;
AfficheDebug(s,clorange);
end;
trouve_element(Adr,typeGen); trouve_element(Adr,typeGen);
Btype:=BrancheN[branche_trouve,IndexBranche_trouve].BType; Btype:=BrancheN[branche_trouve,IndexBranche_trouve].BType;
BisSuiv:=Btype; // si aiguillage bis BisSuiv:=Btype; // si aiguillage bis
if (NivDebug=3) then AfficheDebug('Suivant='+IntToSTR(Adr)+ '('+intToSTR(Btype)+')',clyellow); 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';
end;
AfficheDebug(s,clorange);
end;
AdrPrec:=AdrFonc;AdrFonc:=Adr; AdrPrec:=AdrFonc;AdrFonc:=Adr;
BisPrec:=BisFonc;BisFonc:=typeGen; BisPrec:=BisFonc;BisFonc:=typeGen;
inc(i); inc(i);
@@ -4662,6 +4695,7 @@ end;
// renvoie l'état du signal suivant // renvoie l'état du signal suivant
// si renvoie 0, pas trouvé le signal suivant. // si renvoie 0, pas trouvé le signal suivant.
// rang=1 pour feu suivant, 2 pour feu suivant le 1, etc // rang=1 pour feu suivant, 2 pour feu suivant le 1, etc
// Dans AdresseFeuSuivant : adreses du feu suivant (variable globale)
function etat_signal_suivant(adresse,rang : integer) : integer ; function etat_signal_suivant(adresse,rang : integer) : integer ;
var num_feu,AdrDet,etat,AdrFeu,i,j,prec,AdrSuiv : integer; var num_feu,AdrDet,etat,AdrFeu,i,j,prec,AdrSuiv : integer;
TypePrec,TypeActuel : integer; TypePrec,TypeActuel : integer;
@@ -4684,6 +4718,7 @@ begin
begin begin
Affiche('Erreur 600 - feu non trouvé',clred); Affiche('Erreur 600 - feu non trouvé',clred);
etat_signal_suivant:=0; etat_signal_suivant:=0;
AdresseFeuSuivant:=0;
exit; exit;
end; end;
Etat:=0; Etat:=0;
@@ -4695,6 +4730,7 @@ begin
begin begin
Affiche('Msg 601 - feu '+intToSTR(adresse)+' non renseigné ',clOrange); Affiche('Msg 601 - feu '+intToSTR(adresse)+' non renseigné ',clOrange);
etat_signal_suivant:=0; etat_signal_suivant:=0;
AdresseFeuSuivant:=0;
exit; exit;
end; end;
TypePrec:=1; // détecteur TypePrec:=1; // détecteur
@@ -4723,12 +4759,14 @@ begin
if (AdrSuiv=9999) then if (AdrSuiv=9999) then
begin begin
Etat_signal_suivant:=0; Etat_signal_suivant:=0;
AdresseFeuSuivant:=0;
exit; exit;
end; end;
if (AdrSuiv=0) then if (AdrSuiv=0) then
begin begin
if NivDebug=3 then AfficheDebug('Le suivant est un buttoir',clyellow); if NivDebug=3 then AfficheDebug('Le suivant est un buttoir',clyellow);
Etat_signal_suivant:=carre_F; // faire comme si c'était un signal au carré Etat_signal_suivant:=carre_F; // faire comme si c'était un signal au carré
AdresseFeuSuivant:=0;
exit; exit;
end; end;
@@ -4752,6 +4790,7 @@ begin
inc(num_feu); inc(num_feu);
Etat:=EtatSignalCplx[AdrFeu]; Etat:=EtatSignalCplx[AdrFeu];
Signal_suivant:=AdrFeu; Signal_suivant:=AdrFeu;
if NivDebug=3 then AfficheDebug('Trouvé feu suivant Adr='+IntToSTR(AdrFeu)+'='+IntToSTR(etat),clOrange); if NivDebug=3 then AfficheDebug('Trouvé feu suivant Adr='+IntToSTR(AdrFeu)+'='+IntToSTR(etat),clOrange);
end end
else else
@@ -4764,6 +4803,7 @@ begin
until (j=10) or ((AdrFeu<>0) and (num_feu=rang)); until (j=10) or ((AdrFeu<>0) and (num_feu=rang));
if etat=0 then Signal_Suivant:=0; if etat=0 then Signal_Suivant:=0;
etat_signal_suivant:=Etat; etat_signal_suivant:=Etat;
AdresseFeuSuivant:=Signal_suivant;
if (NivDebug=3) and (adrFeu=0) then AfficheDebug('Pas Trouvé de feu suivant au feu Adr='+IntToSTR(ADresse),clOrange); if (NivDebug=3) and (adrFeu=0) then AfficheDebug('Pas Trouvé de feu suivant au feu Adr='+IntToSTR(ADresse),clOrange);
//TraceDet:=false; //TraceDet:=false;
end; end;
@@ -4885,13 +4925,14 @@ begin
end; end;
// renvoie vrai si une mémoire de zone est occupée du signal courant au signal suivant // 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 var
TypePrec,TypeActuel,ife,Detecteur_precedent,actuel,AdrDet,Etat,AdrFeu,i,j,prec,AdrSuiv : integer; AdrSuiv,prec,TypePrec,TypeActuel,ife,actuel,AdrDet,Etat,AdrFeu,i,j,PresTrain01,PrecInitial : integer;
Pres_train,sort : boolean; Pres_train,sort : boolean;
begin begin
if NivDebug>=1 then AfficheDebug('Cherche mémoire à 1 du signal '+intToSTR(adresse)+' au signal suivant ',clyellow); if NivDebug>=1 then AfficheDebug('Proc test_memoire_zones - Cherche mémoire à 1 du signal '+intToSTR(adresse)+' au signal suivant ',clyellow);
i:=Index_feu(adresse); i:=Index_feu(adresse);
if (i=0) then if (i=0) then
@@ -4942,7 +4983,6 @@ begin
if feux[i].Btype_suiv4=5 then TypeActuel:=3; // le type du feu 1=détecteur 2=aig 5=bis if feux[i].Btype_suiv4=5 then TypeActuel:=3; // le type du feu 1=détecteur 2=aig 5=bis
end; // détecteur sur le signal courant end; // détecteur sur le signal courant
Detecteur_precedent:=prec;
TypePrec:=1; TypePrec:=1;
if (prec=0) then if (prec=0) then
begin begin
@@ -4950,44 +4990,41 @@ begin
exit; exit;
end; end;
PrecInitial:=Prec;
repeat repeat
inc(j); inc(j);
// à la première itération, si "actuel" est déja un détecteur, ne pas faire de recherche sur le suivant // à 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 // et chaîner mémoire de zone
if (j=1) and (Typeactuel=1) then // si détecteur if (j=1) and (Typeactuel=1) then // si détecteur
begin begin
//AfficheDebug('C''est un détecteur',clred); Pres_train:=MemZone[Prec,actuel];
AdrSuiv:=actuel;
actuel:=prec;
TypePrec:=1;
TypeActuel:=1;
//TypeGen:=1;
Pres_train:=MemZone[prec,actuel];
if Pres_Train and (NivDebug=3) then Affiche('Présence train de '+intToSTR(prec)+' à '+intToSTR(actuel),clyellow); if Pres_Train and (NivDebug=3) then Affiche('Présence train de '+intToSTR(prec)+' à '+intToSTR(actuel),clyellow);
Detecteur_precedent:=actuel;
end end
else else
begin begin
AdrSuiv:=suivant_alg3(prec,TypePrec,actuel,TypeActuel,1); AdrSuiv:=suivant_alg3(prec,TypePrec,actuel,TypeActuel,1);
//AfficheDebug('A:'+IntToSTR(BisActuel);
prec:=actuel;TypePrec:=TypeActuel; prec:=actuel;TypePrec:=TypeActuel;
actuel:=AdrSuiv;TypeActuel:=typeGen; actuel:=AdrSuiv;TypeActuel:=typeGen;
end; end;
//AfficheDebug('A suivant='+IntToSTR(adrsuiv),clred);
if AdrSuiv=0 then if NivDebug=3 then AfficheDebug('A suivant='+IntToSTR(adrsuiv),clred);
if actuel=0 then
begin begin
// si c'est un buttoir // si c'est un buttoir
test_memoire_zones:=false; test_memoire_zones:=false;
if NivDebug=3 then AfficheDebug('sortie car buttoir',clyellow);
exit; exit;
end; end;
// si le suivant est un détecteur comporte t-il un signal? // si le suivant est un détecteur ; contrôler mémoire de zone et comporte t-il un signal?
AdrFeu:=0; AdrFeu:=0;
if (TypeActuel=1) then // détecteur if (TypeActuel=1) then // détecteur
begin begin
if (NivDebug=3) and MemZone[Detecteur_precedent][actuel] then AfficheDebug('Présence train de '+intToSTR(Detecteur_precedent)+' à '+intToSTR(actuel),clyellow); if (NivDebug=3) and MemZone[PrecInitial][actuel] then AfficheDebug('Présence train de '+intToSTR(PrecInitial)+' à '+intToSTR(actuel),clyellow);
Pres_train:=MemZone[Detecteur_precedent][actuel] or Pres_train; // mémoire de zone Pres_train:=MemZone[PrecInitial][actuel] or Pres_train; // mémoire de zone
Detecteur_precedent:=actuel; // pour préparer le suivant if Pres_Train then PresTrain01:=1 else PresTrain01:=0;
if NivDebug=3 then AfficheDebug('mémoire de zone '+IntToSTR(PrecInitial)+' à '+intToSTR(actuel)+'='+IntToSTR(PresTrain01),clyellow);
// prec:=actuel; // pour préparer le suivant
i:=index_feu_det(AdrSuiv); // renvoie l'index du signal se trouvant au détecteur "AdrSuiv": il peut y avoir 4 détecteurs par signal i:=index_feu_det(AdrSuiv); // renvoie l'index du signal se trouvant au détecteur "AdrSuiv": il peut y avoir 4 détecteurs par signal
AdrFeu:=feux[i].adresse; // adresse du feu AdrFeu:=feux[i].adresse; // adresse du feu
@@ -5020,7 +5057,7 @@ begin
if (NivDebug=3) then AfficheDebug('Trouvé aiguillage '+intToSTR(AdrSuiv),clyellow); if (NivDebug=3) then AfficheDebug('Trouvé aiguillage '+intToSTR(AdrSuiv),clyellow);
end; end;
sort:=(j=10) or (AdrFeu<>0) ; sort:=(j=10) or (AdrFeu<>0) ;
until (sort); until (sort); // on arrete jusqu'à trouver un signal ou si on va trop loin (10 itérations)
inc(ife); inc(ife);
until ife>=5; until ife>=5;
if (NivDebug=3) and (Etat=0) then AfficheDebug('Pas trouvé de signal suivant au '+intToSTR(adresse),clyellow); if (NivDebug=3) and (Etat=0) then AfficheDebug('Pas trouvé de signal suivant au '+intToSTR(adresse),clyellow);
@@ -5080,7 +5117,7 @@ begin
inc(i); inc(i);
repeat repeat
dec(i); dec(i);
trouve:=(event_det_tick[i].etat=etat) and (event_det_tick[i].detecteur=Adr) ; trouve:=(event_det_tick[i].etat=etat) and (event_det_tick[i].detecteur=Adr) ;
until (trouve or (i=0)); until (trouve or (i=0));
if trouve then if trouve then
begin begin
@@ -5195,6 +5232,7 @@ begin
// trouvé la route si j=2 : - si j=3 : + // trouvé la route si j=2 : - si j=3 : +
if (TraceListe) then AfficheDebug('Route trouvée',clyellow); if (TraceListe) then AfficheDebug('Route trouvée',clyellow);
if (TraceListe) then AfficheDebug('detecteur_suivant_el('+IntToSTR(det1)+',1,'+IntToSTR(det2)+',1',clyellow);
AdrSuiv:=detecteur_suivant_El(det1,1,det2,1); AdrSuiv:=detecteur_suivant_El(det1,1,det2,1);
AdrPrec:=detecteur_suivant_El(det2,1,det1,1); AdrPrec:=detecteur_suivant_El(det2,1,det1,1);
@@ -5205,22 +5243,25 @@ begin
if traceListe then AfficheDebug(s,clyellow); if traceListe then AfficheDebug(s,clyellow);
// trouver l'index du détecteur (det1) à 0 // 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); i:=trouve_index_det_chrono(det1,0,N_Event_tick);
if TraceListe then AfficheDebug('Index det='+intToSTR(i),clyellow); if TraceListe then AfficheDebug('Index det='+intToSTR(i),clyellow);
// et trouver l'index du détecteur précédent à 0 avant l'index i // 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é ? t:=event_det_tick[i].traite; // détecteur précédent déja traité ?
if (i=0) or t then if (i=0) or t then
begin begin
if (i=0) and TraceListe then AfficheDebug('La memoire prec '+intToSTR(AdrPrec)+'=0 donc route non valide',clyellow); 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 memoire prec '+intToSTR(AdrPrec)+' a déja été traitée 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; calcul_zones_det:=0;exit;
end; end;
if TraceListe then AfficheDebug('route ok car '+IntToStr(AdrPrec)+'=0 à l''index '+intToSTR(i),clyellow); if TraceListe then AfficheDebug('route ok car '+IntToStr(AdrPrec)+'=0 à l''index '+intToSTR(i)+' - DetSuivant='+intToSTR(AdrSuiv),clyellow);
Mem[AdrPrec]:=false; // inutile Mem[AdrPrec]:=false; // inutile
//marquer l'adresse précédente comme traitée //marquer l'adresse précédente comme traitée
@@ -5281,6 +5322,7 @@ begin
end; end;
s:='train '+IntToSTR(Train_Courant)+' Mem '+IntToSTR(det2)+' à '+IntTOStr(AdrSuiv); s:='train '+IntToSTR(Train_Courant)+' Mem '+IntToSTR(det2)+' à '+IntTOStr(AdrSuiv);
Affiche(s,clyellow); Affiche(s,clyellow);
if AffAigDet then AfficheDebug(s,clyellow);
// et effacer le premier détecteur de la route (det1) // et effacer le premier détecteur de la route (det1)
i:=1; i:=1;
@@ -5342,6 +5384,7 @@ begin
// signal non directionnel // signal non directionnel
etat:=etat_signal_suivant(AdrFeu,1) ; // état du signal suivant + adresse du signal suivant dans Signal_Suivant etat:=etat_signal_suivant(AdrFeu,1) ; // état du signal suivant + adresse du signal suivant dans Signal_Suivant
if AffSignal then AfficheDebug('Etat signal suivant ('+intToSTR(AdresseFeuSuivant)+') est '+intToSTR(etat),clyellow);
// signaux traités spécifiquement // signaux traités spécifiquement
if (AdrFeu=201) then if (AdrFeu=201) then
@@ -5479,11 +5522,11 @@ begin
else else
begin begin
// sinon si signal suivant=jaune // sinon si signal suivant=jaune
if (TestBit(etat,jaune)) then Maj_Etat_Signal(AdrFeu,jaune_cli); if (TestBit(etat,jaune)) then Maj_Etat_Signal(AdrFeu,jaune_cli);
end; end;
end end
else else
// aiguille locale non déviée // aiguille locale non déviée ou aspect feu<9
// si le signal suivant est rouge // si le signal suivant est rouge
begin begin
if AffSignal then AfficheDebug('pas d''aiguille déviée',clYellow); if AffSignal then AfficheDebug('pas d''aiguille déviée',clYellow);
@@ -5784,11 +5827,20 @@ begin
// on reçoit un doublon dans deux index consécutifs. // on reçoit un doublon dans deux index consécutifs.
if N_Event_tick>=1 then if N_Event_tick>=1 then
begin begin
//Affiche('Event_det_tick['+intToSTR(N_event_tick)+'].detecteur['+intToSTR(Adresse)+']='+intToSTr(event_det_tick[N_event_tick].detecteur[Adresse]),clyellow); if (event_det_tick[N_event_tick].etat=etat01) and (event_det_tick[N_event_tick].detecteur=Adresse) then
if (event_det_tick[i].etat=etat01) and (event_det_tick[i].detecteur=Adresse) then exit; // déja stocké begin
//Affiche(IntToSTR(Adresse)+' déja stocké',clorange);
exit; // déja stocké
end;
end; end;
if Traceliste then AfficheDebug('--------------------- détecteur '+intToSTR(Adresse)+' à '+intToSTR(etat01)+'-----------------------------',clOrange); if Traceliste then AfficheDebug('--------------------- détecteur '+intToSTR(Adresse)+' à '+intToSTR(etat01)+'-----------------------------',clOrange);
if AffAigDet then
begin
s:='Evt Det '+intToSTR(adresse)+'='+intToSTR(etat01);
Affiche(s,clyellow);
AfficheDebug(s,clyellow);
end;
//if etat then Mem[Adresse]:=true; // mémoriser l'état à 1 //if etat then Mem[Adresse]:=true; // mémoriser l'état à 1
@@ -5796,15 +5848,6 @@ begin
detecteur[Adresse]:=etat; detecteur[Adresse]:=etat;
detecteur_chgt:=Adresse; 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
//Affiche('front descendant',clyellow);
inc(N_event_det);
event_det[N_event_det]:=Adresse;
if not(configNulle) then calcul_zones; // en avant les calculs
end;
// stocke les changements d'état des détecteurs dans le tableau chronologique // stocke les changements d'état des détecteurs dans le tableau chronologique
if (N_Event_tick<Max_Event_det_tick) then if (N_Event_tick<Max_Event_det_tick) then
begin begin
@@ -5812,11 +5855,33 @@ begin
// event_det_tick[N_event_tick].train:=0; // event_det_tick[N_event_tick].train:=0;
event_det_tick[N_event_tick].tick:=tick; event_det_tick[N_event_tick].tick:=tick;
event_det_tick[N_event_tick].detecteur:=Adresse; event_det_tick[N_event_tick].detecteur:=Adresse;
event_det_tick[N_event_tick].etat:=etat01; event_det_tick[N_event_tick].etat:=etat01;
// Affiche('stockage de '+intToSTR(N_event_tick)+' à '+intToSTR(etat01),clyellow); // Affiche('stockage de '+intToSTR(N_event_tick)+' '+IntToSTR(Adresse)+' à '+intToSTR(etat01),clyellow);
end; 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;
// attention à partir de cette section le code est susceptible de ne pas être exécuté
// Mettre à jour le TCO // Mettre à jour le TCO
if AvecTCO then if AvecTCO then
begin begin
@@ -5859,9 +5924,17 @@ end;
// évènement d'aiguillage // évènement d'aiguillage
procedure Event_Aig(adresse,pos : integer); procedure Event_Aig(adresse,pos : integer);
var s: string;
begin begin
aiguillage[adresse].position:=pos;
if (N_Event_tick<Max_Event_det_tick) then if (N_Event_tick<Max_Event_det_tick) then
begin begin
if AffAigDet then
begin
s:='Aig '+intToSTR(adresse)+'='+intToSTR(pos);
Affiche(s,clyellow);
AfficheDebug(s,clyellow);
end;
inc(N_Event_tick); inc(N_Event_tick);
event_det_tick[N_event_tick].tick:=tick; event_det_tick[N_event_tick].tick:=tick;
event_det_tick[N_event_tick].aiguillage:=adresse; event_det_tick[N_event_tick].aiguillage:=adresse;
@@ -6004,25 +6077,21 @@ begin
adraig:=((adresse * 4)+1 ); // *4 car N=1, c'est le "poids fort" adraig:=((adresse * 4)+1 ); // *4 car N=1, c'est le "poids fort"
if (valeur and $C)=$8 then if (valeur and $C)=$8 then
begin begin
aiguillage[adraig+3].position:=2 ; // état aiguillage haut
Event_Aig(adraig+3,2); Event_Aig(adraig+3,2);
if trace then begin s:='accessoire '+intToSTR(adraig+3)+'=2';Affiche(s,clYellow);end; if trace then begin s:='accessoire '+intToSTR(adraig+3)+'=2';Affiche(s,clYellow);end;
end; end;
if (valeur and $C)=$4 then if (valeur and $C)=$4 then
begin begin
aiguillage[adraig+3].position:=1 ; // état aiguillage haut
Event_Aig(adraig+3,1); Event_Aig(adraig+3,1);
if trace then begin s:='accessoire '+intToSTR(adraig+3)+'=1';Affiche(s,clYellow);end; if trace then begin s:='accessoire '+intToSTR(adraig+3)+'=1';Affiche(s,clYellow);end;
end; end;
if (valeur and $3)=$2 then if (valeur and $3)=$2 then
begin begin
aiguillage[adraig+2].position:=2; // état aiguillage bas
Event_Aig(adraig+2,2); Event_Aig(adraig+2,2);
if trace then begin s:='accessoire '+intToSTR(adraig+2)+'=2';Affiche(s,clYellow);end; if trace then begin s:='accessoire '+intToSTR(adraig+2)+'=2';Affiche(s,clYellow);end;
end; end;
if (valeur and $3)=$1 then if (valeur and $3)=$1 then
begin begin
aiguillage[adraig+2].position:=1; // état aiguillage bas
Event_Aig(adraig+2,1); Event_Aig(adraig+2,1);
if trace then begin s:='accessoire '+intToSTR(adraig+2)+'=1';Affiche(s,clYellow);end; if trace then begin s:='accessoire '+intToSTR(adraig+2)+'=1';Affiche(s,clYellow);end;
end; end;
@@ -6064,25 +6133,21 @@ begin
adraig:=(adresse * 4)+1; adraig:=(adresse * 4)+1;
if (valeur and $C)=$8 then if (valeur and $C)=$8 then
begin begin
aiguillage[adraig+1].position:=2 ; // état aiguillage haut
Event_Aig(adraig+1,2); Event_Aig(adraig+1,2);
if trace then begin s:='accessoire '+intToSTR(adraig+1)+'=2';Affiche(s,clYellow);end; if trace then begin s:='accessoire '+intToSTR(adraig+1)+'=2';Affiche(s,clYellow);end;
end; end;
if (valeur and $C)=$4 then if (valeur and $C)=$4 then
begin begin
aiguillage[adraig+1].position:=1 ; // état aiguillage haut
Event_Aig(adraig+1,1); Event_Aig(adraig+1,1);
if trace then begin s:='accessoire '+intToSTR(adraig+1)+'=1';Affiche(s,clYellow);end; if trace then begin s:='accessoire '+intToSTR(adraig+1)+'=1';Affiche(s,clYellow);end;
end; end;
if (valeur and $3)=$2 then if (valeur and $3)=$2 then
begin begin
aiguillage[adraig].position:=2; // état aiguillage bas
Event_Aig(adraig,2); Event_Aig(adraig,2);
if trace then begin s:='accessoire '+intToSTR(adraig)+'=2';Affiche(s,clYellow);end; if trace then begin s:='accessoire '+intToSTR(adraig)+'=2';Affiche(s,clYellow);end;
end; end;
if (valeur and $3)=$1 then if (valeur and $3)=$1 then
begin begin
aiguillage[adraig].position:=1; // état aiguillage bas
Event_Aig(adraig,1); Event_Aig(adraig,1);
if trace then begin s:='accessoire '+intToSTR(adraig)+'=1';Affiche(s,clYellow);end; if trace then begin s:='accessoire '+intToSTR(adraig)+'=1';Affiche(s,clYellow);end;
end; end;
@@ -6554,8 +6619,8 @@ begin
// event_det[1]:=527; // event_det[1]:=527;
// event_det[2]:=520; // event_det[2]:=520;
// N_event_det:=2; // N_event_det:=2;
//aiguillage[20].Position:=const_droit+1; // aiguillage[23].Position:=const_droit;
//aiguillage[12].Position:=const_droit+1; // aiguillage[12].Position:=const_droit;
//traceDet:=true; //traceDet:=true;
// calcul_zones; // calcul_zones;
//maj_feu(201); //maj_feu(201);
@@ -6567,14 +6632,13 @@ begin
//i:=suivant_alg3(553,1,1,3,1); //i:=suivant_alg3(553,1,1,3,1);
//Affichedebug(intToSTr(i),clred); //Affichedebug(intToSTr(i),clred);
//Affiche(IntToSTR(calcul_zones_det(522,514)),clyellow); //Affiche(IntToSTR(calcul_zones_det(522,514)),clyellow);
//test_memoire_zones(1011);
//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); //i:=etat_signal_suivant(1001,1);
// Affiche(IntToSTR(detecteur_suivant(25,2,529,1)),clyellow); // Affiche(IntToSTR(detecteur_suivant(25,2,529,1)),clyellow);
//i:=Aiguille_deviee(176); //i:=Aiguille_deviee(176);
//signal_direction(372); //signal_direction(372);
//FormDebug.show; //FormDebug.show;
//NivDebug:=3;
//test_memoire_zones(218); //test_memoire_zones(218);
//Det_Adj(520); //Det_Adj(520);
//Affiche(' Adj1='+intToStr(Adj1)+' Adj2='+intToStr(Adj2),clyellow); //Affiche(' Adj1='+intToStr(Adj1)+' Adj2='+intToStr(Adj2),clyellow);
@@ -6726,29 +6790,44 @@ begin
end; end;
//simulation //simulation
if index_simule<>0 then if (index_simule<>0) then
begin begin
if not(MsgSim) then begin Affiche('Simulation en cours ',Cyan);MsgSim:=true;end; 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 begin
inc(I_simule); inc(I_simule);
// evt détecteur ? // evt détecteur ?
if Tablo_simule[i_simule].detecteur<>0 then if Tablo_simule[i_simule].detecteur<>0 then
begin begin
Affiche('Simulation tick='+IntToSTR(tick)+' det='+intToSTR(Tablo_simule[i_simule].detecteur)+'='+IntToSTR(Tablo_simule[i_simule].etat),Cyan); // 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 '+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 Event_Detecteur(Tablo_simule[i_simule].detecteur, Tablo_simule[i_simule].etat=1); // créer évt détecteur
end; end;
// evt aiguillage ? // evt aiguillage ?
if Tablo_simule[i_simule].aiguillage<>0 then if Tablo_simule[i_simule].aiguillage<>0 then
begin begin
Affiche('Simulation tick='+IntToSTR(tick)+' aig='+intToSTR(Tablo_simule[i_simule].aiguillage)+'='+IntToSTR(Tablo_simule[i_simule].etat),Cyan); 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 Event_Aig(Tablo_simule[i_simule].Aiguillage,Tablo_simule[i_simule].etat); // créer évt aiguillage
end; end;
end; end;
if i_Simule>=Index_simule then if i_Simule>=Index_simule then
begin begin
Index_Simule:=0; // fin de simulation Index_Simule:=0; // fin de simulation
I_Simule:=0;
MsgSim:=false; MsgSim:=false;
Affiche('Fin de simulation',Cyan); Affiche('Fin de simulation',Cyan);
end; end;
@@ -6957,8 +7036,8 @@ begin
begin begin
s:='Dét '+intToSTR(Adresse_detecteur[j])+'='; s:='Dét '+intToSTR(Adresse_detecteur[j])+'=';
if Detecteur[adresse_detecteur[j]] then s:=s+'1' else s:=s+'0'; if Detecteur[adresse_detecteur[j]] then s:=s+'1' else s:=s+'0';
s:=s+' Mem='; //s:=s+' Mem=';
if Mem[adresse_detecteur[j]] then s:=s+'1' else s:=s+'0'; //if Mem[adresse_detecteur[j]] then s:=s+'1' else s:=s+'0';
Affiche(s,clYellow); Affiche(s,clYellow);
end; end;
end; end;
@@ -7006,10 +7085,8 @@ begin
' Droit='+IntToSTR(aiguillage[i].ADroit)+aiguillage[i].ADroitB; ' 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].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); if aiguillage[i].vitesse<>0 then s:=s+' Vitesse déviée='+intToSTR(aiguillage[i].vitesse);
end Affiche(s,clYellow);
else end;
s:=s+' absent';
Affiche(s,clYellow);
end; end;
for i:=1 to MaxAiguillage do for i:=1 to MaxAiguillage do
@@ -7026,11 +7103,8 @@ begin
' Droit='+IntToSTR(aiguillageB[i].ADroit)+aiguillageB[i].ADroitB; ' 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].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); if aiguillageB[i].vitesse<>0 then s:=s+' Vitesse déviée='+intToSTR(aiguillageB[i].vitesse);
end Affiche(s,clYellow);
else end;
s:=s+' absent';
Affiche(s,clYellow);
end; end;
end; end;
@@ -7108,14 +7182,14 @@ begin
// aiguillage normal // aiguillage normal
if aiguillage[adr].modele=1 then if aiguillage[adr].modele=1 then
begin begin
//Affiche('Normal',clyellow);
if etat=0 then etatAig:=2 else etatAig:=1; if etat=0 then etatAig:=2 else etatAig:=1;
aiguillage[adr].position:=etatAig;
aiguillageB[adr].position:=etatAig;
Event_Aig(adr,etatAig); Event_Aig(adr,etatAig);
end; end;
// TJD TJS // TJD TJS
if (aiguillage[adr].modele=2) or (aiguillage[adr].modele=3) then if (aiguillage[adr].modele=2) or (aiguillage[adr].modele=3) then
begin begin
//Affiche('TJDS',clyellow);
adr2:=aiguillage[adr].Apointe; // 2eme adresse de la TJD adr2:=aiguillage[adr].Apointe; // 2eme adresse de la TJD
case etat of case etat of
1 : begin etatAig:=1;EtatAig2:=2;end; 1 : begin etatAig:=1;EtatAig2:=2;end;
@@ -7123,21 +7197,19 @@ begin
5 : begin etatAig:=2;EtatAig2:=1;end; 5 : begin etatAig:=2;EtatAig2:=1;end;
0 : begin etatAig:=2;EtatAig2:=2;end; 0 : begin etatAig:=2;EtatAig2:=2;end;
end; end;
aiguillage[adr].position:=etatAig;aiguillage[adr2].position:=etatAig2;
Event_Aig(adr,etatAig); Event_Aig(adr,etatAig);
Event_Aig(adr2,etatAig2); Event_Aig(adr2,etatAig2);
end; end;
if aiguillage[adr].modele=4 then // aiguillage triple if aiguillage[adr].modele=4 then // aiguillage triple
begin begin
//Affiche('Triple',clyellow);
// état de l'aiguillage 1 // état de l'aiguillage 1
if (etat=0) or (etat=2) then etatAig:=2; if (etat=0) or (etat=2) then etatAig:=2;
if etat=3 then etatAig:=1; if etat=3 then etatAig:=1;
aiguillage[adr].Position:=etatAig;
// état de l'aiguillage 2 // état de l'aiguillage 2
adr2:=aiguillage[adr].AdrTriple; adr2:=aiguillage[adr].AdrTriple;
if (etat=0) or (etat=3) then etatAig2:=2; if (etat=0) or (etat=3) then etatAig2:=2;
if etat=2 then etatAig2:=1; if etat=2 then etatAig2:=1;
aiguillage[adr2].Position:=etatAig2;
Event_Aig(adr,etatAig); Event_Aig(adr,etatAig);
Event_Aig(adr2,etatAig2); Event_Aig(adr2,etatAig2);
end; end;
@@ -7158,7 +7230,7 @@ begin
Delete(recuCDM,j,i+5-j); Delete(recuCDM,j,i+5-j);
val(ss,etat,erreur); val(ss,etat,erreur);
Event_detecteur(Adr,etat=1); Event_detecteur(Adr,etat=1);
//FormDebug.MemoDet.Lines.Add(IntToSTR(adr)+' '+IntToSTR(etat)); //Affiche(IntToSTR(adr)+' '+IntToSTR(etat),clyellow);
if AfficheDet then Affiche('Rétro Détecteur '+intToSTR(adr)+'='+IntToStr(etat),clYellow); if AfficheDet then Affiche('Rétro Détecteur '+intToSTR(adr)+'='+IntToStr(etat),clYellow);
end ; end ;
@@ -7231,21 +7303,26 @@ begin
for i:=1 to NbreFeux do for i:=1 to NbreFeux do
begin begin
// feu de signalisation // feu de signalisation
s:=IntToSTR(i)+' Adresse='+IntToSTR(feux[i].Adresse); s:=IntToSTR(i)+' Adr='+IntToSTR(feux[i].Adresse);
s:=s+' décodeur='+IntToStr(feux[i].decodeur); s:=s+' décodeur='+IntToStr(feux[i].decodeur);
if feux[i].aspect<10 then if feux[i].aspect<10 then
begin begin
s:=s+' SIG Nombre de feux='+IntToSTR(feux[i].aspect)+' '; 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); 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); s:=s+' Cible unisemaf='+intToSTR(feux[i].Unisemaf);
end end
else else
// feu directionnel // feu directionnel
begin begin
s:=s+' DIR Nombre de feux='+IntToSTR(feux[i].aspect-10)+' '; s:=s+' DIR Nbre de feux='+IntToSTR(feux[i].aspect-10)+' ';
NfeuxDir:=feux[i].aspect-10; NfeuxDir:=feux[i].aspect-10;
for j:=1 to NfeuxDir+1 do for j:=1 to NfeuxDir+1 do
begin begin
@@ -7279,8 +7356,8 @@ begin
Affiche('Version 1.4 : Gestion des Fx vers les locomotives par actionneurs',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); Affiche('Version 1.41 : Gestion des passages à niveaux par actionneurs',clLime);
Affiche('Version 1.42 : Correction erreur lecture feux',clLime); Affiche('Version 1.42 : Correction erreur lecture feux',clLime);
Affiche('Version 1.43 : Correction erreur gestion sémaphore',clLime);
Affiche('Version 1.44 : Gestion trains avec voitures éclairées',clLime);
end; end;
procedure TFormPrinc.ClientSocketLenzDisconnect(Sender: TObject; procedure TFormPrinc.ClientSocketLenzDisconnect(Sender: TObject;
@@ -7293,27 +7370,30 @@ procedure TFormPrinc.ChronoDetectClick(Sender: TObject);
var i,j,etat : integer; var i,j,etat : integer;
s : string; s : string;
begin begin
if N_event_tick=0 then
begin
Affiche('Aucun évenèment détecteur ou aiguillage',clYellow);
end;
for i:=1 to N_Event_tick do for i:=1 to N_Event_tick do
begin begin
//for j:=1 to 1100 do //for j:=1 to 1100 do
begin begin
etat:=event_det_tick[i].etat; j:=event_det_tick[i].detecteur;
if etat<>-1 then if j<>-1 then
begin begin
j:=event_det_tick[i].detecteur;
s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick); s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick);
s:=s+' Det='+IntToSTR(j)+'='+intToSTR(etat); s:=s+' Det='+IntToSTR(j)+'='+intToSTR(event_det_tick[i].etat);
// s:=s+' Det suiv='+intTostr(event_det_tick[i].suivant); // s:=s+' Det suiv='+intTostr(event_det_tick[i].suivant);
Affiche(s,clyellow); Affiche(s,clyellow);
end; end;
end; end;
etat:=event_det_tick[i].aiguillage; j:=event_det_tick[i].aiguillage;
if etat<>-1 then if j<>-1 then
begin begin
s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick); s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick);
s:=s+' Aig='+intToSTR(etat)+'='+intToSTR(event_det_tick[i].etat); s:=s+' Aig='+intToSTR(j)+'='+intToSTR(event_det_tick[i].etat);
Affiche(s,clyellow); Affiche(s,clyellow);
end; end;
end; end;
@@ -7324,7 +7404,6 @@ end;
procedure TFormPrinc.FichierSimuClick(Sender: TObject); procedure TFormPrinc.FichierSimuClick(Sender: TObject);
begin begin
FormSimulation.showModal; FormSimulation.showModal;
//TraceListe:=true;
end; end;
procedure TFormPrinc.ButtonEcrCVClick(Sender: TObject); procedure TFormPrinc.ButtonEcrCVClick(Sender: TObject);
@@ -7492,6 +7571,68 @@ begin
formconfig.close; formconfig.close;
end; 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;
Affiche('Fin de simulation',Cyan);
end;
begin begin
end. end.
BIN
View File
Binary file not shown.
+1
View File
@@ -44,6 +44,7 @@ object FormSimulation: TFormSimulation
Height = 21 Height = 21
TabOrder = 1 TabOrder = 1
Text = '1' Text = '1'
OnChange = EditIntervalleChange
OnKeyPress = EditIntervalleKeyPress OnKeyPress = EditIntervalleKeyPress
end end
object OpenDialog: TOpenDialog object OpenDialog: TOpenDialog
+16 -5
View File
@@ -15,6 +15,7 @@ type
procedure ButtonChargeClick(Sender: TObject); procedure ButtonChargeClick(Sender: TObject);
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure EditIntervalleKeyPress(Sender: TObject; var Key: Char); procedure EditIntervalleKeyPress(Sender: TObject; var Key: Char);
procedure EditIntervalleChange(Sender: TObject);
private private
{ Déclarations privées } { Déclarations privées }
public public
@@ -48,7 +49,6 @@ begin
index_simule:=1; index_simule:=1;
repeat repeat
readln(fte,s); readln(fte,s);
i:=pos('Tick=',s); i:=pos('Tick=',s);
if i<>0 then if i<>0 then
begin begin
@@ -72,10 +72,10 @@ begin
val(s,k,erreur); val(s,k,erreur);
Tablo_simule[index_simule].etat:=k; 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)+ ' Detecteur='+intToSTR(Tablo_simule[index_simule].detecteur)+
'='+intToSTR(Tablo_simule[index_simule].etat); '='+intToSTR(Tablo_simule[index_simule].etat);
Affiche(s,ClLime); Affiche(s,ClLime); }
inc(index_simule); inc(index_simule);
end; end;
@@ -95,10 +95,10 @@ begin
val(s,k,erreur); val(s,k,erreur);
Tablo_simule[index_simule].etat:=k; 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)+ ' Aiguillage='+intToSTR(Tablo_simule[index_simule].aiguillage)+
'='+intToSTR(Tablo_simule[index_simule].etat); '='+intToSTR(Tablo_simule[index_simule].etat);
Affiche(s,ClLime); Affiche(s,ClLime); }
inc(index_simule); inc(index_simule);
end; end;
@@ -110,8 +110,12 @@ begin
Affiche('Intervalle='+intToSTR(intervalle),clyellow); Affiche('Intervalle='+intToSTR(intervalle),clyellow);
dec(index_simule); dec(index_simule);
closeFile(fte); closeFile(fte);
formprinc.ButtonArretSimu.Visible:=true;
formprinc.ButtonArretSimu.top:=120;
FormSimulation.Close; FormSimulation.Close;
end; end;
end; end;
@@ -129,4 +133,11 @@ begin
if (intervalle<0) then Intervalle:=1; if (intervalle<0) then Intervalle:=1;
end; end;
procedure TFormSimulation.EditIntervalleChange(Sender: TObject);
var erreur : integer;
begin
Val(EditIntervalle.Text,intervalle,erreur);
if (intervalle<0) then Intervalle:=1;
end;
end. end.
BIN
View File
Binary file not shown.
+11 -2
View File
@@ -1,6 +1,6 @@
object FormTCO: TFormTCO object FormTCO: TFormTCO
Left = 333 Left = 205
Top = 121 Top = 235
Width = 928 Width = 928
Height = 681 Height = 681
VertScrollBar.Visible = False VertScrollBar.Visible = False
@@ -481,6 +481,15 @@ object FormTCO: TFormTCO
Text = 'EditCellY' Text = 'EditCellY'
OnKeyPress = EditCellYKeyPress OnKeyPress = EditCellYKeyPress
end end
object ButtonConfigTCO: TButton
Left = 576
Top = 8
Width = 113
Height = 25
Caption = 'Configuration TCO'
TabOrder = 10
OnClick = ButtonConfigTCOClick
end
object PopupMenu1: TPopupMenu object PopupMenu1: TPopupMenu
Left = 352 Left = 352
Top = 472 Top = 472
+11
View File
@@ -69,6 +69,7 @@ type
EditCellX: TEdit; EditCellX: TEdit;
EditCellY: TEdit; EditCellY: TEdit;
Label19: TLabel; Label19: TLabel;
ButtonConfigTCO: TButton;
procedure FormCreate(Sender: TObject); procedure FormCreate(Sender: TObject);
procedure ImageTCOClick(Sender: TObject); procedure ImageTCOClick(Sender: TObject);
procedure FormActivate(Sender: TObject); procedure FormActivate(Sender: TObject);
@@ -155,6 +156,7 @@ type
Shift: TShiftState; X, Y: Integer); Shift: TShiftState; X, Y: Integer);
procedure EditCellXKeyPress(Sender: TObject; var Key: Char); procedure EditCellXKeyPress(Sender: TObject; var Key: Char);
procedure EditCellYKeyPress(Sender: TObject; var Key: Char); procedure EditCellYKeyPress(Sender: TObject; var Key: Char);
procedure ButtonConfigTCOClick(Sender: TObject);
private private
{ Déclarations privées } { Déclarations privées }
@@ -189,6 +191,8 @@ procedure construit_TCO;
implementation implementation
uses UnitConfigTCO;
{$R *.dfm} {$R *.dfm}
@@ -1633,4 +1637,11 @@ begin
end; end;
procedure TFormTCO.ButtonConfigTCOClick(Sender: TObject);
begin
TformconfigTCO.create(self);
formconfigTCO.showmodal;
formconfigTCO.close;
end;
end. end.
BIN
View File
Binary file not shown.
+2 -2
View File
@@ -22,7 +22,7 @@ var
FormVersion: TFormVersion; FormVersion: TFormVersion;
Lance_verif : integer; 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 implementation
@@ -105,7 +105,7 @@ var s,s2,s3,Version_p,Url,LocalFile : string;
V_publie,V_utile : real; V_publie,V_utile : real;
begin begin
//Affiche('vérifie version',clLime); //Affiche('vérifie version',clLime);
// exit ;//&&&&&&&&&&&&&&&&&& if not(AvecInit) then exit ;
Url:='http://cdmrail.free.fr/ForumCDR/viewtopic.php?f=77&t=3906#p50499'; Url:='http://cdmrail.free.fr/ForumCDR/viewtopic.php?f=77&t=3906#p50499';
LocalFile:='page.txt'; LocalFile:='page.txt';
trouve_version:=false; trouve_version:=false;