diff --git a/ConfigGenerale.cfg b/ConfigGenerale.cfg index 8bb1dd8..d1e641f 100644 --- a/ConfigGenerale.cfg +++ b/ConfigGenerale.cfg @@ -1,23 +1,27 @@ / Fichier de configuration de signaux_complexes_GL +Algo_localisation=1 +Avec_roulage=1 +Debug=0 +Filtrage_det=3 Fonte=12 -Protocole=2 +Protocole=1 IpV4_PC=127.0.0.1:9999 Ipv4_interface=192.168.1.23:5550 MaxCom=30 -Protocole_serie=COMX:115200,N,8,1,0 +Protocole_serie=COM22:115200,N,8,1,0 Inter_car=50 Tempo_maxi=7 -Entete=0 +Entete=1 Init_Aig=0 Init_Dem_Aig=0 -Tempo_Aig=200 +Tempo_Aig=20 Init_demUSBCOM=0 -Init_demETH=0 +Init_demETH=1 Fenetre=0 nb_det_dist=3 verif_version=0 notif_version=0 -TCO=1 +TCO=0 MasqueBandeauTCO=0 CDM=0 Lay=RESEAU_GILY_SIGNAL_AJOUTE.LAY @@ -29,48 +33,51 @@ Nb_cantons_Sig=3 Alg_Unisemaf=1 /------------ [section_aig] -1,P518,D100D,S3P,V30,I0,INIT(2,5) -2,P12S,D519,S100S,V0,I0,INIT(2,5) -3,P1S,D4P,S5D,V0,I0,INIT(2,5) -4,P3D,D6S,S514,V0,I0,INIT(2,5) -5,P515,D3S,S100S,V0,I0,INIT(2,5) -6,P516,D0,S4D,V0,I0,INIT(2,5) -7,P527,D519,S520,V0,I0,INIT(2,5) -8,P527,D521,S522,V0,I0,INIT(2,5) -9,P526,D513,S515,V60,I0,INIT(2,5) -10,P101S,D29P,S528,V30,I0,INIT(2,5) -11,P18P,D30D,S101D,V0,I0,INIT(2,5) -12,P517,D20S,S2P,V0,I0,INIT(1,5) -17,P525,D535,S528,V0,I0,INIT(2,5) -18,P11P,D23P,S517,V0,I0,INIT(1,5) -19,P101D,D22P,S531,V0,I0,INIT(2,5) -20,P520,D21P,S12D,V0,I0,INIT(2,5) -21,P20D,D28D,S28D,V0,I0,INIT(2,5) -22,P19D,D537,S32P,V0,I0,INIT(2,5) -23,P18D,D538,S534,V0,I0,INIT(2,5) -24,P538,D32S,S533,V0,I0,INIT(2,5) -25,P31S,D529,S27P,V0,I0,INIT(2,5) -26TJD,D(530,28D),S(529,28S),V0,I0,INIT(2,5),E4 -27,P25S,D530,S537,V0,I0,INIT(2,5) -28TJD,D(21D,26D),S(21S,26S),V0,I0,INIT(2,5),E4 -29,P10D,D513,S30S,V60,I0,INIT(2,5) -30,P524,D11D,S29S,V0,I0,INIT(2,5) -31,P534,D34D,S25P,V0,I0,INIT(1,5) -32,P22S,D34S,S24D,V0,I0,INIT(1,5) -34,P0,D31D,S32D,V0,I0,INIT(2,5) +1,P518,D100D,S3P,V30,I0,INIT(2,3) +2,P12S,D519,S100S,V0,I0,INIT(1,3) +3,P1S,D4P,S5D,V0,I0,INIT(2,2) +4,P3D,D6S,S514,V0,I0,INIT(1,2) +5,P515,D3S,S100S,V0,I0,INIT(1,2) +6,P516,D0,S4D,V0,I0,INIT(2,2) +7,P527,D519,S520,V0,I0,INIT(2,2) +8,P527,D521,S103S,V0,I0,INIT(1,2) +9,P526,D103D,S515,V60,I0,INIT(1,2) +10,P101S,D29P,S528,V30,I0,INIT(1,2) +11,P18P,D30D,S101D,V0,I0,INIT(1,2) +12,P517,D20S,S2P,V0,I0,INIT(1,2) +17,P525,D535,S528,V0,I0,INIT(1,4) +18,P11P,D23P,S102S,V0,I0,INIT(1,2) +19,P101D,D22P,S531,V0,I0,INIT(1,2) +20,P520,D21P,S12D,V0,I0,INIT(2,2) +21,P20D,D28D,S28D,V0,I0,INIT(2,2) +22,P19D,D537,S32P,V0,I0,INIT(2,2) +23,P18D,D538,S534,V0,I0,INIT(2,2) +24,P538,D32S,S533,V0,I0,INIT(2,2) +25,P104S,D529,S27P,V0,I0,INIT(2,2) +26TJD,D(530,28D),S(529,28S),V0,I0,INIT(2,2),E4 +27,P25S,D530,S537,V0,I0,INIT(2,2) +28TJD,D(21D,26D),S(21S,26S),V0,I0,INIT(2,2),E4 +29,P10D,D513,S30S,V60,I0,INIT(2,2) +30,P524,D11D,S29S,V0,I0,INIT(2,2) +31,P534,D34D,S104S,V0,I0,INIT(1,2) +32,P22S,D34S,S24D,V0,I0,INIT(1,2) +34,P0,D31D,S32D,V0,I0,INIT(2,2) 100CROI,D(1D,523Z),S(2S,5S) 101CROI,D(11S,525Z),S(19P,10P) +102CROI,D(22P,10D),S(517,18S) +103CROI,D(513,9D),S(522,8S) +104CROI,D(0,32D),S(25P,31S) 0 /------------ [section_branches] -A2,A12,517,A18,A11,A30,524,521,A8,527,A7,519,A2 +A2,A12,517,A102,A18,A11,A30,524,521,A8,527,A7,519,A2 A7,520,A20,A12 -A1,A3,A4,514,522,A8 -A1,A100,523,526,A9,513,A29,A10,A101,A19,531,518,A1 +A1,A3,A4,514,522,A103,A8 +A1,A100,523,526,A9,A103,513,A29,A10,A101,A19,531,518,A1 A9,515,A5 A11,A101,525,A17,528,A10 A17,535,533,A24,538,A23 -A7,520,A20,A21,A28,A26,530,A27,A25,A31,534,A23,A18 +A7,520,A20,A21,A28,A26,530,A27,A25,A104,A31,534,A23,A18 A26,529,A25 A22,537,A27 A22,A32,A24 @@ -79,21 +86,19 @@ A31,A34,0 0 /------------ [section_sig] -500,4,0,5,(527,A8),0,FVC0,FRC0,(A12S),MOT(90,85,149,153,105,0,0,0,101,165,0,0,0,0,0,0,0,0,0),NA5 -510,9,0,2,(530,A26),0,FVC0,FRC0,(A100D,A5S),MOT(8,1,0,4,0,0,0,0,2,0,16,0,0,32,0,0,0,0,0),NA3 176,7,0,1,(520,A20),0,FVC0,FRC0 190,7,0,1,(523,526),0,FVC0,FRC0 204,9,0,1,(527,A7),1,FVC0,FRC0 218,7,0,1,(525,A17),0,FVC0,FRC0 232,2,1,1,(516,A6),0,FVC0,FRC0 -260,9,1,1,(518,A1),1,FVC0,FRC0 +520,9,1,1,(518,A1),1,FVC0,FRC0 274,3,0,1,(524,521),0,FVC0,FRC0 -288,7,0,1,(522,A8),1,FVC0,FRC0 +288,7,0,1,(522,A103),1,FVC0,FRC0 302,9,0,1,(526,A9),1,FVC0,FRC0 316,7,1,1,(515,A5),1,FVC0,FRC0 330,7,0,1,(519,A2),1,FVC0,FRC0 344,9,0,1,(528,A10),1,FVC0,FRC0 -358,9,0,1,(517,A18),1,FVC0,FRC0 +358,9,0,1,(517,A102),1,FVC0,FRC0 372,D3,1,(A10D)(A19S)(A19D,A22D)(A19D,A22S) 382,D3,1,(A29S,A10S)(A19S)(A19D,A22D)(A19D,A22S) 392,3,0,1,(535,533),1,FVC0,FRC0 @@ -104,7 +109,6 @@ A31,A34,0 476,9,0,1,(538,A23),1,FVC0,FRC0 497,9,0,4,(531,A19),1,FVC0,FRC0 600,7,0,0,(521,A8),1,FVC0,FRC0 -1001,9,0,7,(529,A26),1,FVC0,FRC1,(A21S,A6D),(A1S),(A3D),SR(3,5,2,4,0,0,0,0,0,0,0,0,3,0,0,0) 0 /------------ [section_act] @@ -127,3 +131,21 @@ AdrBaseDetDccpp=513 <1> 0 +/------------ +[section_trains] +TrainElectrique,11,110,40,30 +BB25531,1,120,50,40 +TGV,2,120,50,30 +BB16024,3,120,60,50 +CC406526,4,120,80,70 +CAMERA,10,120,0,0 +0 +/------------ +[section_placement] +TRAINELECTRIQUE,0,0,0 +BB25531,0,0,0 +TGV,0,0,0 +BB16024,523,526,0 +CC406526,528,531,0 +CAMERA,0,0,0 +0 diff --git a/Notice d'utilisation des signaux_complexes_GL_V5.3.pdf b/Notice d'utilisation des signaux_complexes_GL_V5.4.pdf similarity index 73% rename from Notice d'utilisation des signaux_complexes_GL_V5.3.pdf rename to Notice d'utilisation des signaux_complexes_GL_V5.4.pdf index 597e8c7..f298af2 100644 Binary files a/Notice d'utilisation des signaux_complexes_GL_V5.3.pdf and b/Notice d'utilisation des signaux_complexes_GL_V5.4.pdf differ diff --git a/Signaux_complexes_GL.exe b/Signaux_complexes_GL.exe deleted file mode 100644 index 21cace5..0000000 Binary files a/Signaux_complexes_GL.exe and /dev/null differ diff --git a/UnitCDF.dcu b/UnitCDF.dcu index 15e6f68..c0d4f49 100644 Binary files a/UnitCDF.dcu and b/UnitCDF.dcu differ diff --git a/UnitConfig.dcu b/UnitConfig.dcu index d695338..4d18988 100644 Binary files a/UnitConfig.dcu and b/UnitConfig.dcu differ diff --git a/UnitConfig.dfm b/UnitConfig.dfm index decce34..add9ec0 100644 --- a/UnitConfig.dfm +++ b/UnitConfig.dfm @@ -1570,7 +1570,7 @@ object FormConfig: TFormConfig Top = 8 Width = 633 Height = 505 - ActivePage = TabSheetCDM + ActivePage = TabSheetAutonome Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 @@ -2126,41 +2126,38 @@ object FormConfig: TFormConfig Left = 312 Top = 8 Width = 297 - Height = 81 + Height = 49 BevelInner = bvLowered BevelKind = bkFlat BorderStyle = bsNone Lines.Strings = ( - '1. Port COM de l'#39'adresse USB de l'#39'interface XpressNet.' - 'Attention de COM1 '#224' 30 - Si le port de l'#39'interface USB>30, il ' - 'faut le changer manuellement dans le gestionnaire des ' - 'p'#233'riph'#233'riques. Si COMX : Signaux complexes d'#233'tecte le' - 'port automatiquement (mais le d'#233'marrage est plus long)') + '1. Port COM de l'#39'adresse USB de l'#39'interface XpressNet. ' + 'COM de 1 '#224' 99 - Si COMX : Signaux complexes d'#233'tecte le ' + 'port automatiquement (mais le d'#233'marrage est plus long)' + ' ') ReadOnly = True TabOrder = 3 end object Memo2: TMemo Left = 312 - Top = 96 + Top = 64 Width = 297 - Height = 97 + Height = 73 BevelInner = bvLowered BevelKind = bkFlat BorderStyle = bsNone Lines.Strings = ( '2. Valeur de temporisation entre deux octets transf'#233'r'#233's '#224' ' 'l'#39'interface. Elle peut '#234'tre nulle. ' - 'Pour les interfaces s'#233'rie sans protocole (0) comme le ' - 'GENLI, il est conseill'#233' de la positionner '#224' une valeur de ' - 'l'#39'ordre de 30 (ms). ' - 'Pour les interfaces avec protocole mat'#233'riel RTS-CTS (2) ' - 'cette variable est ignor'#233'e.') + 'Pour les interfaces s'#233'rie sans protocole (0) comme le GENLI, il ' + 'est conseill'#233' de mettre 30 (ms). Pour les interfaces avec ' + 'protocole mat'#233'riel RTS-CTS (2) cette variable est ignor'#233'e.') ReadOnly = True TabOrder = 4 end object Memo3: TMemo Left = 312 - Top = 200 + Top = 144 Width = 297 Height = 89 BevelInner = bvLowered @@ -2169,8 +2166,8 @@ object FormConfig: TFormConfig Lines.Strings = ( '3. Valeur maximale par tranche de 100 ms qui d'#233'finit le temps ' 'd'#39'attente de la r'#233'ponse de l'#39'interface apr'#232's ' - 'une trame qui lui est transf'#233'r'#233'e. ' - 'Cette valeur est '#224' tester en fonction de votre interface. ' + 'une trame qui lui est transf'#233'r'#233'e. Cette valeur est '#224' tester en ' + 'fonction de votre interface. ' 'En cas de d'#233'passement de la valeur, un message '#171' pas de ' 'r'#233'ponse de l'#39'interface '#187' sera affich'#233'.') ReadOnly = True @@ -2178,16 +2175,18 @@ object FormConfig: TFormConfig end object Memo4: TMemo Left = 312 - Top = 296 + Top = 240 Width = 297 - Height = 57 + Height = 49 BevelInner = bvLowered BevelKind = bkFlat BorderStyle = bsNone Lines.Strings = ( - '4. Pour l'#39'utilisation d'#39'interfaces s'#233'rie (GENLI), cette valeur ' - 'doit '#234'tre '#224' 0. Pour les interfaces utilisant nativement de ' - 'l'#39'USB, cette valeur doit '#234'tre '#224' 1. ') + + '4. Pour l'#39'utilisation d'#39'interfaces s'#233'rie (GENLI), cette valeur d' + + 'oit ' + #234'tre '#224' 0. Pour les interfaces utilisant nativement de l'#39'USB, ' + 'cette valeur doit '#234'tre '#224' 1. ') ReadOnly = True TabOrder = 6 end @@ -2300,6 +2299,31 @@ object FormConfig: TFormConfig TabOrder = 1 end end + object GroupBox25: TGroupBox + Left = 312 + Top = 320 + Width = 297 + Height = 49 + Caption = 'Divers' + TabOrder = 9 + object Label58: TLabel + Left = 24 + Top = 24 + Width = 155 + Height = 13 + Caption = 'Filtrage des d'#233'tecteurs (x100 ms)' + end + object EditFiltrDet: TEdit + Left = 224 + Top = 16 + Width = 25 + Height = 21 + Hint = 'Temps de filtrage d'#39'un d'#233'tecteur qui passe '#224' 0' + ParentShowHint = False + ShowHint = True + TabOrder = 0 + end + end end object TabSheetAig: TTabSheet Caption = 'Aiguillages' diff --git a/UnitConfig.pas b/UnitConfig.pas index 7e9443a..d6cb673 100644 --- a/UnitConfig.pas +++ b/UnitConfig.pas @@ -318,6 +318,9 @@ type EditVitNom: TEdit; LabelInfVitesse: TLabel; CheckRoulage: TCheckBox; + GroupBox25: TGroupBox; + Label58: TLabel; + EditFiltrDet: TEdit; procedure ButtonAppliquerEtFermerClick(Sender: TObject); procedure FormActivate(Sender: TObject); procedure FormCreate(Sender: TObject); @@ -469,6 +472,7 @@ const // constantes du fichier de configuration NomConfig='ConfigGenerale.cfg'; Debug_ch='Debug'; +Filtrage_det_ch='Filtrage_det'; Algo_localisation_ch='Algo_localisation'; Avec_roulage_ch='Avec_roulage'; nb_det_dist_ch='nb_det_dist'; @@ -677,6 +681,8 @@ begin envoi_CDM(s); sleep(10); Application.ProcessMessages; + SauvefiltrageDet0:=filtrageDet0; + filtrageDet0:=0; end; end; //else Affiche('CDM Rail non lancé',clOrange); @@ -752,9 +758,10 @@ begin end; end; - i:=pos(':',sa); - val(copy(sa,4,i-1),Numport,erreur); - config_com:=not( (copy(sa,1,3)<>'COM') or (NumPort>MaxPortCom) or (prot_serie=-1) or (prot_serie>4) or (i=0) ); + i:=pos('COM',sa); + if i<>0 then delete(sa,1,3); + val(sa,Numport,erreur); + config_com:=not( (i=0) or (NumPort>MaxPortCom) or (prot_serie=-1) or (prot_serie>4) or (i=0) ); end; // transforme l'aiguillage de la base de données aiguillage en texte @@ -1381,6 +1388,7 @@ begin writeln(fichierN,Algo_localisation_ch+'=',Algo_localisation); writeln(fichierN,Avec_roulage_ch+'=',avecRoulage); writeln(fichierN,debug_ch+'=',debug); + writeln(fichierN,Filtrage_det_ch+'=',filtrageDet0); // taille de la fonte writeln(fichierN,Fonte_ch+'=',TailleFonte); FormPrinc.FenRich.Font.Size:=TailleFonte; @@ -2310,6 +2318,14 @@ begin val(s,debug,erreur); end; + sa:=uppercase(Filtrage_det_ch)+'='; + i:=pos(sa,s); + if i=1 then + begin + delete(s,i,length(sa)); + val(s,filtrageDet0,erreur); + end; + sa:=uppercase(Algo_localisation_ch)+'='; i:=pos(sa,s); if i=1 then @@ -2408,6 +2424,7 @@ begin trouve_PROTOCOLE_SERIE:=true; delete(s,i,length(sa)); if not(config_com(s)) then Affiche('Erreur port com mal déclaré : '+s,clred); + if (NumPort>MaxPortCom) then Affiche('Le port com est supérieur au nombre de COMx à explorer dans le fichier de configuraion',clred); portcom:=s; end; @@ -2960,6 +2977,10 @@ begin changeInterface:=changeInterface or (i<>portinterface); portInterface:=i; + val(EditFiltrDet.Text,i,erreur); + if (i<0) or (i>10) then i:=3; + filtrageDet0:=i; + Val(editTempoAig.Text,i,erreur); if i>3000 then begin labelInfo.Caption:='Temporisation de séquencement incorrecte ';ok:=false;end; Tempo_Aig:=i; @@ -3136,10 +3157,6 @@ var i :integer; s : string; begin if affevt then affiche('FormConfig activate',clLime); - Aig_supprime.Adresse:=0; - Feu_Supprime.Adresse:=0; - Feu_sauve.adresse:=0; - clicListe:=false; Edit_HG.Visible:=false; labelHG.Visible:=false; @@ -3174,6 +3191,7 @@ begin EditIPLenz.text:=AdresseIP; EditportLenz.text:=IntToSTR(PortInterface); EditTempoAig.Text:=IntToSTR(Tempo_Aig); + EditFiltrDet.text:=intToSTR(filtrageDet0); EditComUSB.Text:=PortCom; EditFonte.text:=IntToSTR(TailleFonte); @@ -3370,6 +3388,9 @@ begin clicListe:=true; if affevt then affiche('FormConfig create',clLime); PageControl.ActivePage:=Formconfig.TabSheetCDM; // force le premier onglet sur la page + Aig_supprime.Adresse:=0; + Feu_Supprime.Adresse:=0; + Feu_sauve.adresse:=0; clicListe:=false; if AvecRoulage=1 then LabelInfVitesse.Visible:=false else LabelInfVitesse.Visible:=true; ConfigPrete:=true; @@ -9254,6 +9275,10 @@ end; + + + + end. diff --git a/UnitConfigCellTCO.dcu b/UnitConfigCellTCO.dcu index 291daa5..e5cada5 100644 Binary files a/UnitConfigCellTCO.dcu and b/UnitConfigCellTCO.dcu differ diff --git a/UnitConfigCellTCO.dfm b/UnitConfigCellTCO.dfm index 8930ca4..c6dce62 100644 --- a/UnitConfigCellTCO.dfm +++ b/UnitConfigCellTCO.dfm @@ -74,13 +74,13 @@ object FormConfCellTCO: TFormConfCellTCO TabOrder = 1 OnClick = ButtonFonteClick end - object EditTexte: TEdit + object EditTexteCCTCO: TEdit Left = 8 Top = 16 Width = 209 Height = 24 TabOrder = 2 - OnChange = EditTexteChange + OnChange = EditTexteCCTCOChange end end object GroupBox2: TGroupBox diff --git a/UnitConfigCellTCO.pas b/UnitConfigCellTCO.pas index 3c8c564..27a463e 100644 --- a/UnitConfigCellTCO.pas +++ b/UnitConfigCellTCO.pas @@ -13,7 +13,7 @@ type ComboRepr: TComboBox; Label1: TLabel; ButtonFonte: TButton; - EditTexte: TEdit; + EditTexteCCTCO: TEdit; GroupBox2: TGroupBox; Label15: TLabel; EditTypeImage: TEdit; @@ -31,7 +31,7 @@ type procedure ButtonOkClick(Sender: TObject); procedure EditTypeImageKeyPress(Sender: TObject; var Key: Char); procedure EditAdrElementChange(Sender: TObject); - procedure EditTexteChange(Sender: TObject); + procedure EditTexteCCTCOChange(Sender: TObject); procedure ButtonFonteClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure ComboReprChange(Sender: TObject); @@ -65,11 +65,12 @@ procedure actualise; var Bimage : integer; oriente,piedFeu : integer; begin - actualize:=true; // évite les évènemebts parasites + actualize:=true; // évite les évènements parasites FormConfCellTCO.caption:='Propriétés de la cellule '+IntToSTR(XClicCell)+','+intToSTR(YClicCell); Bimage:=TCO[XClicCell,YClicCell].Bimage; formConfCellTCO.EditTypeImage.Text:=intToSTR(Bimage); + // si signal if Bimage<30 then With formConfCellTCO.ImagePalette do begin @@ -78,6 +79,7 @@ begin Transparent:=false; end; + // si pas signal if Bimage<>30 then with formConfCellTCO do begin @@ -88,6 +90,7 @@ begin RadioButtonD.Enabled:=false; end; + //mettre l'image de la cellule cliquée dans l'icone de la fenetre de config cellule with formConfCellTCO.ImagePalette.Picture do case Bimage of 1: Assign(FormTCO.ImagePalette1.Picture); @@ -181,7 +184,7 @@ begin with formConfCellTCO do begin - EditTexte.Text:=Tco[XClicCell,YClicCell].Texte; + EditTexteCCTCO.Text:=Tco[XClicCell,YClicCell].Texte; EditAdrElement.Text:=IntToSTR(tco[XClicCellInserer,YClicCellInserer].Adresse); ComboRepr.ItemIndex:=tco[XClicCell,yClicCell].repr; end; @@ -245,7 +248,7 @@ begin end; -procedure TFormConfCellTCO.EditTexteChange(Sender: TObject); +procedure TFormConfCellTCO.EditTexteCCTCOChange(Sender: TObject); begin PCanvasTCO.Brush.Color:=fond; @@ -254,11 +257,11 @@ begin Tco[XClicCell,YClicCell].CoulFonte:=clTexte; Tco[XClicCell,YClicCell].TailleFonte:=8; end; - Tco[XClicCell,YClicCell].Texte:=EditTexte.Text; - TCO_modifie:=true; + Tco[XClicCell,YClicCell].Texte:=EditTexteCCTCO.Text; + if not(clicTCO) then TCO_modifie:=true; if not(selectionaffichee) then efface_entoure; affiche_texte(XClicCell,YClicCell); - formTCO.EditTexte.Text:=EditTexte.text; + formTCO.EditTexte.Text:=EditTexteCCTCO.text; if not(selectionaffichee) then _entoure_cell_clic; end; diff --git a/UnitConfigTCO.dcu b/UnitConfigTCO.dcu index 35986f3..56277f1 100644 Binary files a/UnitConfigTCO.dcu and b/UnitConfigTCO.dcu differ diff --git a/UnitDebug.dcu b/UnitDebug.dcu index cc4e553..d6825ba 100644 Binary files a/UnitDebug.dcu and b/UnitDebug.dcu differ diff --git a/UnitDebug.dfm b/UnitDebug.dfm index 90392af..192a7b5 100644 --- a/UnitDebug.dfm +++ b/UnitDebug.dfm @@ -1,9 +1,8 @@ object FormDebug: TFormDebug Left = 306 Top = 21 - Width = 856 + Width = 864 Height = 721 - VertScrollBar.Position = 6 VertScrollBar.Smooth = True VertScrollBar.Tracking = True Caption = 'Fen'#234'tre de d'#233'bug' @@ -21,13 +20,13 @@ object FormDebug: TFormDebug OnCreate = FormCreate OnKeyPress = FormKeyPress DesignSize = ( - 831 + 839 690) PixelsPerInch = 96 TextHeight = 13 object Label1: TLabel - Left = 666 - Top = -2 + Left = 674 + Top = 4 Width = 108 Height = 13 Anchors = [akTop, akRight] @@ -42,8 +41,8 @@ object FormDebug: TFormDebug ParentFont = False end object Label2: TLabel - Left = 514 - Top = -4 + Left = 522 + Top = 2 Width = 131 Height = 18 Anchors = [akTop, akRight] @@ -56,8 +55,8 @@ object FormDebug: TFormDebug ParentFont = False end object EditNivDebug: TEdit - Left = 777 - Top = -4 + Left = 785 + Top = 2 Width = 49 Height = 21 Anchors = [akTop, akRight] @@ -72,8 +71,8 @@ object FormDebug: TFormDebug OnKeyPress = EditNivDebugKeyPress end object ButtonEcrLog: TButton - Left = 441 - Top = 322 + Left = 449 + Top = 328 Width = 97 Height = 29 Anchors = [akTop, akRight] @@ -82,8 +81,8 @@ object FormDebug: TFormDebug OnClick = ButtonEcrLogClick end object ButtonRazTampon: TButton - Left = 441 - Top = 354 + Left = 449 + Top = 360 Width = 97 Height = 33 Anchors = [akTop, akRight] @@ -93,8 +92,8 @@ object FormDebug: TFormDebug OnClick = ButtonRazTamponClick end object ButtonCherche: TButton - Left = 441 - Top = 290 + Left = 449 + Top = 296 Width = 97 Height = 25 Anchors = [akTop, akRight] @@ -103,8 +102,8 @@ object FormDebug: TFormDebug OnClick = ButtonChercheClick end object ButtonAffEvtChrono: TButton - Left = 441 - Top = 250 + Left = 449 + Top = 256 Width = 97 Height = 33 Anchors = [akTop, akRight] @@ -114,8 +113,8 @@ object FormDebug: TFormDebug OnClick = ButtonAffEvtChronoClick end object ButtonCop: TButton - Left = 441 - Top = 202 + Left = 449 + Top = 208 Width = 97 Height = 41 Anchors = [akTop, akRight] @@ -130,39 +129,20 @@ object FormDebug: TFormDebug WordWrap = True OnClick = ButtonCopClick end - object RichEdit: TRichEdit - Left = 546 - Top = 170 - Width = 270 - Height = 153 - Anchors = [akTop, akRight] - Font.Charset = DEFAULT_CHARSET - Font.Color = clWhite - Font.Height = -11 - Font.Name = 'Arial' - Font.Style = [] - HideScrollBars = False - ParentFont = False - PopupMenu = PopupMenuRE - ReadOnly = True - ScrollBars = ssVertical - TabOrder = 6 - OnChange = RichEditChange - end object ButtonRazLog: TButton - Left = 441 - Top = 394 + Left = 449 + Top = 400 Width = 97 Height = 33 Anchors = [akTop, akRight] Caption = 'Raz Tampon Log <-----' - TabOrder = 7 + TabOrder = 6 WordWrap = True OnClick = ButtonRazLogClick end object GroupBox1: TGroupBox - Left = 447 - Top = 634 + Left = 455 + Top = 600 Width = 372 Height = 185 Anchors = [akTop, akRight] @@ -175,7 +155,7 @@ object FormDebug: TFormDebug Font.Style = [] ParentColor = False ParentFont = False - TabOrder = 8 + TabOrder = 7 object GroupBox3: TGroupBox Left = 8 Top = 16 @@ -309,8 +289,8 @@ object FormDebug: TFormDebug end end object GroupBox2: TGroupBox - Left = 439 - Top = 14 + Left = 447 + Top = 20 Width = 380 Height = 149 Anchors = [akTop, akRight] @@ -323,7 +303,7 @@ object FormDebug: TFormDebug Font.Style = [] ParentColor = False ParentFont = False - TabOrder = 9 + TabOrder = 8 object CheckAffSig: TCheckBox Left = 8 Top = 16 @@ -482,20 +462,20 @@ object FormDebug: TFormDebug end object RichDebug: TRichEdit Left = 8 - Top = 2 - Width = 419 + Top = 8 + Width = 427 Height = 788 Anchors = [akLeft, akTop, akRight] Lines.Strings = ( 'RichDebug') PopupMenu = PopupMenuRD ScrollBars = ssBoth - TabOrder = 10 + TabOrder = 9 OnChange = RichDebugChange end object GroupBox5: TGroupBox - Left = 447 - Top = 522 + Left = 455 + Top = 488 Width = 372 Height = 57 Anchors = [akTop, akRight] @@ -508,7 +488,7 @@ object FormDebug: TFormDebug Font.Style = [] ParentColor = False ParentFont = False - TabOrder = 11 + TabOrder = 10 object EditSimuDet: TEdit Left = 16 Top = 24 @@ -561,8 +541,8 @@ object FormDebug: TFormDebug end end object ButtonRazTout: TButton - Left = 442 - Top = 170 + Left = 450 + Top = 176 Width = 97 Height = 25 Hint = @@ -572,12 +552,12 @@ object FormDebug: TFormDebug Caption = 'RAZ tous trains' ParentShowHint = False ShowHint = True - TabOrder = 12 + TabOrder = 11 OnClick = ButtonRazToutClick end object GroupBox6: TGroupBox - Left = 446 - Top = 586 + Left = 454 + Top = 552 Width = 373 Height = 41 Anchors = [akTop, akRight] @@ -590,7 +570,7 @@ object FormDebug: TFormDebug Font.Style = [] ParentColor = False ParentFont = False - TabOrder = 13 + TabOrder = 12 object Label3: TLabel Left = 16 Top = 16 @@ -653,14 +633,15 @@ object FormDebug: TFormDebug end end object MemoEvtDet: TRichEdit - Left = 548 - Top = 330 + Left = 556 + Top = 174 Width = 265 - Height = 185 + Height = 307 Anchors = [akTop, akRight] Color = clBlack ScrollBars = ssVertical - TabOrder = 14 + TabOrder = 13 + OnChange = MemoEvtDetChange end object SaveDialog: TSaveDialog Left = 768 @@ -671,7 +652,6 @@ object FormDebug: TFormDebug Top = 432 object copier1: TMenuItem Caption = 'copier' - OnClick = copier1Click end end object PopupMenuRD: TPopupMenu diff --git a/UnitDebug.pas b/UnitDebug.pas index f4a3390..5ce9133 100644 --- a/UnitDebug.pas +++ b/UnitDebug.pas @@ -17,7 +17,6 @@ type ButtonCherche: TButton; ButtonAffEvtChrono: TButton; ButtonCop: TButton; - RichEdit: TRichEdit; PopupMenuRE: TPopupMenu; copier1: TMenuItem; ButtonRazLog: TButton; @@ -73,7 +72,6 @@ type procedure CheckBoxTraceLIsteClick(Sender: TObject); procedure CheckTrameClick(Sender: TObject); procedure ButtonCopClick(Sender: TObject); - procedure copier1Click(Sender: TObject); procedure ButtonRazLogClick(Sender: TObject); procedure CheckBoxEvtDetAigClick(Sender: TObject); procedure CheckBoxAffFDClick(Sender: TObject); @@ -88,7 +86,6 @@ type procedure ButtonSimuDet0Click(Sender: TObject); procedure ButtonSimuDet1Click(Sender: TObject); procedure ButtonRazToutClick(Sender: TObject); - procedure RichEditChange(Sender: TObject); procedure MemoEvtDet1Change(Sender: TObject); procedure EditDebugSignalChange(Sender: TObject); procedure CheckBoxTiersClick(Sender: TObject); @@ -101,6 +98,7 @@ type procedure Button0Click(Sender: TObject); procedure FormKeyPress(Sender: TObject; var Key: Char); procedure FormActivate(Sender: TObject); + procedure MemoEvtDetChange(Sender: TObject); private { Déclarations privées } public @@ -115,8 +113,6 @@ var N_Event_tick : integer ; // dernier index - - procedure AfficheDebug(s : string;lacouleur : TColor); procedure AfficheDebug_suivi(s : string;lacouleur : TColor); procedure RE_ColorLine(ARichEdit: TRichEdit; ARow: Integer; AColor: TColor); @@ -139,15 +135,6 @@ begin end; end; -procedure AfficheDebug(s : string;lacouleur : TColor); -begin - if debugAffiche then - with FormDebug.RichDebug do - begin - Lines.add(s); - RE_ColorLine(FormDebug.RichDebug,FormDebug.RichDebug.lines.count-1,lacouleur); - end; -end; procedure affiche_evt(s: string;lacouleur : TColor); begin @@ -159,6 +146,16 @@ begin end; end; +procedure AfficheDebug(s : string;lacouleur : TColor); +begin + if debugAffiche then + with FormDebug.RichDebug do + begin + Lines.add(s); + RE_ColorLine(FormDebug.RichDebug,FormDebug.RichDebug.lines.count-1,lacouleur); + end; +end; + procedure AfficheDebug_suivi(s : string;lacouleur : TColor); var i : integer; begin @@ -177,19 +174,12 @@ var s: string; begin if affevt then affiche('FormDebug create',clLime); EditNivDebug.Text:='0'; - s:='Cette fenêtre permet d''afficher des informations sur le '; - s:=s+'comportement du programme. Positionner le niveau du débug de 1 à 3 pour'; - s:=s+' afficher des informations plus ou moins détaillées.'; - RichEdit.Lines.add(s); RichDebug.WordWrap:=false; // interdit la coupure des chaînes en limite du composant RichDebug.color:=$33; initform:=false; RichDebug.clear; s:=DateToStr(date)+' '+TimeToStr(Time)+' '; - if IsWow64Process then s:=s+' OS 64 Bits' else s:=s+' OS 32 Bits'; - RichEdit.color:=$111122; - RichDebug.Lines.add(s); - Autoscroll:=true; // permet l'affichage de l'ascenseur + Autoscroll:=true; // permet l'affichage de l'ascenseur dans radstudio DebugAffiche:=true; end; @@ -325,13 +315,6 @@ begin RichDebug.Lines:=Formprinc.FenRich.lines; end; -procedure TFormDebug.copier1Click(Sender: TObject); -begin - RichEdit.SelectAll; - RichEdit.CopyToClipboard; - RichEdit.SetFocus; -end; - procedure TFormDebug.ButtonRazLogClick(Sender: TObject); begin RichDebug.Clear; @@ -408,12 +391,13 @@ end; procedure TFormDebug.Button2Click(Sender: TObject); var Adr,erreur,ancdebug,trainreseve : integer ; + reservetraintiers : boolean; begin Val(EditSigSuiv.Text,Adr,erreur); if erreur<>0 then exit; ancdebug:=NivDebug; NivDebug:=3; Cond_Carre(Adr); - carre_signal(adr,trainreseve); + carre_signal(adr,0,reservetraintiers); NivDebug:=AncDebug; end; @@ -463,11 +447,6 @@ begin Raz_tout; end; -procedure TFormDebug.RichEditChange(Sender: TObject); -begin - SendMessage(RichEdit.handle, WM_VSCROLL, SB_BOTTOM, 0); -end; - procedure TFormDebug.MemoEvtDet1Change(Sender: TObject); begin SendMessage(MemoEvtDet.handle, WM_VSCROLL, SB_BOTTOM, 0); @@ -556,7 +535,7 @@ begin end; // pilotage par USB ou par éthernet de la centrale ------------ - if (hors_tension2=false) and (portCommOuvert or parSocketLenz) then + if (hors_tension=false) and (portCommOuvert or parSocketLenz) then begin groupe:=(adr-1) div 4; fonction:=((adr-1) mod 4)*2 + (sortie-1); @@ -598,7 +577,7 @@ begin end; // pilotage par USB ou par éthernet de la centrale ------------ - if (hors_tension2=false) and (portCommOuvert or parSocketLenz) then + if (hors_tension=false) and (portCommOuvert or parSocketLenz) then begin groupe:=(adr-1) div 4; fonction:=((adr-1) mod 4)*2 + (sortie-1); @@ -622,4 +601,9 @@ begin formDebug.buttonCP.Caption:='Etat '+intToSTR(Nb_cantons_Sig)+' cantons précédents signal'; end; +procedure TFormDebug.MemoEvtDetChange(Sender: TObject); +begin + SendMessage(MemoEvtDet.handle,WM_VSCROLL,SB_BOTTOM,0); +end; + end. diff --git a/UnitPrinc.dcu b/UnitPrinc.dcu index 2616f6d..0c1154f 100644 Binary files a/UnitPrinc.dcu and b/UnitPrinc.dcu differ diff --git a/UnitPrinc.dfm b/UnitPrinc.dfm index 70c105f..3b599c9 100644 --- a/UnitPrinc.dfm +++ b/UnitPrinc.dfm @@ -1,6 +1,6 @@ object FormPrinc: TFormPrinc - Left = 35 - Top = 192 + Left = 64 + Top = 110 Width = 1213 Height = 670 Caption = 'Client TCP-IP CDM Rail ou USB - syst'#232'me LENZ' @@ -14,12 +14,11 @@ object FormPrinc: TFormPrinc OldCreateOrder = False Position = poScreenCenter Scaled = False - ShowHint = True OnClose = FormClose OnCreate = FormCreate DesignSize = ( - 1197 - 612) + 1205 + 619) PixelsPerInch = 96 TextHeight = 13 object LabelTitre: TLabel @@ -895,7 +894,7 @@ object FormPrinc: TFormPrinc end object Image4Dir: TImage Left = 1064 - Top = 136 + Top = 120 Width = 57 Height = 25 Picture.Data = { @@ -1205,13 +1204,13 @@ object FormPrinc: TFormPrinc Left = 632 Top = 192 Width = 546 - Height = 391 + Height = 399 HorzScrollBar.Smooth = True HorzScrollBar.Tracking = True VertScrollBar.Smooth = True VertScrollBar.Tracking = True Anchors = [akTop, akRight, akBottom] - Color = clWhite + Color = clSilver ParentColor = False TabOrder = 0 end @@ -1264,8 +1263,8 @@ object FormPrinc: TFormPrinc end object StatusBar1: TStatusBar Left = 0 - Top = 590 - Width = 1197 + Top = 597 + Width = 1205 Height = 22 Panels = <> SimplePanel = True @@ -1284,9 +1283,29 @@ object FormPrinc: TFormPrinc Left = 904 Top = 5 Width = 282 - Height = 92 + Height = 108 Anchors = [akTop, akRight] TabOrder = 4 + object Label1: TLabel + Left = 136 + Top = 88 + Width = 89 + Height = 13 + Caption = 'Nombre de trains : ' + end + object LabelNbTrains: TLabel + Left = 256 + Top = 84 + Width = 9 + Height = 19 + Caption = '0' + Font.Charset = ANSI_CHARSET + Font.Color = clBlack + Font.Height = -16 + Font.Name = 'Arial' + Font.Style = [fsBold] + ParentFont = False + end object BoutonRaf: TButton Left = 8 Top = 8 @@ -1353,34 +1372,6 @@ object FormPrinc: TFormPrinc OnClick = BoutonRazTrainsClick end end - object Panel2: TPanel - Left = 905 - Top = 104 - Width = 281 - Height = 25 - Anchors = [akTop, akRight] - TabOrder = 5 - object Label1: TLabel - Left = 16 - Top = 4 - Width = 89 - Height = 13 - Caption = 'Nombre de trains : ' - end - object LabelNbTrains: TLabel - Left = 248 - Top = 2 - Width = 9 - Height = 19 - Caption = '0' - Font.Charset = ANSI_CHARSET - Font.Color = clBlack - Font.Height = -16 - Font.Name = 'Arial' - Font.Style = [fsBold] - ParentFont = False - end - end object StaticText: TStaticText Left = 16 Top = 567 @@ -1388,7 +1379,7 @@ object FormPrinc: TFormPrinc Height = 17 Anchors = [akLeft, akBottom] Caption = 'xx' - TabOrder = 6 + TabOrder = 5 end object FenRich: TRichEdit Left = 8 @@ -1406,7 +1397,7 @@ object FormPrinc: TFormPrinc PopupMenu = PopupMenuFenRich ReadOnly = True ScrollBars = ssBoth - TabOrder = 7 + TabOrder = 6 WordWrap = False OnChange = FenRichChange OnMouseDown = FenRichMouseDown @@ -1418,7 +1409,7 @@ object FormPrinc: TFormPrinc Height = 105 Anchors = [akTop, akRight] Caption = 'Variables CV' - TabOrder = 8 + TabOrder = 7 object Label3: TLabel Left = 208 Top = 34 @@ -1480,7 +1471,7 @@ object FormPrinc: TFormPrinc Height = 129 Anchors = [akTop, akRight] Caption = 'Commande aux trains' - TabOrder = 9 + TabOrder = 8 object Label4: TLabel Left = 8 Top = 22 @@ -1509,6 +1500,132 @@ object FormPrinc: TFormPrinc Height = 13 Caption = #224' ' end + object SBMarcheArretLoco: TSpeedButton + Left = 96 + Top = 88 + Width = 73 + Height = 33 + Hint = 'Arr'#234't de tous les trains' + Glyph.Data = { + 020E0000424D020E000000000000360400002800000049000000210000000100 + 080000000000CC090000C40E0000C40E00000001000000000000000000000000 + 80000080000000808000800000008000800080800000C0C0C000C0DCC000F0CA + A6000020400000206000002080000020A0000020C0000020E000004000000040 + 20000040400000406000004080000040A0000040C0000040E000006000000060 + 20000060400000606000006080000060A0000060C0000060E000008000000080 + 20000080400000806000008080000080A0000080C0000080E00000A0000000A0 + 200000A0400000A0600000A0800000A0A00000A0C00000A0E00000C0000000C0 + 200000C0400000C0600000C0800000C0A00000C0C00000C0E00000E0000000E0 + 200000E0400000E0600000E0800000E0A00000E0C00000E0E000400000004000 + 20004000400040006000400080004000A0004000C0004000E000402000004020 + 20004020400040206000402080004020A0004020C0004020E000404000004040 + 20004040400040406000404080004040A0004040C0004040E000406000004060 + 20004060400040606000406080004060A0004060C0004060E000408000004080 + 20004080400040806000408080004080A0004080C0004080E00040A0000040A0 + 200040A0400040A0600040A0800040A0A00040A0C00040A0E00040C0000040C0 + 200040C0400040C0600040C0800040C0A00040C0C00040C0E00040E0000040E0 + 200040E0400040E0600040E0800040E0A00040E0C00040E0E000800000008000 + 20008000400080006000800080008000A0008000C0008000E000802000008020 + 20008020400080206000802080008020A0008020C0008020E000804000008040 + 20008040400080406000804080008040A0008040C0008040E000806000008060 + 20008060400080606000806080008060A0008060C0008060E000808000008080 + 20008080400080806000808080008080A0008080C0008080E00080A0000080A0 + 200080A0400080A0600080A0800080A0A00080A0C00080A0E00080C0000080C0 + 200080C0400080C0600080C0800080C0A00080C0C00080C0E00080E0000080E0 + 200080E0400080E0600080E0800080E0A00080E0C00080E0E000C0000000C000 + 2000C0004000C0006000C0008000C000A000C000C000C000E000C0200000C020 + 2000C0204000C0206000C0208000C020A000C020C000C020E000C0400000C040 + 2000C0404000C0406000C0408000C040A000C040C000C040E000C0600000C060 + 2000C0604000C0606000C0608000C060A000C060C000C060E000C0800000C080 + 2000C0804000C0806000C0808000C080A000C080C000C080E000C0A00000C0A0 + 2000C0A04000C0A06000C0A08000C0A0A000C0A0C000C0A0E000C0C00000C0C0 + 2000C0C04000C0C06000C0C08000C0C0A000F0FBFF00A4A0A000808080000000 + FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFFFF00F60E0E0E0E0E + 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E + 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E + 0EFFFF0000000E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E + 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E + 0E0E0E0E0E0E0E0E0E0E0E0E0E0EFF0000000E0E0E0E0E0E0E0E0E0E0E0E0E0E + 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E + 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0EAF0000000E0E + 0E0E0E0E0E0E0E0E0E0E5FAFAFA70E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E + 0E0E0E0E0E0E0E5FAFAFA70E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E + 0E0E0E0E0E0EAF0000000E0E0E0E0E0E0E0E0E0E5FFFFFFFFFFFFFAF0E0E0E0E + 0E0E0E0E0EFFFF560E0E0E0E0E0E0E0E0E0EFFFFFFFFFFFFA70E0E0E0E0E0EAF + FFEF0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0EAF0000000E0E0E0E0E0E0E0E0E5F + FFFFFFFFFFFFFFFFEF0E0E0E0E0E0E0E0EF6FF560E0E0E0E0E0E0E0E16FFFFFF + FFFFFFFFFFAF0E0E0E0E0EAFFFAF0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0EAF00 + 00000E0E0E0E0E0E0E0E0EFFFFFFF6A75FAFFFFFFF560E0E0E0E0E0E0EF6FF56 + 0E0E0E0E0E0E0E0EFFFFFFEF5E56A7FFFFFF5F0E0E0E0EAFFFAF0E0E0E0E0E0E + 0E0E0E0E0E0E0E0E0E0EAF0000000E0E0E0E0E0E0E0EAFFFFFA70E0E0E0E0EF6 + FFEF0E0E0E0E0E0E0EF6FF560E0E0E0E0E0E0EAFFFFF5F0E0E0E0E0EFFFFFF0E + 0E0E0EAFFFAF0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0EAF0000000E0E0E0E0E0E + 0E0EF6FFEF0E0E0E0E0E0E16FFFF0E0E0E0E0E0E0EF6FF560E0E0E0E0E0E0EFF + FFAF0E0E0E0E0E0E0EFFFFA70E0E0EAFFFAF0E0E0E0E0E0E0E0E0E0E0E0E0E0E + 0E0EEF0000000E0E0E0E0E0E0E0EFFFF0E0E0E0E0E0E0E0EF6FF160E0E0E0E0E + 0EF6FF560E0E0E0E0E0E5FFFFF0E0E0E0E0E0E0E0EEFFFF60E0E0EAFFFAF0E0E + 0E0E0E0E0E0E0E0E0E0E0E0E0E0EEF0000000E0E0E0E0E0E0E56FFFF0E0E0E0E + 0E0E0E0EEFFF560E0E0E0E0E0EF6FF560E0E0E0E0E0EEFFFAF0E0E0E0E0E0E0E + 0E56FFFF0E0E0EAFFFAF0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0EEF0000000E0E + 0E0E0E0E0E5FFFF60E0E0E0E0E0E0E0EF6FF560E0E0E0E0E0EF6FF560E0E0E0E + 0E0EFFFF560E0E0E0E0E0E0E0E0EFFFF5E0E0EAFFFAF0E0E0E0E0E0E0E0E0E0E + 0E0E0E0E0E0EEF0000000E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0EFFFF0E0E + 0E0E0E0E0EF6FF560E0E0E0E0E0EFFFF0E0E0E0E0E0E0E0E0E0EEFFFA70E0EAF + FFAF0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0EEF0000000E0E0E0E0E0E0E0E0E0E + 0E0E0E0E0E0E0EF6FFFF0E0E0E0E0E0E0EF6FF560E0E0E0E0E56FFFF0E0E0E0E + 0E0E0E0E0E0EAFFFEF0E0EAFFFAF0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0EEF00 + 00000E0E0E0E0E0E0E0E0E0E0E0E0E0E0E5FFFFFFFEF0E0E0E0E0E0E0EF6FF56 + 0E0E0E0E0E5FFFF60E0E0E0E0E0E0E0E0E0EA7FFEF0E0EAFFFFFFFFFFFFFFFF6 + A70E0E0E0E0E0E0E0E0EEF0000000E0E0E0E0E0E0E0E0E0E0E0E0EAFFFFFFFFF + FF0E0E0E0E0E0E0E0EF6FF560E0E0E0E0E5FFFF60E0E0E0E0E0E0E0E0E0EA7FF + 080E0EAFFFFFFFFFFFFFFFFFFF080E0E0E0E0E0E0E0EEF0000000E0E0E0E0E0E + 0E0E0E0E0EEFFFFFFFFFFFFF560E0E0E0E0E0E0E0EF6FF560E0E0E0E0E5FFFF6 + 0E0E0E0E0E0E0E0E0E0EA7FF080E0EAFFFFFFFFFFFFFFFFFFFFFA70E0E0E0E0E + 0E0EEF0000000E0E0E0E0E0E0E0E0E0EFFFFFFFFFFFFEF0E0E0E0E0E0E0E0E0E + 0EF6FF560E0E0E0E0E5FFFF60E0E0E0E0E0E0E0E0E0EA7FF080E0EAFFFAF0E0E + 0E0E0E5FFFFFFF0E0E0E0E0E0E0EEF0000000E0E0E0E0E0E0E0E0EF6FFFFFFF6 + A70E0E0E0E0E0E0E0E0E0E0E0EF6FF560E0E0E0E0E5EFFF60E0E0E0E0E0E0E0E + 0E0EA7FFEF0E0EAFFFAF0E0E0E0E0E0E56FFFF160E0E0E0E0E0EEF0000000E0E + 0E0E0E0E0E0E56FFFFF6560E0E0E0E0E0E0E0E0E0E0E0E0E0EF6FF560E0E0E0E + 0E16FFFF0E0E0E0E0E0E0E0E0E0EEFFFAF0E0EAFFFAF0E0E0E0E0E0E0EF6FFA7 + 0E0E0E0E0E0EEF0000000E0E0E0E0E0E0E0EAFFFF60E0E0E0E0E0E0E0E0E0E0E + 0E0E0E0E0EF6FF560E0E0E0E0E0EFFFF0E0E0E0E0E0E0E0E0E0EF6FFA70E0EAF + FFAF0E0E0E0E0E0E0EEFFFAF0E0E0E0E0E0EEF0000000E0E0E0E0E0E0E0EEFFF + A70E0E0E0E0E0E0E5F560E0E0E0E0E0E0EF6FF560E0E0E0E0E0EFFFF5F0E0E0E + 0E0E0E0E0E0EFFFF560E0EAFFFAF0E0E0E0E0E0E0EEFFFAF0E0E0E0E0E0EEF00 + 00000E0E0E0E0E0E0E0E07FF5E0E0E0E0E0E0E5FFFF60E0E0E0E0E0E0EF6FF56 + 0E0E0E0E0E0EEFFFEF0E0E0E0E0E0E0E0E5FFFFF0E0E0EAFFFAF0E0E0E0E0E0E + 0EEFFFAF0E0E0E0E0E0EEF0000000E0E0E0E0E0E0E0EEFFF5F0E0E0E0E0E0EA7 + FFEF0E0E0E0E0E0E0EF6FF560E0E0E0E0E0E5FFFFF0E0E0E0E0E0E0E0EF6FFEF + 0E0E0EAFFFAF0E0E0E0E0E0E0EF6FFA70E0E0E0E0E0EEF0000000E0E0E0E0E0E + 0E0EA7FFEF0E0E0E0E0E0EFFFFA70E0E0E0E0E0E0EF6FF560E0E0E0E0E0E0EFF + FFEF0E0E0E0E0E0E5FFFFF560E0E0EAFFFAF0E0E0E0E0E0E56FFFF560E0E0E0E + 0E0EEF0000000E0E0E0E0E0E0E0E16FFFF5F0E0E0E0EEFFFFF0E0E0E0E0E0E0E + 0EF6FF560E0E0E0E0E0E0EA7FFFFEF0E0E0E0E5FFFFFF60E0E0E0EAFFFAF0E0E + 0E0E0E56FFFFFF0E0E0E0E0E0E0EEF0000000E0E0E0E0E0E0E0E0EF6FFFFF6EF + EFFFFFFFEF0E0E0EFFFFFFFFFFFFFFFFFFFFFFFFAF0E0E0EF6FFFFFFAFA7F6FF + FFFF0E0E0E0E0EAFFFFFFFFFFFFFFFFFFFFFA70E0E0E0E0E0E0EEF0000000E0E + 0E0E0E0E0E0E0E0EFFFFFFFFFFFFFFFF0E0E0E0EFFFFFFFFFFFFFFFFFFFFFFFF + AF0E0E0E0EFFFFFFFFFFFFFFFF5E0E0E0E0E0EAFFFFFFFFFFFFFFFFFFFF60E0E + 0E0E0E0E0E0EEF0000000E0E0E0E0E0E0E0E0E0E0EF6FFFFFFFFEF0E0E0E0E0E + FFF6F6F6F6F6F6F6F6F6F6FFA70E0E0E0E0EEFFFFFFFFFF6160E0E0E0E0E0EA7 + FFF6F6F6F6F6F6EFA70E0E0E0E0E0E0E0E0EEF0000000E0E0E0E0E0E0E0E0E0E + 0E0E0E5F5E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E + 5E5F0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0EEF00 + 00000E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E + 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E + 0E0E0E0E0E0E0E0E0E0EEF0000000E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E + 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E + 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0EEF0000000E0E0E0E0E0E + 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E + 0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E0E + 0E0EF6000000} + Layout = blGlyphBottom + ParentShowHint = False + ShowHint = True + Visible = False + OnClick = SBMarcheArretLocoClick + end object loco: TButton Left = 6 Top = 88 @@ -1587,27 +1704,29 @@ object FormPrinc: TFormPrinc Top = 144 Width = 113 Height = 33 + Anchors = [akTop, akRight] Caption = 'Envoi vers centrale DCC++' - TabOrder = 10 + TabOrder = 9 WordWrap = True OnClick = ButtonEnvClick end object EditEnvoi: TEdit - Left = 928 + Left = 936 Top = 152 Width = 121 Height = 21 - TabOrder = 11 + Anchors = [akTop, akRight] + TabOrder = 10 Text = '<1>' end object Button1: TButton - Left = 960 + Left = 936 Top = 120 Width = 75 Height = 25 + Anchors = [akTop, akRight] Caption = 'Button1' - TabOrder = 12 - Visible = False + TabOrder = 11 OnClick = Button1Click end object Timer1: TTimer @@ -1795,6 +1914,10 @@ object FormPrinc: TFormPrinc Caption = 'Placer les trains' OnClick = Placerlestrains1Click end + object RazResa: TMenuItem + Caption = 'Mise '#224' z'#233'ro des r'#233'servations des aiguillages' + OnClick = RazResaClick + end end end object ClientSocketCDM: TClientSocket diff --git a/UnitPrinc.pas b/UnitPrinc.pas index 773ca23..13db0ce 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -43,7 +43,8 @@ interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, OleCtrls, ExtCtrls, jpeg, ComCtrls, ShellAPI, TlHelp32, - ImgList, ScktComp, StrUtils, Menus, ActnList, MSCommLib_TLB, MMSystem , registry ; + ImgList, ScktComp, StrUtils, Menus, ActnList, MSCommLib_TLB, MMSystem , registry, + Buttons ; type TFormPrinc = class(TForm) @@ -99,9 +100,6 @@ type BoutonRaf: TButton; ButtonArretSimu: TButton; ButtonDroit: TButton; - Panel2: TPanel; - Label1: TLabel; - LabelNbTrains: TLabel; LabelEtat: TLabel; ButtonAffTCO: TButton; ButtonLanceCDM: TButton; @@ -155,6 +153,10 @@ type Informationsdusignal1: TMenuItem; Button1: TButton; Evenementsdetecteurspartrain1: TMenuItem; + RazResa: TMenuItem; + SBMarcheArretLoco: TSpeedButton; + Label1: TLabel; + LabelNbTrains: TLabel; procedure FormCreate(Sender: TObject); procedure MSCommUSBLenzComm(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); @@ -228,6 +230,8 @@ type procedure Button1Click(Sender: TObject); procedure Informationsdusignal1Click(Sender: TObject); procedure Evenementsdetecteurspartrain1Click(Sender: TObject); + procedure RazResaClick(Sender: TObject); + procedure SBMarcheArretLocoClick(Sender: TObject); private { Déclarations privées } procedure DoHint(Sender : Tobject); @@ -261,11 +265,12 @@ const_inconnu=9; // position inconnue NbCouleurTrain=8; MaxCdeDccpp=20; ClBleuClair=$FF7070 ; +clRose=$AAAAFF; Cyan=$FF6060; clviolet=$FF00FF; GrisF=$414141; clOrange=$0077FF; -couleurTrain : array[1..NbCouleurTrain] of Tcolor = (clYellow,clLime,clOrange,clAqua,clFuchsia,clLtGray,clred,clWhite); +couleurTrain : array[0..NbCouleurTrain] of Tcolor = (clRose,clYellow,clLime,clOrange,clAqua,clFuchsia,clLtGray,clred,clWhite); Max_Simule=10000; Max_Event_det_tick=30000; EtatSign : array[0..13] of string[20] =('carré','sémaphore','sémaphore cli','vert','vert cli','violet', @@ -378,16 +383,16 @@ var NombreImages,signalCpx,branche_trouve,Indexbranche_trouve,Actuel,Signal_suivant, Nbre_recu_cdm,Tempo_chgt_feux,Adj1,Adj2,NbrePN,ServeurInterfaceCDM,index_couleur, ServeurRetroCDM,TailleFonte,Nb_Det_Dist,Tdoubleclic,algo_Unisemaf,fA,fB, - etape,idEl,avecRoulage,intervalle_courant : integer; + etape,idEl,avecRoulage,intervalle_courant,filtrageDet0,SauvefiltrageDet0 : integer; ack,portCommOuvert,traceTrames,AffMem,CDM_connecte,dupliqueEvt,affiche_retour_dcc, Raz_Acc_signaux,AvecInit,AvecTCO,terminal,Srvc_Aig,Srvc_Det,Srvc_Act,MasqueBandeauTCO, Srvc_PosTrain,Srvc_Sig,debugtrames,LayParParam,AvecFVR,InverseMotif, - Hors_tension2,traceSign,TraceZone,Ferme,parSocketLenz,ackCdm,PremierFD,doubleclic, + Hors_tension,traceSign,TraceZone,Ferme,parSocketLenz,ackCdm,PremierFD,doubleclic, NackCDM,MsgSim,StopSimu,succes,recu_cv,AffAigDet,Option_demarrage,AffTiers,AvecDemandeAiguillages, TraceListe,clignotant,nack,Maj_feux_cours,configNulle,LanceCDM,AvecInitAiguillages, AvecDemandeInterfaceUSB,AvecDemandeInterfaceEth,aff_acc,affiche_aigdcc,modeStkRetro, - retEtatDet,roulage,init_aig_cours,affevt : boolean; + retEtatDet,roulage,init_aig_cours,affevt,placeAffiche : boolean; tick,Premier_tick : longint; @@ -402,13 +407,10 @@ var detecteur : array[0..NbMemZone] of // détecteurs indexés par l'adresse record etat : boolean; // état 0/1 du déecteur - tempo : integer; // temporisation de passage de 1 à 0 pour retarder le démarrage train au feu non rouge train : string; // nom du train ayant enclenché le détecteur (CDM - pas fiable) AdrTrain : integer; // adresse du train "train" - IndexTrain : integer; // index du train - QuitteVers1,QuitteVers2 : integer; // - vers1,vers2 : integer; // détecteurs vers lequel se dirige le train sur un front descendant - de1,de2 : integer; // détecteurs d'où vient le train qui vient sur ce détecteur + tempo0 : integer; // tempo de retombée à 0 du détecteur (filtrage) + IndexTrain : integer; // index du train end; TypeGen : TEquipement; @@ -511,6 +513,8 @@ var nom_train : string; adresse,vitmax,VitNominale,VitRalenti : integer; TempoArret : integer; // tempo d'arret pour le timer + TempoDemarre : integer; + index_event_det_train : integer; // index du train en cours de roulage du tableau event_det_train end; // éléments verrouillés @@ -532,6 +536,7 @@ var event_det_train : array[0..Max_Trains] of record NbEl,AdrTrain : integer; + signal_rouge : integer ; // si le train est arreté sur un signal au rouge nom_train : string; // nom du train suivant : integer; // suivant prévisionnel à det1 et det2 Det : array[1..2] of record @@ -574,7 +579,7 @@ function detecteur_suivant_El(el1: integer;TypeDet1 : TEquipement;el2 : integer; function test_memoire_zones(adresse : integer) : boolean; function PresTrainPrec(Adresse,NbCtSig : integer;var AdrTr : integer) : boolean; function cond_carre(adresse : integer) : boolean; -function carre_signal(adresse : integer;var TrainReserve : integer) : boolean; +function carre_signal(adresse,TrainReserve : integer;var reserveTrainTiers : boolean) : boolean; procedure Event_Detecteur(Adresse : integer;etat : boolean;train : string); procedure Event_act(adr,adr2,etat : integer;trainDecl : string); function verif_UniSemaf(adresse,UniSem : integer) : integer; @@ -595,6 +600,7 @@ procedure vitesse_loco(nom_train :string;loco : integer;vitesse : integer;sens : procedure Maj_Feux; procedure Det_Adj(adresse : integer); procedure reserve_canton(detecteur1,detecteur2,adrtrain : integer); +function signal_detecteur(detecteur : integer) : integer; implementation @@ -1337,7 +1343,7 @@ begin if trouve then Index_train_nom:=i else Index_train_nom:=0 ; end; -// trouve l'index d'un train par son adresse +// trouve l'index d'un train par son adresse dans le tableau trains function index_train_adresse(adr : integer) : integer; var i : integer; trouve : boolean; @@ -1664,27 +1670,24 @@ end; function envoi(s : string) : boolean; var tempo : integer; begin - if Hors_tension2=false then + envoi_ss_ack(s); + // attend l'ack + ack:=false;nack:=false; + if portCommOuvert or parSocketLenz then begin - envoi_ss_ack(s); - // attend l'ack - ack:=false;nack:=false; - if portCommOuvert or parSocketLenz then + tempo:=0; + repeat + Application.processMessages; + inc(tempo);Sleep(50); + until ferme or ack or nack or (tempo>(TimoutMaxInterface*3)); // l'interface répond < 5s en mode normal et 1,5 mn en mode programmation + if not(ack) or nack then begin - tempo:=0; - repeat - Application.processMessages; - inc(tempo);Sleep(50); - until ferme or ack or nack or (tempo>(TimoutMaxInterface*3)); // l'interface répond < 5s en mode normal et 1,5 mn en mode programmation - if not(ack) or nack then - begin - s:='Pas de réponse de l''interface'; - Affiche(s,clRed); - if traceTrames then AfficheDebug(s,clred); - inc(pasreponse); - end; - if ack then begin pasreponse:=0;hors_tension2:=false;end; + s:='Pas de réponse de l''interface'; + Affiche(s,clRed); + if traceTrames then AfficheDebug(s,clred); + inc(pasreponse); end; + if ack then begin pasreponse:=0;hors_tension:=false;end; end; envoi:=ack; end; @@ -2014,11 +2017,13 @@ end; procedure vitesse_loco(nom_train :string;loco : integer;vitesse : integer;sens : boolean); var s : string; begin - if portCommOuvert or parSocketLenz then + if not(hors_tension) and ((portCommOuvert or parSocketLenz)) then begin if protocole=1 then begin - //Affiche(inttostr(vitesse),clOrange); + //Affiche('X9 train '+inttostr(loco)+' '+inttostr(vitesse),clOrange); + //AfficheDebug('X9 train '+inttostr(loco)+' '+inttostr(vitesse),clOrange); + if vitesse>127 then vitesse:=127; if sens then vitesse:=vitesse or 128; s:=#$e4+#$13+#$0+char(loco)+char(vitesse); @@ -2032,12 +2037,13 @@ begin envoi(s); end; end; + if cdm_connecte then begin - s:=chaine_CDM_vitesseST(vitesse,nom_train); // par nom du train - //s:=chaine_CDM_vitesseINT(vitesse,loco); // par adresse du train - envoi_CDM(s); - //affiche(s,clLime); + s:=chaine_CDM_vitesseST(vitesse,nom_train); // par nom du train + //s:=chaine_CDM_vitesseINT(vitesse,loco); // par adresse du train + envoi_CDM(s); + //affiche(s,clLime); end; end; @@ -3308,7 +3314,7 @@ begin code_to_aspect(code,aspect,combine); s:='Signal Bahn: ad'+IntToSTR(adresse)+'='+chaine_signal(code); if traceSign then affiche(s,clOrange); - if Affsignal then afficheDebug(s,clOrange); + if Affsignal or traceListe then afficheDebug(s,clOrange); //Affiche(IntToSTR(aspect)+' '+inttoSTR(combine),clOrange); // spécifique au décodeur digital bahn: @@ -3349,9 +3355,58 @@ begin end; end; +// renvoie l'adresse du détecteur suivant des deux éléments contigus +// TypeElprec/actuel: 1= détecteur 2= aiguillage 4=Buttoir +// algo= type d'algorithme pour suivant_alg3 +function detecteur_suivant(prec : integer;TypeElPrec : TEquipement;actuel : integer;TypeElActuel : TEquipement;algo : integer) : integer ; +var actuelCalc,PrecCalc,j,AdrSuiv ,indexCalc : integer; + TypeprecCalc,TypeActuelCalc : TEquipement; +begin + if NivDebug>=2 then + AfficheDebug('Proc Detecteur_suivant '+IntToSTR(prec)+','+BTypeToChaine(typeElPrec)+'/'+intToSTR(actuel)+','+ + BTypeToChaine(TypeElActuel)+ + ' Alg='+IntToSTR(algo),clyellow); + j:=0; + + PrecCalc:=prec; + TypeprecCalc:=TypeElprec; + ActuelCalc:=actuel; + TypeActuelCalc:=TypeELActuel; + // étape 1 trouver le sens + repeat + inc(j); + AdrSuiv:=suivant_alg3(precCalc,TypeprecCalc,actuelCalc,TypeActuelCalc,algo); + indexCalc:=index_aig(actuelCalc); + if (typeGen=tjd) and false then // si le précédent est une TJD/S et le suivant aussi + begin + if ((aiguillage[index_aig(AdrSuiv)].modele=tjd) or (aiguillage[index_aig(AdrSuiv)].modele=tjs)) and + ((aiguillage[indexCalc].modele=tjd) or (aiguillage[indexCalc].modele=tjs)) then + begin + if nivDebug=3 then AfficheDebug('501 - Détection Précédent=TJD/S Suivant=TJD/S',clyellow); + // subsituer la pointe + actuelCalc:=aiguillage[indexCalc].APointe; + end; + end; + precCalc:=actuelCalc; + TypeprecCalc:=TypeActuelCalc; + actuelCalc:=AdrSuiv; + TypeActuelCalc:=typeGen; + //Affiche('Suivant signalaig='+IntToSTR(AdrSuiv),clyellow); + until (j=10) or (typeGen=det) or (AdrSuiv=0) or (AdrSuiv>=9990); // arret si détecteur + + // si trouvé le sens, trouver le suivant + if AdrSuiv=actuel then + begin + AdrSuiv:=suivant_alg3(prec,TypeElPrec,actuel,TypeElActuel,1); // suivant immédiat + end; + if (NivDebug=3) and (AdrSuiv<9990) then AfficheDebug('618 : Le suivant est le '+intToSTR(AdrSuiv),clYellow); + detecteur_suivant:=AdrSuiv; +end; + + // pilotage d'un signal, et mise à jour du graphisme du feu dans les 3 fenetres procedure envoi_signal(Adr : integer); -var i,adresse,det,a,b,aspect,x,y,TailleX,TailleY,Orientation,AdrTrain : integer; +var i,it,j,index_train,adresse,detect,detsuiv,a,b,aspect,x,y,TailleX,TailleY,Orientation,AdrTrain : integer; ImageFeu : TImage; frX,frY : real; s : string; @@ -3389,28 +3444,40 @@ begin if ((a=semaphore_F) or (a=carre_F) or (a=violet_F)) and ((b<>semaphore_F) and (b<>carre_F) and (b<>violet_F)) then begin // y a t il un train en face du signal - det:=feux[i].Adr_det1; - if det<>0 then + detect:=feux[i].Adr_det1; + if detect<>0 then begin // test si train sur le détecteur det - if detecteur[det].etat then + if detecteur[detect].etat then begin - AdrTrain:=detecteur[det].AdrTrain; + AdrTrain:=detecteur[detect].AdrTrain; if AdrTrain<>0 then begin - s:='Le train @'+intToSTR(detecteur[det].AdrTrain)+' va démarrer du signal '+intToSTR(adr); - Affiche(s,clLime); - if TraceLIste then AfficheDebug(s,clLime); - detecteur[det].tempo:=20; // armer la tempo à 2s + s:='Le train @'+intToSTR(AdrTrain)+' va démarrer du signal '+intToSTR(adr); + Affiche(s,clWhite); + if TraceListe then AfficheDebug(s,clWhite); + index_train:=index_train_adresse(adrtrain); + if index_train<>0 then it:=trains[index_train].index_event_det_train; + if it<>0 then event_det_train[it].signal_rouge:=0; + // faire la réservation du canton + if feux[i].Btype_suiv1<>det then detSuiv:=detecteur_suivant(detect,det,feux[i].Adr_el_suiv1,feux[i].Btype_suiv1,1) + else detSuiv:=feux[i].Adr_el_suiv1; + if detSuiv<9990 then reserve_canton(detect,detSuiv,Adrtrain); + // démarrage d'un train + j:=index_train_adresse(adrtrain); + trains[j].tempoDemarre:=20; // armer la tempo à 2s + // annuler la demande d'arret éventuelle + trains[j].TempoArret:=0; + // arreter le train //s:=detecteur[det].train; //detecteur[det].train:=s; //Affiche('et son détecteur '+IntToSTR(det)+'=1 tempo démarrage ; train '+s,clYellow); - if cdm_connecte then - begin - s:=chaine_CDM_vitesseST(0,s); // 0% - envoi_cdm(s); - end; + //if cdm_connecte then + //begin + // s:=chaine_CDM_vitesseST(0,s); // 0% + // envoi_cdm(s); + //end; end; end; end; @@ -4584,55 +4651,6 @@ begin end; -// renvoie l'adresse du détecteur suivant des deux éléments contigus -// TypeElprec/actuel: 1= détecteur 2= aiguillage 4=Buttoir -// algo= type d'algorithme pour suivant_alg3 -function detecteur_suivant(prec : integer;TypeElPrec : TEquipement;actuel : integer;TypeElActuel : TEquipement;algo : integer) : integer ; -var actuelCalc,PrecCalc,j,AdrSuiv ,indexCalc : integer; - TypeprecCalc,TypeActuelCalc : TEquipement; -begin - if NivDebug>=2 then - AfficheDebug('Proc Detecteur_suivant '+IntToSTR(prec)+','+BTypeToChaine(typeElPrec)+'/'+intToSTR(actuel)+','+ - BTypeToChaine(TypeElActuel)+ - ' Alg='+IntToSTR(algo),clyellow); - j:=0; - - PrecCalc:=prec; - TypeprecCalc:=TypeElprec; - ActuelCalc:=actuel; - TypeActuelCalc:=TypeELActuel; - // étape 1 trouver le sens - repeat - inc(j); - AdrSuiv:=suivant_alg3(precCalc,TypeprecCalc,actuelCalc,TypeActuelCalc,algo); - indexCalc:=index_aig(actuelCalc); - if (typeGen=tjd) and false then // si le précédent est une TJD/S et le suivant aussi - begin - if ((aiguillage[index_aig(AdrSuiv)].modele=tjd) or (aiguillage[index_aig(AdrSuiv)].modele=tjs)) and - ((aiguillage[indexCalc].modele=tjd) or (aiguillage[indexCalc].modele=tjs)) then - begin - if nivDebug=3 then AfficheDebug('501 - Détection Précédent=TJD/S Suivant=TJD/S',clyellow); - // subsituer la pointe - actuelCalc:=aiguillage[indexCalc].APointe; - end; - end; - precCalc:=actuelCalc; - TypeprecCalc:=TypeActuelCalc; - actuelCalc:=AdrSuiv; - TypeActuelCalc:=typeGen; - //Affiche('Suivant signalaig='+IntToSTR(AdrSuiv),clyellow); - until (j=10) or (typeGen=det) or (AdrSuiv=0) or (AdrSuiv>=9990); // arret si détecteur - - // si trouvé le sens, trouver le suivant - if AdrSuiv=actuel then - begin - AdrSuiv:=suivant_alg3(prec,TypeElPrec,actuel,TypeElActuel,1); // suivant immédiat - end; - if (NivDebug=3) and (AdrSuiv<9990) then AfficheDebug('618 : Le suivant est le '+intToSTR(AdrSuiv),clYellow); - detecteur_suivant:=AdrSuiv; -end; - - //renvoie l'élément connecté de l'aiguillage ou de la tjd tjs "adr" sur le point D,S ou P passé par connect procedure aig_ext(adr : integer ; connect : char;var suiv : integer;var typ_suiv: char); var i : integer; @@ -5404,15 +5422,17 @@ begin end; // renvoie vrai si le signal adresse doit afficher un carré car les aiguillages au dela du signal sont mal positionnés -// renvoie dans TrainReserve l'adresse de l'aiguillage qui a été réservé -function carre_signal(adresse : integer;var TrainReserve : integer) : boolean; +// TrainReserve : adresse du train qui demande la fonction +// Si reserveTrainTiers=vrai, le parcours est réservé par un autre train +function carre_signal(adresse,TrainReserve : integer;var reserveTrainTiers : boolean) : boolean; var - i,j,k,prec,indexFeu,AdrSuiv,index2,voie,AdrFeu : integer; + i,j,k,prec,indexFeu,AdrSuiv,index2,voie,AdrFeu,adrtrain : integer; TypeELPrec,TypeElActuel : TEquipement; multi, sort : boolean; s : string; begin - TrainReserve:=0; + AdrTrain:=0; + ReserveTrainTiers:=false; if (NivDebug>=1) then AfficheDebug('Test si signal '+IntToSTR(adresse)+' doit afficher un carré si aiguillage avals mal positionnés',clyellow); i:=Index_feu(adresse); @@ -5435,6 +5455,7 @@ begin // trouver si une des voies présente un train if (multi) then begin + reserveTrainTiers:=false; carre_signal:=false; // pour l'instant verrouillé en mode pas de carré exit; end; @@ -5446,11 +5467,12 @@ begin k:=index_aig(actuel); if aiguillage[k].AdrTrain<>0 then begin - TrainReserve:=aiguillage[k].AdrTrain; - if (nivdebug>=1) then AfficheDebug('Aiguillage '+intToSTR(aiguillage[k].adresse)+' verrouillé par train @'+intToSTR(TrainReserve),clorange); - result:=false; - if debug=3 then formprinc.Caption:=''; - exit; + AdrTrain:=aiguillage[k].AdrTrain; + if AdrTrain<>0 then + begin + reserveTrainTiers:=reserveTrainTiers or (adrTrain<>TrainReserve); + if (nivdebug>=1) then AfficheDebug('Aiguillage '+intToSTR(aiguillage[k].adresse)+' verrouillé par train @'+intToSTR(AdrTrain),clorange); + end; end; end; @@ -5460,7 +5482,7 @@ begin AdrSuiv:=suivant_alg3(prec,typeElPrec,actuel,typeELActuel,2); // arret sur aiguille en talon mal positionéne if (AdrSuiv=9999) or (AdrSuiv=9996) or (AdrSuiv=9995) then // élément non trouvé ou position aiguillage inconnu ou buttoir - begin + begin; carre_signal:=true; if debug=3 then formprinc.Caption:=''; exit; @@ -5473,9 +5495,9 @@ begin TypeElActuel:=typeGen; end; - // si le précécent est un détecteur comporte t-il un signal? + // si le précédent est un détecteur comporte t-il un signal? indexFeu:=0; - if (prec>512) then + if (typeElPrec=det) then begin //indexFeu:=index_feu_det(AdrSuiv,voie,index2); // trouve l'index du feu correspondant au détecteur AdrSuiv indexFeu:=index_feu_det(prec,voie,index2); // trouve l'index du feu correspondant au détecteur AdrSuiv @@ -5536,12 +5558,13 @@ begin k:=index_aig(actuel); if aiguillage[k].AdrTrain<>0 then begin - TrainReserve:=aiguillage[k].AdrTrain; - if (nivdebug>=1) then AfficheDebug('Aiguillage '+intToSTR(aiguillage[k].adresse)+' verrouillé par train @'+intToSTR(TrainReserve),clorange); - result:=true; - if debug=3 then formprinc.Caption:=''; - exit; - end; + AdrTrain:=aiguillage[k].AdrTrain; + if adrTrain<>0 then + begin + reserveTrainTiers:=reserveTrainTiers or (AdrTrain<>Trainreserve); + if (nivdebug>=1) then AfficheDebug('Aiguillage '+intToSTR(aiguillage[k].adresse)+' verrouillé par train @'+intToSTR(AdrTrain),clorange); + end; + end; end; sort:=(j=10) or (indexFeu<>0) or (AdrSuiv=9998) or (AdrSuiv=0); // arret si aiguillage en talon ou buttoir @@ -5550,8 +5573,9 @@ begin // si trouvé 9998, aiguillages mal positionnés if (NivDebug>=1) then begin - if (AdrSuiv=9998) then AfficheDebug('Le signal '+intToSTR(adresse)+' doit afficher un carré car l''aiguillage pris en talon '+IntToSTR(actuel)+' est mal positionné',clYellow) - else AfficheDebug('Le signal '+IntToSTR(adresse)+' ne doit pas être au carré',clYellow); + if (AdrSuiv=9998) then AfficheDebug('Le signal '+intToSTR(adresse)+' doit afficher un carré car l''aiguillage pris en talon '+IntToSTR(actuel)+' est mal positionné',clYellow); + if AdrTrain<>0 then afficheDebug('Un aiguillage est réservé par le train '+intToSTR(AdrTrain),clyellow); + if (AdrSuiv<>9998) and (AdrTrain=0) then AfficheDebug('Le signal '+intToSTR(adresse)+' ne doit pas afficher de carré',clyellow); end; carre_signal:=AdrSuiv=9998; if debug=3 then formprinc.Caption:=''; @@ -6328,6 +6352,7 @@ begin if AdrSuiv=0 then AfficheDebug('Buttoir',clyellow); end; if debug=3 then formprinc.Caption:=''; + Signal_precedent:=0; exit; end; @@ -6386,7 +6411,7 @@ end; // renvoie vrai si présence train // dans AdrTrain: // renvoie 0 si pas d -// renvoie l'adresse du train dans AdrTrain ou 0 si elle est indisponible +// renvoie l'adresse du 1er train rencontré dans AdrTrain ou 0 si elle est indisponible function PresTrainPrec(Adresse,NbCtSig : integer;var AdrTr : integer) : boolean; var AdrSuiv,prec,ife,actuel,i,j,ifd, @@ -6442,7 +6467,7 @@ begin end; // détecteur sur le signal courant pres_Train:=Detecteur[actuel].etat; - if pres_train then AdrTr:=Detecteur[actuel].AdrTrain; + if pres_train and (AdrTr=0) then AdrTr:=Detecteur[actuel].AdrTrain; TypeActuel:=det; if actuel=0 then @@ -6466,7 +6491,7 @@ begin if AdrSuiv=0 then begin PresTrainPrec:=Pres_Train or (Detecteur[actuel].etat); - AdrTr:=Detecteur[actuel].AdrTrain; + if (adrTr=0) then AdrTr:=Detecteur[actuel].AdrTrain; end; if (nivDebug=3) then @@ -6496,7 +6521,8 @@ begin etat:=Detecteur[actuel].etat; Pres_train:=MemZone[actuel,dernierdet].etat or Pres_Train or (etat); PresTrainPrec:=Pres_Train; - if etat then AdrTr:=Detecteur[actuel].AdrTrain; + if adrTr=0 then AdrTr:=Detecteur[actuel].AdrTrain; + if adrtr=0 then AdrTr:=MemZone[actuel,dernierdet].AdrTrain; if Pres_Train then begin @@ -6563,7 +6589,7 @@ end; // mise à jour de l'état d'un feu en fonction de son environnement et affiche le feu procedure Maj_Feu(Adrfeu : integer); var Adr_det,etat,Aig,Adr_El_Suiv,modele,index,IndexAig,trainreserve,AdrTrainLoc : integer ; - PresTrain,Aff_semaphore,car : boolean; + PresTrain,Aff_semaphore,car,reserveTrainTiers : boolean; code,combine,AdrSignalsuivant : integer; Btype_el_suivant : TEquipement; s : string; @@ -6617,7 +6643,7 @@ begin //AfficheDebug('Feux à 2 feux',CLOrange); // si aiguillage après signal mal positionnées ou réservé ou pas de train avant le signal PresTrain:=PresTrainPrec(AdrFeu,Nb_cantons_Sig,AdrTrainLoc); - if carre_signal(AdrFeu,trainreserve) or not(PresTrain) or (feux[index].VerrouilleCarre) then + if carre_signal(AdrFeu,AdrTrainLoc,reserveTrainTiers) or not(PresTrain) or (feux[index].VerrouilleCarre) then begin Maj_Etat_Signal(AdrFeu,violet); envoi_signal(AdrFeu); @@ -6641,16 +6667,15 @@ begin begin PresTrain:=false; // détecteurs précédent le feu , pour déterminer si leurs mémoires de zones sont à 1 pour libérer le carré - if (Feux[index].VerrouCarre) and (modele>=4) then - presTrain:=PresTrainPrec(AdrFeu,Nb_cantons_Sig,AdrTrainLoc); //etape A // présence train par adresse train - - if AffSignal then afficheDebug('Fin de la recherche des 4 détecteurs précédents-----',clOrange); + //if (Feux[index].VerrouCarre) and (modele>=4) then + presTrain:=PresTrainPrec(AdrFeu,Nb_cantons_Sig,AdrTrainLoc); //etape A // présence train par adresse train + if AffSignal and roulage then AfficheDebug('L''@ du train avant le signal est '+intToSTR(AdrTrainLoc),clYellow); // si le signal peut afficher un carré et les aiguillages après le signal sont mal positionnées ou aig réservé ou que pas présence train avant signal et signal // verrouillable au carré, afficher un carré - car:=carre_signal(AdrFeu,trainreserve); // si trainReserve<>0, réservé par le train + car:=carre_signal(AdrFeu,AdrTrainLoc,reserveTrainTiers); // si reserveTrainTiers, réservé par un autre train // En mode roulage, si la réservation est faite par le train détecté en étape A, ne pas verrouiller au carré - if roulage and (trainreserve<>0) and (AdrTrainLoc=TrainReserve) then car:=false; + if roulage then car:=reserveTrainTiers or car; // conditions supplémentaires de carré en fonction des aiguillages décrits car:=cond_carre(AdrFeu) or car; @@ -6874,7 +6899,7 @@ end; // libère le canton avant detecteur2 comportant un signal et le signal précédent // attention le détecteur 2 n'est pas forcément associé à un signal (et dans le bon sens Procedure libere_canton(detecteur1,detecteur2 : integer); -var sd2,i,j,AdrPrec : integer; +var sd2,i,j: integer; typ : tEquipement; begin if not(roulage) then exit; @@ -6906,10 +6931,11 @@ begin end; // réserve le canton du detecteur équipé du feu (non compris) au feu suivant +// det1 et det2 sont contigus procedure reserve_canton(detecteur1,detecteur2,adrtrain : integer); -var it,AdrSig,actuel,succ,Suiv,i,j,etat,etatSuiv,AdrSignalsuivant : integer; +var AdrSig,i,j,etat,etatSuiv,AdrSignalsuivant : integer; rouge,cas2 : boolean; - typ,typSuiv,typeAct : tEquipement; + typ : tEquipement; begin if not(roulage) then exit; if traceliste then afficheDebug('demande réservation canton '+intToSTR(detecteur1)+' '+intToSTR(detecteur2)+' par train @'+intToSTR(adrtrain),clorange); @@ -6981,14 +7007,22 @@ end; // pilote le train sur le détecteur det2, d'adresse adrtrain // le det1 indique d'ou vient le train pour le bon sens du signal -procedure pilote_train(det1,det2,adrtrain : integer); +// le train est piloté si ontrouve un signal dans le bon sens sur det2 +// it : numéro du train du réseau (pour la couleur) +procedure pilote_train(det1,det2,AdrTrain,it : integer); var entree_signal,jauneC,rappel30C,rappel60C,rouge : boolean; - i,adresse,adresse2,Etat,voie,i2 : integer; + i,index_train,adresse,adresse2,Etat,voie,i2 : integer; + couleur : TColor; + s : string; begin if not(roulage) or (adrtrain=0) then exit; i:=index_feu_det(det2,voie,i2); // index du feu associé au det2 j:=signal_detecteur(det3); - if i=0 then exit; + + i2:=((it-1) mod NbCouleurTrain) +1; + couleur:=CouleurTrain[i2]; + index_train:=index_train_adresse(adrTrain); // index du tableau trains + adresse:=feux[i].adresse; //voir si il est dans le bon sens adresse2:=signal_suivant_det(det1,det2); // renvoie le signal suivant dans le sens det1 det2 @@ -6997,7 +7031,7 @@ begin etat:=feux[i].EtatSignal; rouge:=testbit(etat,semaphore) or testbit(etat,carre) or testbit(etat,violet); - jauneC:=testbit(etat,jaune); + jauneC:=testbit(etat,jaune) or testbit(etat,blanc) or testbit(etat,blanc_cli); rappel30C:=testbit(etat,rappel_30); rappel60C:=testbit(etat,rappel_60); @@ -7005,12 +7039,17 @@ begin // si le feu est au rouge et qu'on entre dans son détecteur if rouge and entree_signal then - begin - if traceListe then AfficheDebug('Signal '+intToSTR(adresse)+' au rouge - Arrêt train @'+intToSTR(AdrTrain),clLime); - i:=index_train_adresse(AdrTrain); - if (i<>0) and (i0) and (index_train0) and (i0) and (index_train0) and (i0) and (index_train0) and (i0) and (index_train0) and (index_train0) and (i0) and (index_train0 then inc(nbre); - end; - - if ((nbre<2) and (i_simule>=77)) or (i_simule>=118) then - begin - Affiche('Erreur suivi: '+intToSTR(i_simule),clred); - Index_Simule:=0; // fin de simulation - I_Simule:=0; - MsgSim:=false; - StopSimu:=true; - //exit; - end; - { - if i_simule<>0 then - begin - s:=IntToSTR(i_simule)+' tick='+intToSTR(Tablo_simule[i_simule].tick)+' '+intToSTR(det3); - if front then s:=s+' (1)' else s:=s+' (0)'; - Affiche(s,clLime); - end; - } - det3:=adresse; // c'est le nouveau détecteur - if det3=0 then exit; // pas de nouveau détecteur - traite:=false; - s:='V2A->Le nouveau détecteur est '+IntToSTR(det3); - if front then s:=s+' (1)' else s:=s+' (0)'; - FormDebug.MemoEvtDet.lines.add(s) ; - if dupliqueEvt then AfficheDebug(s,clyellow) ; - - for i:=1 to N_trains do - begin - Nbre:=event_det_train[i].NbEl ; // Nombre d'éléments du tableau courant exploré - det1:=event_det_train[i].det[1].adresse; - det2:=event_det_train[i].det[2].adresse; - - { - if ((det2=det3) and (nbre=2)) or ((det1=det3) and (nbre=1)) then - begin - s:='Rebond dét. '+intToSTR(det3)+' déjà affecté au train '+IntToSTR(i); - FormDebug.MemoEvtDet.lines.add(s); - if dupliqueEvt then AfficheDebug(s,clyellow); - exit; // sortir - end; - } - - // 1 élément dans le tableau et détecteur à 0--------------------------------------------- - if (nbre=1) and not(front) then - begin - Det_Adj(det3); // renvoie les adresses des détecteurs adjacents au détecteur "det3" résultat dans adj1 et adj2 - // vérifie si les détecteurs adjacents sont à 0 pour remplir le champ "prévision" de det3 : le train se dirige de det3 à adj1 ou adj2 - if not(detecteur[Adj1].etat) then - begin - detecteur[det3].vers1:=Adj1; // le train de det3 peut aller vers adj1 - detecteur[adj1].de1:=det3; // marquer adj1 que le train vient de det3 - end - else detecteur[det3].vers1:=0; - if not(detecteur[Adj2].etat) then - begin - detecteur[det3].vers2:=Adj2; // le train de det3 peut aller vers adj2 - detecteur[adj2].de1:=det3; // marquer adj2 que le train vient de det3 - end - else detecteur[det3].vers2:=0; - - - if (roulage) then - begin - // traiter pour les cas avec 1 élément - if traceListe then AfficheDebug('1-0 traitement Train n°'+intToSTR(i)+' 1 détecteur',clyellow); - // vérifier si l'élément du tableau et le nouveau sont contigus - if (Adj1=det1) or (Adj2=det1) then - begin - with event_det_train[i] do - begin - det[2].adresse:=det3; - det[2].etat:=front; - NbEl:=2; - end; - - adrTrainLoc:=event_det_train[i].Adrtrain; - Train_ch:=event_det_train[i].nom_train; - if (AdrTrainLoc=0) and roulage then Affiche('Démarrage train non placé depuis détecteur '+intToSTR(det3),clred); - - // en mode roulage, on a placé les trains - - j:=1; - repeat - trouve:=placement[j].detdir=det3; - inc(j); - until (j>6) or trouve; - dec(j); - //si début de démarrage train i - if not(trouve) or (TrainZone[i].Nbre>0) then exit; - // affecter le nouveau détecteur - detecteur[det3].train:=Train_ch; - detecteur[det3].AdrTrain:=AdrTrainLoc; - // libérer l'ancien - //detecteur[event_det_train[i].Det[1].adresse].AdrTrain:=0; - //detecteur[event_det_train[i].Det[1].adresse].train:=''; - - AdrSuiv:=detecteur_suivant_el(det1,det,det3,det,1); - //*** route validée *** - MemZone[det1,det3].etat:=FALSE; // dévalide l'ancienne zone - MemZone[det1,det3].train:=''; - MemZone[det1,det3].Adrtrain:=0; - MemZone[det3,det1].etat:=FALSE; // dévalide l'ancienne zone inverse - MemZone[det3,det1].train:=''; - MemZone[det3,det1].Adrtrain:=0; - - MemZone[det3,AdrSuiv].etat:=true; // valide la nouvelle zone - MemZone[det3,AdrSuiv].train:=Train_ch; - MemZone[det3,AdrSuiv].AdrTrain:=AdrTrainLoc; - MemZone[AdrSuiv,det3].etat:=False; // on dévalide la zone inverse - MemZone[AdrSuiv,det2].train:=''; - MemZone[AdrSuiv,det2].AdrTrain:=0; - - // stockage dans historique de zones - if iMaxZones then n:=1; - with TrainZone[i] do - begin - Nbre:=n; - Zone[n].det1:=det1; - Zone[n].det2:=det3; - train:=train_ch; - AdrTrain:=AdrTrainLoc - end; - end; - //reserve_canton(det1,det3,false,0,false); // déreserve le canton précedent - //reserve_canton(det3,AdrSuiv,false,TrainZone[i].Adrtrain,true); // si feu réserve canton courant - libere_canton(det1,det3); // on quitte det3 - reserve_canton(det3,adrSuiv,adrtrainLoc); - event_act(det1,det3,1,''); // évènement actionneur - maj_feux; - - // affichages - Affiche_Evt('1-0 route ok de '+intToSTR(det1)+' à '+IntToSTR(det3),clWhite); - FormDebug.MemoEvtDet.lines.add(s); - if traceListe then AfficheDebug(s,clyellow); - //Affiche(s,CouleurTrain[index_couleur]); - if AffAigDet then AfficheDebug(s,clyellow); - - index_couleur:=((i - 1) mod NbCouleurTrain) +1; - Affiche_Evt('1-0. Tampon train '+intToStr(i)+' '+event_det_train[i].nom_train+'--------',couleurTrain[index_couleur]); - with FormDebug.MemoEvtDet do - begin - s:=intToSTR(event_det_train[i].det[1].adresse); - Affiche_Evt(s,couleurTrain[index_couleur]); - if dupliqueEvt or traceliste then AfficheDebug(s,clyellow); - s:=intToSTR(event_det_train[i].det[2].adresse); - Affiche_evt(s,couleurTrain[index_couleur]); - if dupliqueEvt or traceliste then AfficheDebug(s,clyellow); - end; - - if TCOouvert then - begin - // activation - if ModeCouleurCanton=0 then zone_TCO(det3,AdrSuiv,1) - else zone_TCO(det3,adrSuiv,2); // affichage avec la couleur de index_couleur du train - end; - exit; // sortir absolument - end - else - begin - Affiche_evt('les éléments '+intToSTR(det1)+' et '+intToSTR(det3)+' ne sont pas contigus',clyellow); - // det3 et det1 non adjacents - end; - end; - end; - - // 1 élément dans le tableau et détecteur à 1 : on pilote le train si feu sur det3--------------------------------------------- - if (nbre=1) and front then - begin - if traceListe then AfficheDebug('1-1 Traitement Train n°'+intToSTR(i)+' 1 détecteur',clyellow); - if detecteur[det3].de1=det1 then - // vérifier si l'élément du tableau et le nouveau sont contigus - //Det_Adj(det1); // renvoie les adresses des détecteurs adjacents au détecteur "det1" résultat dans adj1 et adj2 - //if (Adj1=det3) or (Adj2=det3) then - begin - Train_ch:=event_det_train[i].nom_train; - AdrTrainLoc:=event_det_train[i].AdrTrain; - - // en mode roulage, on a placé les trains - if roulage then - begin - j:=1; - repeat - trouve:=placement[j].detdir=det3; - inc(j); - until (j>6) or trouve; - dec(j); - //si début de démarrage train i - if trouve and (TrainZone[i].Nbre=0) and (det10 then Maj_Feu(j); - exit; - end; - if Traceliste then AfficheDebug(inttoSTR(det3)+' n''est pas contigu à '+intToSTR(det1)+' pour le train '+intToSTR(i),clyellow); - traite:=true; // traiter le train suivant - end; - - // 2 éléments dans le tableau et détecteur à 0--------------------------------------------- - if (nbre=2) and not(front) then - begin - if TraceListe or (NivDebug=3) then AfficheDebug('2-0 traitement Train n°'+intToSTR(i)+' 2 détecteurs',clyellow); - // front descendant sur détecteur 2 - det_suiv:=det_suiv_cont(det1,det2); // test si le suivant de det1 à det2 est bien le nouveau détecteur (det3) - if traceliste then affichedebug('Le suivant aux '+intToSTR(det1)+' '+intToSTR(det2)+' est '+intToSTR(det_suiv),clYellow); - if (det_suiv=det3) then - begin - if TraceListe then AfficheDebug('La route est valide car les détecteurs '+intToSTR(det2)+' '+intToSTR(det3)+' sont contigus',clyellow); - // ici on cherche le suivant à det2 det3, algo=1 - AdrSuiv:=detecteur_suivant_el(det2,det,det3,det,0); - if TraceListe then AfficheDebug('le sursuivant est '+intToSTR(adrsuiv),clyellow); - if (Adrsuiv>=9990) then - begin - //Affiche('Erreur 1500 : pas de suivant sur la route de '+intToSTR(det2)+' à '+intToSTR(det3),clRed); - if (NivDebug=3) or TraceListe then AfficheDebug('Msg 1500 : pas de suivant sur la route de '+intToSTR(det2)+' à '+intToSTR(det3),clorange); - end - else - begin - if (det2MaxZones then n:=1; - with TrainZone[i] do - begin - Nbre:=n; - Zone[n].det1:=det3; - Zone[n].det2:=AdrSuiv; - Nbre:=n; - end; - // zone suivante en prévision - det4:=detecteur_suivant_EL(det3,det,AdrSuiv,det,1); - TrainPrevZone[i][1]:=det4; - end; - - event_act(det2,det3,0,''); // désactivation zone - event_act(det3,AdrSuiv,1,''); // activation zone - end - else - begin - s:='Erreur 740 : Adresse détecteur trop élevé '; - if (det2>NbMemZone) and (det2<9990) then s:=s+inttostr(det2)+' '; - if (det3>NbMemZone) and (det3<9990) then s:=s+inttostr(det3)+' '; - if (AdrSuiv>NbMemZone) and (AdrSuiv<9990) then s:=s+inttostr(AdrSuiv); - Affiche(s,clred); - end; - - // supprimer le 1er et décaler - with event_det_train[i] do - begin - det[1].adresse:=event_det_train[i].det[2].adresse; - det[1].etat:=event_det_train[i].det[2].etat; - det[2].adresse:=det3; - det[2].etat:=detecteur[det3].etat; - NbEl:=2; - end; - - // affichages - index_couleur:=((i - 1) mod NbCouleurTrain) +1; - s:='2-0 Train n°'+intToSTR(i)+' route ok de '+intToSTR(det2)+' à '+IntToSTR(det3)+' '+intToSTR(det3)+' à '+IntToSTR(Adrsuiv); - FormDebug.MemoEvtDet.lines.add(s); - if traceListe then AfficheDebug(s,clyellow); - if DebugAffiche then With FormDebug.RichEdit do - begin - s:='Train '+IntToSTR(i); - if AdrTrainLoc<>0 then s:=s+' @'+intToSTR(AdrTrainLoc); - s:=s+' '+intToStr(det2)+' à '+intToStr(det3)+'=>'+IntToSTR(det3)+' à '+IntToStr(AdrSuiv); - s:=s+' Prev='+intToSTR(TrainPrevZone[i][1]); - Lines.Add(s); - RE_ColorLine(FormDebug.RichEdit,lines.count-1,CouleurTrain[index_couleur]); - end; - s:='Train '+IntToSTR(i); - if AdrTrainLoc<>0 then s:=s+' @'+intToSTR(AdrTrainLoc); - s:=s+' '+Train_ch+' sur zones '+IntToSTR(det3)+' à '+IntToStr(AdrSuiv); - if traceListe then AfficheDebug(s,clyellow); - - s:='Train '+IntToSTR(i); - if AdrTrainLoc<>0 then s:=s+' '+train_ch+' @'+intToSTR(AdrTrainLoc); - s:=s+' sur zones '+IntToSTR(det3)+' à '+IntToStr(AdrSuiv); - Affiche(s,CouleurTrain[index_couleur]); - if AffAigDet then AfficheDebug(s,clyellow); - - Affiche_Evt('1.Tampon train '+intToStr(i)+' '+event_det_train[i].nom_train+'--------',couleurTrain[index_couleur]); - with FormDebug.MemoEvtDet do - begin - Affiche_Evt(intToSTR(event_det_train[i].det[1].adresse),couleurTrain[index_couleur]); - Affiche_Evt(intToStr(event_det_train[i].det[2].adresse),couleurTrain[index_couleur]); - end; - if TraceListe or dupliqueEvt then - begin - AfficheDebug(intToSTR(event_det_train[i].det[1].adresse),clyellow); - AfficheDebug(intToSTR(event_det_train[i].det[2].adresse),clyellow); - end; - if TCOouvert then - begin - zone_TCO(det2,det3,0); // désactivation - // activation - if ModeCouleurCanton=0 then zone_TCO(det3,AdrSuiv,1) - else zone_TCO(det3,AdrSuiv,2); // affichage avec la couleur de index_couleur du train - end; - - // mettre à jour si présence signal sur det3 pour le passer au rouge de suite - j:=signal_detecteur(det3); - if j<>0 then - begin - Maj_Feu(j); - k:=index_feu(j); - // si le feu j est au rouge - etat:=feux[k].etatsignal; - if (testBit(etat,carre)) or (testBit(etat,semaphore)) or (testBit(etat,semaphore_cli)) then - begin - // Maj du signal précédent (pour l'avertissement) - j:=Signal_precedent(j); - if j<>0 then - begin - maj_feu(j); - j:=Signal_precedent(j); - if j<>0 then maj_feu(j); - end; - end; - end; - maj_feux; // mise à jour générale - maj_feux; // 2eme mise à jour - maj_feux; - exit; // sortir absolument - end; - end - else - begin - if TraceListe then AfficheDebug('La route est invalide car les détecteurs '+intToSTR(det2)+' '+intToSTR(det3)+' ne sont pas contigus',clOrange); - if event_det_train[i].det[2].adresse=det3 then - begin - s:='7. Rebond dét. '+intToSTR(det3)+' déjà affecté au train '+IntToSTR(i); - FormDebug.MemoEvtDet.lines.add(s); - if dupliqueEvt then AfficheDebug(s,clyellow); - // exhit sortir - end; - end; - traite:=true; - end; - - if (nbre=2) and front then - begin - if TraceListe or (NivDebug=3) then AfficheDebug('2-1 traitement Train n°'+intToSTR(i)+' 2 détecteurs',clyellow); - // front descendant sur détecteur 2 - det_suiv:=det_suiv_cont(det1,det2); // test si le suivant de det1 à det2 est bien le nouveau détecteur (det3) - if traceliste then affichedebug('Le suivant aux '+intToSTR(det1)+' '+intToSTR(det2)+' est '+intToSTR(det_suiv),clYellow); - if (det_suiv=det3) then - begin - if TraceListe then AfficheDebug('La route est valide car les détecteurs '+intToSTR(det2)+' '+intToSTR(det3)+' sont contigus',clyellow); - if (det1NbMemZone) and (det2<9990) then s:=s+inttostr(det2)+' '; - if (det3>NbMemZone) and (det3<9990) then s:=s+inttostr(det2)+' '; - if (AdrSuiv>NbMemZone) and (det2<9990) then s:=s+inttostr(det2); - Affiche(s,clred); - end; - // stockage dans historique de zones sauf s'il est déja stocké - if idet2) or (TrainZone[i].Zone[n].det2<>det3) then - begin - n:=TrainZone[i].Nbre+1; - if n>MaxZones then n:=1; - TrainZone[i].Nbre:=n; - TrainZone[i].Zone[n].det1:=det2; - TrainZone[i].Zone[n].det2:=det3; - TrainZone[i].Nbre:=n; - // zone suivante en prévision - det4:=detecteur_suivant_EL(det2,det,det3,det,1); - TrainPrevZone[i][1]:=det4; - end; - end; - // affichages - s:='2-1 Train n°'+intToSTR(i)+' Route ok de '+intToSTR(det2)+' à '+IntToSTR(det3)+' '+intToSTR(det3)+' à '+IntToSTR(Adrsuiv); - FormDebug.MemoEvtDet.lines.add(s); - if traceListe then AfficheDebug(s,clyellow); - if DebugAffiche then With FormDebug.RichEdit do - begin - s:='Train '+IntToSTR(i)+' '+intToStr(det2)+' à '+intToStr(det3); - Lines.Add(s); - index_couleur:=((i - 1) mod NbCouleurTrain) +1; - RE_ColorLine(FormDebug.RichEdit,lines.count-1,CouleurTrain[index_couleur]); - end; - if TraceListe then AfficheDebug(s,clyellow); - Affiche(s,CouleurTrain[index_couleur]); - if AffAigDet then AfficheDebug(s,clyellow); - if TCOouvert then - begin - zone_TCO(det1,det2,0); // désactivation - // activation - if ModeCouleurCanton=0 then zone_TCO(det2,det3,1) - else zone_TCO(det2,det3,2); // affichage avec la couleur de index_couleur du train - end; - exit; // sortir absolument - end - else - begin - if TraceListe then AfficheDebug('La route est invalide car les détecteurs '+intToSTR(det2)+' '+intToSTR(det3)+' ne sont pas contigus',clOrange); - if event_det_train[i].det[2].adresse=det3 then - begin - s:='7. Rebond dét. '+intToSTR(det3)+' déjà affecté au train '+IntToSTR(i); - FormDebug.MemoEvtDet.lines.add(s); - if dupliqueEvt then AfficheDebug(s,clyellow); - exit; // rebond :sortir - end; - end; - traite:=true; // non traité: train suivant - end; - end; // fin de la boucle for i - - // nouveau train front det=1 (uniquement mode roulage) - { - if front then - begin - if traceListe then AfficheDebug('Nouveau train',clyellow); - if N_Trains>=Max_Trains then - begin - Affiche('Erreur nombre de train maximal atteint',clRed); - N_trains:=0; - end; - Inc(N_trains); - with event_det_train[N_trains] do - begin - det[1].adresse:=det3; - det[2].adresse:=0; - det[1].etat:=front; - NbEl:=1; - nom_train:=detecteur[det3].train; - AdrTrain:=detecteur[det3].AdrTrain; - end; - end; - } - - - if front then - begin - Det_Adj(det3); // renvoie les adresses des détecteurs adjacents au détecteur "det3" résultat dans adj1 et adj2 - // libére les "vers det3" de adj1 - if adj1<9990 then - begin - if detecteur[adj1].vers1=det3 then detecteur[adj1].vers1:=0; - if detecteur[adj1].vers2=det3 then detecteur[adj1].vers2:=0; - end; - // libére les "vers det3" de adj2 - if adj2<9990 then - begin - if detecteur[adj2].vers1=det3 then detecteur[adj2].vers1:=0; - if detecteur[adj2].vers2=det3 then detecteur[adj2].vers2:=0; - end; - - if adj1<9990 then - begin - if not(detecteur[Adj1].etat) then - // détecteur adjacent à 1 - begin - detecteur[det3].vers1:=Adj1; // le train de det3 peut aller vers adj1 - detecteur[adj1].de1:=det3; // marquer adj1 que le train vient de det3 - end - else - // détecteur adjacent à 0 - begin - detecteur[det3].vers1:=0; - detecteur[det3].de1:=0; detecteur[det3].de2:=0; - detecteur[adj1].de1:=0; - end; - end; - if adj2<9990 then - begin - if not(detecteur[Adj2].etat) then - begin - detecteur[det3].vers2:=Adj2; // le train de det3 peut aller vers adj2 - detecteur[adj2].de1:=det3; // marquer adj2 que le train vient de det3 - end - else - begin - detecteur[det3].vers2:=0; - detecteur[det3].de1:=0; detecteur[det3].de2:=0; - detecteur[adj2].de1:=0; - end; - end; - - // test nouveau train - v1:=detecteur[det3].vers1; // destination du det3 - v2:=detecteur[det3].vers2; - de1:=detecteur[v1].de1; // provenance du v1 - de2:=detecteur[v1].de2; - if ( (det3=de1) and (de1<>0) or ((v1=de2)) and (de2<>0)) then - cas1:=true; - - de1:=detecteur[v2].de1; // provenance du v2 - de2:=detecteur[v2].de2; - if ( (det3=de1) and (de1<>0) or ((v2=de2)) and (de2<>0)) then - cas2:=true; - if cas1 and cas2 then - begin - Affiche_evt('Incertitude '+intToSTR(det3)+' vers '+intToSTR(v1)+' ou '+intToSTR(v2),clwhite); - exit; - end; - - if cas1 then Affiche_evt('C1-1 Nouveau train de '+intToSTR(det3)+' à '+intToSTR(v1),clyellow); - if cas2 then Affiche_evt('C2-1 Nouveau train de '+intToSTR(det3)+' à '+intToSTR(v2),clyellow); - - - end; - - if not(front) then - begin - - v1:=detecteur[det3].vers1; // destination du det3 - v2:=detecteur[det3].vers2; - de1:=detecteur[v1].de1; // provenance du v1 - de2:=detecteur[v1].de2; - if ( (det3=de1) and (de1<>0) or ((v1=de2)) and (de2<>0)) then - cas1:=true; - - de1:=detecteur[v2].de1; // provenance du v2 - de2:=detecteur[v2].de2; - if ( (det3=de1) and (de1<>0) or ((v2=de2)) and (de2<>0)) then - cas2:=true; - - if cas1 and cas2 then - begin - Affiche_evt('Incertitude '+intToSTR(det3)+' vers '+intToSTR(v1)+' ou '+intToSTR(v2),clwhite); - exit; - end; - - if cas1 then Affiche_evt('C1-0 Nouveau train de '+intToSTR(det3)+' à '+intToSTR(v1),clyellow); - if cas2 then Affiche_evt('C1-0 Nouveau train de '+intToSTR(det3)+' à '+intToSTR(v2),clyellow); - - detecteur[det3].vers1:=0; - detecteur[det3].vers2:=0; - - Det_Adj(det3); // renvoie les adresses des détecteurs adjacents au détecteur "det3" résultat dans adj1 et adj2 - if adj1<9990 then - begin - if detecteur[adj1].etat then - begin - detecteur[det3].de1:=adj1; // revalider les liens possibles avec les adjacents - if detecteur[adj1].vers1=0 then detecteur[adj1].vers1:=det3 - else - if detecteur[adj1].vers2=0 then detecteur[adj1].vers2:=det3 - else Affiche_evt('Anomalie 750 ',clred); - end; - end; - - if adj2<9990 then - begin - if detecteur[adj2].etat then - begin - detecteur[det3].de1:=adj2; // revalider les liens possibles avec les adjacents - if detecteur[adj2].vers1=0 then detecteur[adj2].vers1:=det3 - else - if detecteur[adj2].vers2=0 then detecteur[adj2].vers2:=det3 - else Affiche_evt('Anomalie 751 ',clred); - end; - end; - end; - - exit; - - // nouveau train front det=0 - if traite or not(front) then - begin - if traceListe then AfficheDebug('Nouveau train',clyellow); - // Nombre d'éléments à 0 : ici c'est un nouveau train donc créer un train, donc un tableau - if N_Trains>=Max_Trains then - begin - Affiche('Erreur nombre de train maximal atteint',clRed); - N_trains:=0; - end; - Inc(N_trains); - with event_det_train[N_trains] do - begin - det[1].adresse:=0; - det[2].adresse:=0; - NbEl:=0; - nom_train:=''; - end; - - // vérifier si le détecteur du nouveau train est associé à un feu vers un buttoir - for i:=1 to NbreFeux do - begin - AdrFeu:=Feux[i].Adresse; - AdrDetfeu:=Feux[i].Adr_Det1; - if (AdrDetFeu=Det3) and (feux[i].aspect<10) then - begin - AdrSuiv:=Feux[i].Adr_el_suiv1; - TypeSuiv:=Feux[i].Btype_suiv1; - AdrPrec:=detecteur_suivant(AdrSuiv,typeSuiv,AdrDetFeu,det,1) ; // détecteur précédent le feu ; algo 1 - if AdrPrec=0 then - begin - if TraceListe then Affiche('FD - Le feu '+IntToSTR(AdrFeu)+' est précédé d''un buttoir',clyellow); - if AdrDetFeu6) or trouve; - dec(j); - //si début de démarrage train i - if not(trouve) or (TrainZone[i].Nbre>0) then - begin - exit; - end; - // affecter le nouveau détecteur - detecteur[det3].train:=Train_ch; - detecteur[det3].AdrTrain:=AdrTrainLoc; - // libérer l'ancien - //detecteur[event_det_train[i].Det[1].adresse].AdrTrain:=0; - //detecteur[event_det_train[i].Det[1].adresse].train:=''; - end; - - AdrSuiv:=detecteur_suivant_el(det1,det,det3,det,1); - //*** route validée *** - MemZone[det1,det3].etat:=FALSE; // dévalide l'ancienne zone - MemZone[det1,det3].train:=''; - MemZone[det1,det3].Adrtrain:=0; - MemZone[det3,det1].etat:=FALSE; // dévalide l'ancienne zone inverse - MemZone[det3,det1].train:=''; - MemZone[det3,det1].Adrtrain:=0; - MemZone[det3,AdrSuiv].etat:=true; // valide la nouvelle zone - MemZone[det3,AdrSuiv].train:=Train_ch; - MemZone[det3,AdrSuiv].AdrTrain:=AdrTrainLoc; - MemZone[AdrSuiv,det3].etat:=False; // on dévalide la zone inverse - MemZone[AdrSuiv,det2].train:=''; - MemZone[AdrSuiv,det2].AdrTrain:=0; - - // stockage dans historique de zones - if iMaxZones then n:=1; - with TrainZone[i] do - begin - Nbre:=n; - Zone[n].det1:=det1; - Zone[n].det2:=det3; - train:=train_ch; - AdrTrain:=AdrTrainLoc - end; - end; - //reserve_canton(det1,det3,false,0,false); // déreserve le canton précedent - //reserve_canton(det3,AdrSuiv,false,TrainZone[i].Adrtrain,true); // si feu réserve canton courant - libere_canton(det1,det3); // on quitte det3 - reserve_canton(det3,adrSuiv,adrtrainLoc); - event_act(det1,det3,1,''); // évènement actionneur - maj_feux; - - // affichages - Affiche_Evt('1-0 route ok de '+intToSTR(det1)+' à '+IntToSTR(det3),clWhite); - if traceListe then AfficheDebug(s,clyellow); - //Affiche(s,CouleurTrain[index_couleur]); - if AffAigDet then AfficheDebug(s,clyellow); - - Affiche_Evt('1-0. Tampon train '+intToStr(i)+' '+event_det_train[i].nom_train+'--------',couleur); - s:=intToSTR(event_det_train[i].det[1].adresse); - Affiche_Evt(s,couleur); - if dupliqueEvt or traceliste then AfficheDebug(s,clyellow); - s:=intToSTR(event_det_train[i].det[2].adresse); - Affiche_evt(s,couleur); - if dupliqueEvt or traceliste then AfficheDebug(s,clyellow); - - if TCOouvert then - begin - // activation - if ModeCouleurCanton=0 then zone_TCO(det3,AdrSuiv,1) - else zone_TCO(det3,adrSuiv,2); // affichage avec la couleur de index_couleur du train - end; - exit; // sortir absolument - end - else - begin - Affiche_evt('les éléments '+intToSTR(det1)+' et '+intToSTR(det3)+' ne sont pas contigus',clyellow); - // det3 et det1 non adjacents - end; - end; - end; - - // 1 élément dans le tableau et détecteur à 1 : on pilote le train si feu sur det3--------------------------------------------- - if (nbre=1) and front then - begin - if traceListe then AfficheDebug('1-1 Traitement Train n°'+intToSTR(i)+' 1 détecteur',clyellow); - // vérifier si l'élément du tableau et le nouveau sont contigus - Det_Adj(det1); // renvoie les adresses des détecteurs adjacents au détecteur "det1" résultat dans adj1 et adj2 - suivok:=(Adj1=det3) or (Adj2=det3); - if suivok then - begin - Train_ch:=event_det_train[i].nom_train; - AdrTrainLoc:=event_det_train[i].AdrTrain; - - event_det_tick[N_event_tick].train:=i; - - // en mode roulage, on a placé les trains - if roulage then - begin - j:=1; - repeat - trouve:=placement[j].detdir=det3; - inc(j); - until (j>6) or trouve; - dec(j); - //si début de démarrage train i - if trouve and (TrainZone[i].Nbre=0) and (det10 then Maj_Feu(j); - exit; - end; - if Traceliste then AfficheDebug(inttoSTR(det3)+' n''est pas contigu à '+intToSTR(det1)+' pour le train '+intToSTR(i),clyellow); - traite:=true; // traiter le train suivant - end; - - // 2 éléments dans le tableau et détecteur à 0--------------------------------------------- - if (nbre=2) and not(front) then - begin - if TraceListe or (NivDebug=3) then AfficheDebug('2-0 traitement Train n°'+intToSTR(i)+' 2 détecteurs',couleur); - // test si det1, det2 et det3 sont contigus malgré aig mal positionnés - //zizi + if TraceListe or (NivDebug=3) then AfficheDebug('2-0 traitement Train n°'+intToSTR(i)+' 2 détecteurs',couleur); + // test si det1, det2 et det3 sont contigus malgré aig mal positionnés det_suiv:=det_suiv_cont(det1,det2); // test si le suivant de det1 à det2 est bien le nouveau détecteur (det3) if traceliste then affichedebug('Le suivant aux '+intToSTR(det1)+' '+intToSTR(det2)+' est '+intToSTR(det_suiv),couleur); SuivOk:=det_suiv=det3; @@ -8237,6 +7141,19 @@ begin end else begin + // en mode roulage, voir si on perd le détecteur si le train était arreté devat un signal rouge + {if roulage then + begin + AdrFeu:=event_det_train[i].signal_rouge; + if AdrFeu<>0 then + begin + s:='Erreur signal '+intToSTR(AdrFeu)+' au rouge et perte détecteur: ignoré'; + Affiche_Evt(s,clred); + if traceListe then AfficheDebug(s,clred); + event_det_tick[N_event_tick].reaffecte:=4; // fd sur un feu à 0 + exit; + end; + end;} if (det20 then s:=s+' @'+intToSTR(AdrTrainLoc); - s:=s+' '+intToStr(det2)+' à '+intToStr(det3)+'=>'+IntToSTR(det3)+' à '+IntToStr(AdrSuiv); - s:=s+' Prev='+intToSTR(TrainPrevZone[i][1]); - Lines.Add(s); - RE_ColorLine(FormDebug.RichEdit,lines.count-1,couleur); - end; s:='Train '+IntToSTR(i); if AdrTrainLoc<>0 then s:=s+' @'+intToSTR(AdrTrainLoc); s:=s+' '+Train_ch+' sur zones '+IntToSTR(det3)+' à '+IntToStr(AdrSuiv); @@ -8339,11 +7247,8 @@ begin if AffAigDet then AfficheDebug(s,couleur); Affiche_Evt('1.Tampon train '+intToStr(i)+' '+event_det_train[i].nom_train+'--------',couleur); - with FormDebug.MemoEvtDet do - begin - Affiche_Evt(intToSTR(event_det_train[i].det[1].adresse),couleur); - Affiche_Evt(intToStr(event_det_train[i].det[2].adresse),couleur); - end; + Affiche_Evt(intToSTR(event_det_train[i].det[1].adresse),couleur); + Affiche_Evt(intToStr(event_det_train[i].det[2].adresse),couleur); if TraceListe or dupliqueEvt then begin AfficheDebug(intToSTR(event_det_train[i].det[1].adresse),couleur); @@ -8364,8 +7269,8 @@ begin Maj_Feu(j); k:=index_feu(j); // si le feu j est au rouge - etat:=feux[k].etatsignal; - if (testBit(etat,carre)) or (testBit(etat,semaphore)) or (testBit(etat,semaphore_cli)) then + etatSig:=feux[k].etatsignal; + if (testBit(etatSig,carre)) or (testBit(etatSig,semaphore)) or (testBit(etatSig,semaphore_cli)) then begin // Maj du signal précédent (pour l'avertissement) j:=Signal_precedent(j); @@ -8391,13 +7296,447 @@ begin s:='7. Rebond dét. '+intToSTR(det3)+' déjà affecté au train '+IntToSTR(i); FormDebug.MemoEvtDet.lines.add(s); if dupliqueEvt then AfficheDebug(s,clyellow); - // exhit sortir end; end; - //traite:=true; + end; +end; + + +// calcul des zones depuis le tableau des fronts montants ou descendants des évènements détecteurs +// transmis dans le tableau Event_det +// rattache le nouveau détecteur à un train +// adresse: adresse du detecteur, front: état du détecteur +procedure calcul_zones_V1(adresse: integer;etat : boolean); +var m,AdrFeu,AdrDetFeu,AdrTrainLoc,Nbre,i,i2,j,k,n,det1,det2,det3,det4,AdrSuiv,AdrPrec,Prev, + id_couleur,det_suiv,nc,etatSig : integer ; + traite,trouve,SuivOk,casaig,rebond : boolean; + couleur : tcolor; + TypeSuiv : tEquipement; + s,train_ch : string; +begin + det3:=adresse; // c'est le nouveau détecteur + if det3=0 then exit; // pas de nouveau détecteur + traite:=false; + rebond:=false; + s:='Le nouveau détecteur est '+IntToSTR(det3); + if etat then s:=s+' 1' else s:=s+' 0'; + Affiche_evt(s,clwhite) ; + if dupliqueEvt then AfficheDebug(s,clyellow) ; + + for i:=1 to N_trains do + begin + index_couleur:=((i - 1) mod NbCouleurTrain) +1; + couleur:=CouleurTrain[index_couleur]; + Nbre:=event_det_train[i].NbEl ; // Nombre d'éléments du tableau courant exploré + det1:=event_det_train[i].det[1].adresse; + det2:=event_det_train[i].det[2].adresse; + + + if ((det2=det3) and (nbre=2)) or ((det1=det3) and (nbre=1)) then + begin + //s:='Dét. '+intToSTR(det3)+' déjà affecté au train '+IntToSTR(i); + //Affiche_evt(s,clwhite); + event_det_tick[N_event_tick].train:=i; + event_det_tick[N_event_tick].reaffecte:=3; + if dupliqueEvt then AfficheDebug(s,clyellow); + rebond:=true; // possible rebond ? end; - if (nbre=2) and front then + + // 1 élément dans le tableau et détecteur à 0--------------------------------------------- + if (nbre=1) and not(etat) then + begin + Det_Adj(det3); // renvoie les adresses des détecteurs adjacents au détecteur "det3" résultat dans adj1 et adj2 + //if (roulage) then + begin + // traiter pour les cas avec 1 élément + if traceListe then AfficheDebug('1-0 traitement Train n°'+intToSTR(i)+' 1 détecteur',clyellow); + // vérifier si l'élément du tableau et le nouveau sont contigus + if (Adj1=det1) or (Adj2=det1) then + begin + event_det_tick[N_event_tick].train:=i; + + with event_det_train[i] do + begin + det[2].adresse:=det3; + det[2].etat:=etat; + NbEl:=2; + end; + + // en mode roulage, on a placé les trains + if roulage then + begin + adrTrainLoc:=event_det_train[i].Adrtrain; + Train_ch:=event_det_train[i].nom_train; + if (AdrTrainLoc=0) and roulage then Affiche('Démarrage train non placé depuis détecteur '+intToSTR(det3),clred); + + j:=1; + repeat + trouve:=placement[j].detdir=det3; + inc(j); + until (j>6) or trouve; + dec(j); + //si début de démarrage train i + if not(trouve) or (TrainZone[i].Nbre>0) then + begin + exit; + end; + // affecter le nouveau détecteur + detecteur[det3].train:=Train_ch; + detecteur[det3].AdrTrain:=AdrTrainLoc; + // libérer l'ancien + //detecteur[event_det_train[i].Det[1].adresse].AdrTrain:=0; + //detecteur[event_det_train[i].Det[1].adresse].train:=''; + end; + + AdrSuiv:=detecteur_suivant_el(det1,det,det3,det,1); + //*** route validée *** + if (det1MaxZones then n:=1; + with TrainZone[i] do + begin + Nbre:=n; + Zone[n].det1:=det1; + Zone[n].det2:=det3; + train:=train_ch; + AdrTrain:=AdrTrainLoc + end; + end; + //reserve_canton(det1,det3,false,0,false); // déreserve le canton précedent + //reserve_canton(det3,AdrSuiv,false,TrainZone[i].Adrtrain,true); // si feu réserve canton courant + libere_canton(det1,det3); // on quitte det3 + reserve_canton(det3,adrSuiv,adrtrainLoc); + event_act(det1,det3,1,''); // évènement actionneur + maj_feux; + + // affichages + Affiche_Evt('1-0 route ok de '+intToSTR(det1)+' à '+IntToSTR(det3),clWhite); + if traceListe then AfficheDebug(s,clyellow); + //Affiche(s,CouleurTrain[index_couleur]); + if AffAigDet then AfficheDebug(s,clyellow); + + Affiche_Evt('1-0. Tampon train '+intToStr(i)+' '+event_det_train[i].nom_train+'--------',couleur); + s:=intToSTR(event_det_train[i].det[1].adresse); + Affiche_Evt(s,couleur); + if dupliqueEvt or traceliste then AfficheDebug(s,clyellow); + s:=intToSTR(event_det_train[i].det[2].adresse); + Affiche_evt(s,couleur); + if dupliqueEvt or traceliste then AfficheDebug(s,clyellow); + + if TCOouvert then + begin + // activation + if ModeCouleurCanton=0 then zone_TCO(det3,AdrSuiv,1) + else zone_TCO(det3,adrSuiv,2); // affichage avec la couleur de index_couleur du train + end; + exit; // sortir absolument + end + else + begin + Affiche_evt('1-0 Les éléments '+intToSTR(det1)+' et '+intToSTR(det3)+' ne sont pas contigus',clyellow); + // det3 et det1 non adjacents + end; + end; + end; + + // 1 élément dans le tableau et détecteur à 1 : on pilote le train si feu sur det3--------------------------------------------- + if (nbre=1) and etat then + begin + if traceListe then AfficheDebug('1-1 Traitement Train n°'+intToSTR(i)+' 1 détecteur',clyellow); + // vérifier si l'élément du tableau et le nouveau sont contigus + Det_Adj(det1); // renvoie les adresses des détecteurs adjacents au détecteur "det1" résultat dans adj1 et adj2 + suivok:=(Adj1=det3) or (Adj2=det3); + if suivok then + begin + Train_ch:=event_det_train[i].nom_train; + AdrTrainLoc:=event_det_train[i].AdrTrain; + + event_det_tick[N_event_tick].train:=i; + + // en mode roulage, on a placé les trains + if roulage then + begin + j:=1; + repeat + trouve:=placement[j].detdir=det3; + inc(j); + until (j>6) or trouve; + dec(j); + //si début de démarrage train i + if trouve and (TrainZone[i].Nbre=0) and (det10 then Maj_Feu(j); + exit; + end; + if Traceliste then AfficheDebug(inttoSTR(det3)+' n''est pas contigu à '+intToSTR(det1)+' pour le train '+intToSTR(i),clyellow); + traite:=true; // traiter le train suivant + end; + + // 2 éléments dans le tableau et détecteur à 0--------------------------------------------- + if (nbre=2) and not(etat) then + { begin + if not(cdm_connecte) then + begin + detecteur[det3].tempo0:=3; // filtrage à 0,3s + exit; + end; + traite_det0(det3); // ne faire qu'une + end; + } + begin + if TraceListe or (NivDebug=3) then AfficheDebug('2-0 traitement Train n°'+intToSTR(i)+' 2 détecteurs',couleur); + // test si det1, det2 et det3 sont contigus malgré aig mal positionnés + det_suiv:=det_suiv_cont(det1,det2); // test si le suivant de det1 à det2 est bien le nouveau détecteur (det3) + if traceliste then affichedebug('Le suivant aux '+intToSTR(det1)+' '+intToSTR(det2)+' est '+intToSTR(det_suiv),couleur); + SuivOk:=det_suiv=det3; + CasAig:=false; + + if not(SuivOk) then + begin + // cas d'un aiguillage qui a changé + if det3=event_det_train[i].suivant then + begin + CasAig:=true; + s:='***CasAigChg train '+intToSTR(i)+' '+intToSTR(det1)+' '+intToSTR(det2)+' '+intToSTR(det3); + Affiche_Evt(s,couleur); + if TraceListe then AfficheDebug(s,couleur); + // trouver le suivant + det_Adj(det3); + if adj1<9990 then adrSuiv:=adj1; + if adj2<9990 then adrSuiv:=adj2; + event_det_tick[N_event_tick].reaffecte:=2; // réaffecté par changement d'aiguillage + end; + end; + + if SuivOk or CasAig then + begin + if TraceListe then AfficheDebug('Route est valide, dét '+intToSTR(det2)+' '+intToSTR(det3)+' contigus',couleur); + // ici on cherche le suivant à det2 det3, algo=1 + event_det_tick[N_event_tick].train:=i; + if not(casAig) then AdrSuiv:=detecteur_suivant_el(det2,det,det3,det,0); // dans le cas de CasAig, alors adrSuiv=9996 donc AdrSuiv est calculé plus haut + event_det_train[i].suivant:=AdrSuiv; + if TraceListe then AfficheDebug('le sursuivant est '+intToSTR(adrsuiv),couleur); + if (Adrsuiv>=9990) and not(casaig) then + begin + //Affiche('Erreur 1500 : pas de suivant sur la route de '+intToSTR(det2)+' à '+intToSTR(det3),clRed); + if (NivDebug=3) or TraceListe then AfficheDebug('Msg 1500 : pas de suivant sur la route de '+intToSTR(det2)+' à '+intToSTR(det3),clorange); + end + else + begin + // en mode roulage, voir si on perd le détecteur si le train était arreté devat un signal rouge + {if roulage then + begin + AdrFeu:=event_det_train[i].signal_rouge; + if AdrFeu<>0 then + begin + s:='Erreur signal '+intToSTR(AdrFeu)+' au rouge et perte détecteur: ignoré'; + Affiche_Evt(s,clred); + if traceListe then AfficheDebug(s,clred); + event_det_tick[N_event_tick].reaffecte:=4; // fd sur un feu à 0 + exit; + end; + end;} + if (det2MaxZones then n:=1; + with TrainZone[i] do + begin + Nbre:=n; + Zone[n].det1:=det3; + Zone[n].det2:=AdrSuiv; + Nbre:=n; + end; + // zone suivante en prévision + det4:=detecteur_suivant_EL(det3,det,AdrSuiv,det,1); + TrainPrevZone[i][1]:=det4; + end; + + event_act(det2,det3,0,''); // désactivation zone + event_act(det3,AdrSuiv,1,''); // activation zone + end + else + begin + s:='Erreur 740 : Adresse détecteur trop élevé '; + if det2>NbMemZone then s:=s+inttostr(det2)+' '; + if det3>NbMemZone then s:=s+inttostr(det2)+' '; + if AdrSuiv>NbMemZone then s:=s+inttostr(det2); + Affiche(s,clred); + end; + + // supprimer le 1er et décaler + with event_det_train[i] do + begin + det[1].adresse:=event_det_train[i].det[2].adresse; + det[1].etat:=event_det_train[i].det[2].etat; + det[2].adresse:=det3; + det[2].etat:=detecteur[det3].etat; + NbEl:=2; + end; + + // affichages + s:='2-0 Train n°'+intToSTR(i)+' route ok de '+intToSTR(det2)+' à '+IntToSTR(det3); + if casAig then s:=s+'A'; + s:=s+' à '+IntToSTR(Adrsuiv); + + Affiche_evt(s,couleur); + if traceListe then AfficheDebug(s,clyellow); + s:='Train '+IntToSTR(i); + if AdrTrainLoc<>0 then s:=s+' @'+intToSTR(AdrTrainLoc); + s:=s+' '+Train_ch+' sur zones '+IntToSTR(det3)+' à '+IntToStr(AdrSuiv); + if traceListe then AfficheDebug(s,couleur); + + s:='Train '+IntToSTR(i); + if AdrTrainLoc<>0 then s:=s+' '+train_ch+' @'+intToSTR(AdrTrainLoc); + s:=s+' sur zones '+IntToSTR(det3)+' à '+IntToStr(AdrSuiv); + Affiche(s,Couleur); + if AffAigDet then AfficheDebug(s,couleur); + + Affiche_Evt('1.Tampon train '+intToStr(i)+' '+event_det_train[i].nom_train+'--------',couleur); + Affiche_Evt(intToSTR(event_det_train[i].det[1].adresse),couleur); + Affiche_Evt(intToStr(event_det_train[i].det[2].adresse),couleur); + if TraceListe or dupliqueEvt then + begin + AfficheDebug(intToSTR(event_det_train[i].det[1].adresse),couleur); + AfficheDebug(intToSTR(event_det_train[i].det[2].adresse),couleur); + end; + if TCOouvert then + begin + zone_TCO(det2,det3,0); // désactivation + // activation + if ModeCouleurCanton=0 then zone_TCO(det3,AdrSuiv,1) + else zone_TCO(det3,AdrSuiv,2); // affichage avec la couleur de index_couleur du train + end; + + // mettre à jour si présence signal sur det3 pour le passer au rouge de suite + j:=signal_detecteur(det3); + if j<>0 then + begin + Maj_Feu(j); + k:=index_feu(j); + // si le feu j est au rouge + etatSig:=feux[k].etatsignal; + if (testBit(etatSig,carre)) or (testBit(etatSig,semaphore)) or (testBit(etatSig,semaphore_cli)) then + begin + // Maj du signal précédent (pour l'avertissement) + j:=Signal_precedent(j); + if j<>0 then + begin + maj_feu(j); + j:=Signal_precedent(j); + if j<>0 then maj_feu(j); + end; + end; + end; + maj_feux; // mise à jour générale + maj_feux; // 2eme mise à jour + maj_feux; + exit; // sortir absolument + end; + end + else + begin + //Affiche_Evt('Route invalide: dét '+intToSTR(det2)+' '+intToSTR(det3)+' non contigus',clOrange); + if event_det_train[i].det[2].adresse=det3 then + begin + s:='7. Rebond dét. '+intToSTR(det3)+' déjà affecté au train '+IntToSTR(i); + FormDebug.MemoEvtDet.lines.add(s); + if dupliqueEvt then AfficheDebug(s,clyellow); + end; + end; + end; + + + if (nbre=2) and etat then begin if TraceListe or (NivDebug=3) then AfficheDebug('2-1 traitement Train n°'+intToSTR(i)+' 2 détecteurs',clwhite); // front descendant sur détecteur 2 @@ -8424,7 +7763,10 @@ begin detecteur[det2].train:=''; // désaffectation du nom de train de l'ancien détecteur detecteur[det2].AdrTrain:=0; - pilote_train(det2,det3,adrtrainLoc); // pilote le train sur det3 + i2:=index_train_adresse(AdrTrainLoc); + if i2<>0 then trains[i2].index_event_det_train:=i; // lier l'index du train en circulation + + pilote_train(det2,det3,adrtrainLoc,i); // pilote le train sur det3 // test si on peut réserver le canton suivant det_suiv:=det_suiv_cont(det2,det3); if det_suiv<9990 then reserve_canton(det3,det_suiv,AdrTrainLoc); @@ -8458,17 +7800,9 @@ begin end; end; // affichages - s:='2-1 Train n°'+intToSTR(i)+' Route ok de '+intToSTR(det2)+' à '+IntToSTR(det3)+' '+intToSTR(det3)+' à '+IntToSTR(Adrsuiv); + s:='2-1 Train n°'+intToSTR(i)+' Route ok de '+intToSTR(det2)+' à '+IntToSTR(det3); Affiche_evt(s,couleur); if traceListe then AfficheDebug(s,Couleur); - if DebugAffiche then With FormDebug.RichEdit do - begin - s:='Train '+IntToSTR(i)+' '+intToStr(det2)+' à '+intToStr(det3); - Lines.Add(s); - RE_ColorLine(FormDebug.RichEdit,lines.count-1,Couleur); - end; - if TraceListe then AfficheDebug(s,couleur); - Affiche(s,Couleur); if AffAigDet then AfficheDebug(s,couleur); if TCOouvert then begin @@ -8482,44 +7816,698 @@ begin else begin if TraceListe then AfficheDebug('La route est invalide car les détecteurs '+intToSTR(det2)+' '+intToSTR(det3)+' ne sont pas contigus',clOrange); - if event_det_train[i].det[2].adresse=det3 then + {if rebond and (event_det_train[i].det[2].adresse=det3) then begin s:='7. Rebond dét. '+intToSTR(det3)+' déjà affecté au train '+IntToSTR(i); FormDebug.MemoEvtDet.lines.add(s); if dupliqueEvt then AfficheDebug(s,clyellow); + // désaffecter la zone + memzone[det2,det_suiv].etat:=false; + memZone[det1,det2].etat:=true; exit; // rebond :sortir - end; + end; } end; traite:=true; // non traité: train suivant end; end; // fin de la boucle for i - // nouveau train front det=1 (uniquement mode roulage) - { - if front then + // dans cette partie, le détecteur n'a pas encore été affecté à un train existant. + if rebond then exit; + + if etat then + begin + for i:=1 to N_trains do + begin + i2:=event_det_train[i].Suivant; + SuivOk:=event_det_train[i].Det[2].etat ; + det_adj(det3); + if (adj1=i2) or (adj2=i2) then + begin + s:='Train '+intToSTR(i)+' Détection '+intToSTR(det3)+' à 1 avant RAZ du '+intToSTR(i2); + Affiche_evt(s,clorange); + if traceListe then afficheDebug(s,clorange); + detecteur[det3].AdrTrain:=i; // récupération du train au détecteur + + adrTrainLoc:=detecteur[i2].AdrTrain; + Train_ch:=MemZone[det2,i2].train; + + detecteur[det3].train:=Train_ch; // affectation nom train au nouveau détecteur + detecteur[det3].AdrTrain:=AdrTrainLoc; // affectation train au nouveau détecteur + detecteur[det2].train:=''; // désaffectation du nom de train de l'ancien détecteur + detecteur[det2].AdrTrain:=0; + + event_det_tick[N_event_tick].train:=i; + event_det_tick[N_event_tick].reaffecte:=1; // mauvais séquençage détecteurs contigus + + pilote_train(i2,det3,adrtrainLoc,i); // pilote le train sur det3 + // test si on peut réserver le canton suivant + det_suiv:=det_suiv_cont(i2,det3); + if det_suiv<9990 then reserve_canton(det3,det_suiv,AdrTrainLoc); + // libère canton + libere_canton(i2,det3); + + + exit; + end; + end; + end; + + // nouveau train front det=0 + if not(etat) then begin if traceListe then AfficheDebug('Nouveau train',clyellow); + // Nombre d'éléments à 0 : ici c'est un nouveau train donc créer un train, donc un tableau if N_Trains>=Max_Trains then begin Affiche('Erreur nombre de train maximal atteint',clRed); N_trains:=0; end; Inc(N_trains); + event_det_tick[N_event_tick].train:=n_trains; + with event_det_train[N_trains] do begin - det[1].adresse:=det3; + det[1].adresse:=0; det[2].adresse:=0; - det[1].etat:=front; - NbEl:=1; - nom_train:=detecteur[det3].train; - AdrTrain:=detecteur[det3].AdrTrain; + NbEl:=0; + nom_train:=''; + end; + + // vérifier si le détecteur du nouveau train est associé à un feu vers un buttoir + for i:=1 to NbreFeux do + begin + AdrFeu:=Feux[i].Adresse; + AdrDetfeu:=Feux[i].Adr_Det1; + if (AdrDetFeu=Det3) and (feux[i].aspect<10) then + begin + AdrSuiv:=Feux[i].Adr_el_suiv1; + TypeSuiv:=Feux[i].Btype_suiv1; + AdrPrec:=detecteur_suivant(AdrSuiv,typeSuiv,AdrDetFeu,det,1) ; // détecteur précédent le feu ; algo 1 + if AdrPrec=0 then + begin + if TraceListe then Affiche('FD - Le feu '+IntToSTR(AdrFeu)+' est précédé d''un buttoir',clyellow); + if AdrDetFeu6) or trouve; + dec(j); + //si début de démarrage train i + if not(trouve) or (TrainZone[i].Nbre>0) then + begin + exit; + end; + // affecter le nouveau détecteur + detecteur[det3].train:=Train_ch; + detecteur[det3].AdrTrain:=AdrTrainLoc; + // libérer l'ancien + //detecteur[event_det_train[i].Det[1].adresse].AdrTrain:=0; + //detecteur[event_det_train[i].Det[1].adresse].train:=''; + end; + + AdrSuiv:=detecteur_suivant_el(det1,det,det3,det,1); + //*** route validée *** + if (det1MaxZones then n:=1; + with TrainZone[i] do + begin + Nbre:=n; + Zone[n].det1:=det1; + Zone[n].det2:=det3; + train:=train_ch; + AdrTrain:=AdrTrainLoc + end; + end; + //reserve_canton(det1,det3,false,0,false); // déreserve le canton précedent + //reserve_canton(det3,AdrSuiv,false,TrainZone[i].Adrtrain,true); // si feu réserve canton courant + libere_canton(det1,det3); // on quitte det3 + reserve_canton(det3,adrSuiv,adrtrainLoc); + event_act(det1,det3,1,''); // évènement actionneur + maj_feux; + + // affichages + Affiche_Evt('1-0 route ok de '+intToSTR(det1)+' à '+IntToSTR(det3),clWhite); + if traceListe then AfficheDebug(s,clyellow); + //Affiche(s,CouleurTrain[index_couleur]); + if AffAigDet then AfficheDebug(s,clyellow); + + Affiche_Evt('1-0. Tampon train '+intToStr(i)+' '+event_det_train[i].nom_train+'--------',couleur); + s:=intToSTR(event_det_train[i].det[1].adresse); + Affiche_Evt(s,couleur); + if dupliqueEvt or traceliste then AfficheDebug(s,clyellow); + s:=intToSTR(event_det_train[i].det[2].adresse); + Affiche_evt(s,couleur); + if dupliqueEvt or traceliste then AfficheDebug(s,clyellow); + + if TCOouvert then + begin + // activation + if ModeCouleurCanton=0 then zone_TCO(det3,AdrSuiv,1) + else zone_TCO(det3,adrSuiv,2); // affichage avec la couleur de index_couleur du train + end; + exit; // sortir absolument + end + else + begin + Affiche_evt('1-0 Les éléments '+intToSTR(det1)+' et '+intToSTR(det3)+' ne sont pas contigus',clyellow); + // det3 et det1 non adjacents + end; + end; + end; + + // 1 élément dans le tableau et détecteur à 1 : on pilote le train si feu sur det3--------------------------------------------- + if (nbre=1) and etat then + begin + if traceListe then AfficheDebug('1-1 Traitement Train n°'+intToSTR(i)+' 1 détecteur',clyellow); + // vérifier si l'élément du tableau et le nouveau sont contigus + Det_Adj(det1); // renvoie les adresses des détecteurs adjacents au détecteur "det1" résultat dans adj1 et adj2 + suivok:=(Adj1=det3) or (Adj2=det3); + if suivok then + begin + Train_ch:=event_det_train[i].nom_train; + AdrTrainLoc:=event_det_train[i].AdrTrain; + + event_det_tick[N_event_tick].train:=i; + + // en mode roulage, on a placé les trains + if roulage then + begin + j:=1; + repeat + trouve:=placement[j].detdir=det3; + inc(j); + until (j>6) or trouve; + dec(j); + //si début de démarrage train i + if trouve and (TrainZone[i].Nbre=0) and (det10 then Maj_Feu(j); + exit; + end; + if Traceliste then AfficheDebug(inttoSTR(det3)+' n''est pas contigu à '+intToSTR(det1)+' pour le train '+intToSTR(i),clyellow); + traite:=true; // traiter le train suivant + end; + + // 2 éléments dans le tableau et détecteur à 0--------------------------------------------- + if (nbre=2) and not(etat) then + begin + if TraceListe or (NivDebug=3) then AfficheDebug('2-0 traitement Train n°'+intToSTR(i)+' 2 détecteurs',couleur); + // test si det1, det2 et det3 sont contigus malgré aig mal positionnés + { + det_suiv:=det_suiv_cont(det1,det2); // test si le suivant de det1 à det2 est bien le nouveau détecteur (det3) + if traceliste then affichedebug('Le suivant aux '+intToSTR(det1)+' '+intToSTR(det2)+' est '+intToSTR(det_suiv),couleur); + SuivOk:=det_suiv=det3; + CasAig:=false; + + if not(SuivOk) then + begin + // cas d'un aiguillage qui a changé + if det3=event_det_train[i].suivant then + begin + CasAig:=true; + s:='***CasAigChg train '+intToSTR(i)+' '+intToSTR(det1)+' '+intToSTR(det2)+' '+intToSTR(det3); + Affiche_Evt(s,couleur); + if TraceListe then AfficheDebug(s,couleur); + // trouver le suivant + det_Adj(det3); + if adj1<9990 then adrSuiv:=adj1; + if adj2<9990 then adrSuiv:=adj2; + event_det_tick[N_event_tick].reaffecte:=2; // réaffecté par changement d'aiguillage + end; + end; + } + casaig:=false; + suivok:=det2=det3; + + if SuivOk or CasAig then + begin + if TraceListe then AfficheDebug('Route est valide, dét '+intToSTR(det2)+' '+intToSTR(det3)+' contigus',couleur); + // ici on cherche le suivant à det2 det3, algo=1 + event_det_tick[N_event_tick].train:=i; + Adrsuiv:=det_suiv_cont(det1,det2); + //if not(casAig) then AdrSuiv:=detecteur_suivant_el(det2,det,det3,det,0); // dans le cas de CasAig, alors adrSuiv=9996 donc AdrSuiv est calculé plus haut + event_det_train[i].suivant:=AdrSuiv; + if TraceListe then AfficheDebug('le sursuivant est '+intToSTR(adrsuiv),couleur); + if (Adrsuiv>=9990) and not(casaig) then + begin + //Affiche('Erreur 1500 : pas de suivant sur la route de '+intToSTR(det2)+' à '+intToSTR(det3),clRed); + if (NivDebug=3) or TraceListe then AfficheDebug('Msg 1500 : pas de suivant sur la route de '+intToSTR(det2)+' à '+intToSTR(det3),clorange); + end + else + begin + if (det2MaxZones then n:=1; + with TrainZone[i] do + begin + Nbre:=n; + Zone[n].det1:=det3; + Zone[n].det2:=AdrSuiv; + Nbre:=n; + end; + // zone suivante en prévision + det4:=detecteur_suivant_EL(det3,det,AdrSuiv,det,1); + TrainPrevZone[i][1]:=det4; + end; + + event_act(det2,det3,0,''); // désactivation zone + event_act(det3,AdrSuiv,1,''); // activation zone + end + else + begin + s:='Erreur 740 : Adresse détecteur trop élevé '; + if det2>NbMemZone then s:=s+inttostr(det2)+' '; + if det3>NbMemZone then s:=s+inttostr(det2)+' '; + if AdrSuiv>NbMemZone then s:=s+inttostr(det2); + Affiche(s,clred); + end; + { + // supprimer le 1er et décaler + with event_det_train[i] do + begin + det[1].adresse:=event_det_train[i].det[2].adresse; + det[1].etat:=event_det_train[i].det[2].etat; + det[2].adresse:=det3; + det[2].etat:=detecteur[det3].etat; + NbEl:=2; + end; + } + event_det_train[i].det[2].etat:=etat; + // affichages + s:='2-0 Train n°'+intToSTR(i)+' route ok de '+intToSTR(det2)+' à '+IntToSTR(det3); + if casAig then s:=s+'A'; + s:=s+' à '+IntToSTR(Adrsuiv); + + Affiche_evt(s,couleur); + if traceListe then AfficheDebug(s,clyellow); + s:='Train '+IntToSTR(i); + if AdrTrainLoc<>0 then s:=s+' @'+intToSTR(AdrTrainLoc); + s:=s+' '+Train_ch+' sur zones '+IntToSTR(det3)+' à '+IntToStr(AdrSuiv); + if traceListe then AfficheDebug(s,couleur); + + s:='Train '+IntToSTR(i); + if AdrTrainLoc<>0 then s:=s+' '+train_ch+' @'+intToSTR(AdrTrainLoc); + s:=s+' sur zones '+IntToSTR(det3)+' à '+IntToStr(AdrSuiv); + Affiche(s,Couleur); + if AffAigDet then AfficheDebug(s,couleur); + + Affiche_Evt('1.Tampon train '+intToStr(i)+' '+event_det_train[i].nom_train+'--------',couleur); + Affiche_Evt(intToSTR(event_det_train[i].det[1].adresse),couleur); + Affiche_Evt(intToStr(event_det_train[i].det[2].adresse)+' 0',couleur); + if TraceListe or dupliqueEvt then + begin + AfficheDebug(intToSTR(event_det_train[i].det[1].adresse),couleur); + AfficheDebug(intToSTR(event_det_train[i].det[2].adresse),couleur); + end; + if TCOouvert then + begin + zone_TCO(det2,det3,0); // désactivation + // activation + if ModeCouleurCanton=0 then zone_TCO(det3,AdrSuiv,1) + else zone_TCO(det3,AdrSuiv,2); // affichage avec la couleur de index_couleur du train + end; + + // mettre à jour si présence signal sur det3 pour le passer au rouge de suite + j:=signal_detecteur(det3); + if j<>0 then + begin + Maj_Feu(j); + k:=index_feu(j); + // si le feu j est au rouge + etatSig:=feux[k].etatsignal; + if (testBit(etatSig,carre)) or (testBit(etatSig,semaphore)) or (testBit(etatSig,semaphore_cli)) then + begin + // Maj du signal précédent (pour l'avertissement) + j:=Signal_precedent(j); + if j<>0 then + begin + maj_feu(j); + j:=Signal_precedent(j); + if j<>0 then maj_feu(j); + end; + end; + end; + maj_feux; // mise à jour générale + maj_feux; // 2eme mise à jour + maj_feux; + exit; // sortir absolument + end; + end + else + begin + //Affiche_Evt('Route invalide: dét '+intToSTR(det2)+' '+intToSTR(det3)+' non contigus',clOrange); + if event_det_train[i].det[2].adresse=det3 then + begin + s:='7. Rebond dét. '+intToSTR(det3)+' déjà affecté au train '+IntToSTR(i); + FormDebug.MemoEvtDet.lines.add(s); + if dupliqueEvt then AfficheDebug(s,clyellow); + // exhit sortir + end; + end; + //traite:=true; + end; + + if (nbre=2) and etat then + begin + if TraceListe or (NivDebug=3) then AfficheDebug('2-1 traitement Train n°'+intToSTR(i)+' 2 détecteurs',clwhite); + // front descendant sur détecteur 2 + det_suiv:=det_suiv_cont(det1,det2); // test si le suivant de det1 à det2 est bien le nouveau détecteur (det3) + if traceliste then affichedebug('Le suivant aux '+intToSTR(det1)+' '+intToSTR(det2)+' est '+intToSTR(det_suiv),clWhite); + if (det_suiv=det3) then + begin + event_det_tick[N_event_tick].train:=i; + if TraceListe then AfficheDebug('La route est valide car les détecteurs '+intToSTR(det2)+' '+intToSTR(det3)+' sont contigus',couleur); + if (det1NbMemZone then s:=s+inttostr(det2)+' '; + if det3>NbMemZone then s:=s+inttostr(det2)+' '; + if AdrSuiv>NbMemZone then s:=s+inttostr(det2); + Affiche(s,clred); + end; + // stockage dans historique de zones sauf s'il est déja stocké + if idet2) or (TrainZone[i].Zone[n].det2<>det3) then + begin + n:=TrainZone[i].Nbre+1; + if n>MaxZones then n:=1; + TrainZone[i].Nbre:=n; + TrainZone[i].Zone[n].det1:=det2; + TrainZone[i].Zone[n].det2:=det3; + TrainZone[i].Nbre:=n; + // zone suivante en prévision + det4:=detecteur_suivant_EL(det2,det,det3,det,1); + TrainPrevZone[i][1]:=det4; + end; + end; + // affichages + s:='2-1 Train n°'+intToSTR(i)+' Route ok de '+intToSTR(det2)+' à '+IntToSTR(det3); + Affiche_evt(s,couleur); + if traceListe then AfficheDebug(s,Couleur); + if AffAigDet then AfficheDebug(s,couleur); + if TCOouvert then + begin + zone_TCO(det1,det2,0); // désactivation + // activation + if ModeCouleurCanton=0 then zone_TCO(det2,det3,1) + else zone_TCO(det2,det3,2); // affichage avec la couleur de index_couleur du train + end; + exit; // sortir absolument + end + else + begin + if TraceListe then AfficheDebug('La route est invalide car les détecteurs '+intToSTR(det2)+' '+intToSTR(det3)+' ne sont pas contigus',clOrange); + {if rebond and (event_det_train[i].det[2].adresse=det3) then + begin + s:='7. Rebond dét. '+intToSTR(det3)+' déjà affecté au train '+IntToSTR(i); + FormDebug.MemoEvtDet.lines.add(s); + if dupliqueEvt then AfficheDebug(s,clyellow); + // désaffecter la zone + memzone[det2,det_suiv].etat:=false; + memZone[det1,det2].etat:=true; + exit; // rebond :sortir + end; } + end; + traite:=true; // non traité: train suivant + end; + end; // fin de la boucle for i + + // dans cette partie, le détecteur n'a pas encore été affecté à un train existant. + if rebond then exit; + + if etat then begin - // voir si on crée un nouveau train for i:=1 to N_trains do begin det2:=event_det_train[i].Suivant; @@ -8530,14 +8518,14 @@ begin Affiche_evt('Train '+intToSTR(i)+' Détection '+intToSTR(det3)+' à 1 avant RAZ du '+intToSTR(det2),clorange); detecteur[det3].AdrTrain:=i; // récupération du train au détecteur event_det_tick[N_event_tick].train:=i; - event_det_tick[N_event_tick].reaffecte:=1; + event_det_tick[N_event_tick].reaffecte:=1; // mauvais séquençage détecteurs contigus exit; end; end; end; // nouveau train front det=0 - if traite or not(front) then + if not(etat) then begin if traceListe then AfficheDebug('Nouveau train',clyellow); // Nombre d'éléments à 0 : ici c'est un nouveau train donc créer un train, donc un tableau @@ -8608,7 +8596,7 @@ begin with event_det_train[N_trains] do begin det[1].adresse:=det3; - det[1].etat:=front; + det[1].etat:=etat; NbEl:=1; nom_train:=detecteur[det3].train; AdrTrain:=detecteur[det3].AdrTrain; @@ -8627,8 +8615,8 @@ begin end; s:=intToSTR(event_det_train[N_trains].det[1].adresse); - id_couleur:=((N_trains - 1) mod NbCouleurTrain) +1;; - Affiche_Evt('0-0 Création train '+intToStr(N_trains)+' '+detecteur[det3].train+'--------', CouleurTrain[id_couleur]); + id_couleur:=((N_trains - 1) mod NbCouleurTrain) +1; + Affiche_Evt('0-0 Création train '+intToStr(N_trains)+' '+detecteur[det3].train+'--------',CouleurTrain[id_couleur]); Affiche_evt(s,CouleurTrain[id_couleur]); if dupliqueEvt then begin @@ -8644,11 +8632,12 @@ begin end; end; + procedure calcul_zones(adresse: integer;front : boolean); begin if debug=3 then formprinc.Caption:='Calcul_zones '+intToSTR(adresse); if Algo_localisation=1 then calcul_zones_v1(adresse,front); - if Algo_localisation=2 then calcul_zones_v2b(adresse,front); + if Algo_localisation=2 then calcul_zones_v2(adresse,front); if debug=3 then formprinc.Caption:=''; end; @@ -8940,7 +8929,7 @@ end; // traitement des évènements détecteurs procedure Event_Detecteur(Adresse : integer;etat : boolean;train : string); -var dr,i,AdrSuiv,indextrain,AdrFeu,AdrDetfeu,index,Etat01,AdrPrec : integer; +var dr,i,AdrSuiv,AdrFeu,AdrDetfeu,index,Etat01,AdrPrec : integer; typeSuiv : tequipement; s : string; begin @@ -8949,6 +8938,29 @@ begin Affiche('Erreur 82 : reçu adresse de détecteur trop grande : '+intToSTR(adresse),clred); exit; end; + + // vérifier si front descendant pour filtrage + if filtrageDet0<>0 then + begin + dr:=detecteur[adresse].tempo0; + if (detecteur[Adresse].etat and not(etat)) and (dr=0) then + begin + if dr<>0 then exit; + detecteur[adresse].tempo0:=filtrageDet0; + exit; + end; + if dr=99 then detecteur[adresse].tempo0:=0; + + // si détecteur passe à 1 et qu'un filtrage à 0 est en cours, annuler le 0 + if etat and (dr<>0) then + begin + Affiche_Evt('Détecteur '+intToSTR(adresse)+' à 0 annulé',clorange); + detecteur[adresse].tempo0:=0; + end; + end; + + + s:=detecteur[adresse].train; if (train='') and (s<>'') then train:=s; if Etat then Etat01:=1 else Etat01:=0; @@ -9185,7 +9197,7 @@ begin end; end; -// pilotage d'un accessoire (décodeur d'aiguillage, de signal) +// pilotage d'un accessoire (décodeur d'aiguillage, de signal) et génère l'event aig // par CDM ou interface // octet = 1 (dévié) ou 2 (droit) // si acc=Taig, alors la sortie "octet" est mise à 1 puis à 0 @@ -9240,8 +9252,14 @@ begin if (pilotage=0) or (pilotage>2) then exit; // pilotage par USB ou par éthernet de la centrale ------------ - if (hors_tension2=false) and (portCommOuvert or parSocketLenz) then + if (portCommOuvert or parSocketLenz) then begin + if hors_tension then + begin + Affiche('Voie hors tension, pas de pilotage d''accessoires',clRose); + result:=false; + exit; + end; if protocole=1 then begin groupe:=(adresse-1) div 4; @@ -9482,6 +9500,8 @@ begin n:=pos(#$0A,chaineINT); if n>j then delete(chaineINT,n,1); + if i>1 then delete(chaineINT,1,i-1); + ack:=chaineINT<>''; // Affiche(copy(chaineINT,i,j-i+1),clblue); @@ -9746,7 +9766,7 @@ begin delete(chaineInt,1,1); case chaineINT[1] of #$00 : begin ack:=true;msg:='Voie hors tension';end; - #$01 : begin ack:=true;msg:='Reprise';Hors_tension2:=false;end; + #$01 : begin ack:=true;msg:='Reprise';Hors_tension:=false;end; #$02 : begin ack:=true;msg:='Mode programmation ';end; @@ -9793,7 +9813,7 @@ begin begin delete(chaineInt,1,2); Affiche('Voie hors tension msg1',clRed); - Hors_tension2:=true; + Hors_tension:=true; decode_chaine_retro_Xpress:=chaineINT; exit; end; @@ -9802,7 +9822,7 @@ begin begin delete(chaineInt,1,2); Affiche('Voie hors tension msg2',clRed); - Hors_tension2:=false; + Hors_tension:=false; decode_chaine_retro_Xpress:=chaineINT; exit; end; @@ -9816,7 +9836,7 @@ begin Affiche('reprise puissance ',clLime); delete(chaineInt,1,8); - Hors_tension2:=false; + Hors_tension:=false; decode_chaine_retro_Xpress:=chaineINT; exit; end; @@ -9826,7 +9846,7 @@ begin begin delete(chaineInt,1,3); Affiche('Reprise msg 2',clOrange); - Hors_tension2:=false; + Hors_tension:=false; decode_chaine_retro_Xpress:=chaineINT; exit; end; @@ -9835,6 +9855,7 @@ begin begin delete(chaineInt,1,2); Affiche('Court circuit msg 1',clRed); + Hors_tension:=true; decode_chaine_retro_Xpress:=chaineINT; exit; end; @@ -9941,6 +9962,7 @@ begin end; Affiche('CDM rail déconnecté',Cyan); AfficheDebug('CDM rail déconnecté',Cyan); + filtrageDet0:=SauvefiltrageDet0; end; end; @@ -10013,7 +10035,10 @@ begin if (temp>15) then begin - Affiche_suivi(' mais l''interface n''a pas répondu',clyellow); + s:=' mais l''interface n''a pas répondu '; + if protocole=1 then s:=s+' en XpressNet'; + if protocole=2 then s:=s+' en DCC++'; + Affiche_suivi(s,clyellow); portCommOuvert:=false; // refermer le port result:=false; exit; @@ -10143,7 +10168,10 @@ begin if debug=1 then affiche('Connexion interface USB',clLime); if portcommouvert then exit; numport:=0; - if portcom<>'' then val(portcom[4],numport,erreur); + if portcom<>'' then + begin + val(copy(portcom,4,6),Numport,erreur); + end; if numport=0 then // scan des ports @@ -10465,6 +10493,16 @@ begin Lance_CDM:=true; end; +procedure Raz_reservations ; +var i : integer; +begin + // raz des réservations + for i:=1 to MaxAiguillage do + begin + aiguillage[i].AdrTrain:=0; + end; +end; + // supprime les events, les trains etc Procedure Raz_tout; var i,j : integer; @@ -10488,10 +10526,6 @@ begin detecteur[i].etat:=false; detecteur[i].train:=''; detecteur[i].adrTrain:=0; - detecteur[i].vers1:=0; - detecteur[i].vers2:=0; - detecteur[i].de1:=0; - detecteur[i].de2:=0; ancien_detecteur[i]:=false; end; for i:=1 to NbMemZone do @@ -10518,6 +10552,7 @@ begin event_det_train[i].Det[2].etat:=false; end; + // raz des réservations for i:=1 to maxaiguillage do begin aiguillage[i].AdrTrain:=0; @@ -10527,7 +10562,6 @@ begin if DebugAffiche then begin FormDebug.MemoEvtDet.Clear; - FormDebug.Richedit.Clear; end; roulage:=false; @@ -10589,9 +10623,8 @@ end; // démarrage principal du programme signaux_complexes procedure TFormPrinc.FormCreate(Sender: TObject); -var i,t : integer; +var i : integer; s : string; - teq : tequipement; begin TraceSign:=True; configPrete:=false; // form config prete @@ -10600,6 +10633,7 @@ begin ntrains:=0; ntrains_cdm:=0; protocole:=1; + filtrageDet0:=3; Srvc_Aig:=true; Srvc_Det:=true; Srvc_Act:=true; @@ -10710,10 +10744,10 @@ begin } // TCO - + for i:=1 to MaxCdeDccpp do CdeDccpp[i]:=''; // lecture fichiers de configuration - procetape('on va lire la config'); //2 + procetape('on va lire la config'); lit_config; lire_fichier_tco; procetape('on a lu la config'); @@ -10731,8 +10765,46 @@ begin Application.ProcessMessages; - // lancer CDM rail et le connecte si on le demande - procetape('test CDM et son lancement'); //1 + // Initialisation des images des signaux + procetape('Création des signaux'); + NbreImagePLigne:=Formprinc.ScrollBox1.Width div (largImg+5); + + // ajoute les images des feux dynamiquement + for i:=1 to NbreFeux do + begin + if debug=1 then affiche('Création du signal '+intToSTR(i)+' ----------',clLime); + cree_image(i); // et initialisation tableaux signaux + end; + Tempo_init:=5; // démarre les initialisation des signaux et des aiguillages dans 0,5 s + + // il faut afficher la fenetre TCO pour l'init aiguillage sinon violation + begin + //créée la fenêtre TCO non modale + FormTCO:=TformTCO.Create(nil); + i:=0; + repeat + application.processmessages; + inc(i); + until (TcoOuvert) or (i>20); + Application.processmessages; + if avecTCO then FormTCO.show; // créer fiche dynamique (projet/fichier) + end; + + raz_tout; + procetape('Début des init'); + I_Simule:=0; + tick:=0; + N_Event_tick:=0 ; // dernier index + NombreImages:=0; + + //Affiche('Fin des initialisations',clyellow); + LabelEtat.Caption:=' '; + Affiche_memoire; + modeStkRetro:=false; + + + // lancer CDM rail et le connecte si on le demande à faire après la création des feux et du tco + procetape('test CDM et son lancement'); if LanceCDM then Lance_CDM; procetape('fin cdm'); Loco.Visible:=true; @@ -10771,47 +10843,7 @@ begin LireunfichierdeCV1.enabled:=false; end; - // Initialisation des images des signaux - procetape('Création des signaux'); - NbreImagePLigne:=Formprinc.ScrollBox1.Width div (largImg+5); - // ajoute les images des feux dynamiquement - for i:=1 to NbreFeux do - begin - if debug=1 then affiche('Création du signal '+intToSTR(i)+' ----------',clLime); - cree_image(i); // et initialisation tableaux signaux - end; - Tempo_init:=5; // démarre les initialisation des signaux et des aiguillages dans 0,5 s - - // il faut afficher la fenetre TCO pour l'init aiguillage sinon violation - begin - //créée la fenêtre TCO non modale - FormTCO:=TformTCO.Create(nil); - i:=0; - repeat - application.processmessages; - inc(i); - until (TcoOuvert) or formTCO.active or (i>20); - Application.processmessages; - { - if not(TCOOUvert) then Affiche('Erreur : fenêtre TCO non créée',clred); - if TCOOuvert and (Debug=1) then Affiche('Fenêtre TCO créée',clYellow); - if formTCO.active then Affiche('active',clyellow); - } - if avecTCO then FormTCO.show; // créer fiche dynamique (projet/fichie) ne pas afficher sinon fenetre fantome!! - end; - - raz_tout; - procetape('Début des init'); - I_Simule:=0; - tick:=0; - N_Event_tick:=0 ; // dernier index - NombreImages:=0; - - //Affiche('Fin des initialisations',clyellow); - LabelEtat.Caption:=' '; - Affiche_memoire; - modeStkRetro:=false; if AvecInit then begin @@ -11041,6 +11073,7 @@ begin end; // arret loco sur n secondes + // démarrage loco temporisé for i:=1 to 20 do begin a:=trains[i].TempoArret; @@ -11051,6 +11084,17 @@ begin if a=0 then vitesse_loco('',trains[i].adresse,0,true) else if (a mod 10)=0 then vitesse_loco('',trains[i].adresse,trains[i].VitRalenti div 2,true); end; + a:=trains[i].TempoDemarre; + if a<>0 then + begin + dec(a); + trains[i].TempoDemarre:=a; + if a=0 then + begin + //Affiche('Démarrage train @'+intToSTR(trains[i].Adresse),clLime); + vitesse_loco('',trains[i].Adresse,trains[i].VitNominale,not(placement[i].inverse)); + end; + end; end; //simulation @@ -11091,6 +11135,7 @@ begin Index_Simule:=0; // fin de simulation I_Simule:=0; MsgSim:=false; + filtrageDet0:=SauvefiltrageDet0; Affiche('Fin de simulation',Cyan); StaticText.caption:=''; end; @@ -11098,30 +11143,22 @@ begin inc(intervalle_courant); end; - // temporisations de démarrage des trains au feux - if (Option_demarrage or roulage) then - for i:=1 to 1024 do + // temporisation détecteur à 0 + for i:=1 to NbMemZone do begin - if detecteur[i].tempo<>0 then + a:=detecteur[i].tempo0; + if a<>0 then begin - dec(detecteur[i].tempo); - //Affiche(intToSTR(i),clBlue); - if detecteur[i].tempo=0 then + dec(a); + detecteur[i].tempo0:=a; + if (a=0) then begin - //s:=detecteur[i].train; - if cdm_connecte then - begin - s:=chaine_CDM_vitesseST(100,s); // 100% - envoi_cdm(s); - end; - if roulage then - begin - a:=index_train_adresse(detecteur[i].AdrTrain); - if (a>1) and (a'0' then ClientSocketInterface.port:=portInterface; ClientSocketInterface.Address:=AdresseIP; ClientSocketInterface.Open; - Hors_tension2:=false; + Hors_tension:=false; end; end; @@ -11368,7 +11405,7 @@ begin end; procedure TFormPrinc.AffEtatDetecteurs(Sender: TObject); -var j,adr,adrTrain,ad1 : integer; +var j,adr,adrTrain : integer; s : string; begin Affiche('Etat des détecteurs:',ClLime); @@ -11377,9 +11414,6 @@ begin adr:=Adresse_detecteur[j]; s:='Dét '+intToSTR(adr)+'='; if Detecteur[adr].etat then s:=s+'1 ' else s:=s+'0 '; - if Algo_localisation=2 then s:=s+'vers1='+intToSTR(detecteur[adr].vers1)+' vers2='+intToSTR(detecteur[adr].vers2)+' '; - if Algo_localisation=2 then s:=s+'de1='+intToSTR(detecteur[adr].de1)+' de2='+intToSTR(detecteur[adr].de2)+' '; - if Algo_localisation=2 then s:=s+'qv1='+intToSTR(detecteur[adr].QuitteVers1)+' qv2='+intToSTR(detecteur[adr].QuitteVers2)+' '; s:=s+detecteur[adr].train; AdrTrain:=detecteur[adr].AdrTrain; @@ -11398,10 +11432,10 @@ var j : integer; trouve : boolean; begin j:=1; - repeat - trouve:=Adresse_detecteur[j]=de; - inc(j); - until (j>NbMaxDet) or trouve; + repeat + trouve:=Adresse_detecteur[j]=de; + inc(j); + until (j>NbMaxDet) or trouve; if trouve then index_adresse_detecteur:=j else index_adresse_detecteur:=0; end; @@ -11912,14 +11946,14 @@ begin if i<>0 then begin Delete(commandeCDM,i,12); - + i:=posEx('AD=',commandeCDM,1);l:=posEx(';',commandeCDM,i); if (i<>0) and (l<>0) then begin ss:=copy(commandeCDM,i+3,l-i-3); val(ss,adr,erreur); Delete(commandeCDM,i,l-i+1); - end; + end; i:=posEx('TRAIN=',commandeCDM,1);l:=posEx(';',commandeCDM,i); if (i<>0) and (l<>0) then @@ -11952,8 +11986,6 @@ begin end; Event_detecteur(Adr,etat=1,train); - //Affiche(train,clYellow); - //Affiche(IntToSTR(adr)+' '+IntToSTR(etat)+' '+train,clyellow); end ; // évènement signal - non stocké ni interprété @@ -11967,7 +11999,7 @@ begin begin nom:=copy(commandeCDM,i+5,l-i-5); Delete(commandeCDM,i,l-i+1); - end; + end; i:=posEx('OBJ=',commandeCDM,1);l:=posEx(';',commandeCDM,i); if (i<>0) and (l<>0) then @@ -12668,6 +12700,7 @@ begin Index_Simule:=0; // fin de simulation I_Simule:=0; MsgSim:=false; + filtrageDet0:=SauvefiltrageDet0; StopSimu:=true; Affiche('Fin de simulation',Cyan); end; @@ -12716,7 +12749,7 @@ end; procedure TFormPrinc.Affichefentredebug1Click(Sender: TObject); begin // formdebug.Create(nil); - formDebug.show; + if debugaffiche then formDebug.show; end; procedure TFormPrinc.locoClick(Sender: TObject); @@ -12771,10 +12804,10 @@ begin end; procedure TFormPrinc.Etatdeszonespartrain1Click(Sender: TObject); -var i,j,n,train,pos : integer; +var i,j,n,train : integer; couleur : tcolor; rien,aff : boolean; - s : string; + s,ss : string; begin Affiche('',clyellow); Affiche('Historique de l''état des zones par train',clWhite); @@ -12819,13 +12852,23 @@ begin for i:=1 to n_trains do begin - Affiche('Event det train '+intToSTR(i),clOrange); + s:='Event det train '+intToSTR(i); + n:=event_det_train[i].AdrTrain; + if n<>0 then s:=s+' @'+intToSTR(n); + ss:=event_det_train[i].nom_train; + if ss<>'' then s:=s+' '+ss; + Affiche(s,clOrange); + + n:=event_det_train[i].signal_rouge; + if n<>0 then Affiche('Arreté devant signal '+intToSTR(n),clyellow); for j:=1 to event_det_train[i].NbEl do begin - Affiche(intToSTR(event_det_train[i].Det[j].adresse),clyellow); + s:=intToSTR(event_det_train[i].Det[j].adresse); + Affiche(s,clyellow); end; end; + { Affiche('Evènements détecteurs par train',clWhite); for i:=1 to n_trains do begin @@ -12837,7 +12880,7 @@ begin if event_det_tick[j].train=i then Affiche(intToSTR(event_det_tick[j].adresse)+' '+intToSTR(event_det_tick[j].etat),couleur); end; end; - + } if rien then Affiche('Aucune zone n''a été déclenchée',clOrange); end; @@ -12865,7 +12908,7 @@ begin Affiche('En orange : pilotage des signaux / erreurs mineures',ClWhite); Affiche('En bleu : pilotage des aiguillages',ClWhite); Affiche('En jaune : rétrosignalisation reçue depuis l''interface',ClWhite); - + Affiche('Taille du TCO : '+intToSTR(SizeOf(tco) div 1024)+' ko',clorange); Affiche(' ',clyellow); end; @@ -12885,10 +12928,11 @@ end; procedure TFormPrinc.Informationsdusignal1Click(Sender: TObject); var s: string; - v,i,etat,aspect,combine,adresse,aig,trainReserve,AdrSignalsuivant : integer; + i,aspect,combine,adresse,aig,trainReserve,AdrSignalsuivant : integer; + reserveTrainTiers : boolean; code : word; -begin - clicliste:=false; +begin + clicliste:=false; s:=((Tpopupmenu(Tmenuitem(sender).GetParentMenu).PopupComponent) as TImage).name; // nom du composant, pout récupérer l'adresse du feu (ex: ImageFeu260) //Affiche(s,clOrange); // nom de l'image du signal (ex: ImageFeu260) adresse:=extract_int(s); // extraire l'adresse (ex 260) @@ -12906,8 +12950,8 @@ begin if aspect=0 then begin Affiche('Le signal est au carré car ',clyellow); - if carre_signal(Adresse,trainreserve) and (trainreserve=0) then affiche('les aiguillages en aval du signal sont mal positionnées ou leur positions inconnues',clyellow) ; - if trainreserve<>0 then affiche('un aiguillage ou un croisement en aval du signal sont réservés par le train @'+intToSTR(trainReserve),clyellow); + if carre_signal(Adresse,trainreserve,reserveTrainTiers) then affiche('les aiguillages en aval du signal sont mal positionnées ou leur positions inconnues',clyellow) ; + if reserveTrainTiers then affiche('un aiguillage ou un croisement en aval du signal sont réservés par un autre train ',clyellow); if Cond_Carre(Adresse) then affiche_suivi('les aiguillages déclarés dans la définition du signal sont mal positionnés',clyellow); if feux[i].VerrouCarre and not(PresTrainPrec(Adresse,Nb_cantons_Sig,TrainReserve)) then affiche('le signal est verrouillable au carré et aucun train n''est présent avant le signal',clyellow); if test_memoire_zones(Adresse) then affiche('présence train dans canton suivant le signal',clyellow); @@ -12992,13 +13036,12 @@ begin else begin groupBox2.Visible:=false;groupBox3.Visible:=true;end; end; - procedure TFormPrinc.ComboTrainsChange(Sender: TObject); var i : integer; begin i:=ComboTrains.itemIndex+1; if (i<>0) and (i'); - //TraceTrames:=true; - affiche_retour_dcc:=true; - tps_affiche_retour_dcc:=2; - Affiche(editEnvoi.text,ClWhite); - envoi(editEnvoi.Text); -end; - - + affiche_retour_dcc:=true; + tps_affiche_retour_dcc:=2; + Affiche(editEnvoi.text,ClWhite); + envoi(editEnvoi.Text); +end; + procedure TFormPrinc.Placerlestrains1Click(Sender: TObject); -begin - if cdm_connecte then - begin - Affiche('Placement des trains incompatible en mode CDM rail',clOrange); - exit; - end; - formplace.showmodal; -end; - +begin + if PlaceAffiche then + begin + if cdm_connecte then + begin + Affiche('Placement des trains incompatible en mode CDM rail',clOrange); + exit; + end; + formplace.showmodal; + end; +end; + procedure TFormPrinc.Demandetatdtecteurs1Click(Sender: TObject); -begin - if portCommOuvert or parSocketLenz then - begin - modeStkRetro:=false; // avec evt - demande_etat_det; - end - else Affiche('L''interface n''est pas connectée par USB ou par Ethernet',clorange); -end; - -// place les trains, positionne aiguillages et lance le roulage -procedure placement_trains; -var adr,AdrTrain,i,j : integer; - trouve : boolean; -begin - for i:=1 to 6 do - begin - Adr:=placement[i].detecteur; - if adr<>0 then - begin - detecteur[Adr].train:=placement[i].train; - detecteur[Adr].AdrTrain:=trains[i].adresse; - event_detecteur(Adr,true,trains[i].nom_train); - Affiche('Positionnement train '+detecteur[Adr].train+' sur détecteur '+intToSTR(Adr),clLime); - end; - end; - init_aiguillages; - - for i:=1 to NDetecteurs do +begin + if portCommOuvert or parSocketLenz then + begin + modeStkRetro:=false; // avec evt + demande_etat_det; + end + else Affiche('L''interface n''est pas connectée par USB ou par Ethernet',clorange); +end; + +// place les trains, positionne aiguillages et lance le roulage +procedure placement_trains; +var adr,AdrTrain,i,j : integer; + trouve : boolean; +begin + trouve:=false; + for i:=1 to 6 do + begin + Adr:=placement[i].detecteur; + if adr<>0 then + begin + detecteur[Adr].train:=placement[i].train; + detecteur[Adr].AdrTrain:=trains[i].adresse; + event_detecteur(Adr,true,trains[i].nom_train); + Affiche('Positionnement train '+detecteur[Adr].train+' sur détecteur '+intToSTR(Adr),clLime); + end; + end; + init_aiguillages; + + for i:=1 to NDetecteurs do begin adr:=Adresse_detecteur[i]; if Detecteur[adr].etat and (detecteur[adr].train<>'') then - begin - Affiche('Lancement du train '+detecteur[adr].train+' depuis détecteur '+intToSTR(adr),clYellow); - AdrTrain:=detecteur[Adr].AdrTrain; - j:=index_train_adresse(AdrTrain); - vitesse_loco('',adrTrain,trains[j].VitNominale,not(placement[j].inverse)); - trouve:=true; - roulage:=true; - end; - end; - if trouve then Maj_feux; - -end; - + begin + Affiche('Lancement du train '+detecteur[adr].train+' depuis détecteur '+intToSTR(adr),clYellow); + AdrTrain:=detecteur[Adr].AdrTrain; + j:=index_train_adresse(AdrTrain); + vitesse_loco('',adrTrain,trains[j].VitNominale,not(placement[j].inverse)); + trouve:=true; + roulage:=true; + end; + end; + if trouve then Maj_feux; +end; + procedure TFormPrinc.Button1Click(Sender: TObject); -begin -// placement_trains; - ouvre_simulation('C:\Program Files (x86)\Borland\Delphi7\Projects\Signaux_complexes_GL\2trains_autonome.txt'); - //ouvre_simulation('C:\Program Files (x86)\Borland\Delphi7\Projects\Signaux_complexes_GL\oua.txt'); -end; - - +begin + placement_trains; + ouvre_simulation('C:\Program Files (x86)\Borland\Delphi7\Projects\Signaux_complexes_GL\2trains_autonome.txt'); + // ouvre_simulation('C:\Program Files\Borland\Delphi7\Projects\Signaux_complexes_GL\2trains_autonome.txt'); +end; + procedure TFormPrinc.Evenementsdetecteurspartrain1Click(Sender: TObject); var i,j,train,pos : integer; s : string; -begin -Affiche('Evenements tous détecteurs',clwhite); +begin +Affiche('Evenements tous détecteurs',clwhite); Affiche(' ',clyellow); for i:=0 to n_trains do begin @@ -13212,8 +13253,12 @@ Affiche('Evenements tous d s:=''; for j:=1 to train*15 do s:=s+' '; s:=s+intToSTR(event_det_tick[i].adresse)+' '+intToSTR(event_det_tick[i].etat); - if event_det_tick[i].reaffecte=1 then s:=s+'R'; - if event_det_tick[i].reaffecte=2 then s:=s+'A'; + case event_det_tick[i].reaffecte of + 1 : s:=s+'/S'; + 2 : s:=s+'/A'; + 3 : s:=s+'/R'; + 4 : s:=s+'/0'; + end; Affiche(s,couleur); end; if event_det_tick[i].modele=aig then @@ -13229,10 +13274,28 @@ Affiche('Evenements tous d Affiche(s,clWhite); end; end; - -end; - - - + end; + +procedure TFormPrinc.RazResaClick(Sender: TObject); +begin + Affiche('Mise à 0 de la réservation des aiguillages',clYellow); + Raz_reservations; + Maj_feux; +end; + +procedure TFormPrinc.SBMarcheArretLocoClick(Sender: TObject); +var i,adr : integer; +begin + for i:=1 to Ntrains do + begin + adr:=Trains[i].adresse; + if adr<>0 then + begin + Affiche('Arrêt train @'+intToSTR(adr)+' '+Trains[i].nom_train,clyellow); + vitesse_loco('',adr,0,not(placement[i].inverse)); + end; + end; +end; + end. diff --git a/UnitSR.dcu b/UnitSR.dcu index fc34935..e85d153 100644 Binary files a/UnitSR.dcu and b/UnitSR.dcu differ diff --git a/UnitSimule.dcu b/UnitSimule.dcu index db8087c..4bb4d78 100644 Binary files a/UnitSimule.dcu and b/UnitSimule.dcu differ diff --git a/UnitSimule.pas b/UnitSimule.pas index 34de9be..400c64a 100644 --- a/UnitSimule.pas +++ b/UnitSimule.pas @@ -118,6 +118,8 @@ begin closeFile(fte); formprinc.ButtonArretSimu.Visible:=true; i_simule:=1; + SauvefiltrageDet0:=filtrageDet0; + filtrageDet0:=0; FormSimulation.Close; Affiche('Fichier simulation : '+Nomfichier ,clyellow); end; diff --git a/UnitTCO.dcu b/UnitTCO.dcu index f4c9b3f..1debe25 100644 Binary files a/UnitTCO.dcu and b/UnitTCO.dcu differ diff --git a/UnitTCO.pas b/UnitTCO.pas index ba2cb1c..ed9559d 100644 --- a/UnitTCO.pas +++ b/UnitTCO.pas @@ -311,7 +311,7 @@ type end; const - ZoomMax=50;ZoomMin=20; + ZoomMax=50;ZoomMin=15; MaxCellX=150;MaxCellY=70; ClFond_ch='CoulFond'; clVoies_ch='CoulVoies'; @@ -328,16 +328,16 @@ const type // structure du TCO - TTCO = array[1..MaxCellX] of array[1..MaxCellY] of record + TTCO = array[1..MaxCellX,1..MaxCellY] of record Adresse : integer ; // adresse du détecteur ou de l'aiguillage ou du feu BImage : integer ; // 0=rien 1=voie 2=aiguillage gauche gauche ... 30=feu mode : integer; // couleur de voie 0=éteint 1=ClVoies 2=couleur en fonction du train trajet : integer; // décrit le trajet ouvert sur la voie (cas d'un croisement ou d'ue tjd/S) inverse : boolean; // aiguillage piloté inversé repr : integer; // position de la représentation texte 0 = rien 1=centrale 2=Haut 3=Bas - Texte : string[30]; // texte de la cellule - Fonte : string[30]; // fonte du texte - FontStyle : string[4]; // GSIB (Gras Souligné Italique Barré) + Texte : string; // texte de la cellule + Fonte : string; // fonte du texte + FontStyle : string; // GSIB (Gras Souligné Italique Barré) coulFonte : Tcolor; TailleFonte : integer; Couleur : Tcolor; // couleur non utilisée @@ -351,7 +351,7 @@ var clAllume,clVoies,Fond,couleurAdresse,clGrille,cltexte,clQuai,CoulFonte,ClCanton : Tcolor; FormTCO: TFormTCO; Forminit,sourisclic,SelectionAffichee,TamponAffecte,entoure,Diffusion,TCO_modifie, - piloteAig,BandeauMasque,eval_format,TCOouvert : boolean; + clicTCO,piloteAig,BandeauMasque,eval_format,TCOouvert : boolean; HtImageTCO,LargImageTCO,XclicCell,YclicCell,XminiSel,YminiSel,XCoupe,Ycoupe,Temposouris, XmaxiSel,YmaxiSel,AncienXMiniSel,AncienXMaxiSel ,AncienYMiniSel,AncienYMaxiSel, Xclic,Yclic,XClicCellInserer,YClicCellInserer,Xentoure,Yentoure,RatioC,ModeCouleurCanton, @@ -3328,17 +3328,18 @@ begin comborepr.Enabled:=false; ImageTCO.Top:=0; ImageTCO.Left:=0; + //controlStyle:=controlStyle+[csOpaque]; end; -// clic gauche sur image +// clic gauche sur TCO procedure TFormTCO.ImageTCOClick(Sender: TObject); var Position: TPoint; Bimage : integer; s : string; begin - //Affiche('Clic gauche',clLime); - + if affevt then Affiche('TCO ImageTCOClic',clLime); + clicTCO:=true; GetCursorPos(Position); { Menuitem:=TmenuItem.Create(popupMenu1); @@ -3361,21 +3362,22 @@ begin if (bimage=2) or (bimage=3) or (bimage=4) or (bimage=5) or (bimage=12) or (bimage=13) or (bimage=14) or (bimage=15) then begin - + // aiguillage inversé with FormConfCellTCO.CheckPinv do begin enabled:=true; checked:=TCO[XClicCell,YClicCell].inverse; - end; + end; CheckPinv.checked:=TCO[XClicCell,YClicCell].inverse; CheckPinv.enabled:=true ; end - else - begin - CheckPinv.enabled:=false; - FormConfCellTCO.checkPinv.enabled:=false; - end; - + else + begin + CheckPinv.enabled:=false; + FormConfCellTCO.checkPinv.enabled:=false; + end; + + // si voie ou rien ou signal ou quai if (Bimage=1) or (Bimage=0) or (Bimage=23) then begin s:=Tco[XClicCell,YClicCell].Texte; @@ -3399,8 +3401,8 @@ begin ComboRepr.ItemIndex:=tco[XClicCell,yClicCell].repr; if not(selectionaffichee) then _entoure_cell_clic; - actualise; + clicTCO:=false; end; // trouve le détecteur det dans le TCO et renvoie X et Y @@ -3416,7 +3418,7 @@ begin trouve:=tco[xc,yc].Adresse=det; until (xc=NbreCellX+1) or trouve; inc(yc); - until (yc=NbreCellY+1) or trouve; + until (yc=NbreCellY+1) or trouve; dec(yc); if trouve then begin @@ -4558,18 +4560,18 @@ begin TCO_modifie:=true; end; -procedure copier; +procedure copier; var x,y : integer; begin if SelectionAffichee then begin TamponTCO_org.NbreCellX:=NbreCellX; TamponTCO_org.NbreCellY:=NbreCellY; - + TamponTCO_Org.x1:=XminiSel div LargeurCell +1; TamponTCO_Org.x2:=XmaxiSel div LargeurCell +1; TamponTCO_Org.y1:=yminiSel div LargeurCell +1; - TamponTCO_Org.y2:=ymaxiSel div LargeurCell +1; + TamponTCO_Org.y2:=ymaxiSel div LargeurCell +1; for y:=TamponTCO_Org.y1 to TamponTCO_Org.y2 do for x:=TamponTCO_Org.x1 to TamponTCO_Org.x2 do tamponTCO[x,y]:=tco[x,y]; @@ -4669,7 +4671,7 @@ begin // ImageTCO.BeginDrag(true); if button=mbLeft then begin - //Affiche('Souris clic enfoncée',clLime); + if affEvt then Affiche('TCO Souris clicG enfoncée',clLime); Temposouris:=0; xMiniSel:=99999;yMiniSel:=99999; xMaxiSel:=0;yMaxiSel:=0; @@ -4691,6 +4693,7 @@ begin if button=mbRight then begin + if affEvt then Affiche('TCO Souris clicG enfoncée',clLime); GetCursorPos(Position); Position:=ImageTCO.screenToCLient(Position); Xclic:=position.X; @@ -4816,7 +4819,7 @@ procedure TFormTCO.EditAdrElementChange(Sender: TObject); var Adr,erreur,index : integer; begin //Affiche('Chgt adresse',clyellow); - + if clicTCO then exit; Val(EditAdrElement.Text,Adr,erreur); if (erreur<>0) or (Adr<0) or (Adr>2048) then Adr:=0; @@ -4853,6 +4856,7 @@ end; procedure TFormTCO.EditTypeImageKeyPress(Sender: TObject; var Key: Char); var Bimage,erreur : integer; begin + if affevt then Affiche('TCC evt editTypeImageKeyPress',clorange); if actualize then exit; if ord(Key)=VK_RETURN then begin @@ -5144,6 +5148,8 @@ end; procedure TFormTCO.EditTexteChange(Sender: TObject); begin + if clicTCO then exit; + if affevt then Affiche('TCO.EditTextChange',clOrange); PCanvasTCO.Brush.Color:=fond; efface_entoure; if Tco[XClicCell,YClicCell].texte='' then @@ -5153,7 +5159,7 @@ begin end; Tco[XClicCell,YClicCell].Texte:=EditTexte.Text; - formConfCellTCO.EditTexte.Text:=EditTexte.Text; + formConfCellTCO.EditTexteCCTCO.Text:=EditTexte.Text; TCO_modifie:=true; affiche_texte(XClicCell,YClicCell); end; @@ -5186,10 +5192,11 @@ end; procedure TFormTCO.CheckPinvClick(Sender: TObject); var Bimage : integer; begin + if clicTCO then exit; if actualize then exit; if (xClicCell=0) or (xClicCell>NbreCellX) or (yClicCell=0) or (yClicCell>NbreCelly) then exit; Bimage:=Tco[xClicCell,yClicCell].Bimage; - if (bimage=2) or (bimage=3) or (bimage=4) or (bimage=5) or (bimage=12) or (bimage=13) + if (bimage=2) or (bimage=3) or (bimage=4) or (bimage=5) or (bimage=12) or (bimage=13) or (bimage=14) or (bimage=15) then begin TCO[xClicCell,yClicCell].inverse:=CheckPinv.checked; @@ -5218,6 +5225,7 @@ procedure TFormTCO.ImageTCODblClick(Sender: TObject); var Bimage,Adresse,i : integer; tjdC : boolean; begin + //Affiche('Double clic',clred); Bimage:=Tco[xClicCell,yClicCell].BImage; Adresse:=TCO[xClicCell,yClicCell].Adresse; if adresse=0 then exit; @@ -5265,7 +5273,7 @@ begin LabelNbFeux.Visible:=False; EditNbreFeux.Visible:=false; GroupBox1.Visible:=true; - GroupBox2.Visible:=true; + GroupBox2.Visible:=true; efface_entoure; SelectionAffichee:=false; @@ -5293,6 +5301,7 @@ end; procedure TFormTCO.ComboReprChange(Sender: TObject); begin + if clicTCO then exit; tco[XClicCell,YClicCell].Repr:=comborepr.ItemIndex; efface_entoure; SelectionAffichee:=false; diff --git a/Unitplace.dcu b/Unitplace.dcu index c4d86ff..28ef933 100644 Binary files a/Unitplace.dcu and b/Unitplace.dcu differ diff --git a/Unitplace.dfm b/Unitplace.dfm index b58a45e..fd9919a 100644 --- a/Unitplace.dfm +++ b/Unitplace.dfm @@ -14,6 +14,7 @@ object FormPlace: TFormPlace KeyPreview = True OldCreateOrder = False OnActivate = FormActivate + OnCreate = FormCreate OnKeyPress = FormKeyPress PixelsPerInch = 96 TextHeight = 13 diff --git a/Unitplace.pas b/Unitplace.pas index 5423c67..54eb3d3 100644 --- a/Unitplace.pas +++ b/Unitplace.pas @@ -3,7 +3,7 @@ interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, - Dialogs, StdCtrls, unitprinc; + Dialogs, StdCtrls, unitprinc, unitpilote; type TFormPlace = class(TForm) @@ -71,6 +71,7 @@ type procedure EditDir4Change(Sender: TObject); procedure EditDir5Change(Sender: TObject); procedure EditDir6Change(Sender: TObject); + procedure FormCreate(Sender: TObject); private { Déclarations privées } public @@ -380,8 +381,8 @@ begin end; procedure TFormPlace.ButtonLanceRoutageClick(Sender: TObject); -var i,j,adrDet,AdrTrain : integer; - trouve : boolean; +var a,i,j,id,adrDet,AdrTrain,AdrFeu : integer; + trouve,rouge : boolean; begin if cdm_connecte then begin @@ -395,21 +396,37 @@ begin adrDet:=Adresse_detecteur[i]; if Detecteur[adrDet].etat and (detecteur[adrDet].train<>'') then begin - Affiche('Lancement du train '+detecteur[adrDet].train+' depuis détecteur '+intToSTR(adrDet),clYellow); + rouge:=false; AdrTrain:=detecteur[AdrDet].AdrTrain; - j:=index_train_adresse(AdrTrain); - vitesse_loco('',adrTrain,trains[j].VitNominale,not(placement[j].inverse)); - trouve:=true; - roulage:=true; - maj_feux; - reserve_canton(AdrDet,placement[j].detdir,adrtrain); + AdrFeu:=signal_detecteur(AdrDet); // trouve l'adresse du feu correspondant au détecteur + if adrFeu<>0 then + begin + id:=index_feu(AdrFeu); + a:=feux[id].EtatSignal; + if ((a=semaphore_F) or (a=carre_F) or (a=violet_F)) then rouge:=true; + end; + if not(rouge) then + begin + j:=index_train_adresse(AdrTrain); + vitesse_loco('',adrTrain,trains[j].VitNominale,not(placement[j].inverse)); + trouve:=true; + roulage:=true; + maj_feux; + Affiche('Lancement du train '+detecteur[adrDet].train+' depuis détecteur '+intToSTR(adrDet),clYellow); + reserve_canton(AdrDet,placement[j].detdir,adrtrain); + end + Else Affiche('Le signal '+intToSTR(AdrFeu)+' étant rouge, le train '+detecteur[adrDet].train+' @'+intToSTR(AdrTrain)+' ne démarre pas',clyellow); end; end; if trouve then begin Maj_feux; Formprinc.LabelTitre.caption:=titre+' - Mode roulage en cours'; + with Formprinc.SBMarcheArretLoco do + begin + Visible:=true; + end; end; if not(trouve) then Affiche('Pas de train placé',clOrange); end; @@ -540,4 +557,9 @@ begin placement[6].detdir:=i; end; +procedure TFormPlace.FormCreate(Sender: TObject); +begin + PlaceAffiche:=true; +end; + end. diff --git a/verif_version.dcu b/verif_version.dcu index d048250..4b1b636 100644 Binary files a/verif_version.dcu and b/verif_version.dcu differ diff --git a/verif_version.pas b/verif_version.pas index 6188737..a5b8114 100644 --- a/verif_version.pas +++ b/verif_version.pas @@ -23,7 +23,7 @@ var Lance_verif : integer; verifVersion,notificationVersion : boolean; -Const Version='5.3'; // sert à la comparaison de la version publiée +Const Version='5.4'; // sert à la comparaison de la version publiée SousVersion=' '; // en cas d'absence de sous version mettre un espace implementation diff --git a/versions.txt b/versions.txt index d7b23e4..1793e7a 100644 --- a/versions.txt +++ b/versions.txt @@ -137,8 +137,12 @@ version 5.2 : Nouvel algorithme pour le d version 5.3 : Informations sur les états des signaux par clic droit sur le signal. Correction éventuelle fenêtre de violation au démarrage. Renforcement du suivi des trains: - (prise en compte des changements d'aiguillages) - (détection simultanée d'un train sur deux détecteurs) + prise en compte des changements d'aiguillages + détection simultanée d'un train sur deux détecteurs +version 5.4 : Amélioration du mode roulage. + Améliorations diverses. + Filtrage des détecteurs en mode autonome. +