diff --git a/Signaux_complexes_GL.dpr b/Signaux_complexes_GL.dpr index fa31dff..c0dc88b 100644 --- a/Signaux_complexes_GL.dpr +++ b/Signaux_complexes_GL.dpr @@ -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. diff --git a/UnitConfig.dcu b/UnitConfig.dcu index 381caab..530cb9e 100644 Binary files a/UnitConfig.dcu and b/UnitConfig.dcu differ diff --git a/UnitConfig.dfm b/UnitConfig.dfm index fa0046f..70647c7 100644 --- a/UnitConfig.dfm +++ b/UnitConfig.dfm @@ -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' diff --git a/UnitConfig.pas b/UnitConfig.pas index 118095a..8bab1df 100644 --- a/UnitConfig.pas +++ b/UnitConfig.pas @@ -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); diff --git a/UnitConfigTCO.dcu b/UnitConfigTCO.dcu new file mode 100644 index 0000000..625a6a0 Binary files /dev/null and b/UnitConfigTCO.dcu differ diff --git a/UnitConfigTCO.dfm b/UnitConfigTCO.dfm new file mode 100644 index 0000000..9aebcfe --- /dev/null +++ b/UnitConfigTCO.dfm @@ -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 diff --git a/UnitConfigTCO.pas b/UnitConfigTCO.pas new file mode 100644 index 0000000..250de1c --- /dev/null +++ b/UnitConfigTCO.pas @@ -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. diff --git a/UnitDebug.dcu b/UnitDebug.dcu index 6194ad7..de4dc92 100644 Binary files a/UnitDebug.dcu and b/UnitDebug.dcu differ diff --git a/UnitDebug.dfm b/UnitDebug.dfm index bff58ab..42827db 100644 --- a/UnitDebug.dfm +++ b/UnitDebug.dfm @@ -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 diff --git a/UnitDebug.pas b/UnitDebug.pas index af0269d..3136932 100644 --- a/UnitDebug.pas +++ b/UnitDebug.pas @@ -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 @@ -140,9 +146,9 @@ begin s:=SaveDialog.FileName; assignFile(fte,s); rewrite(fte); - writeln(fte,s); + 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. diff --git a/UnitPrinc.dcu b/UnitPrinc.dcu index 2b6d359..3670a2a 100644 Binary files a/UnitPrinc.dcu and b/UnitPrinc.dcu differ diff --git a/UnitPrinc.dfm b/UnitPrinc.dfm index 69b5ea2..a2b4073 100644 --- a/UnitPrinc.dfm +++ b/UnitPrinc.dfm @@ -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 diff --git a/UnitPrinc.pas b/UnitPrinc.pas index 2eb7bb8..c1dc218 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -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 A:='Z'; Adr:=BrancheN[branche_trouve_actuel,indexBranche_actuel+1].Adresse; 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; exit; end; @@ -3899,7 +3909,12 @@ begin A:='Z'; Adr:=BrancheN[branche_trouve_actuel,indexBranche_actuel-1].Adresse; 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; exit; end; @@ -4583,12 +4598,30 @@ begin begin detecteur_suivant_el:=Adr; exit; - end; - if NivDebug=3 then AfficheDebug('trouvé 2:'+intToSTR(Adr)+' '+intToSTR(typeGen),clorange); + 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'; + 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 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; BisPrec:=BisFonc;BisFonc:=typeGen; inc(i); @@ -4662,6 +4695,7 @@ end; // renvoie l'état du signal suivant // si renvoie 0, pas trouvé le signal suivant. // 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 ; var num_feu,AdrDet,etat,AdrFeu,i,j,prec,AdrSuiv : integer; TypePrec,TypeActuel : integer; @@ -4684,6 +4718,7 @@ begin begin Affiche('Erreur 600 - feu non trouvé',clred); etat_signal_suivant:=0; + AdresseFeuSuivant:=0; exit; end; Etat:=0; @@ -4695,6 +4730,7 @@ begin begin Affiche('Msg 601 - feu '+intToSTR(adresse)+' non renseigné ',clOrange); etat_signal_suivant:=0; + AdresseFeuSuivant:=0; exit; end; TypePrec:=1; // détecteur @@ -4723,12 +4759,14 @@ begin if (AdrSuiv=9999) then begin Etat_signal_suivant:=0; + AdresseFeuSuivant:=0; exit; end; if (AdrSuiv=0) then begin 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é + AdresseFeuSuivant:=0; exit; end; @@ -4752,6 +4790,7 @@ begin inc(num_feu); Etat:=EtatSignalCplx[AdrFeu]; Signal_suivant:=AdrFeu; + if NivDebug=3 then AfficheDebug('Trouvé feu suivant Adr='+IntToSTR(AdrFeu)+'='+IntToSTR(etat),clOrange); end else @@ -4764,6 +4803,7 @@ begin until (j=10) or ((AdrFeu<>0) and (num_feu=rang)); if etat=0 then Signal_Suivant:=0; 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); //TraceDet:=false; end; @@ -4885,13 +4925,14 @@ begin 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; 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; 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); 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 end; // détecteur sur le signal courant - Detecteur_precedent:=prec; TypePrec:=1; if (prec=0) then begin @@ -4950,44 +4990,41 @@ begin 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); - AdrSuiv:=actuel; - actuel:=prec; - TypePrec:=1; - TypeActuel:=1; - //TypeGen:=1; - Pres_train:=MemZone[prec,actuel]; + Pres_train:=MemZone[Prec,actuel]; if Pres_Train and (NivDebug=3) then Affiche('Présence train de '+intToSTR(prec)+' à '+intToSTR(actuel),clyellow); - Detecteur_precedent:=actuel; end else begin AdrSuiv:=suivant_alg3(prec,TypePrec,actuel,TypeActuel,1); - //AfficheDebug('A:'+IntToSTR(BisActuel); prec:=actuel;TypePrec:=TypeActuel; actuel:=AdrSuiv;TypeActuel:=typeGen; 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 // si c'est un buttoir test_memoire_zones:=false; + if NivDebug=3 then AfficheDebug('sortie car buttoir',clyellow); exit; 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; if (TypeActuel=1) then // détecteur 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 - Detecteur_precedent:=actuel; // pour préparer le suivant + Pres_train:=MemZone[PrecInitial][actuel] or Pres_train; // mémoire de zone + 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 AdrFeu:=feux[i].adresse; // adresse du feu @@ -5020,7 +5057,7 @@ begin if (NivDebug=3) then AfficheDebug('Trouvé aiguillage '+intToSTR(AdrSuiv),clyellow); end; 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); until ife>=5; if (NivDebug=3) and (Etat=0) then AfficheDebug('Pas trouvé de signal suivant au '+intToSTR(adresse),clyellow); @@ -5080,7 +5117,7 @@ begin inc(i); repeat 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)); if trouve then begin @@ -5195,6 +5232,7 @@ begin // trouvé la route si j=2 : - si j=3 : + 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); AdrPrec:=detecteur_suivant_El(det2,1,det1,1); @@ -5205,22 +5243,25 @@ begin 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); + 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 - if (i=0) and TraceListe then AfficheDebug('La memoire prec '+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 (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; 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 //marquer l'adresse précédente comme traitée @@ -5281,6 +5322,7 @@ begin end; s:='train '+IntToSTR(Train_Courant)+' Mem '+IntToSTR(det2)+' à '+IntTOStr(AdrSuiv); Affiche(s,clyellow); + if AffAigDet then AfficheDebug(s,clyellow); // et effacer le premier détecteur de la route (det1) i:=1; @@ -5342,7 +5384,8 @@ begin // signal non directionnel 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 if (AdrFeu=201) then begin @@ -5479,11 +5522,11 @@ begin else begin // 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 else - // aiguille locale non déviée + // aiguille locale non déviée ou aspect feu<9 // si le signal suivant est rouge begin if AffSignal then AfficheDebug('pas d''aiguille déviée',clYellow); @@ -5784,27 +5827,27 @@ begin // on reçoit un doublon dans deux index consécutifs. if N_Event_tick>=1 then 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[i].etat=etat01) and (event_det_tick[i].detecteur=Adresse) then exit; // déja stocké + 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); + Affiche(s,clyellow); + 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 - //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 if (N_Event_tickAdresse 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 if AvecTCO then @@ -5859,9 +5924,17 @@ end; // évènement d'aiguillage procedure Event_Aig(adresse,pos : integer); +var s: string; begin + aiguillage[adresse].position:=pos; if (N_Event_tick0 then 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 end; // evt aiguillage ? if Tablo_simule[i_simule].aiguillage<>0 then begin - Affiche('Simulation 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 + 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 begin Index_Simule:=0; // fin de simulation + I_Simule:=0; MsgSim:=false; Affiche('Fin de simulation',Cyan); end; @@ -6957,8 +7036,8 @@ begin begin s:='Dét '+intToSTR(Adresse_detecteur[j])+'='; if Detecteur[adresse_detecteur[j]] then s:=s+'1' else s:=s+'0'; - s:=s+' Mem='; - if Mem[adresse_detecteur[j]] then s:=s+'1' else s:=s+'0'; + //s:=s+' Mem='; + //if Mem[adresse_detecteur[j]] then s:=s+'1' else s:=s+'0'; Affiche(s,clYellow); end; end; @@ -7006,10 +7085,8 @@ begin ' 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); - end - else - s:=s+' absent'; - Affiche(s,clYellow); + Affiche(s,clYellow); + end; end; for i:=1 to MaxAiguillage do @@ -7026,11 +7103,8 @@ begin ' 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); - end - else - s:=s+' absent'; - - Affiche(s,clYellow); + Affiche(s,clYellow); + end; end; end; @@ -7107,15 +7181,15 @@ begin // aiguillage normal if aiguillage[adr].modele=1 then - begin + begin + //Affiche('Normal',clyellow); if etat=0 then etatAig:=2 else etatAig:=1; - aiguillage[adr].position:=etatAig; - aiguillageB[adr].position:=etatAig; Event_Aig(adr,etatAig); end; // TJD TJS if (aiguillage[adr].modele=2) or (aiguillage[adr].modele=3) then begin + //Affiche('TJDS',clyellow); adr2:=aiguillage[adr].Apointe; // 2eme adresse de la TJD case etat of 1 : begin etatAig:=1;EtatAig2:=2;end; @@ -7123,21 +7197,19 @@ begin 5 : begin etatAig:=2;EtatAig2:=1;end; 0 : begin etatAig:=2;EtatAig2:=2;end; end; - aiguillage[adr].position:=etatAig;aiguillage[adr2].position:=etatAig2; Event_Aig(adr,etatAig); Event_Aig(adr2,etatAig2); end; if aiguillage[adr].modele=4 then // aiguillage triple begin + //Affiche('Triple',clyellow); // état de l'aiguillage 1 if (etat=0) or (etat=2) then etatAig:=2; if etat=3 then etatAig:=1; - aiguillage[adr].Position:=etatAig; // état de l'aiguillage 2 adr2:=aiguillage[adr].AdrTriple; if (etat=0) or (etat=3) then etatAig2:=2; if etat=2 then etatAig2:=1; - aiguillage[adr2].Position:=etatAig2; Event_Aig(adr,etatAig); Event_Aig(adr2,etatAig2); end; @@ -7158,7 +7230,7 @@ begin Delete(recuCDM,j,i+5-j); val(ss,etat,erreur); 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); end ; @@ -7231,21 +7303,26 @@ begin for i:=1 to NbreFeux do begin // 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); if feux[i].aspect<10 then begin - s:=s+' SIG Nombre 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+' 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 s:=s+' Cible unisemaf='+intToSTR(feux[i].Unisemaf); end else // feu directionnel 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; for j:=1 to NfeuxDir+1 do begin @@ -7279,8 +7356,8 @@ begin 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.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; procedure TFormPrinc.ClientSocketLenzDisconnect(Sender: TObject; @@ -7293,27 +7370,30 @@ procedure TFormPrinc.ChronoDetectClick(Sender: TObject); var i,j,etat : integer; s : string; 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 begin //for j:=1 to 1100 do begin - etat:=event_det_tick[i].etat; - if etat<>-1 then + j:=event_det_tick[i].detecteur; + if j<>-1 then begin - j:=event_det_tick[i].detecteur; 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); Affiche(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); - 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); end; end; @@ -7324,7 +7404,6 @@ end; procedure TFormPrinc.FichierSimuClick(Sender: TObject); begin FormSimulation.showModal; - //TraceListe:=true; end; procedure TFormPrinc.ButtonEcrCVClick(Sender: TObject); @@ -7492,6 +7571,68 @@ begin 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; + Affiche('Fin de simulation',Cyan); +end; + begin end. diff --git a/UnitSimule.dcu b/UnitSimule.dcu index 066947c..2ab4e0a 100644 Binary files a/UnitSimule.dcu and b/UnitSimule.dcu differ diff --git a/UnitSimule.dfm b/UnitSimule.dfm index 0015063..b0f9e00 100644 --- a/UnitSimule.dfm +++ b/UnitSimule.dfm @@ -44,6 +44,7 @@ object FormSimulation: TFormSimulation Height = 21 TabOrder = 1 Text = '1' + OnChange = EditIntervalleChange OnKeyPress = EditIntervalleKeyPress end object OpenDialog: TOpenDialog diff --git a/UnitSimule.pas b/UnitSimule.pas index d58f4c1..b89cab5 100644 --- a/UnitSimule.pas +++ b/UnitSimule.pas @@ -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; + 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. diff --git a/UnitTCO.dcu b/UnitTCO.dcu index 34b8b97..2c852cb 100644 Binary files a/UnitTCO.dcu and b/UnitTCO.dcu differ diff --git a/UnitTCO.dfm b/UnitTCO.dfm index 60b0f02..9ca69ed 100644 --- a/UnitTCO.dfm +++ b/UnitTCO.dfm @@ -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 diff --git a/UnitTCO.pas b/UnitTCO.pas index fd0b8aa..ab8e6e4 100644 --- a/UnitTCO.pas +++ b/UnitTCO.pas @@ -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. diff --git a/verif_version.dcu b/verif_version.dcu index 95c665f..d32beed 100644 Binary files a/verif_version.dcu and b/verif_version.dcu differ diff --git a/verif_version.pas b/verif_version.pas index c9ff221..89db25a 100644 --- a/verif_version.pas +++ b/verif_version.pas @@ -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;