diff --git a/ConfigGenerale.cfg b/ConfigGenerale.cfg index 37fd7ff..0360471 100644 --- a/ConfigGenerale.cfg +++ b/ConfigGenerale.cfg @@ -12,7 +12,7 @@ Fenetre=0 nb_det_dist=3 verif_version=0 NOTIF_VERSION=0 -TCO=0 +TCO=1 MasqueBandeauTCO=0 CDM=0 Lay=RESEAU_GILY_SIGNAL_AJOUTE.LAY @@ -23,21 +23,21 @@ Tempo_Feu=100 Alg_Unisemaf=1 /------------ [section_aig] -1,P518,D523,S3P,V30,I0,INIT(9,5) -2,P12S,D519,S5S,V0,I0,INIT(9,5) +1,P518,D100D,S3P,V30,I0,INIT(9,5) +2,P12S,D519,S100S,V0,I0,INIT(9,5) 3,P1S,D4P,S5D,V0,I0,INIT(9,5) 4,P3D,D6S,S514,V0,I0,INIT(9,5) -5,P515,D3S,S2S,V0,I0,INIT(9,5) +5,P515,D3S,S100S,V0,I0,INIT(9,5) 6,P516,D0,S4D,V0,I0,INIT(9,5) 7,P527,D519,S520,V0,I0,INIT(9,5) 8,P527,D521,S522,V0,I0,INIT(9,5) 9,P526,D513,S515,V60,I0,INIT(9,5) -10,P19P,D29P,S528,V30,I0,INIT(9,5) -11,P18P,D30D,S525,V0,I0,INIT(9,5) +10,P101S,D29P,S528,V30,I0,INIT(9,5) +11,P18P,D30D,S101D,V0,I0,INIT(9,5) 12,P517,D20S,S2P,V0,I0,INIT(9,5) 17,P525,D535,S528,V0,I0,INIT(9,5) 18,P11P,D23P,S517,V0,I0,INIT(9,5) -19,P10P,D22P,S531,V0,I0,INIT(9,5) +19,P101D,D22P,S531,V0,I0,INIT(9,5) 20,P520,D21P,S12D,V0,I0,INIT(9,5) 21,P20D,D28D,S28D,V0,I0,INIT(9,5) 22,P19D,D537,S32P,V0,I0,INIT(9,5) @@ -49,25 +49,27 @@ Alg_Unisemaf=1 28TJD,D(21D,26D),S(21S,26S),V0,I0,INIT(9,5),E4 29,P10D,D513,S30S,V60,I0,INIT(9,5) 30,P524,D11D,S29S,V0,I0,INIT(9,5) -31,P534,D33D,S25P,V0,I0,INIT(9,5) -32,P22S,D33S,S24D,V0,I0,INIT(9,5) -33,P0,D31D,S32D,V0,I0,INIT(9,5) +31,P534,D34D,S25P,V0,I0,INIT(9,5) +32,P22S,D34S,S24D,V0,I0,INIT(9,5) +34,P0,D31D,S32D,V0,I0,INIT(9,5) +100CROI,D(1D,523Z),S(2S,5S) +101CROI,D(11S,525Z),S(19P,10P) 0 /------------ [section_branches] A2,A12,517,A18,A11,A30,524,521,A8,527,A7,519,A2 A7,520,A20,A12 A1,A3,A4,514,522,A8 -A1,523,526,A9,513,A29,A10,A19,531,518,A1 +A1,A100,523,526,A9,513,A29,A10,A101,A19,531,518,A1 A9,515,A5 -A11,525,A17,528,A10 +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 A26,529,A25 A22,537,A27 A22,A32,A24 A6,516,0 -A31,A33,0 +A31,A34,0 0 /------------ [section_sig] diff --git a/Notice d'utilisation des signaux_complexes_GL_V4.0.pdf b/Notice d'utilisation des signaux_complexes_GL_V4.1.pdf similarity index 69% rename from Notice d'utilisation des signaux_complexes_GL_V4.0.pdf rename to Notice d'utilisation des signaux_complexes_GL_V4.1.pdf index c99ad58..3f3385a 100644 Binary files a/Notice d'utilisation des signaux_complexes_GL_V4.0.pdf and b/Notice d'utilisation des signaux_complexes_GL_V4.1.pdf differ diff --git a/UnitConfig.dcu b/UnitConfig.dcu index 9268985..b770598 100644 Binary files a/UnitConfig.dcu and b/UnitConfig.dcu differ diff --git a/UnitConfig.dfm b/UnitConfig.dfm index a1cb43c..a0b8259 100644 --- a/UnitConfig.dfm +++ b/UnitConfig.dfm @@ -1578,7 +1578,7 @@ object FormConfig: TFormConfig Top = 8 Width = 633 Height = 497 - ActivePage = TabSheetSig + ActivePage = TabSheetAig Font.Charset = DEFAULT_CHARSET Font.Color = clBlack Font.Height = -11 @@ -2308,7 +2308,8 @@ object FormConfig: TFormConfig 'Aiguillage simple' 'TJD' 'TJS' - 'Aiguillage triple') + 'Aiguillage triple' + 'Croisement') end object GroupBox16: TGroupBox Left = 8 @@ -2919,7 +2920,7 @@ object FormConfig: TFormConfig Top = 48 Width = 129 Height = 21 - ItemHeight = 13 + ItemHeight = 0 TabOrder = 1 OnChange = ComboBoxDecChange end diff --git a/UnitConfig.pas b/UnitConfig.pas index c22e777..e791fea 100644 --- a/UnitConfig.pas +++ b/UnitConfig.pas @@ -620,19 +620,21 @@ end; function encode_aig(index : integer): string; var s : string; c : char; - tjdC,tjsC,triC : boolean; + tjdC,tjsC,triC,croi : boolean; begin if index=0 then exit; s:=IntToSTR(aiguillage[index].Adresse); tjdC:=aiguillage[index].modele=tjd; tjsC:=aiguillage[index].modele=tjs; triC:=aiguillage[index].modele=triple; + croi:=aiguillage[index].modele=crois; if tjdC then s:=s+'TJD'; if tjsC then s:=s+'TJS'; + if croi then s:=s+'CROI'; if triC then begin s:=s+'TRI,';s:=s+intToSTR(aiguillage[index].AdrTriple);end; s:=s+','; // aiguillage normal ou triple - if not(tjdC) and not(tjsC) then + if not(tjdC) and not(tjsC) and not(croi) then begin // P s:=s+'P';s:=s+intToSTR(aiguillage[index].Apointe); @@ -660,7 +662,7 @@ begin end; end; - // tjd 2/4 états ou tjs + // tjd 2/4 états ou tjs if (tjdC or tjsC) then begin s:=s+'D('+intToSTR(aiguillage[index].Adroit); @@ -671,21 +673,37 @@ begin s:=s+','+intToSTR(aiguillage[index].DDevie)+aiguillage[index].DDevieB+')'; end; + if croi then + begin //zizi + s:=s+'D('+intToSTR(aiguillage[index].Adroit); + c:=aiguillage[index].AdroitB;if c<>'Z' then s:=s+c; + s:=s+','+intToSTR(aiguillage[index].DDroit)+aiguillage[index].DDroitB+'),'; + s:=s+'S('+intToSTR(aiguillage[index].Adevie); + c:=aiguillage[index].AdevieB;if c<>'Z' then s:=s+c; + s:=s+','+intToSTR(aiguillage[index].DDevie)+aiguillage[index].DDevieB+')'; + end; + if tjsC then begin s:=s+',L'+intToSTR(aiguillage[index].Tjsint)+aiguillage[index].TjsintB; end; // vitesse de franchissement et inversion - if aiguillage[index].vitesse=0 then s:=s+',V0'; - if aiguillage[index].vitesse=30 then s:=s+',V30'; - if aiguillage[index].vitesse=60 then s:=s+',V60'; - if aiguillage[index].inversionCDM=1 then s:=s+',I1' else s:=s+',I0'; + if not(croi) then + begin + if aiguillage[index].vitesse=0 then s:=s+',V0'; + if aiguillage[index].vitesse=30 then s:=s+',V30'; + if aiguillage[index].vitesse=60 then s:=s+',V60'; + if aiguillage[index].inversionCDM=1 then s:=s+',I1' else s:=s+',I0'; + end; // valeur d'initialisation - s:=s+',INIT('; - s:=s+IntToSTR(aiguillage[index].posInit)+','; - s:=s+IntToSTR(aiguillage[index].temps)+')'; + if not(croi) then + begin + s:=s+',INIT('; + s:=s+IntToSTR(aiguillage[index].posInit)+','; + s:=s+IntToSTR(aiguillage[index].temps)+')'; + end; if tjdC then begin @@ -891,6 +909,7 @@ begin if j>1 then begin Feux[i].FeuBlanc:=(copy(s,1,j-1))='1';delete(s,1,j);end; j:=pos(',',s); val(s,Feux[i].decodeur,erreur); + if (Feux[i].decodeur>NbDecodeur-1) then Affiche('Erreur 677 Ligne '+chaine_signal+' : erreur décodeur inconnu',clred); if j<>0 then delete(s,1,j); feux[i].Adr_el_suiv1:=0;feux[i].Adr_el_suiv2:=0;feux[i].Adr_el_suiv3:=0;feux[i].Adr_el_suiv4:=0; @@ -1117,7 +1136,7 @@ var s: string; continue : boolean; begin - assign(fichierN,'ConfigGenerale.cfg'); + assign(fichierN,NomConfig); rewrite(fichierN); // entête @@ -1264,10 +1283,10 @@ var s,sa,chaine,SOrigine: string; trouve_Tempo_maxi,trouve_Entete,trouve_tco,trouve_cdm,trouve_Serveur_interface,trouve_fenetre,trouve_MasqueTCO, trouve_NOTIF_VERSION,trouve_verif_version,trouve_fonte,trouve_tempo_aig,trouve_raz,trouve_section_aig, pds,trouve_section_branche,trouve_section_sig,trouve_section_act,fichier_trouve,trouve_tempo_feu, - trouve_algo_uni : boolean; + trouve_algo_uni,croi : boolean; bd,virgule,i_detect,i,erreur,aig2,detect,offset,index, adresse,j,position,temporisation,invers,indexPointe,indexDevie,indexDroit, ComptEl,Compt_IT,Num_Element,k,modele,adr,adr2,erreur2,l,t,Nligne,postriple,itl, - postjd,postjs,nv,it,Num_Champ,asp,adraig : integer; + postjd,postjs,nv,it,Num_Champ,asp,adraig,poscroi : integer; function lit_ligne : string ; var esp,l1,l2,k : integer; @@ -1587,7 +1606,8 @@ begin postriple:=pos('TRI',enregistrement);triC:=postriple<>0;if triC then delete(enregistrement,postriple,3); postjd:=pos('TJD',enregistrement);tjdC:=postjd<>0;if tjdC then delete(enregistrement,postjd,3); postjs:=pos('TJS',enregistrement);tjsC:=postjs<>0;if tjsC then delete(enregistrement,postjs,3); - + poscroi:=pos('CROI',enregistrement);croi:=poscroi<>0;if croi then delete(enregistrement,poscroi,4); + // adresse de l'aiguillage Val(enregistrement,adraig,erreur); // adraig = adresse de l'aiguillage if erreur<>0 then Affiche('Erreur aiguillage '+intToSTR(adraig)+' ; caractère '+enregistrement[erreur]+' inconnu',clred); @@ -1613,7 +1633,7 @@ begin begin aiguillage[maxaiguillage].modele:=aig; end; - //if debugConfig then Affiche(s,clyellow); + if croi then aiguillage[maxaiguillage].modele:=crois; if (triC) then begin @@ -1651,7 +1671,7 @@ begin begin if debugconfig then Affiche('Section D - enregistrement='+enregistrement,clYellow); ComptEl:=ComptEl+1; - if tjdC or tjsC then + if tjdC or tjsC or croi then begin Delete(Enregistrement,1,2); decodeAig(Enregistrement,detect,c); @@ -1663,8 +1683,6 @@ begin aiguillage[maxaiguillage].DdroitB:=c; i:=pos(')',enregistrement);if i=0 then begin Affiche('Erreur de syntaxe ligne '+SOrigine,clred);exit;end; Delete(enregistrement,1,i+1); - - //Affiche(enregistrement,clBlue); end else begin @@ -1684,7 +1702,7 @@ begin if debugconfig then Affiche('Section S - enregistrement='+enregistrement,clYellow); ComptEl:=ComptEl+1; - if tjdC or tjsC then + if tjdC or tjsC or croi then begin Delete(enregistrement,1,2); decodeAig(enregistrement,detect,c); @@ -2682,7 +2700,7 @@ end; // affiche le graphisme de l'aiguillage en fonction du tablo en index procedure Aff_champs_aig_tablo(index : integer); var Adresse,Adr2,ind,id2,erreur,position : integer; - tjd,tri,tjs : boolean; + tjd,tri,tjs,croi : boolean; s,ss : string; i : integer; B : char; @@ -2703,6 +2721,7 @@ begin tjd:=pos('TJD',s)<>0 ; tri:=pos('TRI',s)<>0 ; tjs:=pos('TJS',s)<>0 ; + croi:=pos('CROI',s)<>0 ; with formconfig do begin EditAdrAig.Color:=clWindow; @@ -2710,11 +2729,14 @@ begin ImageAffiche.Picture.Bitmap.TransparentColor:=clblue; ImageAffiche.Transparent:=true; GroupBoxEtatTJD.Visible:=false; + GroupBox21.Visible:=true; + GroupBox10.Visible:=true; + checkInverse.Visible:=true; // tjd - if tjd or tjs then + if tjd or tjs or croi then begin - Label20.Visible:=true; + if not(croi) then Label20.Visible:=true; if tjd then begin ComboBoxAig.ItemIndex:=1; @@ -2796,7 +2818,7 @@ begin LabelTJD2.Caption:=IntToSTR(adr2); end; - if (aiguillage[ind].EtatTJD=2) and tjd then + if ((aiguillage[ind].EtatTJD=2) and tjd) or croi then begin // droit haut EditDevie_HD.Text:=intToSTR(aiguillage[index].Ddevie)+aiguillage[index].DdevieB; @@ -2817,8 +2839,18 @@ begin if aiguillage[Index_Aig(adresse)].vitesse=60 then begin RadioButtonSans.checked:=false;RadioButton30kmh.checked:=false;RadioButton60kmh.checked:=true;end; end; + if croi then + begin + GroupBox21.Visible:=false; + GroupBox10.Visible:=false; + checkInverse.Visible:=false; + editL.Visible:=false; + labelL.Visible:=false; + ComboBoxAig.ItemIndex:=4; + end; + // aiguillage normal ou tri - if not(tjd) and not(tjs) or tri then + if (not(tjd) and not(tjs) and not(croi)) or tri then begin EditL.Visible:=false; Label20.Visible:=false; @@ -3565,11 +3597,19 @@ begin aiguillage[index].Ddevie:=adr; aiguillage[index].DdevieB:=B; end; - s:=encode_aig(index); formconfig.RichAig.Lines[index-1]:=s; - end; + + if modele=crois then + begin + aiguillage[index].Ddevie:=adr; + aiguillage[index].DdevieB:=B; + RE_ColorLine(Formconfig.RichAig,index-1,ClWhite); + s:=encode_aig(index); + formconfig.RichAig.Lines[index-1]:=s; + end; + end; end; @@ -3623,6 +3663,7 @@ begin LabelInfo.caption:='Erreur droit aiguillage '+intToSTR(AdrAig); end; end; + if (modele=tjd) or (modele=tjs) then begin // TJD4/TJS @@ -3645,6 +3686,16 @@ begin RE_ColorLine(Formconfig.RichAig,index-1,ClWhite); LabelInfo.caption:='Modification de la TJD homologe ('+IntToSTR(adr2)+')'; end; + + if modele=crois then + begin + aiguillage[index].Ddroit:=adr; + aiguillage[index].DdroitB:=B; + RE_ColorLine(Formconfig.RichAig,index-1,ClWhite); + s:=encode_aig(index); + formconfig.RichAig.Lines[index-1]:=s; + end; + end; end; @@ -3652,7 +3703,7 @@ end; procedure TFormConfig.EditPointe_BGChange(Sender: TObject); var AdrAig,adr,erreur,index : integer; b : char; - normal,tjdC,tjsC,triC : boolean; + normal,tjdC,tjsC,triC,croi : boolean; s : string; begin // cliqué sur le edit pointe aiguillage @@ -3683,6 +3734,7 @@ begin tjdC:=aiguillage[index].modele=tjd; tjsC:=aiguillage[index].modele=tjs; triC:=aiguillage[index].modele=triple; + croi:=aiguillage[index].modele=crois; Aiguillage[index].modifie:=true; @@ -3697,7 +3749,7 @@ begin s:=encode_aig(index); formconfig.RichAig.Lines[ligneclicAig]:=s; end; - if tjdC or tjsC then + if tjdC or tjsC or croi then begin Aiguillage[index].ADevie:=adr; Aiguillage[index].ADevieB:=B; @@ -5546,8 +5598,9 @@ begin end; function verif_coherence : boolean; -var AncAdr,i,j,k,l,Indexaig,adr,adr2,extr,detect,condcarre,nc,index2,SuivAdr : integer; - modAig,AncModel,model,km,SuivModel: TEquipement; +var AncAdr,i,j,k,l,Indexaig,adr,adr2,extr,detect,condcarre,nc,index2,SuivAdr, + x,y,extr2,adr3,index3 : integer; + modAig,AncModel,model,km,SuivModel,model2: TEquipement; c : char; ok,trouveSuiv,TrouvePrec : boolean; begin @@ -5624,7 +5677,7 @@ begin trouve_detecteur(adr); if IndexBranche_trouve=0 then begin - Affiche('Erreur 2: détecteur '+intToSTR(adr)+' décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais absent dans la description des branches',clred); + Affiche('Erreur 21: détecteur '+intToSTR(adr)+' décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais absent dans la description des branches',clred); ok:=false; end; end; @@ -5634,7 +5687,7 @@ begin trouve_detecteur(adr); if IndexBranche_trouve=0 then begin - Affiche('Erreur 3: détecteur '+intToSTR(adr)+' décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais absent dans la description des branches',clRed); + Affiche('Erreur 31: détecteur '+intToSTR(adr)+' décrit dans l''aiguillage '+intToSTR(aiguillage[Indexaig].adresse)+' mais absent dans la description des branches',clRed); ok:=false; end; end; @@ -5877,107 +5930,197 @@ begin // cohérence 7 // parcoure les aiguillages pour voir si les aiguillages déclarés aux extrémités sont existants for Indexaig:=1 to maxaiguillage do - //indexaig:=29; + //indexaig:=index_aig(93); begin adr:=aiguillage[indexaig].Adresse; + model:=aiguillage[indexaig].modele; + if adr>NbMemZone then begin Affiche('Erreur 9.11: adresse aiguillage trop grand: '+intToSTR(adr),clred); ok:=false; end; - adr2:=aiguillage[indexaig].ADroit; - c:=aiguillage[indexaig].AdroitB; - if (c='D') or (c='S') or (c='P') then + // on ne vérifie pas les tjd tjs crois + if (model<>tjd) and (model<>tjd) and (model<>crois) then begin - index2:=Index_aig(adr2); - if index2=0 then - begin - ok:=false; - Affiche('Erreur 10.1: aiguillage '+intToSTR(adr)+': déclaration d''un aiguillage '+IntToSTR(adr2)+' inexistant',clred); - end - else - begin - if c='D' then - begin - extr:=aiguillage[index2].ADroit; - if adr<>extr then Affiche('Erreur 10.2: Discordance de déclaration aiguillages '+intToSTR(adr)+'D: '+intToSTR(adr2)+'D',clred); - end; - if c='S' then - begin - extr:=aiguillage[index2].ADevie; - if adr<>extr then Affiche('Erreur 10.2: Discordance de déclaration aiguillages '+intToSTR(adr)+'D: '+intToSTR(adr2)+'S',clred); - end; - if c='P' then - begin - extr:=aiguillage[index2].APointe; - if adr<>extr then Affiche('Erreur 10.2: Discordance de déclaration aiguillages '+intToSTR(adr)+'D: '+intToSTR(adr2)+'P',clred); - end; - end; - end; - - adr2:=aiguillage[indexaig].Adevie; - c:=aiguillage[indexaig].AdevieB; - if (c='D') or (c='S') or (c='P') then - begin - index2:=Index_aig(adr2); - if index2=0 then - begin - ok:=false; - Affiche('Erreur 10.1: aiguillage '+intToSTR(adr)+': déclaration d''un aiguillage '+IntToSTR(adr2)+' inexistant',clred); - end - else - begin - if c='D' then - begin - extr:=aiguillage[index2].ADroit; - if adr<>extr then Affiche('Erreur 10.3: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'D',clred); - end; - if c='S' then - begin - extr:=aiguillage[index2].ADevie; - if adr<>extr then Affiche('Erreur 10.3: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'S',clred); - end; - if c='P' then - begin - extr:=aiguillage[index2].APointe; - if adr<>extr then Affiche('Erreur 10.3: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'P',clred); - end; - end; - end; - - adr2:=aiguillage[indexaig].APointe; - c:=aiguillage[indexaig].ApointeB; - if (c='D') or (c='S') or (c='P') then - begin - index2:=Index_aig(adr2); - if index2=0 then - begin - ok:=false; - Affiche('Erreur 10.1: aiguillage '+intToSTR(adr)+': déclaration d''un aiguillage '+IntToSTR(adr2)+' inexistant',clred); - end - else - begin - if c='D' then - begin - extr:=aiguillage[index2].ADroit; - if adr<>extr then Affiche('Erreur 10.4: Discordance de déclaration aiguillages '+intToSTR(adr)+'P: '+intToSTR(adr2)+'D',clred); - end; - if c='S' then - begin - extr:=aiguillage[index2].ADevie; - if adr<>extr then Affiche('Erreur 10.4: Discordance de déclaration aiguillages '+intToSTR(adr)+'P: '+intToSTR(adr2)+'S',clred); - end; - if c='P' then - begin - extr:=aiguillage[index2].APointe; - if adr<>extr then Affiche('Erreur 10.4: Discordance de déclaration aiguillages '+intToSTR(adr)+'P: '+intToSTR(adr2)+'P',clred); - end; - end; - end; + adr2:=aiguillage[indexaig].ADroit; // adresse de ce qui est connecté sur la position droite + c:=aiguillage[indexaig].AdroitB; + if (c='D') or (c='S') or (c='P') then + begin + index2:=Index_aig(adr2); // adresse de l'aiguillage connecté + model2:=aiguillage[index2].modele; // modèle de l'aiguillage connecté + if index2=0 then + begin + ok:=false; + Affiche('Erreur 10.20: aiguillage '+intToSTR(adr)+': déclaration d''un aiguillage '+IntToSTR(adr2)+' inexistant',clred); + end + else + begin + // tjs ou tjs à 2 états ou croisement + if ( ((model2=tjs) or (model2=tjd)) and (aiguillage[index2].EtatTJD=2) ) or (model2=crois) then + begin + if (adr<>aiguillage[index2].Adevie) and (adr<>aiguillage[index2].ADroit) and + (adr<>aiguillage[index2].DDevie) and (adr<>aiguillage[index2].Ddroit) then + begin + Affiche('Erreur 10.21: Discordance de déclaration aiguillages '+intToSTR(adr)+': '+intToSTR(adr2),clred); + ok:=false; + end; + end; + + // tjs ou tjs à 4 états + if (((model2=tjs) or (model2=tjd)) and (aiguillage[index2].EtatTJD=4)) then + begin + adr3:=aiguillage[index2].Ddroit; // 2eme adresse de la TJD + index3:=index_aig(adr3); + if (adr<>aiguillage[index2].Adevie) and (adr<>aiguillage[index2].ADroit) and + (adr<>aiguillage[index3].ADevie) and (adr<>aiguillage[index3].Adroit) then + begin + Affiche('Erreur 10.22: Discordance de déclaration aiguillages '+intToSTR(adr)+': '+intToSTR(adr2),clred); + ok:=false; + end; + end; + + if (model2=aig) or (model2=triple) then + begin + if c='D' then + begin + extr:=aiguillage[index2].ADroit; + if adr<>extr then Affiche('Erreur 10.23: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'D différent de '+intToSTR(extr),clred); + end; + if c='S' then + begin + extr:=aiguillage[index2].ADevie; + if adr<>extr then Affiche('Erreur 10.24: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'S différent de '+intToSTR(extr),clred); + end; + if c='P' then + begin + extr:=aiguillage[index2].APointe; + if adr<>extr then Affiche('Erreur 10.25: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'P différent de '+intToSTR(extr),clred); + end; + end; + end; + end; + + adr2:=aiguillage[indexaig].Adevie; // adresse de ce qui est connecté sur la position déviée + c:=aiguillage[indexaig].AdevieB; + if (c='D') or (c='S') or (c='P') then + begin + index2:=Index_aig(adr2); // adresse de l'aiguillage connecté + model2:=aiguillage[index2].modele; // modèle de l'aiguillage connecté + if index2=0 then + begin + ok:=false; + Affiche('Erreur 10.30: aiguillage '+intToSTR(adr)+': déclaration d''un aiguillage '+IntToSTR(adr2)+' inexistant',clred); + end + else + begin + // tjs ou tjs à 2 états ou croisement + if (((model2=tjs) or (model2=tjd)) and (aiguillage[index2].EtatTJD=2)) or (model2=crois) then + begin + if (adr<>aiguillage[index2].Adevie) and (adr<>aiguillage[index2].ADroit) and + (adr<>aiguillage[index2].DDevie) and (adr<>aiguillage[index2].Ddroit) then + begin + Affiche('Erreur 10.31: Discordance de déclaration aiguillage '+intToSTR(adr)+': '+intToSTR(adr2),clred); + ok:=false; + end; + end; + + // tjs ou tjs à 4 états + if (((model2=tjs) or (model2=tjd)) and (aiguillage[index2].EtatTJD=4)) then + begin + adr3:=aiguillage[index2].Ddroit; // 2eme adresse de la TJD + index3:=index_aig(adr3); + if (adr<>aiguillage[index2].Adevie) and (adr<>aiguillage[index2].ADroit) and + (adr<>aiguillage[index3].ADevie) and (adr<>aiguillage[index3].Adroit) then + begin + Affiche('Erreur 10.32: Discordance de déclaration aiguillage '+intToSTR(adr)+': '+intToSTR(adr2),clred); + ok:=false; + end; + end; + + if (model2=aig) or (model2=triple) then + begin + if c='D' then + begin + extr:=aiguillage[index2].ADroit; + if adr<>extr then Affiche('Erreur 10.33: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'D différent de '+intToSTR(extr),clred); + end; + if c='S' then + begin + extr:=aiguillage[index2].ADevie; + if adr<>extr then Affiche('Erreur 10.34: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'S différent de '+intToSTR(extr),clred); + end; + if c='P' then + begin + extr:=aiguillage[index2].APointe; + if adr<>extr then Affiche('Erreur 10.35: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'P différent de '+intToSTR(extr),clred); + end; + end; + end; + end; + + adr2:=aiguillage[indexaig].APointe; // adresse de ce qui est connecté sur la pointe + c:=aiguillage[indexaig].ApointeB; + if (c='D') or (c='S') or (c='P') then + begin + index2:=Index_aig(adr2); // adresse de l'aiguillage connecté + model2:=aiguillage[index2].modele; // modèle de l'aiguillage connecté + if index2=0 then + begin + ok:=false; + Affiche('Erreur 10.40: aiguillage '+intToSTR(adr)+': déclaration d''un aiguillage '+IntToSTR(adr2)+' inexistant',clred); + end + else + begin + // tjs ou tjs à 2 états ou croisement + if (((model2=tjs) or (model2=tjd)) and (aiguillage[index2].EtatTJD=2)) or (model2=crois) then + begin + if (adr<>aiguillage[index2].Adevie) and (adr<>aiguillage[index2].ADroit) and + (adr<>aiguillage[index2].DDevie) and (adr<>aiguillage[index2].Ddroit) then + begin + Affiche('Erreur 10.41: Discordance de déclaration aiguillage '+intToSTR(adr)+': '+intToSTR(adr2),clred); + ok:=false; + end; + + // tjs ou tjs à 4 états + if (((model2=tjs) or (model2=tjd)) and (aiguillage[index2].EtatTJD=4)) then + begin + adr3:=aiguillage[index2].Ddroit; // 2eme adresse de la TJD + index3:=index_aig(adr3); + if (adr<>aiguillage[index2].Adevie) and (adr<>aiguillage[index2].ADroit) and + (adr<>aiguillage[index3].ADevie) and (adr<>aiguillage[index3].Adroit) then + begin + Affiche('Erreur 10.42: Discordance de déclaration aiguillage '+intToSTR(adr)+': '+intToSTR(adr2),clred); + ok:=false; + end; + end; + + if (model2=aig) or (model2=triple) then + begin + if c='D' then + begin + extr:=aiguillage[index2].ADroit; + if adr<>extr then Affiche('Erreur 10.43: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'D différent de '+intToSTR(extr),clred); + end; + if c='S' then + begin + extr:=aiguillage[index2].ADevie; + if adr<>extr then Affiche('Erreur 10.44: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'S différent de '+intToSTR(extr),clred); + end; + if c='P' then + begin + extr:=aiguillage[index2].APointe; + if adr<>extr then Affiche('Erreur 10.45: Discordance de déclaration aiguillages '+intToSTR(adr)+'S: '+intToSTR(adr2)+'P différent de '+intToSTR(extr),clred); + end; + end; + end; + end; + end; + end; end; - + // cohérence 8 // parcoure les branches pour voir si les aiguillages aux extrémités sont cohérentes avec leurs déclarations for i:=1 to NbreBranches do @@ -6026,9 +6169,17 @@ begin if aiguillage[l].Ddevie=AncAdr then trouvePrec:=true; end; end; + if aiguillage[k].modele=crois then + begin + if aiguillage[k].ADroit=AncAdr then trouvePrec:=true; + if aiguillage[k].ADevie=AncAdr then trouvePrec:=true; + if aiguillage[k].Ddroit=AncAdr then trouvePrec:=true; + if aiguillage[k].Ddevie=AncAdr then trouvePrec:=true; + end; + if not(trouvePrec) then begin - Affiche('La description de l''aiguillage '+intToSTR(detect)+' ne correspond pas à son élément contigu ('+intToStr(AncAdr)+') en branche '+intToSTR(i),clred); + Affiche('Erreur 11: La description de l''aiguillage '+intToSTR(detect)+' ne correspond pas à son élément contigu ('+intToStr(AncAdr)+') en branche '+intToSTR(i),clred); ok:=false; end; end; @@ -6045,27 +6196,35 @@ begin end; if (aiguillage[k].modele=Tjd) or (aiguillage[k].modele=TjS) then begin - if aiguillage[k].EtatTJD=2 then - begin - if aiguillage[k].ADroit=SuivAdr then trouveSuiv:=true; - if aiguillage[k].ADevie=SuivAdr then trouveSuiv:=true; - if aiguillage[k].Ddroit=SuivAdr then trouveSuiv:=true; - if aiguillage[k].Ddevie=SuivAdr then trouveSuiv:=true; - end; - if aiguillage[k].EtatTJD=4 then - begin - l:=index_aig(aiguillage[k].Ddroit); // 2eme adresse de la TJD - if aiguillage[k].ADroit=SuivAdr then trouveSuiv:=true; - if aiguillage[k].ADevie=SuivAdr then trouveSuiv:=true; - if aiguillage[k].Ddroit=SuivAdr then trouveSuiv:=true; - if aiguillage[l].Adroit=SuivAdr then trouveSuiv:=true; - if aiguillage[l].Adevie=SuivAdr then trouveSuiv:=true; - if aiguillage[l].Ddevie=SuivAdr then trouveSuiv:=true; - end; + if aiguillage[k].EtatTJD=2 then + begin + if aiguillage[k].ADroit=SuivAdr then trouveSuiv:=true; + if aiguillage[k].ADevie=SuivAdr then trouveSuiv:=true; + if aiguillage[k].Ddroit=SuivAdr then trouveSuiv:=true; + if aiguillage[k].Ddevie=SuivAdr then trouveSuiv:=true; + end; + if aiguillage[k].EtatTJD=4 then + begin + l:=index_aig(aiguillage[k].Ddroit); // 2eme adresse de la TJD + if aiguillage[k].ADroit=SuivAdr then trouveSuiv:=true; + if aiguillage[k].ADevie=SuivAdr then trouveSuiv:=true; + if aiguillage[k].Ddroit=SuivAdr then trouveSuiv:=true; + if aiguillage[l].Adroit=SuivAdr then trouveSuiv:=true; + if aiguillage[l].Adevie=SuivAdr then trouveSuiv:=true; + if aiguillage[l].Ddevie=SuivAdr then trouveSuiv:=true; + end; end; + if aiguillage[k].modele=crois then + begin + if aiguillage[k].ADroit=SuivAdr then trouveSuiv:=true; + if aiguillage[k].ADevie=SuivAdr then trouveSuiv:=true; + if aiguillage[k].Ddroit=SuivAdr then trouveSuiv:=true; + if aiguillage[k].Ddevie=SuivAdr then trouveSuiv:=true; + end; + if not(trouveSuiv) then begin - Affiche('La description de l''aiguillage '+intToSTR(detect)+' ne correspond pas à son élément contigu ('+intToStr(SuivAdr)+') en branche '+intToSTR(i),clred); + Affiche('Erreur 12: La description de l''aiguillage '+intToSTR(detect)+' ne correspond pas à son élément contigu ('+intToStr(SuivAdr)+') en branche '+intToSTR(i),clred); ok:=false; end; end; @@ -6074,6 +6233,52 @@ begin until((model=rien) and (detect=0)) ; end; + // 9. vérifier la cohérence TCO + if avecTCO then + begin + for y:=1 to NbreCellY do + for x:=1 to NbreCellX do + begin + i:=TCO[x,y].BImage; + if i=30 then + begin + adr:=TCO[x,y].adresse; + if index_feu(adr)=0 then + begin + Affiche('Un feu '+IntToSTR(adr)+' est déclaré dans le TCO['+intToSTR(x)+','+intToSTR(y)+'] mais absent de la configuration',clred); + ok:=false; + end; + end; + if (i=2) or (i=3) or (i=4) or (i=5) or (i=12) or (i=13) or (i=14) or (i=15) then + begin + adr:=TCO[x,y].adresse; + if index_aig(adr)=0 then + begin + Affiche('Un aiguillage '+IntToSTR(adr)+' est déclaré dans le TCO['+intToSTR(x)+','+intToSTR(y)+'] mais absent de la configuration',clred); + ok:=false; + end; + end; + if (i=1) or (i=6) or (i=7) or (i=8) or (i=9) or (i=16) or (i=17) or (i=18) or (i=19) or (i=20) or (i=10) or (i=11) then + begin + adr:=TCO[x,y].adresse; + if adr<>0 then + begin + j:=1; + repeat + trouveSuiv:=adr=Adresse_detecteur[j]; + inc(j); + until (j>NDetecteurs) or trouveSuiv; + + if not(trouveSuiv) then + begin + Affiche('Un détecteur '+IntToSTR(adr)+' est déclaré dans le TCO['+intToSTR(x)+','+intToSTR(y)+'] mais absent de la configuration',clred); + ok:=false; + end; + end; + end; + end; + end; + verif_coherence:=ok; end; @@ -6589,6 +6794,7 @@ begin 1 : aiguillage[i].modele:=tjd; 2 : aiguillage[i].modele:=tjs; 3 : aiguillage[i].modele:=triple; + 4 : aiguillage[i].modele:=crois; else aiguillage[i].modele:=rien; end; diff --git a/UnitConfigTCO.dcu b/UnitConfigTCO.dcu index 32fc3d2..564fa53 100644 Binary files a/UnitConfigTCO.dcu and b/UnitConfigTCO.dcu differ diff --git a/UnitDebug.dcu b/UnitDebug.dcu index 6b596a0..f5d5398 100644 Binary files a/UnitDebug.dcu and b/UnitDebug.dcu differ diff --git a/UnitDebug.dfm b/UnitDebug.dfm index 0d92c45..b625bb0 100644 --- a/UnitDebug.dfm +++ b/UnitDebug.dfm @@ -494,6 +494,21 @@ object FormDebug: TFormDebug TabOrder = 9 OnClick = CheckBox1Click end + object CheckDebugTCO: TCheckBox + Left = 200 + Top = 128 + Width = 121 + Height = 17 + Caption = 'Debug TCO' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 10 + OnClick = CheckDebugTCOClick + end end object RichDebug: TRichEdit Left = 0 diff --git a/UnitDebug.pas b/UnitDebug.pas index 758de8e..a1d23ab 100644 --- a/UnitDebug.pas +++ b/UnitDebug.pas @@ -56,6 +56,7 @@ type ButtonSimuAct1: TButton; ButtonElSuiv: TButton; CheckBox1: TCheckBox; + CheckDebugTCO: TCheckBox; procedure FormCreate(Sender: TObject); procedure ButtonEcrLogClick(Sender: TObject); procedure EditNivDebugKeyPress(Sender: TObject; var Key: Char); @@ -90,6 +91,7 @@ type procedure ButtonSimuAct0Click(Sender: TObject); procedure ButtonElSuivClick(Sender: TObject); procedure CheckBox1Click(Sender: TObject); + procedure CheckDebugTCOClick(Sender: TObject); private { Déclarations privées } public @@ -102,7 +104,7 @@ Max_Event_det_tick=30000; var FormDebug: TFormDebug; NivDebug,signalDebug : integer; - AffSignal,AffAffect,initform,AffFD,debug_dec_sig : boolean; + AffSignal,AffAffect,initform,AffFD,debug_dec_sig,debugTCO : boolean; N_event_det : integer; // index du dernier évènement (de 1 à 20) N_Event_tick : integer ; // dernier index @@ -528,4 +530,9 @@ begin dupliqueEvt:=CheckBox1.checked; end; +procedure TFormDebug.CheckDebugTCOClick(Sender: TObject); +begin + debugTCO:=checkDebugTCO.checked; +end; + end. diff --git a/UnitPilote.dcu b/UnitPilote.dcu index 1771dc5..6b58c1c 100644 Binary files a/UnitPilote.dcu and b/UnitPilote.dcu differ diff --git a/UnitPrinc.dcu b/UnitPrinc.dcu index cb4fc29..7f9d422 100644 Binary files a/UnitPrinc.dcu and b/UnitPrinc.dcu differ diff --git a/UnitPrinc.pas b/UnitPrinc.pas index 28b0538..ff26645 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -228,7 +228,7 @@ Etats : array[0..19] of string[30]=('Non command type Taccessoire = (aigP,feu); // aiguillage ou feu TMA = (valide,devalide); -TEquipement = (rien,aig,tjd,tjs,triple,det,buttoir,voie); // voie uniquement pour le tco +TEquipement = (rien,aig,tjd,tjs,triple,det,buttoir,voie,crois); // voie uniquement pour le tco TBranche = record BType : Tequipement ; // ne prend que les valeurs suivantes: dét aig Buttoir Adresse : integer ; // adresse du détecteur ou de l'aiguillage @@ -278,7 +278,7 @@ TFeu = record Lbl : TLabel; // pointeur sur structure Tlabel du feu check : TCheckBox; // pointeur sur structure Checkbox "demande feu blanc" FeuBlanc : boolean ; // avec checkbox ou pas - decodeur : integer; // type du décodeur + decodeur : integer; // type du décodeur // 'rien','Digital Bahn','CDF','LDT','LEB','NMRA','Unisemaf','SR' Adr_det1 : integer; // adresse du détecteur1 sur lequel il est implanté Adr_det2 : integer; // adresse du détecteur2 sur lequel il est implanté (si un signal est pour plusieurs voies) Adr_det3 : integer; // adresse du détecteur3 sur lequel il est implanté (si un signal est pour plusieurs voies) @@ -331,7 +331,7 @@ var Enregistrement,chaine_Envoi,chaine_recue,Id_CDM,Af, entete,suffixe,ConfStCom,LAY : string; maxaiguillage,detecteur_chgt,Temps,Tempo_init,Suivant,ntrains, - NbreImagePligne,NbreBranches,Index2_det,Index2_aig,branche_det,Index_det, + NbreImagePligne,NbreBranches,Index2_det,Index2_aig,branche_det, I_simule,maxTablo_act,NbreVoies,AdresseFeuSuivant,El_suivant : integer; Ancien_detecteur : array[0..NbMemZone] of boolean; // anciens état des détecteurs et adresses des détecteurs et leur état detecteur : array[0..NbMemZone] of @@ -431,7 +431,7 @@ procedure Dessine_feu_mx(CanvasDest : Tcanvas;x,y : integer;FrX,frY : real;adres procedure Pilote_acc0_X(adresse : integer;octet : byte); procedure pilote_acc(adresse : integer;octet : byte;Acc : TAccessoire); function etat_signal_suivant(Adresse,rang : integer) : integer; -function suivant_alg3(prec : integer;typeELprec : TEquipement;var actuel : integer;typeElActuel : TEquipement;alg : integer) : integer; +function suivant_alg3(prec : integer;typeELprec : TEquipement;actuel : integer;typeElActuel : TEquipement;alg : integer) : integer; function detecteur_suivant_El(el1: integer;TypeDet1 : TEquipement;el2 : integer;TypeDet2 : TEquipement;alg : integer) : integer ; function test_memoire_zones(adresse : integer) : boolean; function PresTrainPrec(Adresse : integer) : boolean; @@ -3151,7 +3151,7 @@ end; // 9997: arrêt sur aiguillage dévié // 9996: arrêt sur position inconnue d'aiguillage // la variable actuel peut etre changée en cas de TJD! -function suivant_alg3(prec : integer;typeELprec : TEquipement;var actuel : integer;typeElActuel : TEquipement;alg : integer) : integer; +function suivant_alg3(prec : integer;typeELprec : TEquipement;actuel : integer;typeElActuel : TEquipement;alg : integer) : integer; var Adr,AdrPrec,indexBranche_prec,branche_trouve_prec,indexBranche_actuel,branche_trouve_actuel, tjsc1,tjsc2,AdrTjdP,Adr2,N_iteration,index,NetatTJD,index2 : integer; tjscourbe1,tjscourbe2,tjdC,tjsC : boolean; @@ -3297,7 +3297,6 @@ begin if aiguillage[index].position=const_devie then begin if NivDebug=3 then AfficheDebug('133 - aiguillage '+intToSTR(Adr)+' Pris en pointe dévié',clyellow); - // AdrPrec:=Adr; // JU if alg=3 then // on demande d'arreter si l'aiguillage pris en pointe est dévié begin typeGen:=rien; @@ -3328,7 +3327,7 @@ begin if aiguillage[index].position=const_droit then begin // si TJD (modele=2) sur le précédent, alors substituer avec la 2eme adresse de la TJD - //if aiguillage[index_aig(prec)].modele=tjd then prec:=aiguillage[index_aig(prec)].DDroit; + if aiguillage[index_aig(prec)].modele=tjd then prec:=aiguillage[index_aig(prec)].DDroit; if prec<>aiguillage[index_aig(Adr)].Adroit then //Adroit begin if NivDebug=3 then AfficheDebug('135.1 - Aiguillage '+intToSTR(adr)+' mal positionné',clyellow); @@ -3429,7 +3428,7 @@ begin if (NetatTJD=2) and tjdC then begin if aiguillage[index].position=const_droit then - begin + begin // d'où vient t-on de la tjd if BtypePrec=Aig then begin @@ -3810,6 +3809,21 @@ begin suivant_alg3:=9999;exit; end; end; + + if (aiguillage[index].modele=crois) then + begin + adr:=9999; + if aiguillage[index].Adroit=prec then begin adr:=aiguillage[index].Ddroit;A:=aiguillage[index].DdroitB;end; + if aiguillage[index].Adevie=prec then begin adr:=aiguillage[index].Ddevie;A:=aiguillage[index].DdevieB;end; + if aiguillage[index].Ddevie=prec then begin adr:=aiguillage[index].Adevie;A:=aiguillage[index].AdevieB;end; + if aiguillage[index].Ddroit=prec then begin adr:=aiguillage[index].Adroit;A:=aiguillage[index].AdroitB;end; + + if A='Z' then typeGen:=det else typeGen:=aig; //TypeEL=(1=détécteur 2=aig) + suivant_alg3:=adr; + if a='' then a:=' '; + if nivDebug=3 then Affichedebug('le port de destination du croisement est '+IntToSTR(adr)+a,clyellow); + exit; + end; if (aiguillage[index].modele=triple) then // aiguillage triple begin @@ -5340,11 +5354,11 @@ begin s:='Trouvé feu ('+IntToSTR(nfeux)+'/'+intToSTR(NFeuxMax)+') '+IntToSTR(AdrFeu); if (NivDebug>0) And Pres_Train then AfficheDebug(s+' et mémoire de zone à 1',clyellow); if (NivDebug>0) And (not(Pres_Train)) then AfficheDebug(s+' et mémoire de zone à 0',clOrange); - { if nFeux=NFeuxMax then + if nFeux=NFeuxMax then begin PresTrainPrec:=Pres_train; exit; - end; } + end; end else begin @@ -5355,7 +5369,7 @@ begin end; end; end; - until (j=10) or malpositionne; // on arrete jusqu'à trouver un signal ou si on va trop loin (10 itérations) + until (j=10) or malpositionne or (nfeux>=NFeuxMax); // on arrete jusqu'à trouver un signal ou si on va trop loin (10 itérations) inc(ife); until ife>=5; if (NivDebug>0) then AfficheDebug('Pas trouvé de signal suivant au '+intToSTR(adresse),clyellow); @@ -5448,7 +5462,7 @@ begin if (modele>=4) and ( (not(PresTrain) and Feux[index].VerrouCarre) or car) then Maj_Etat_Signal(AdrFeu,carre) else begin - // si on quitte le détecteur on affiche un sémaphore : attention tester le sens de circulation + // si on quitte le détecteur on affiche un sémaphore : tester le sens de circulation // pour ne pas passer au rouge un feu à contresens. // trouver la mémoire de zone MemZone[Adr_det,?] qui a déclenché le feu rouge if AffSignal then AfficheDebug('test du sémaphore',clYellow); @@ -5458,7 +5472,7 @@ begin begin if AffSignal then AfficheDebug('Présence train après signal'+intToSTR(AdrFeu)+' -> sémaphore ou carré',clYellow); if testBit(feux[index].EtatSignal,carre)=FALSE then Maj_Etat_Signal(AdrFeu,semaphore); - end + end // zizi else begin Aig:=Aiguille_deviee(Adrfeu); @@ -6999,7 +7013,7 @@ begin FormDebug.Caption:=AF+' debug'; N_Trains:=0; NivDebug:=0; - debugtrames:=true; + debugtrames:=false; algo_Unisemaf:=1; AvecInit:=true; //&&&& avec initialisation des aiguillages ou pas @@ -7116,7 +7130,7 @@ begin Affiche_memoire; { - aiguillage[index_aig(1)].position:=const_devie; + aiguillage[index_aig(1)].position:=const_droit; aiguillage[index_aig(3)].position:=const_devie; aiguillage[index_aig(5)].position:=const_droit; aiguillage[index_aig(7)].position:=const_devie; @@ -7131,9 +7145,9 @@ begin aiguillage[index_aig(31)].position:=const_devie; aiguillage[index_aig(25)].position:=const_droit; aiguillage[index_aig(9)].position:=const_droit; - - Affiche(intToSTR(det_suiv_cont(527,520)),clLime); -} + i:=suivant_alg3(523,det,100,aig,1) ; + Affiche(intToSTR(i),clLime); + } //det_suiv_cont(525,528) ; end; @@ -7805,8 +7819,7 @@ begin delete(trame_cdm,1,j); goto reprise; end; - - + if long>l then begin if debugTrames then diff --git a/UnitSR.dcu b/UnitSR.dcu index f7adf93..ea66fb7 100644 Binary files a/UnitSR.dcu and b/UnitSR.dcu differ diff --git a/UnitSimule.dcu b/UnitSimule.dcu index 4d981df..ef004ad 100644 Binary files a/UnitSimule.dcu and b/UnitSimule.dcu differ diff --git a/UnitTCO.dcu b/UnitTCO.dcu index 6ae5171..ee4d2fc 100644 Binary files a/UnitTCO.dcu and b/UnitTCO.dcu differ diff --git a/UnitTCO.pas b/UnitTCO.pas index 9d2a0dd..7350f49 100644 --- a/UnitTCO.pas +++ b/UnitTCO.pas @@ -1916,8 +1916,12 @@ begin r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); FillRect(r); - if mode=1 then couleur:=clAllume else couleur:=clVoies; - Brush.COlor:=Couleur; + case mode of + 0: couleur:=clVoies; + 1: couleur:=clAllume; + 2: couleur:=couleurtrain[index_couleur]; + end; + Brush.Color:=Couleur; pen.color:=Couleur; Pen.Mode:=pmCopy; @@ -1949,9 +1953,13 @@ begin r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); FillRect(r); - if mode=1 then couleur:=clAllume else couleur:=clVoies; - Brush.COlor:=Couleur; - pen.color:=Couleur; + case mode of + 0: couleur:=clVoies; + 1: couleur:=clAllume; + 2: couleur:=couleurtrain[index_couleur]; + end; + Brush.Color:=couleur; + pen.color:=couleur; Pen.Mode:=pmCopy; // brush.color:=clblue; @@ -1982,8 +1990,12 @@ begin r:=Rect(x0,y0,x0+LargeurCell,y0+HauteurCell); FillRect(r); - if mode=1 then couleur:=clAllume else couleur:=clVoies; - Brush.COlor:=Couleur; + case mode of + 0: couleur:=clVoies; + 1: couleur:=clAllume; + 2: couleur:=couleurtrain[index_couleur]; + end; + Brush.Color:=Couleur; pen.color:=Couleur; Pen.Mode:=pmCopy; @@ -2020,7 +2032,7 @@ begin 1: couleur:=clAllume; 2: couleur:=couleurtrain[index_couleur]; end; - Brush.COlor:=Couleur; + Brush.Color:=Couleur; pen.color:=Couleur; Pen.Mode:=pmCopy; @@ -2071,7 +2083,7 @@ begin 1: couleur:=clAllume; 2: couleur:=couleurtrain[index_couleur]; end; - Brush.COlor:=Couleur; + Brush.Color:=Couleur; pen.color:=Couleur; Pen.Mode:=pmCopy; xbv1:=x0+(LargeurCell div 2)-round(3*frXGlob); // pos x de la bande verticale @@ -3075,6 +3087,7 @@ begin begin affiche_cellule(x,y); end; + end; //afficher les cellules des feux et les textes pour que les pieds recouvrent le reste et afficher les textes @@ -3234,14 +3247,16 @@ end; procedure zone_TCO(det1,det2,mode: integer); var i,j,x,y,xn,yn,ancienY,ancienX,Xdet1,Ydet1,Xdet2,Ydet2,Bimage,adresse, - pos,pos2 : integer; - memtrouve,debugTCO,increment : boolean; + pos,pos2,ir : integer; + memtrouve,increment,sortir : boolean; mdl : Tequipement; + routeTCO : array[1..100] of record + x,y : integer; + end; s : string; begin // trouver le détecteur det1 - debugTCO:=false; - if debugTCO then Affiche('Zone_TCO det1='+intToSTR(det1)+' det2='+intToSTR(det2)+' mode='+intToSTR(mode)+' couleur='+intToSTR(index_couleur),clyellow); + if debugTCO then AfficheDebug('Zone_TCO det1='+intToSTR(det1)+' det2='+intToSTR(det2)+' mode='+intToSTR(mode)+' couleur='+intToSTR(index_couleur),clyellow); trouve_det(det1,Xdet1,Ydet1); if (Xdet1=0) or (Ydet1=0) then exit; @@ -3250,16 +3265,8 @@ begin increment:=true; // inverser coordonnées des détecteurs si à l'envers en X - if xDet2x) and (ancienY=Y) then begin xn:=x-1;if pos=const_devie then yn:=y+1;end; - if (ancienXy) then xn:=x-1; - if (pos=const_inconnu) then Erreur_TCO(x,y); + if (ancienXy) then xn:=x+1; + if (pos=const_inconnu) then begin Erreur_TCO(x,y);exit;end; end; 3 : begin - if debugTCO then Affiche('El 3',clyellow); + //if debugTCO then AfficheDebug('El 3',clyellow); pos:=positionTCO(x,y); if (ancienXx) and (ancienY=Y) then xn:=x-1; if (ancienX>x) and (ancienYx) and (ancienY=Y) then xn:=x-1; if (ancienX>x) and (ancienY>y) then xn:=x-1; - if (pos=const_inconnu) then Erreur_TCO(x,y); + if (pos=const_inconnu) then begin Erreur_TCO(x,y);exit;end; end; 5 : begin - if debugTCO then Affiche('El 5',clyellow); + //if debugTCO then AfficheDebug('El 5',clyellow); pos:=positionTCO(x,y); if (ancienXx) and (ancienY=Y) then begin xn:=x-1;if pos=const_devie then yn:=y-1;end; if (ancienXx) and (ancienY=Y) then begin xn:=x-1;yn:=y-1;end; if (ancienX>x) and (ancienY>y) then begin xn:=x-1;yn:=y-1;end; - if (pos=const_inconnu) then Erreur_TCO(x,y); + if (pos=const_inconnu) then begin Erreur_TCO(x,y);exit;end; end; 13 : begin - if debugTCO then Affiche('El 13',clyellow); + //if debugTCO then AfficheDebug('El 13',clyellow); pos:=positionTCO(x,y); if (ancienXx) and (ancienYy) then begin xn:=x+1;yn:=y-1;end; - if (pos=const_inconnu) then Erreur_TCO(x,y); + if (pos=const_inconnu) then begin Erreur_TCO(x,y);exit;end; end; 14 : begin - if debugTCO then Affiche('El 14',clyellow); + //if debugTCO then AfficheDebug('El 14',clyellow); pos:=positionTCO(x,y); if (ancienXx) and (ancienY>y) then begin xn:=x-1;if pos=const_droit then yn:=y-1;end; - if (pos=const_inconnu) then Erreur_TCO(x,y); + if (pos=const_inconnu) then begin Erreur_TCO(x,y);exit;end; end; 15 : begin - if debugTCO then Affiche('El 15',clyellow); + //if debugTCO then AfficheDebug('El 15',clyellow); pos:=positionTCO(x,y); if (ancienXY) then begin xn:=x+1;if pos=const_droit then yn:=y-1;end; if (ancienX>x) and (ancienYx) and (ancienY=y) then begin xn:=x-1;yn:=y+1;end; - if (pos=const_inconnu) then Erreur_TCO(x,y); + if (pos=const_inconnu) then begin Erreur_TCO(x,y);exit;end; end; 16 : if ancienX0 then begin j:=Index_Aig(adresse); pos:=aiguillage[j].position; - if (pos=const_inconnu) then Erreur_TCO(x,y); + if (pos=const_inconnu) then begin Erreur_TCO(x,y);exit;end; mdl:=aiguillage[j].modele; if mdl=tjd then begin @@ -3434,18 +3446,18 @@ begin // TJD ou croisement 22 : begin // tjd ou tjs - if debugTCO then Affiche('El 22',clyellow); + //if debugTCO then AfficheDebug('El 22',clyellow); if adresse<>0 then begin j:=Index_Aig(adresse); pos:=aiguillage[j].position; - if (pos=const_inconnu) then Erreur_TCO(x,y); + if (pos=const_inconnu) then begin Erreur_TCO(x,y);exit;end; mdl:=aiguillage[j].modele; if mdl=tjd then begin j:=Index_Aig(aiguillage[j].Ddroit); pos2:=aiguillage[j].position; // 2eme adresse de la TJD - if (pos2=const_inconnu) then Erreur_TCO(x,y); + if (pos2=const_inconnu) then begin Erreur_TCO(x,y);exit;end; if (pos=const_droit) and (pos2=const_droit) then begin if ancienXdet2) and memTrouve) or (i>NbCellulesTCO); + //until (x=1) or (x=NbreCellX) or (y=NbreCellY) or ((adresse<>det2) and memTrouve) or (i>NbCellulesTCO); + until ((adresse<>det2) and memTrouve) or (i>NbCellulesTCO) or sortir; + //Affiche(intToSTR(x),clLime); if i>NbCellulesTCO then begin - s:='Erreur 1000 TCO : dépassement d''itérations '+IntToSTR(det1)+' - '+IntToSTR(det2); - Affiche(s,clred); AfficheDebug(s,clred); + // fausse route, sortir + if DebugTCO then AfficheDebug('Erreur 1000 TCO : dépassement d''itérations - Route de '+IntToSTR(det1)+' à '+IntToSTR(det2),clred); + exit; end; + + dec(ir); + for i:=1 to ir do + Affiche_cellule(routeTCO[i].x,routeTCO[i].y); + end; procedure TFormTCO.FormActivate(Sender: TObject); @@ -4858,7 +4883,7 @@ end; procedure TFormTCO.ButtonSimuClick(Sender: TObject); begin - aiguillage[Index_Aig(1)].position:=const_devie; +{ aiguillage[Index_Aig(1)].position:=const_devie; aiguillage[Index_Aig(2)].position:=const_droit; aiguillage[Index_Aig(3)].position:=const_droit; aiguillage[Index_Aig(4)].position:=const_devie; @@ -4868,9 +4893,15 @@ begin aiguillage[Index_Aig(20)].position:=const_droit; aiguillage[Index_Aig(21)].position:=const_droit; aiguillage[Index_Aig(26)].position:=const_droit; - aiguillage[Index_Aig(28)].position:=const_devie; + aiguillage[Index_Aig(28)].position:=const_devie; } index_couleur:=1; - zone_TCO(520,529,1); + aiguillage[Index_Aig(120)].position:=const_droit; + aiguillage[Index_Aig(119)].position:=const_droit; + aiguillage[Index_Aig(116)].position:=const_droit; + aiguillage[Index_Aig(117)].position:=const_devie; + + + zone_TCO(595,602,1); end; procedure TFormTCO.CheckPinvClick(Sender: TObject); diff --git a/Unit_Pilote_aig.dcu b/Unit_Pilote_aig.dcu index 12be50b..9d8a104 100644 Binary files a/Unit_Pilote_aig.dcu and b/Unit_Pilote_aig.dcu differ diff --git a/verif_version.dcu b/verif_version.dcu index 153a287..00b4133 100644 Binary files a/verif_version.dcu and b/verif_version.dcu differ diff --git a/verif_version.pas b/verif_version.pas index 4be9f61..51c0cf4 100644 --- a/verif_version.pas +++ b/verif_version.pas @@ -23,7 +23,7 @@ var Lance_verif : integer; verifVersion,notificationVersion : boolean; -Const Version='4.0'; // sert à la comparaison de la version publiée +Const Version='4.1'; // 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 053af24..8748d6a 100644 --- a/versions.txt +++ b/versions.txt @@ -98,12 +98,14 @@ version 3.84 : Possibilit version 3.85 : Affichage des cantons occupés avec des couleurs différentes par train ou non dans le TCO. Grille optionnelle sauvegardée dans la configuration du TCO. Possibilité de déclarer des signaux implantés à droite ou à gauche des voies dans le TCO. -version 4.0 Changement de l'algorithme d'affichage du TCO. +version 4.0 : Changement de l'algorithme d'affichage du TCO. Calcul de la route correcte d'un train si changement de la position de l'aiguillage derrière le train. Renforcement de la vérification de la configuration. Possibilité de multisélectionner les feux ou les aiguillages pour leur suppression dans le panneau de configuration. +version 4.1 : Intégration des croisements + Correction de quelques bugs