diff --git a/Notice d'utilisation des signaux_complexes_GL_V1.75.pdf b/Notice d'utilisation des signaux_complexes_GL_V1.75.pdf deleted file mode 100644 index 6faf973..0000000 Binary files a/Notice d'utilisation des signaux_complexes_GL_V1.75.pdf and /dev/null differ diff --git a/Notice d'utilisation des signaux_complexes_GL_V2.00.pdf b/Notice d'utilisation des signaux_complexes_GL_V2.00.pdf new file mode 100644 index 0000000..212289e Binary files /dev/null and b/Notice d'utilisation des signaux_complexes_GL_V2.00.pdf differ diff --git a/UnitConfig.dfm b/UnitConfig.dfm index f2ea95a..6dd195b 100644 --- a/UnitConfig.dfm +++ b/UnitConfig.dfm @@ -1,6 +1,6 @@ object FormConfig: TFormConfig - Left = 226 - Top = 188 + Left = 305 + Top = 330 Hint = 'Modifie les fichiers de configuration selon les s'#233'lections chois' + 'ies' @@ -22,17 +22,16 @@ object FormConfig: TFormConfig TextHeight = 13 object LabelInfo: TLabel Left = 601 - Top = 432 - Width = 13 + Top = 416 + Width = 29 Height = 16 - Caption = '- ' + Caption = '- -' Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'Arial Narrow' Font.Style = [] ParentFont = False - WordWrap = True end object Image1: TImage Left = 600 @@ -1231,7 +1230,7 @@ object FormConfig: TFormConfig end object ImageTJD: TImage Left = 720 - Top = 336 + Top = 320 Width = 137 Height = 57 Picture.Data = { @@ -1366,8 +1365,8 @@ object FormConfig: TFormConfig Visible = False end object ImageTri: TImage - Left = 624 - Top = 344 + Left = 592 + Top = 360 Width = 145 Height = 65 Picture.Data = { @@ -1543,6 +1542,208 @@ object FormConfig: TFormConfig Height = 13 Caption = 'Verrouillable au carr'#233' :' end + object Image2: TImage + Left = 712 + Top = 424 + Width = 129 + Height = 41 + Picture.Data = { + 07544269746D617006180000424D06180000000000007600000028000000CA00 + 00003A000000010004000000000090170000120B0000120B0000100000000000 + 0000000000000000800000800000008080008000000080008000808000008080 + 8000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF + FF00CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCC000000CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC000000CCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC000000CCCCC8888887 + 7CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC00 + 0000CCCCC88888888888888887CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCC88887CCCCC000000CCCC48888888888888888888888777CCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCC777888888888887CCCCC000000CCCCC88888888888888888888888 + 8888888888C7777CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCC7C77788888888888888888888887CCCCC000000CCCCC8888888 + 8888888888888888888888888888888888888887CCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCC7C7888888888888888888888888888888888888CCCCC00 + 0000CCCC78888888888888888888888888888888888888888888888888888888 + 88877877C77CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCC7C77777777888888888888888888888888888888888888888 + 888888888CCCCC000000CCCC4000077888888888888888888888888888888888 + 8888888888888888888888888888888888888888888788888C77CC8CCCC8CC8C + C7C8778C78788787888888888888888888888888888888888888888888888888 + 88888888888888888888888884CCCC000000CCCC788877700000000777888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 888888888888888888888888888888888888887774CCCC000000CCCC88888888 + 8878877000000008788888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 888888888888888888888888888888888888888888877770000000070CCCCC00 + 0000CCCC88888888888888888888777000000007778878888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888887770000000077 + 7888888887CCCC000000CCC48888888888888888888888888888888707000000 + 0077077788888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888877777770000 + 00000777888888888888888887CCCC000000CCC4888888888888888888888888 + 8888888888888888770770000000077077777788888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888787707 + 000000000007777788888888888888888888888888CCCC000000CCC788888888 + 8888888888888888888888888888888888888888878887787700700000000000 + 7007707777777787787788788888888887888878778888787787777777700000 + 0000000000000777778888888888888888888888888888888888888887CCCC00 + 0000CCC788888888888888888888888888888888888888888888888888888888 + 8888888888877887777007007000000000000000000000000000000000000000 + 0000000707777777878788888888888888888888888888888888888888888888 + 8888888887CCCC000000CCC78888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888878 + 8888888888888888888888888888888888888888888888888888888888888888 + 88888888888888888888888888CCCC000000CC48888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 888888888888888888888888888888888888888888CCCC000000CC4888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 88888888888888888888888888888888888888888888888888888888887CCC00 + 0000CC7888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 88888888887CCC000000CC788888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 888888888888888888888888887CCC000000CC40377788888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888887CCC000000CCCCCC440040 + 7778888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 88888888888888888888888888888888888888888888888888888888887CCC00 + 0000CCCCCCCCCCCCCC4400737888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 88877303000CCC000000CCCCCCCCCCCCCCCCCCC4440400777888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 88888888887777000004444CCCCCCC000000CCCCCCCCCCCCCCCCCCCCCCCCCCC4 + 4400307778888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888887773300000444CCCCCCCCCCCCCCC000000CCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCC4404400777888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888877730004404C4CCCCCCCCCCCCCCCCCCCCCCC00 + 0000CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC44400003777888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 888888888888888888888888888888888887730300444CCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCC000000CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCC0000078888888888888888888888888888888888888888888888888888888 + 88888888888888888888888888888888888888888887770044444CCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC000000CCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCC4C40400377788888888888888888888888888888888888888888888 + 888888888888888888888888888888888888888888888888888888888000000C + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC000000CCCCCCCCCCCC + CCCCCCCCCCCCCCCCC44440003777788888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 88888888888887770C44CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC00 + 0000CCCCCCCCCCCCCCCCCCCC4440040037778888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 888888888888888888888888888888888888877744444CCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCC000000CCCCCCCCCCCCC4440003078788888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888773 + 0444CCCCCCCCCCCCCCCCCCCCCCCCCC000000CCCC444000300778788888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 88888888888888888887730400444CCCCCCCCCCCCCCCCC000000CC0377778888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 888888888888888888888888888888888888888888877300444444CCCCCCCC00 + 0000CC7888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 88887707044CCC000000CC788888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 888888888888888888888888888CCC000000CC48888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888887CCC000000CCC888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 88888888888888888888888888888888888888888888888888888888887CCC00 + 0000CC4788888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 88888888887CCC000000CCC88888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 888888888888888888888888887CCC000000CCC8888888888888888888888888 + 8888888888888888888888888888888888888878787777777770770700707707 + 0000000000700770770777777778778878888888888888888888888888888888 + 888888888888888888888888888888888888888888CCCC000000CCC788888888 + 8888888888888888888888888888888887777770700000000000000000777777 + 7777777777787777777877878877777777770077077070000000000070077777 + 8878888888888888888888888888888888888888888888888888888888CCCC00 + 0000CCC488888888888888888888888888888877077700000000070777777778 + 8888888888888888888888888888888888888888888888888888888888888888 + 8887887777770700000000000707877888888888888888888888888888888888 + 8888888888CCCC000000CCC78888888888888888887777000000000707778788 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888878777700000000700777888888 + 88888888888888888888888887CCCC000000CCC4888888887777000000000077 + 7888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 887707700000000007778888888888888888888887CCCC000000CCCC78777000 + 0000777788888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888788777000007778888888888888887CCCC00 + 0000CCCC00077778888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888888888888888887770000007 + 778888888CCCCC000000CCCC7888888888888888888888888888888888888888 + 8888888888888888888888888888888888888888878888788787887877887888 + 8888888888888888888888888888888888888888888888888888888888888888 + 88888888888887700000070784CCCC000000CCCC788888888888888888888888 + 8888888888888888888888888888888878C7CCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC88888888888888888888888888 + 888888888888888888888888888888888888777004CCCC000000CCCC78888888 + 8888888888888888888888888888888777C7CCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCC7777C888888888888888888888888888888888888888888888888CCCCC00 + 0000CCCC4888888888888888888888888777CCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC7788788888888888888888888888888 + 888888888CCCCC000000CCCCC8888888888888887CCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC77CC8 + 8888888888888888888888887CCCCC000000CCCCC88887C7CCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCC777888888888888888887CCCCC000000CCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC7888888888887CCCCC00 + 0000CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CC777888CCCCCC000000CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCCC + CCCCCCCCCCCCCCCCCCCCCCCCCCCCCC000000} + Proportional = True + Visible = False + end object ButtonAppliquerEtFermer: TButton Left = 384 Top = 440 @@ -1568,7 +1769,7 @@ object FormConfig: TFormConfig Top = 8 Width = 585 Height = 417 - ActivePage = TabSheet3 + ActivePage = TabSheetAig Font.Charset = DEFAULT_CHARSET Font.Color = clBackground Font.Height = -11 @@ -1576,6 +1777,7 @@ object FormConfig: TFormConfig Font.Style = [] ParentFont = False TabOrder = 2 + OnChange = PageControlChange object TabSheetCDM: TTabSheet Caption = 'CDM Rail' object GroupBox1: TGroupBox @@ -2105,7 +2307,7 @@ object FormConfig: TFormConfig end end end - object TabSheet1: TTabSheet + object TabSheetAig: TTabSheet Caption = 'Aiguillages' ImageIndex = 2 object Label12: TLabel @@ -2117,32 +2319,20 @@ object FormConfig: TFormConfig 'Liste de mod'#233'lisation des aiguillages du fichier config.cfg - cl' + 'iquez sur une ligne pour afficher la description de l'#39'aiguillage' end - object MemoAig: TMemo - Left = 0 - Top = 24 - Width = 273 - Height = 361 - Color = clInfoText - Font.Charset = DEFAULT_CHARSET - Font.Color = clAqua - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - HideSelection = False - ParentFont = False - ReadOnly = True - ScrollBars = ssVertical - TabOrder = 0 - OnClick = MemoAigClick - OnDblClick = MemoAigDblClick + object Label28: TLabel + Left = 88 + Top = 208 + Width = 52 + Height = 13 + Caption = 'LabelTJD1' end object GroupBox11: TGroupBox Left = 280 Top = 32 Width = 289 - Height = 233 + Height = 265 Caption = 'Description de l'#39'aiguillage' - TabOrder = 1 + TabOrder = 0 object LabelAdresse: TLabel Left = 37 Top = 20 @@ -2219,7 +2409,7 @@ object FormConfig: TFormConfig Top = 142 Width = 9 Height = 16 - Caption = 'P' + Caption = 'D' Font.Charset = ANSI_CHARSET Font.Color = clBlack Font.Height = -13 @@ -2240,6 +2430,20 @@ object FormConfig: TFormConfig Font.Style = [fsBold] ParentFont = False end + object LabelTJD1: TLabel + Left = 112 + Top = 208 + Width = 28 + Height = 13 + Caption = 'LabelTJD1' + end + object LabelTJD2: TLabel + Left = 168 + Top = 208 + Width = 28 + Height = 13 + Caption = 'LabelTJD1' + end object GroupBox10: TGroupBox Left = 40 Top = 64 @@ -2254,6 +2458,7 @@ object FormConfig: TFormConfig Height = 17 Caption = 'sans' TabOrder = 0 + OnClick = RadioButtonsansClick end object RadioButton30kmh: TRadioButton Left = 24 @@ -2262,6 +2467,7 @@ object FormConfig: TFormConfig Height = 17 Caption = '30 km/h' TabOrder = 1 + OnClick = RadioButton30kmhClick end object RadioButton60kmh: TRadioButton Left = 24 @@ -2270,6 +2476,7 @@ object FormConfig: TFormConfig Height = 17 Caption = '60 km/h' TabOrder = 2 + OnClick = RadioButton60kmhClick end end object EditDroit_BD: TEdit @@ -2279,6 +2486,7 @@ object FormConfig: TFormConfig Height = 21 TabOrder = 1 Text = 'EditDroit_BD' + OnChange = EditDroit_BDChange end object EditDevie_HD: TEdit Left = 240 @@ -2287,6 +2495,7 @@ object FormConfig: TFormConfig Height = 21 TabOrder = 2 Text = 'EditDevie_HD' + OnChange = EditDevie_HDChange end object EditPointe_BG: TEdit Left = 32 @@ -2295,22 +2504,23 @@ object FormConfig: TFormConfig Height = 21 TabOrder = 3 Text = 'EditPointe_BG' + OnChange = EditPointe_BGChange end object EditP1: TEdit - Left = 88 - Top = 204 - Width = 41 + Left = 112 + Top = 148 + Width = 33 Height = 21 TabOrder = 4 - Text = 'EditPointe' + Text = 'EditDDroit' end object EditP2: TEdit - Left = 144 - Top = 204 - Width = 41 + Left = 112 + Top = 172 + Width = 33 Height = 21 TabOrder = 5 - Text = 'EditPointe' + Text = 'EditDdevie' end object EditDevieS2: TEdit Left = 240 @@ -2319,18 +2529,56 @@ object FormConfig: TFormConfig Height = 21 TabOrder = 6 Text = 'EditDevie_HD' + OnChange = EditDevieS2Change + end + object CheckInverse: TCheckBox + Left = 40 + Top = 232 + Width = 185 + Height = 17 + Caption = 'Inversion de l'#39#233'tat CDM' + TabOrder = 7 end end object Edit_HG: TEdit - Left = 296 + Left = 312 Top = 172 Width = 41 Height = 21 - TabOrder = 2 + TabOrder = 1 Text = 'EditPointe' end + object RichAig: TRichEdit + Left = 0 + Top = 32 + Width = 265 + Height = 337 + Color = clBlack + Lines.Strings = ( + 'RichAig') + ReadOnly = True + ScrollBars = ssVertical + TabOrder = 2 + OnMouseDown = RichAigMouseDown + end + object EditP3: TEdit + Left = 432 + Top = 180 + Width = 33 + Height = 21 + TabOrder = 3 + Text = 'EditDDroit' + end + object EditP4: TEdit + Left = 432 + Top = 204 + Width = 33 + Height = 21 + TabOrder = 4 + Text = 'EditDDroit' + end end - object TabSheet2: TTabSheet + object TabSheetBranches: TTabSheet Caption = 'Branches' ImageIndex = 3 object Label14: TLabel @@ -2358,7 +2606,7 @@ object FormConfig: TFormConfig WordWrap = False end end - object TabSheet3: TTabSheet + object TabSheetSig: TTabSheet Caption = 'Signaux' ImageIndex = 4 object Label15: TLabel @@ -2370,31 +2618,13 @@ object FormConfig: TFormConfig 'Liste de mod'#233'lisation des signaux du fichier config.cfg - clique' + 'z sur une ligne pour afficher la description du signal' end - object MemoSignaux: TMemo - Left = 0 - Top = 24 - Width = 289 - Height = 361 - Color = clInfoText - Font.Charset = DEFAULT_CHARSET - Font.Color = clAqua - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - ParentFont = False - ReadOnly = True - ScrollBars = ssBoth - TabOrder = 0 - WordWrap = False - OnClick = MemoSignauxClick - end object GroupBox12: TGroupBox - Left = 304 + Left = 288 Top = 40 - Width = 257 + Width = 281 Height = 313 Caption = 'Description du signal' - TabOrder = 1 + TabOrder = 0 object ImageSignal: TImage Left = 8 Top = 72 @@ -2416,51 +2646,194 @@ object FormConfig: TFormConfig end object LabelDec: TLabel Left = 80 - Top = 72 + Top = 52 Width = 53 Height = 13 Caption = 'D'#233'codeur: ' end object LabelDetAss: TLabel Left = 80 - Top = 88 + Top = 72 Width = 86 Height = 13 Caption = 'D'#233'tecteur associ'#233 end object LabelElSuiv: TLabel - Left = 80 - Top = 104 + Left = 176 + Top = 72 Width = 75 Height = 13 Caption = 'Element suivant' end - object LabelVerrou: TLabel - Left = 80 - Top = 120 - Width = 105 - Height = 13 - Caption = 'Verrouillable au carr'#233' :' - end object Label17: TLabel - Left = 80 - Top = 144 + Left = 8 + Top = 216 Width = 131 Height = 26 Caption = 'Conditions suppl'#233'mentaires d'#39'affichage du carr'#233' :' WordWrap = True end + object Label24: TLabel + Left = 104 + Top = 88 + Width = 8 + Height = 13 + Caption = '1' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBackground + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object Label25: TLabel + Left = 104 + Top = 112 + Width = 8 + Height = 13 + Caption = '2' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBackground + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object Label26: TLabel + Left = 104 + Top = 136 + Width = 8 + Height = 13 + Caption = '3' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBackground + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end + object Label27: TLabel + Left = 104 + Top = 160 + Width = 8 + Height = 13 + Caption = '4' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBackground + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [fsBold] + ParentFont = False + end object MemoCarre: TMemo Left = 8 - Top = 184 + Top = 248 Width = 241 - Height = 97 + Height = 49 ReadOnly = True + ScrollBars = ssVertical TabOrder = 0 end + object ComboBoxDec: TComboBox + Left = 136 + Top = 48 + Width = 129 + Height = 21 + ItemHeight = 13 + TabOrder = 1 + OnChange = ComboBoxDecChange + end + object EditDet1: TEdit + Left = 120 + Top = 88 + Width = 41 + Height = 21 + TabOrder = 2 + Text = 'EditDet1' + OnChange = EditDet1Change + end + object EditSuiv1: TEdit + Left = 184 + Top = 88 + Width = 41 + Height = 21 + TabOrder = 3 + Text = 'EditSuiv1' + OnChange = EditSuiv1Change + end + object EditDet2: TEdit + Left = 120 + Top = 112 + Width = 41 + Height = 21 + TabOrder = 4 + Text = 'Edit1' + end + object EditSuiv2: TEdit + Left = 184 + Top = 112 + Width = 41 + Height = 21 + TabOrder = 5 + Text = 'Edit2' + end + object EditDet3: TEdit + Left = 120 + Top = 136 + Width = 41 + Height = 21 + TabOrder = 6 + Text = 'Edit1' + end + object EditSuiv3: TEdit + Left = 184 + Top = 136 + Width = 41 + Height = 21 + TabOrder = 7 + Text = 'Edit2' + end + object EditDet4: TEdit + Left = 120 + Top = 160 + Width = 41 + Height = 21 + TabOrder = 8 + Text = 'Edit1' + end + object EditSuiv4: TEdit + Left = 184 + Top = 160 + Width = 41 + Height = 21 + TabOrder = 9 + Text = 'Edit2' + end + object CheckVerrouCarre: TCheckBox + Left = 112 + Top = 192 + Width = 145 + Height = 17 + Caption = 'Verrouillable au carr'#233 + TabOrder = 10 + OnClick = CheckVerrouCarreClick + end + end + object RichSig: TRichEdit + Left = 0 + Top = 32 + Width = 273 + Height = 345 + Color = clBlack + Lines.Strings = ( + 'RichSig') + ScrollBars = ssBoth + TabOrder = 1 + WordWrap = False + OnMouseDown = RichSigMouseDown end end - object TabSheet4: TTabSheet + object TabSheetAct: TTabSheet Caption = 'Actionneurs' ImageIndex = 5 object Label16: TLabel diff --git a/UnitConfig.pas b/UnitConfig.pas index fda20f2..99b95e1 100644 --- a/UnitConfig.pas +++ b/UnitConfig.pas @@ -68,16 +68,14 @@ type Label6: TLabel; Label9: TLabel; Label11: TLabel; - TabSheet1: TTabSheet; - MemoAig: TMemo; + TabSheetAig: TTabSheet; Label12: TLabel; - TabSheet2: TTabSheet; + TabSheetBranches: TTabSheet; Label14: TLabel; MemoBranches: TMemo; - TabSheet3: TTabSheet; - MemoSignaux: TMemo; + TabSheetSig: TTabSheet; Label15: TLabel; - TabSheet4: TTabSheet; + TabSheetAct: TTabSheet; Label16: TLabel; MemoAct: TMemo; CheckBoxSrvSig: TCheckBox; @@ -118,7 +116,6 @@ type LabelDetAss: TLabel; LabelElSuiv: TLabel; Label19: TLabel; - LabelVerrou: TLabel; GroupBox14: TGroupBox; RadioButtonLoc: TRadioButton; RadioButtonPN: TRadioButton; @@ -156,14 +153,51 @@ type Label10: TLabel; Label17: TLabel; MemoCarre: TMemo; + RichAig: TRichEdit; + ComboBoxDec: TComboBox; + RichSig: TRichEdit; + EditDet1: TEdit; + EditSuiv1: TEdit; + Label24: TLabel; + Label25: TLabel; + EditDet2: TEdit; + EditSuiv2: TEdit; + Label26: TLabel; + EditDet3: TEdit; + EditSuiv3: TEdit; + Label27: TLabel; + EditDet4: TEdit; + EditSuiv4: TEdit; + CheckVerrouCarre: TCheckBox; + Image2: TImage; + LabelTJD1: TLabel; + EditP3: TEdit; + EditP4: TEdit; + Label28: TLabel; + LabelTJD2: TLabel; + CheckInverse: TCheckBox; procedure ButtonAppliquerEtFermerClick(Sender: TObject); procedure Button2Click(Sender: TObject); procedure FormActivate(Sender: TObject); procedure FormCreate(Sender: TObject); - procedure MemoAigDblClick(Sender: TObject); - procedure MemoAigClick(Sender: TObject); procedure MemoSignauxClick(Sender: TObject); procedure MemoActClick(Sender: TObject); + procedure PageControlChange(Sender: TObject); + procedure RichAigMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure EditPointe_BGChange(Sender: TObject); + procedure EditDevie_HDChange(Sender: TObject); + procedure EditDroit_BDChange(Sender: TObject); + procedure EditDevieS2Change(Sender: TObject); + procedure RadioButtonsansClick(Sender: TObject); + procedure RadioButton30kmhClick(Sender: TObject); + procedure RadioButton60kmhClick(Sender: TObject); + procedure ComboBoxDecChange(Sender: TObject); + procedure RichSigMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure EditDet1Change(Sender: TObject); + procedure EditSuiv1Change(Sender: TObject); + procedure CheckVerrouCarreClick(Sender: TObject); private { Déclarations privées } public @@ -177,13 +211,15 @@ TitreAig='Description de l''aiguillage '; var FormConfig: TFormConfig; AdresseIPCDM,AdresseIP,PortCom,recuCDM : string; - portCDM,TempoOctet,TimoutMaxInterface,Valeur_entete,Port,protocole,NumPort : integer; + portCDM,TempoOctet,TimoutMaxInterface,Valeur_entete,Port,protocole,NumPort, + LigneCliquee,AncLigneCliquee : integer; + clicliste : boolean; function config_com(s : string) : boolean; function envoi_CDM(s : string) : boolean; procedure connecte_CDM; function place_id(s : string) : string; -procedure decodeAig(s : string;var adr : integer;var B : char;var bis : boolean); +procedure decodeAig(s : string;var adr : integer;var B : char); implementation @@ -326,7 +362,7 @@ begin ipOK:=true; end; -// vérifie si ma config de la com série/usb est ok +// vérifie si la config de la com série/usb est ok function config_com(s : string) : boolean; var sa : string; j,i,erreur : integer; @@ -365,6 +401,125 @@ begin config_com:=not( (copy(sa,1,3)<>'COM') or (NumPort>9) or (protocole=-1) or (protocole>4) or (i=0) ); end; + +// transforme l'aiguillage du tableau en texte +function encode_aig(i : integer): string; +var s : string; + c : char; + tjd : boolean; +begin + s:=IntToSTR(i); + tjd:=aiguillage[i].modele=2; + if tjd then s:=s+'TJD'; + if aiguillage[i].modele=3 then s:=s+'TJS'; + if aiguillage[i].modele=4 then begin s:=s+'TRI,';s:=s+intToSTR(aiguillage[i].AdrTriple);end; + s:=s+','; + if not(tjd) then + begin + // P + s:=s+'P';s:=s+intToSTR(aiguillage[i].Apointe); + c:=aiguillage[i].APointeB ; + if c<>'Z' then s:=s+c; + // D + s:=s+',D';s:=s+intToSTR(aiguillage[i].Adroit); + c:=aiguillage[i].ADroitB ; + if c<>'Z' then s:=s+c; + // S + s:=s+',S';s:=s+intToSTR(aiguillage[i].Adevie); + c:=aiguillage[i].AdevieB ; + if c<>'Z' then s:=s+c; + // S2 aiguillage triple + if aiguillage[i].modele=4 then + begin + s:=s+',S2-'; + s:=s+intToSTR(aiguillage[i].Adevie2); + c:=aiguillage[i].Adevie2B ; + if c<>'Z' then s:=s+c; + end; + // vitesse de franchissement + if aiguillage[i].vitesse=30 then s:=s+',30'; + if aiguillage[i].vitesse=60 then s:=s+',60'; + end + + else + // tjd + begin + s:=s+'D('+intToSTR(aiguillage[i].Adroit); + c:=aiguillage[i].AdroitB;if c<>'Z' then s:=s+c; + s:=s+','+intToSTR(aiguillage[i].DDroit)+aiguillage[i].DDroitB+'),'; + s:=s+'S('+intToSTR(aiguillage[i].Adevie); + c:=aiguillage[i].AdevieB;if c<>'Z' then s:=s+c; + s:=s+','+intToSTR(aiguillage[i].DDevie)+aiguillage[i].DDevieB+'),'; + s:=s+'I'+IntToSTR(aiguillage[i].InversionCDM); + end; + + encode_aig:=s; +end; + +function TypeEl_to_char(i : integer) : string; +begin + case i of // 1=détecteur 2=aig ou TJD ou TJS 4=tri + 1 : TypeEl_to_char:=''; + 2,3,4 : TypeEl_to_char:='A'; + end; + +end; + +// transforme le signal du tableau en texte +function encode_sig(i : integer): string; +var s : string; + c : char; + adresse,aspect,j,k,NfeuxDir : integer; +begin + // adresse + adresse:=feux[i].adresse; + if adresse=0 then begin encode_sig:='';exit;end; + + s:=IntToSTR(adresse)+','; + // forme - D=directionnel ajouter 10 + aspect:=feux[i].aspect; + if aspect<10 then s:=s+IntToSTR(aspect)+',' else s:=s+'D'+intToSTR(aspect-10)+','; + + // bouton feu blanc + if feux[i].feublanc then s:=s+'1,' else s:=s+'0,'; + + // décodeur + s:=s+IntToSTR(feux[i].decodeur)+','; + + // detecteur et élement suivant (4 maxi) + if aspect<10 then + begin + s:=s+'('+IntToSTR(feux[i].Adr_det1)+','+TypeEl_To_char(feux[i].Btype_suiv1)+IntToSTR(feux[i].Adr_el_suiv1); + j:=feux[i].Adr_det2; + if j<>0 then s:=s+','+IntToSTR(feux[i].Adr_det2)+','+TypeEl_To_char(feux[i].Btype_suiv2)+IntToSTR(feux[i].Adr_el_suiv2); + j:=feux[i].Adr_det3; + if j<>0 then s:=s+','+IntToSTR(feux[i].Adr_det3)+','+TypeEl_To_char(feux[i].Btype_suiv3)+IntToSTR(feux[i].Adr_el_suiv3); + j:=feux[i].Adr_det4; + if j<>0 then s:=s+','+IntToSTR(feux[i].Adr_det4)+','+TypeEl_To_char(feux[i].Btype_suiv4)+IntToSTR(feux[i].Adr_el_suiv4); + s:=s+'),'; + end + else + // feux directionels + begin + NfeuxDir:=aspect-10; + for j:=1 to NfeuxDir+1 do + begin + s:=s+'('; + for k:=1 to Length(feux[i].AigDirection[j])-1 do + begin + s:=s+'A'+IntToSTR(feux[i].AigDirection[j][k].adresse) + feux[i].AigDirection[j][k].posaig; + if k'0' then repeat readln(fichier,s); - writeln(fichierN,s); continue:=s[1]<>'0'; until not(continue); + writeln(fichierN,'0'); + copie_commentaire; writeln(fichierN,s); @@ -556,6 +724,7 @@ var i,erreur : integer; s : string; ChangeCDM,changeInterface,changeUSB,change_srv : boolean; begin + // Vérification de la configuration------------------------------------------- // contrôle adresse IP CDM s:=EditAdrIPCDM.text; if not(IpOk(s)) then begin labelInfo.Caption:='Adresse IP CDM rail incorrecte';exit;end; @@ -681,18 +850,26 @@ begin labelHG.Visible:=false; EditP1.Visible:=false; EditP2.Visible:=false; + EditP3.Visible:=false; + EditP4.Visible:=false; + CheckInverse.Visible:=false; + LabelTJD1.Visible:=false; + LabelTJD2.Visible:=false; EditDevieS2.Visible:=false; Label18.Visible:=false; GroupBoxPN.Visible:=false; GroupBoxAct.Visible:=false; - Edit_HG.ReadOnly:=true; + EditP1.ReadOnly:=true; EditP2.ReadOnly:=true; - EditPointe_BG.ReadOnly:=true; - EditDevie_HD.ReadOnly:=true; - EditDroit_BD.ReadOnly:=true; + EditP3.ReadOnly:=true; + EditP4.ReadOnly:=true; + EditPointe_BG.ReadOnly:=false; + EditDevie_HD.ReadOnly:=false; + EditDroit_BD.ReadOnly:=false; + Edit_HG.ReadOnly:=false; EditAdrIPCDM.text:=adresseIPCDM; @@ -740,65 +917,128 @@ begin EditDroit_BD.Text:=''; EditPointe_BG.Text:=''; - EditDevie_HD.Text:=''; - - + EditDevie_HD.Text:=''; end; - procedure TFormConfig.FormCreate(Sender: TObject); var i : integer; +s : string; +couleur : Tcolor; begin + AncLigneCliquee:=-1; // remplit les 4 fenêtres de config des aiguillages branches signaux, actionneurs + + // aiguillages + RichAig.Clear; for i:=1 to MaxAiguillage do - MemoAig.Lines.Add(mod_aiguillages[i]); + begin + if aiguillage[i].modele<>0 then + begin + s:=encode_aig(i); + // Affiche(s,couleur); + RichAig.Lines.Add(s); + RE_ColorLine(RichAig,RichAig.lines.count-1,ClAqua); + Aiguillage[i].modifie:=false; + end; + end; + // branches for i:=1 to NbreBranches do MemoBranches.Lines.Add(mod_Branches[i]); + + // signaux + RichSig.clear; for i:=1 to NbreFeux do - MemoSignaux.Lines.Add(mod_Signaux[i]); + begin + s:=encode_sig(i); + if s<>'' then + begin + //Affiche(s,clyellow); + RichSig.Lines.Add(s); + RE_ColorLine(RichSig,RichSig.lines.count-1,ClAqua); + Feux[i].modifie:=false; + end; + end; + + // actionneurs for i:=1 to maxTablo_act do MemoAct.Lines.Add(mod_Act[i]); PageControl.ActivePage:=TabSheetCDM; // force le premier onglet sur la page + + for i:=1 to NbDecodeur do + begin + ComboBoxDec.items.add(decodeur[i-1]); + end; + EditDet1.Text:='';EditDet2.Text:='';EditDet3.Text:='';EditDet4.Text:=''; + EditSuiv1.Text:='';EditSuiv2.Text:='';EditSuiv3.Text:='';EditSuiv4.Text:=''; end; -procedure decodeAig(s : string;var adr : integer;var B : char;var bis : boolean); +// décode un morceau d'une chaine d'aiguillage ('P5S') +// si erreur, B='?' +procedure decodeAig(s : string;var adr : integer;var B : char); var erreur,i : integer; begin + if s='' then begin B:='?';adr:=0;exit;end; if (s[1]='P') or (s[1]='S') or (s[1]='D') then delete(s,1,1); // supprimer le champ suivant éventuel i:=pos(',',s); if i<>0 then delete(s,i,length(s)-i+1); val(s,adr,erreur); - bis:=pos('B',s)<>0; - B:=#0; - i:=pos('S',s);if i<>0 then B:='S'; - i:=pos('P',s);if i<>0 then B:='P'; - i:=pos('D',s);if i<>0 then B:='D'; + if adr<0 then begin B:='?';adr:=0;exit;end; + if erreur<>0 then + begin + if s[erreur]='S' then begin B:='S';exit;end; + if s[erreur]='P' then begin B:='P';exit;end; + if s[erreur]='D' then begin B:='D';exit;end; + end; + B:='Z'; end; +// procédure appellée quand on clique une ligne aiguillage de RichAig procedure Aff_champs_aig; -var Adresse,Adr2,traite,erreur,ligne,i,j,Nboucle,selpos : integer; +var Adresse,Adr2,traite,erreur,i,j,Nboucle,selpos,AncAdresse,lc : integer; bis,tjd,tri : boolean; s,ss : string; B : char; begin - with formConfig.MemoAig do + // déterminer la ligne cliquée et mettre en surbrillance + with Formconfig.RichAig do begin - ligne:=Perform(EM_LINEFROMCHAR,-1,0); // numéro de la lignée cliquée - s:=Uppercase(Lines[ligne]); - if s='' then exit; - SelStart:=Perform(EM_LINEINDEX,Ligne,0); // début de la sélection + lc:=Perform(EM_LINEFROMCHAR,-1,0); // numéro de la lignée cliquée + + s:=Uppercase(Lines[lc]); // ligne cliquée + if s='' then exit; + + AncLigneCliquee:=LigneCliquee; + ligneCliquee:=lc; + //Affiche('Ancienne='+IntToSTR(AncLigneCliquee)+' Nouvelle='+IntToSTR(LigneCliquee),clyellow); + + // Mettre en rouge l'aiguillage modifié quand on clique sur un autre aiguillage + if AncLigneCliquee<>-1 then + begin + val(FormConfig.RichAig.Lines[AncLigneCliquee],AncAdresse,erreur); + + if aiguillage[AncAdresse].modifie then RE_ColorLine(Formconfig.RichAig,AncligneCliquee,ClWhite) else + RE_ColorLine(Formconfig.RichAig,AncligneCliquee,ClAqua); + end; + + { + SelStart:=Perform(EM_LINEINDEX,ligneCliquee,0); // début de la sélection SelLength:=Length(s) ; // fin de la sélection SetFocus; + } + end; - Val(s,Adresse,erreur); + Val(s,Adresse,erreur); // Adresse de l'aiguillage if adresse=0 then exit; - ss:=TitreAig+InttoSTr(Adresse);if s[erreur]='B' then ss:=ss+'bis'; + + RE_ColorLine(Formconfig.RichAig,ligneCliquee,Clyellow); + + ss:=TitreAig+InttoSTr(Adresse); formconfig.LabelAdresse.Caption:= ss; - + tjd:=pos('TJD',s)<>0 ; tri:=pos('TRI',s)<>0 ; with formconfig do @@ -811,22 +1051,58 @@ begin if tjd then begin ImageAffiche.Picture.BitMap:=Imagetjd.Picture.Bitmap; + labelBG.Caption:='S'; Edit_HG.Visible:=true; + labelTJD1.Visible:=true; + LabelTJD2.Visible:=true; + Edit_HG.ReadOnly:=true; // en mode TJD, on ne peut pas modifier + EditPointe_BG.ReadOnly:=true; + EditDevie_HD.ReadOnly:=true; + EditDroit_BD.ReadOnly:=true; tjd:=true; labelHG.Visible:=true; EditP1.Visible:=true; EditP2.Visible:=true; + EditP3.Visible:=true; + EditP4.Visible:=true; + CheckInverse.Visible:=true; EditDevieS2.Visible:=false; Label18.Visible:=false; - EditPointe_BG.Text:=intToSTR(aiguillage[adresse].ADevie)+aiguillage[adresse].ADevieB; - Edit_HG.Text:=intToSTR(aiguillage[adresse].ADroit)+aiguillage[adresse].ADroitB; - Adr2:=aiguillage[adresse].Apointe; - EditDevie_HD.Text:=intToSTR(aiguillage[adr2].ADevie)+aiguillage[adr2].ADevieB; - EditDroit_BD.Text:=intToSTR(aiguillage[adr2].ADroit)+aiguillage[adr2].ADroitB; + // champ en bas à gauche + b:=aiguillage[adresse].ADevieB; + if b='Z' then b:=#0; + EditPointe_BG.Text:=intToSTR(aiguillage[adresse].ADevie)+b; - EditP1.Text:=intToSTR(aiguillage[adresse].APointe); - EditP2.Text:=intToSTR(aiguillage[adr2].APointe); + // champ en haut à gauche + b:=aiguillage[adresse].ADroitB; + if b='Z' then b:=#0; + Edit_HG.Text:=intToSTR(aiguillage[adresse].ADroit)+b; + + // milieu haut gauche + EditP1.Text:=intToSTR(aiguillage[adresse].Ddroit)+aiguillage[adresse].DDroitB; + // milieu bas gauche + EditP2.Text:=intToSTR(aiguillage[adresse].DDevie)+aiguillage[adresse].DDevieB; + + adr2:=aiguillage[adresse].DDevie; + // milieu haut droit + EditP3.Text:=intToSTR(aiguillage[adr2].DDevie)+aiguillage[adr2].DDevieB; + // milieu bas droit + EditP4.Text:=intToSTR(aiguillage[adr2].Ddroit)+aiguillage[adr2].DDroitB; + + // droit haut + EditDevie_HD.Text:=intToSTR(aiguillage[adr2].Adevie)+aiguillage[adr2].AdevieB; + LabelTJD1.Caption:=IntToSTR(adresse); + + // droit bas + EditDroit_BD.Text:=intToSTR(aiguillage[adr2].Ddevie)+aiguillage[adr2].DdevieB; + LabelTJD2.Caption:=IntToSTR(adr2); + + CheckInverse.checked:=aiguillage[adresse].inversionCDM=1; + + if aiguillage[adresse].vitesse=0 then begin RadioButtonSans.checked:=true;RadioButton30kmh.checked:=false;RadioButton60kmh.checked:=false;end; + if aiguillage[adresse].vitesse=30 then begin RadioButtonSans.checked:=false;RadioButton30kmh.checked:=true;RadioButton60kmh.checked:=false;end; + if aiguillage[adresse].vitesse=60 then begin RadioButtonSans.checked:=false;RadioButton30kmh.checked:=false;RadioButton60kmh.checked:=true;end; exit; end else @@ -834,38 +1110,48 @@ begin if tri then begin tri:=true; + labelTJD1.Visible:=false; + LabelTJD2.Visible:=false; + EditPointe_BG.ReadOnly:=false; + labelBG.Caption:='P'; i:=pos(',',s);delete(s,1,i); ImageAffiche.Picture.BitMap:=ImageTri.Picture.Bitmap; EditDevieS2.Visible:=true; Label18.Visible:=true; - Val(s,Adr2,erreur); + Val(s,Adr2,erreur); formconfig.LabelAdresse.Caption:=formconfig.LabelAdresse.Caption+','+IntToSTR(Adr2); end else // aiguillage normal begin - ImageAffiche.Picture.BitMap:=Imageaig.Picture.Bitmap; + ImageAffiche.Picture.BitMap:=Imageaig.Picture.Bitmap; + labelBG.Caption:='P'; + EditPointe_BG.ReadOnly:=false; Edit_HG.Visible:=false; labelHG.Visible:=false; EditP1.Visible:=false; EditP2.Visible:=false; + EditP3.Visible:=false; + EditP4.Visible:=false; + CheckInverse.Visible:=false; + labelTJD1.Visible:=false; + LabelTJD2.Visible:=false; EditDevieS2.Visible:=false; Label18.Visible:=false; tjd:=false; end; end; // affiche(s,clOrange); - + i:=pos(',',s);Delete(s,1,i); traite:=0;nBoucle:=0; if not(tjd) then - repeat + repeat if s<>'' then if s[1]='P' then begin - decodeAig(s,adresse,B,bis); + decodeAig(s,adresse,B); ss:=intToSTR(Adresse); - if bis then ss:=ss+'B'; formconfig.EditPointe_BG.Text:=ss+B; i:=pos(',',s);if i=0 then i:=length(s)+1; Delete(s,1,i); @@ -874,9 +1160,8 @@ begin if s<>'' then if s[1]='S' then begin - decodeAig(s,adresse,B,bis); + decodeAig(s,adresse,B); ss:=intToSTR(Adresse); - if bis then ss:=ss+'B'; formconfig.EditDevie_HD.Text:=ss+B; i:=pos(',',s);if i=0 then i:=length(s)+1; Delete(s,1,i); @@ -885,9 +1170,8 @@ begin if s<>'' then if s[1]='D' then begin - decodeAig(s,adresse,B,bis); + decodeAig(s,adresse,B); ss:=intToSTR(Adresse); - if bis then ss:=ss+'B'; formconfig.EditDroit_BD.Text:=ss+B; i:=pos(',',s);if i=0 then i:=length(s)+1; Delete(s,1,i); @@ -907,21 +1191,21 @@ begin end; end; - if s='' then + if s='' then with formconfig do begin RadioButtonsans.Checked:=true; RadioButton30kmh.Checked:=false; RadioButton60kmh.Checked:=false; end; - if s='30' then + if s='30' then with formconfig do begin RadioButtonsans.Checked:=false; RadioButton30kmh.Checked:=true; RadioButton60kmh.Checked:=false; end; - if s='60' then + if s='60' then with formconfig do begin RadioButtonsans.Checked:=false; @@ -930,22 +1214,40 @@ begin end; end; +// appellée quand on clique sur la liste signaux Procedure aff_champs_sig; -var i,d,l,k, ligne, adresse,erreur,condCarre : integer; - s,ss : string; +var i,j,l,d,k, ligne,lc, adresse,erreur,condCarre,AncAdresse : integer; + s,ss,s2 : string; begin - with formConfig.MemoSignaux do +// déterminer la ligne cliquée et mettre en surbrillance + with Formconfig.RichSig do begin - ligne:=Perform(EM_LINEFROMCHAR,-1,0); // numéro de la lignée cliquée - s:=Uppercase(Lines[ligne]); - if s='' then exit; - SelStart:=Perform(EM_LINEINDEX,Ligne,0); // début de la sélection - SelLength:=Length(s) ; // fin de la sélection - SetFocus; + lc:=Perform(EM_LINEFROMCHAR,-1,0); // numéro de la lignée cliquée + + s:=Uppercase(Lines[lc]); // ligne cliquée + if s='' then exit; + + AncLigneCliquee:=LigneCliquee; + ligneCliquee:=lc; + //Affiche('Ancienne='+IntToSTR(AncLigneCliquee)+' Nouvelle='+IntToSTR(LigneCliquee),clyellow); + + // Mettre en rouge le signal modifié quand on clique sur un autre aiguillage + if AncLigneCliquee<>-1 then + begin + val(FormConfig.RichSig.Lines[AncLigneCliquee],AncAdresse,erreur); + + if feux[lignecliquee+1].modifie then RE_ColorLine(Formconfig.RichSig,AncligneCliquee,ClWhite) else + RE_ColorLine(Formconfig.RichSig,AncligneCliquee,ClAqua); + end; + end; - - Val(s,Adresse,erreur); + + + Val(s,Adresse,erreur); // Adresse du signal if adresse=0 then exit; + + RE_ColorLine(Formconfig.RichSig,ligneCliquee,Clyellow); + ss:='Signal '+InttoSTr(Adresse); formconfig.LabelAdrSig.Caption:= ss; i:=Index_feu(adresse); @@ -955,48 +1257,75 @@ begin Picture.Bitmap.TransparentColor:=clblue; Transparent:=true; Picture.BitMap:=feux[i].Img.Picture.Bitmap; - end; + end; with formconfig do begin - d:=feux[i].decodeur; - LabelDec.caption:='Décodeur associé : '+decodeur[d]; + MemoCarre.Lines.Clear; + EditDet2.Text:=''; EditSuiv2.Text:=''; + EditDet3.Text:=''; EditSuiv3.Text:=''; + EditDet4.Text:=''; EditSuiv4.Text:=''; + ComboBoxDec.ItemIndex:=feux[i].decodeur; d:=feux[i].aspect; - // signal directionnel - if d<10 then + // signal normal + if d<10 then begin - LabelDetAss.caption:='Détecteur associé : '+IntToSTR(feux[i].Adr_det1); - LabelElSuiv.caption:='Element suivant : '+IntToSTR(feux[i].Adr_el_suiv1); - s:='Verrouillable au carré : '; if feux[i].VerrouCarre then s:=s+'oui' else s:=s+'non'; - LabelVerrou.caption:=s; - end - else - begin - LabelDetAss.caption:=''; - LabelElSuiv.caption:=''; - LabelVerrou.caption:=''; - end; - end; + LabelDetAss.visible:=true; + LabelElSuiv.visible:=true; + EditDet1.Text:=IntToSTR(feux[i].Adr_det1); + EditSuiv1.Text:=TypeEl_To_char(feux[i].Btype_suiv1)+IntToSTR(feux[i].Adr_el_suiv1); + j:=feux[i].Adr_det2; + if j<>0 then + begin + Editdet2.Text:=IntToSTR(j);EditSuiv2.Text:=TypeEl_To_char(feux[i].Btype_suiv2)+IntToSTR(feux[i].Adr_el_suiv2); + end else begin EditDet2.Text:='';EditSuiv2.Text:='';end; + j:=feux[i].Adr_det3; + if j<>0 then + begin + EditDet3.Text:=IntToSTR(j);EditSuiv3.Text:=TypeEl_To_char(feux[i].Btype_suiv3)+IntToSTR(feux[i].Adr_el_suiv3); + end + else begin EditDet3.Text:='';EditSuiv3.Text:='';end; + j:=feux[i].Adr_det4; + if j<>0 then + begin + EditDet4.Text:=IntToSTR(j);EditSuiv4.Text:=TypeEl_To_char(feux[i].Btype_suiv4)+IntToSTR(feux[i].Adr_el_suiv4); + end + else begin EditDet4.Text:='';EditSuiv4.Text:='';end; - // conditions de carré - formConfig.MemoCarre.Lines.clear; - CondCarre:=Length(feux[i].condcarre[1]); - + checkVerrouCarre.Checked:=feux[i].VerrouCarre; + + // conditions supplémentaires + CondCarre:=Length(feux[i].condcarre[1]); l:=1; + while condCarre<>0 do begin if condcarre<>0 then dec(condcarre); - ss:=''; + s2:=''; for k:=1 to condCarre do begin - ss:=ss+'A'+IntToSTR(feux[i].condcarre[l][k].Adresse); - if feux[i].condcarre[l][k].PosAig='S' then ss:=ss+' dévié ' else ss:=ss+' droit '; - if k0 then formConfig.MemoCarre.Lines.add('ou'); end; + + end + else + begin // directionnel + EditDet1.Text:='';EditSuiv1.Text:=''; + EditDet2.Text:='';EditSuiv2.Text:=''; + EditDet3.Text:='';EditSuiv3.Text:=''; + EditDet4.Text:='';EditSuiv4.Text:=''; + LabelDetAss.visible:=false; + LabelElSuiv.visible:=false; + end; + end; + + end; @@ -1089,7 +1418,7 @@ begin GroupBoxPN.Visible:=false; formconfig.RadioButtonPN.Checked:=false; formconfig.RadioButtonLoc.Checked:=true; - end; + end; // trouver l'index dans le tableau val(s,adresse,erreur); i:=0; @@ -1118,15 +1447,7 @@ begin ss:='Actionneur '+InttoSTr(Adresse); end; -procedure TFormConfig.MemoAigDblClick(Sender: TObject); -begin - Aff_champs_aig; -end; -procedure TFormConfig.MemoAigClick(Sender: TObject); -begin - Aff_champs_aig -end; procedure TFormConfig.MemoSignauxClick(Sender: TObject); begin @@ -1138,8 +1459,378 @@ begin Aff_champs_act; end; +procedure TFormConfig.PageControlChange(Sender: TObject); +begin + if PageControl.ActivePage=TabSheetAig then + begin + end; +end; +// cliqué sur liste aiguillages +procedure TFormConfig.RichAigMouseDown(Sender: TObject;Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + clicliste:=true; + LabelInfo.caption:=''; + Aff_champs_aig; + clicliste:=false; +end; + +// on change la valeur de la description de la pointe de l'aiguillage +procedure change_Pointe; +var AdrAig,adr,erreur : integer; + b : char; + s : string; +begin + // cliqué sur le edit pointe aiguillage + // ne pas traiter si on a cliqué sur la liste + if clicliste then exit; + + if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAig then + with Formconfig do + begin + s:=formconfig.RichAig.Lines[lignecliquee]; + + Val(s,adrAig,erreur); + //vérifier la syntaxe de P + s:=Editpointe_BG.text; + decodeAig(s,adr,B); + if ((B='S') or (B='P') or (B='D') or (B=#0)) and (s<>'') then + begin + // RichAig.SelStart:=Perform(EM_LINEINDEX,ligneCliquee,0); // début de la sélection + // RichAig.SelLength:=Length(s) ; // fin de la sélection + //SetFocus; + RE_ColorLine(RichAig,ligneCliquee,ClWhite); + Aiguillage[AdrAig].modifie:=true; + LabelInfo.caption:=''; + // modifier la base de données de l'aiguillage + if b=#0 then b:='Z'; + + Aiguillage[AdrAig].APointe:=adr; + Aiguillage[AdrAig].APointeB:=B; + // réencoder la ligne + s:=encode_aig(AdrAig); + + formconfig.RichAig.Lines[lignecliquee]:=s; + labelLigne.Caption:=s; + end + else + LabelInfo.caption:='Erreur pointe aiguillage '+intToSTR(AdrAig); + end; +end; + +// on change la valeur de la description de la déviation de l'aiguillage +procedure change_Devie; +var AdrAig,adr,erreur : integer; + b : char; + tjd : boolean; + s : string; +begin + // cliqué sur le edit dévié aiguillage + // ne pas traiter si on a cliqué sur la liste + if clicliste then exit; + + if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAig then + with Formconfig do + begin + s:=formconfig.RichAig.Lines[lignecliquee]; + Val(s,adrAig,erreur); + //vérifier la syntaxe de P + s:=EditDevie_HD.text; + decodeAig(s,adr,B); + + + if ((B='S') or (B='P') or (B='D') or (B=#0)) and (s<>'') then + begin + // RichAig.SelStart:=Perform(EM_LINEINDEX,ligneCliquee,0); // début de la sélection + // RichAig.SelLength:=Length(s) ; // fin de la sélection + //SetFocus; + tjd:=pos('TJD',s)<>0; + if tjd then + begin + val(EditP1.Text,AdrAig,erreur); // adresse de pointe de la tjd = adresse à utiliser + end; + + + RE_ColorLine(RichAig,ligneCliquee,ClWhite); + Aiguillage[AdrAig].modifie:=true; + LabelInfo.caption:=''; + // modifier la base de données de l'aiguillage + if b=#0 then b:='Z'; + Aiguillage[AdrAig].ADevie:=adr; + Aiguillage[AdrAig].ADevieB:=B; + // réencoder la ligne + s:=encode_aig(AdrAig); + formconfig.RichAig.Lines[lignecliquee]:=s; + labelLigne.Caption:=s; + end + else + begin + LabelInfo.caption:='Erreur déviation aiguillage '+intToSTR(AdrAig); + end; + end; +end; + +// on change la valeur de la description du droit de l'aiguillage +procedure change_Droit; +var AdrAig,adr,erreur : integer; + b : char; + tjd : boolean; + s : string; +begin + // cliqué sur le edit droit aiguillage + // ne pas traiter si on a cliqué sur la liste + if clicliste then exit; + + if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAig then + with Formconfig do + begin + s:=formconfig.RichAig.Lines[lignecliquee]; + Val(s,adrAig,erreur); + //vérifier la syntaxe de P + s:=EditDroit_BD.text; + decodeAig(s,adr,B); + + if ((B='S') or (B='P') or (B='D') or (B=#0)) and (s<>'') then + begin + // RichAig.SelStart:=Perform(EM_LINEINDEX,ligneCliquee,0); // début de la sélection + // RichAig.SelLength:=Length(s) ; // fin de la sélection + //SetFocus; + + tjd:=pos('TJD',s)<>0; + if tjd then + begin + val(EditP1.Text,AdrAig,erreur); // adresse de pointe de la tjd = adresse à utiliser + end; + + RE_ColorLine(RichAig,ligneCliquee,ClWhite); + Aiguillage[AdrAig].modifie:=true; + LabelInfo.caption:=''; + // modifier la base de données de l'aiguillage + if b=#0 then b:='Z'; + Aiguillage[AdrAig].ADroit:=adr; + Aiguillage[AdrAig].ADroitB:=B; + // réencoder la ligne + s:=encode_aig(AdrAig); + formconfig.RichAig.Lines[lignecliquee]:=s; + labelLigne.Caption:=s; + end + else + begin + LabelInfo.caption:='Erreur droit aiguillage '+intToSTR(AdrAig); + end; + end; +end; + +procedure change_S2; +var AdrAig,adr,erreur : integer; + b : char; + s : string; +begin + // cliqué sur le edit droit aiguillage + // ne pas traiter si on a cliqué sur la liste + if clicliste then exit; + + if FormConfig.PageControl.ActivePage=FormConfig.TabSheetAig then + with Formconfig do + begin + s:=formconfig.RichAig.Lines[lignecliquee]; + Val(s,adrAig,erreur); + //vérifier la syntaxe de P + s:=EditDevieS2.text; + decodeAig(s,adr,B); + + if ((B='S') or (B='P') or (B='D') or (B=#0)) and (s<>'') then + begin + // RichAig.SelStart:=Perform(EM_LINEINDEX,ligneCliquee,0); // début de la sélection + // RichAig.SelLength:=Length(s) ; // fin de la sélection + //SetFocus; + + RE_ColorLine(RichAig,ligneCliquee,ClWhite); + Aiguillage[AdrAig].modifie:=true; + LabelInfo.caption:=''; + // modifier la base de données de l'aiguillage + if b=#0 then b:='Z'; + Aiguillage[AdrAig].ADevie2:=adr; + Aiguillage[AdrAig].ADevie2B:=B; + // réencoder la ligne + s:=encode_aig(AdrAig); + formconfig.RichAig.Lines[lignecliquee]:=s; + labelLigne.Caption:=s; + end + else + begin + LabelInfo.caption:='Erreur droit aiguillage '+intToSTR(AdrAig); + end; + end; +end; + +procedure change_det1; +var s : string; + i,erreur : integer; +begin + if clicliste then exit; + + if FormConfig.PageControl.ActivePage=FormConfig.TabSheetSig then + with Formconfig do + begin + s:=EditDet1.Text; + Val(s,i,erreur); + if erreur<>0 then begin LabelInfo.caption:='Erreur détecteur1 ';exit;end; + LabelInfo.caption:=' '; + feux[lignecliquee+1].Adr_det1:=i; + s:=encode_sig(lignecliquee+1); + RichSig.Lines[lignecliquee]:=s; + feux[lignecliquee+1].modifie:=true; + end; +end; + +procedure change_Suiv1; +var s : string; + i,erreur : integer; + B : char; +begin + if clicliste then exit; + + if FormConfig.PageControl.ActivePage=FormConfig.TabSheetSig then + with Formconfig do + begin + s:=EditSuiv1.Text; + if s='' then begin LabelInfo.caption:='Erreur élément suivant 1';exit;end; + Val(s,i,erreur); + //if erreur<>0 then + if erreur<>0 then + begin + if (s[erreur]='A') and (erreur=1) then + begin + feux[lignecliquee+1].Btype_suiv1:=2; // type de l'élément suivant (1=détecteur 2=aig ou TJD ou TJS 4=tri + delete(s,erreur,1); + Val(s,i,erreur); + end + else begin LabelInfo.caption:='Erreur élément suivant 1';exit;end; + end + else feux[lignecliquee+1].Btype_suiv1:=1; + + LabelInfo.caption:=' '; + + feux[lignecliquee+1].Adr_el_suiv1:=i; + s:=encode_sig(lignecliquee+1); + RichSig.Lines[lignecliquee]:=s; + end; +end; + + + +procedure TFormConfig.EditPointe_BGChange(Sender: TObject); +begin + change_pointe; +end; + +procedure TFormConfig.EditDevie_HDChange(Sender: TObject); +begin + Change_devie; +end; + +procedure TFormConfig.EditDroit_BDChange(Sender: TObject); +begin + Change_droit; +end; + +procedure TFormConfig.EditDevieS2Change(Sender: TObject); +begin + Change_s2; +end; + +procedure TFormConfig.RadioButtonsansClick(Sender: TObject); +var AdrAig,erreur : integer; + s : string; +begin + s:=formconfig.RichAig.Lines[lignecliquee]; + Val(s,adrAig,erreur); + if AdrAig=0 then exit; + aiguillage[AdrAig].vitesse:=0; + aiguillage[AdrAig].modifie:=true; + s:=encode_aig(AdrAig); + formconfig.RichAig.Lines[lignecliquee]:=s; + labelLigne.Caption:=s; +end; + +procedure TFormConfig.RadioButton30kmhClick(Sender: TObject); +var AdrAig,erreur : integer; + s : string; +begin + s:=formconfig.RichAig.Lines[lignecliquee]; + Val(s,adrAig,erreur); + if AdrAig=0 then exit; + aiguillage[AdrAig].vitesse:=30; + aiguillage[AdrAig].modifie:=true; + s:=encode_aig(AdrAig); + formconfig.RichAig.Lines[lignecliquee]:=s; + labelLigne.Caption:=s; +end; + +procedure TFormConfig.RadioButton60kmhClick(Sender: TObject); +var AdrAig,erreur : integer; + s : string; +begin + s:=formconfig.RichAig.Lines[lignecliquee]; + Val(s,adrAig,erreur); + if AdrAig=0 then exit; + aiguillage[AdrAig].vitesse:=60; + aiguillage[AdrAig].modifie:=true; + s:=encode_aig(AdrAig); + formconfig.RichAig.Lines[lignecliquee]:=s; + labelLigne.Caption:=s; +end; + + + +procedure TFormConfig.ComboBoxDecChange(Sender: TObject); +var s: string; +begin +// Affiche(IntToStr(ComboBoxDec.ItemIndex),clyellow); + feux[lignecliquee+1].decodeur:= ComboBoxDec.ItemIndex; + s:=encode_sig(lignecliquee+1); + formconfig.RichSig.Lines[lignecliquee]:=s; +end; + +// cliqué sur liste feux +procedure TFormConfig.RichSigMouseDown(Sender: TObject;Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +begin + clicliste:=true; + LabelInfo.caption:=''; + Aff_champs_sig; + clicliste:=false; +end; + + + +procedure TFormConfig.EditDet1Change(Sender: TObject); +begin + change_det1; +end; + +procedure TFormConfig.EditSuiv1Change(Sender: TObject); +begin + change_Suiv1; +end; + +procedure TFormConfig.CheckVerrouCarreClick(Sender: TObject); +var s : string; +begin + if clicliste then exit; + + if FormConfig.PageControl.ActivePage=FormConfig.TabSheetSig then + begin + feux[lignecliquee+1].VerrouCarre:=checkVerrouCarre.Checked; + s:=encode_sig(lignecliquee+1); + RichSig.Lines[lignecliquee]:=s; + feux[lignecliquee+1].modifie:=true; + end; +end; end. + + + diff --git a/UnitConfigTCO.dcu b/UnitConfigTCO.dcu index 5beea9a..d52b93e 100644 Binary files a/UnitConfigTCO.dcu and b/UnitConfigTCO.dcu differ diff --git a/UnitDebug.dcu b/UnitDebug.dcu index 8e9ff07..706690d 100644 Binary files a/UnitDebug.dcu and b/UnitDebug.dcu differ diff --git a/UnitDebug.dfm b/UnitDebug.dfm index 8e7de04..0ce9c9e 100644 --- a/UnitDebug.dfm +++ b/UnitDebug.dfm @@ -1,10 +1,9 @@ object FormDebug: TFormDebug - Left = 241 - Top = 150 - BorderStyle = bsSingle + Left = 186 + Top = 143 + Width = 809 + Height = 773 Caption = 'Fen'#234'tre de d'#233'bug' - ClientHeight = 639 - ClientWidth = 789 Color = clWindow TransparentColorValue = clTeal Font.Charset = DEFAULT_CHARSET @@ -16,13 +15,17 @@ object FormDebug: TFormDebug Position = poMainFormCenter OnClose = FormClose OnCreate = FormCreate + DesignSize = ( + 793 + 735) PixelsPerInch = 96 TextHeight = 13 object Label1: TLabel - Left = 616 - Top = 15 + Left = 609 + Top = 7 Width = 108 Height = 13 + Anchors = [akTop, akRight] Caption = 'Niveau du Debug (0-3)' Color = clWhite Font.Charset = DEFAULT_CHARSET @@ -34,10 +37,11 @@ object FormDebug: TFormDebug ParentFont = False end object Label2: TLabel - Left = 448 - Top = 12 + Left = 441 + Top = 4 Width = 131 Height = 18 + Anchors = [akTop, akRight] Caption = 'Fen'#234'tre de d'#233'bug' Font.Charset = ANSI_CHARSET Font.Color = clWindowText @@ -47,10 +51,11 @@ object FormDebug: TFormDebug ParentFont = False end object Label3: TLabel - Left = 448 + Left = 441 Top = 168 Width = 97 Height = 193 + Anchors = [akTop, akRight] AutoSize = False Caption = 'Label3' Color = clGray @@ -64,10 +69,11 @@ object FormDebug: TFormDebug WordWrap = True end object EditNivDebug: TEdit - Left = 728 - Top = 12 + Left = 721 + Top = 4 Width = 49 Height = 21 + Anchors = [akTop, akRight] Font.Charset = DEFAULT_CHARSET Font.Color = clBlue Font.Height = -11 @@ -79,10 +85,11 @@ object FormDebug: TFormDebug OnKeyPress = EditNivDebugKeyPress end object MemoEvtDet: TMemo - Left = 552 + Left = 545 Top = 408 Width = 233 Height = 221 + Anchors = [akTop, akRight] Color = clBlack Font.Charset = ANSI_CHARSET Font.Color = clYellow @@ -97,197 +104,309 @@ object FormDebug: TFormDebug TabOrder = 1 end object ButtonEcrLog: TButton - Left = 448 + Left = 441 Top = 504 Width = 97 Height = 29 + Anchors = [akTop, akRight] Caption = 'Sauvegarder le log' TabOrder = 2 OnClick = ButtonEcrLogClick end object MemoDebug: TMemo Left = 0 - Top = 0 - Width = 433 - Height = 625 + Top = 8 + Width = 426 + Height = 722 + Anchors = [akLeft, akTop, akRight, akBottom] Lines.Strings = ( 'MemoDebug') ScrollBars = ssVertical TabOrder = 3 WordWrap = False end - object CheckAffSig: TCheckBox - Left = 448 - Top = 32 - Width = 297 - Height = 17 - Caption = 'Affichage du fonctionnement des signaux' - Font.Charset = DEFAULT_CHARSET - Font.Color = clBlack - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - ParentFont = False - TabOrder = 4 - OnClick = CheckAffSigClick - end object ButtonRazTampon: TButton - Left = 448 - Top = 576 + Left = 441 + Top = 584 Width = 97 Height = 33 - Caption = 'Raz Tampon Ev'#232'nements' - TabOrder = 5 + Anchors = [akTop, akRight] + Caption = 'Raz Tampon Ev'#232'nements ---->' + TabOrder = 4 WordWrap = True OnClick = ButtonRazTamponClick end object ButtonCherche: TButton - Left = 448 + Left = 441 Top = 464 Width = 97 Height = 33 + Anchors = [akTop, akRight] Caption = 'Chercher erreurs' - TabOrder = 6 + TabOrder = 5 OnClick = ButtonChercheClick end object ButtonAffEvtChrono: TButton - Left = 448 + Left = 441 Top = 424 Width = 97 Height = 33 + Anchors = [akTop, akRight] Caption = 'Affiche Evts d'#233'tecteurs et aig' - TabOrder = 7 + TabOrder = 6 WordWrap = True OnClick = ButtonAffEvtChronoClick end - object CheckBoxTraceLIste: TCheckBox - Left = 448 - Top = 80 - Width = 289 - Height = 17 - Caption = 'Affichage des '#233'valuations des routes' - Font.Charset = DEFAULT_CHARSET - Font.Color = clBlack - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - ParentFont = False - TabOrder = 8 - OnClick = CheckBoxTraceLIsteClick - end - object CheckTrame: TCheckBox - Left = 448 - Top = 96 - Width = 321 - Height = 17 - Caption = 'Affichage des trames '#233'chang'#233'es avec l'#39'interface ou CDM' - Font.Charset = DEFAULT_CHARSET - Font.Color = clBlack - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - ParentFont = False - TabOrder = 9 - OnClick = CheckTrameClick - end object ButtonCop: TButton - Left = 448 + Left = 441 Top = 368 Width = 97 Height = 49 + Anchors = [akTop, akRight] Caption = 'Copie fen'#234'te principale dans debug' - TabOrder = 10 + TabOrder = 7 WordWrap = True OnClick = ButtonCopClick end object RichEdit: TRichEdit - Left = 552 + Left = 545 Top = 168 Width = 233 Height = 233 + Anchors = [akTop, akRight] HideScrollBars = False PopupMenu = PopupMenuRE ScrollBars = ssVertical - TabOrder = 11 + TabOrder = 8 end object ButtonRazLog: TButton - Left = 448 + Left = 441 Top = 544 Width = 97 - Height = 25 - Caption = 'Raz Tampon Log' - TabOrder = 12 + Height = 33 + Anchors = [akTop, akRight] + Caption = 'Raz Tampon Log <-----' + TabOrder = 9 + WordWrap = True OnClick = ButtonRazLogClick end - object CheckBoxAct: TCheckBox - Left = 448 - Top = 64 - Width = 257 - Height = 17 - Caption = 'Affichage des '#233'v'#232'vements actionneurs' + object GroupBox1: TGroupBox + Left = 441 + Top = 633 + Width = 353 + Height = 97 + Anchors = [akRight, akBottom] + Caption = 'Fonctions primitives' + Color = cl3DLight Font.Charset = DEFAULT_CHARSET - Font.Color = clBlack - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - ParentFont = False - TabOrder = 13 - OnClick = CheckBoxActClick - end - object CheckBoxEvtDetAig: TCheckBox - Left = 448 - Top = 48 - Width = 281 - Height = 17 - Caption = 'Affichage des '#233'v'#232'nements d'#233'tecteurs et aiguillages' - Font.Charset = DEFAULT_CHARSET - Font.Color = clBlack - Font.Height = -11 - Font.Name = 'MS Sans Serif' - Font.Style = [] - ParentFont = False - TabOrder = 14 - OnClick = CheckBoxEvtDetAigClick - end - object CheckBoxAffFD: TCheckBox - Left = 448 - Top = 112 - Width = 297 - Height = 17 - Caption = 'Affichage des fronts descendants des d'#233'tecteurs' - Color = clWindow - Font.Charset = DEFAULT_CHARSET - Font.Color = clBlack + Font.Color = clBlue Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] ParentColor = False ParentFont = False - TabOrder = 15 - OnClick = CheckBoxAffFDClick + TabOrder = 10 + object ButtonSigSuiv: TButton + Left = 16 + Top = 24 + Width = 97 + Height = 25 + Hint = 'Etat du signal suivant' + Caption = 'Etat signal suivant' + ParentShowHint = False + ShowHint = True + TabOrder = 0 + OnClick = ButtonSigSuivClick + end + object EditSigSuiv: TEdit + Left = 280 + Top = 24 + Width = 49 + Height = 21 + Hint = 'Indiquer l'#39'adresse du signal ' + ParentShowHint = False + ShowHint = True + TabOrder = 1 + end + object EditPrec: TEdit + Left = 224 + Top = 58 + Width = 49 + Height = 21 + Hint = 'Element pr'#233'c'#233'dent' + ParentShowHint = False + ShowHint = True + TabOrder = 2 + end + object EditActuel: TEdit + Left = 288 + Top = 58 + Width = 49 + Height = 21 + Hint = 'Element actuel' + ParentShowHint = False + ShowHint = True + TabOrder = 3 + end + object ButtonDetSuiv: TButton + Left = 16 + Top = 56 + Width = 201 + Height = 25 + Hint = + 'Renvoie l'#39#233'l'#233'ment suivant aux deux '#233'l'#233'ments (d'#233'tecteurs ou aigui' + + 'llages) ' + Caption = 'D'#233'tecteur suivant aux '#233'l'#233'ments' + ParentShowHint = False + ShowHint = True + TabOrder = 4 + OnClick = ButtonDetSuivClick + end + object ButtonCanSuivSig: TButton + Left = 128 + Top = 16 + Width = 105 + Height = 33 + Hint = 'Renvoie l'#39'occupation du canton suivant le signal' + Caption = 'Etat canton suivant signal occup'#233 + ParentShowHint = False + ShowHint = True + TabOrder = 5 + WordWrap = True + OnClick = ButtonCanSuivSigClick + end end - object CheckBoxAffDebDecSig: TCheckBox - Left = 448 - Top = 128 - Width = 321 - Height = 17 - Caption = 'Affichage du pilotage des d'#233'codeurs de signaux' + object GroupBox2: TGroupBox + Left = 433 + Top = 24 + Width = 345 + Height = 137 + Anchors = [akTop, akRight] + Caption = 'S'#233'lections d'#39'affichage' + Color = cl3DLight Font.Charset = DEFAULT_CHARSET - Font.Color = clBlack + Font.Color = clBlue Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] + ParentColor = False ParentFont = False - TabOrder = 16 - OnClick = CheckBoxAffDebDecSigClick + TabOrder = 11 + object CheckAffSig: TCheckBox + Left = 24 + Top = 16 + Width = 297 + Height = 17 + Caption = 'Fonctionnement des signaux' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBlack + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 0 + OnClick = CheckAffSigClick + end + object CheckBoxEvtDetAig: TCheckBox + Left = 24 + Top = 32 + Width = 281 + Height = 17 + Caption = 'Ev'#232'nements d'#233'tecteurs et aiguillages' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBlack + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 1 + OnClick = CheckBoxEvtDetAigClick + end + object CheckBoxTraceLIste: TCheckBox + Left = 24 + Top = 112 + Width = 289 + Height = 17 + Caption = 'Evaluations des routes des trains' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBlack + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 2 + OnClick = CheckBoxTraceLIsteClick + end + object CheckTrame: TCheckBox + Left = 24 + Top = 80 + Width = 305 + Height = 17 + Caption = 'Trames '#233'chang'#233'es avec l'#39'interface ou CDM' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBlack + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 3 + OnClick = CheckTrameClick + end + object CheckBoxAct: TCheckBox + Left = 24 + Top = 48 + Width = 257 + Height = 17 + Caption = 'Ev'#232'vements actionneurs' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBlack + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 4 + OnClick = CheckBoxActClick + end + object CheckBoxAffFD: TCheckBox + Left = 24 + Top = 96 + Width = 297 + Height = 17 + Caption = 'Fronts descendants des d'#233'tecteurs' + Color = cl3DLight + Font.Charset = DEFAULT_CHARSET + Font.Color = clBlack + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentColor = False + ParentFont = False + TabOrder = 5 + OnClick = CheckBoxAffFDClick + end + object CheckBoxAffDebDecSig: TCheckBox + Left = 24 + Top = 64 + Width = 265 + Height = 17 + Caption = 'Pilotage des d'#233'codeurs de signaux' + Font.Charset = DEFAULT_CHARSET + Font.Color = clBlack + Font.Height = -11 + Font.Name = 'MS Sans Serif' + Font.Style = [] + ParentFont = False + TabOrder = 6 + OnClick = CheckBoxAffDebDecSigClick + end end object SaveDialog: TSaveDialog - Left = 760 - Top = 56 + Left = 768 + Top = 488 end object PopupMenuRE: TPopupMenu - Left = 760 - Top = 80 + Left = 768 + Top = 432 object copier1: TMenuItem Caption = 'copier' OnClick = copier1Click diff --git a/UnitDebug.pas b/UnitDebug.pas index d8cb1c6..4b75e19 100644 --- a/UnitDebug.pas +++ b/UnitDebug.pas @@ -16,21 +16,29 @@ type ButtonEcrLog: TButton; Label3: TLabel; MemoDebug: TMemo; - CheckAffSig: TCheckBox; ButtonRazTampon: TButton; ButtonCherche: TButton; ButtonAffEvtChrono: TButton; - CheckBoxTraceLIste: TCheckBox; - CheckTrame: TCheckBox; ButtonCop: TButton; RichEdit: TRichEdit; PopupMenuRE: TPopupMenu; copier1: TMenuItem; ButtonRazLog: TButton; - CheckBoxAct: TCheckBox; + GroupBox1: TGroupBox; + ButtonSigSuiv: TButton; + EditSigSuiv: TEdit; + EditPrec: TEdit; + EditActuel: TEdit; + ButtonDetSuiv: TButton; + GroupBox2: TGroupBox; + CheckAffSig: TCheckBox; CheckBoxEvtDetAig: TCheckBox; + CheckBoxTraceLIste: TCheckBox; + CheckTrame: TCheckBox; + CheckBoxAct: TCheckBox; CheckBoxAffFD: TCheckBox; CheckBoxAffDebDecSig: TCheckBox; + ButtonCanSuivSig: TButton; procedure FormClose(Sender: TObject; var Action: TCloseAction); procedure FormCreate(Sender: TObject); procedure ButtonEcrLogClick(Sender: TObject); @@ -48,6 +56,9 @@ type procedure CheckBoxEvtDetAigClick(Sender: TObject); procedure CheckBoxAffFDClick(Sender: TObject); procedure CheckBoxAffDebDecSigClick(Sender: TObject); + procedure ButtonSigSuivClick(Sender: TObject); + procedure ButtonDetSuivClick(Sender: TObject); + procedure ButtonCanSuivSigClick(Sender: TObject); private { Déclarations privées } public @@ -55,7 +66,7 @@ type end; Const -Max_Event_det_tick=10000; +Max_Event_det_tick=30000; Max_event_det=400; Max_Trains=50; @@ -112,8 +123,8 @@ procedure RE_ColorLine(ARichEdit : TRichEdit;ARow : Integer;AColor : TColor); begin with ARichEdit do begin - SelStart:=SendMessage(Handle,EM_LINEINDEX,ARow-1,0); - SelLength:=Length(Lines[ARow-1]); + SelStart:=SendMessage(Handle,EM_LINEINDEX,ARow,0); + SelLength:=Length(Lines[ARow]); SelAttributes.Color:=AColor; SelLength:=0; end; @@ -303,4 +314,46 @@ begin end; +procedure TFormDebug.ButtonSigSuivClick(Sender: TObject); +var adr,erreur,ancdebug : integer ; +begin + ancdebug:=NivDebug; + NivDebug:=3; + Val(EditSigSuiv.Text,adr,erreur); + if erreur<>0 then exit; + etat_signal_suivant(Adr,1) ; + NivDebug:=AncDebug; +end; + +procedure TFormDebug.ButtonDetSuivClick(Sender: TObject); +var Adr,type1,type2,Prec,Actuel,erreur,ancdebug : integer ; + s1,s2 : string; +begin + ancdebug:=NivDebug; + NivDebug:=3; + s1:=EditPrec.Text; + s2:=EditActuel.Text; + if (s1='') or (s2='') then exit; + if s1[1]='A' then begin type1:=2;delete(s1,1,1);end else type1:=1; + if s2[1]='A' then begin type2:=2;delete(s2,1,1);end else type2:=1; + Val(s1,prec,erreur); if erreur<>0 then exit; + Val(s2,Actuel,erreur); if erreur<>0 then exit; + Adr:=detecteur_suivant_El(prec,type1,actuel,type2); + if Adr<9996 then AfficheDebug('Le détecteur suivant aux éléments '+IntToSTR(prec)+'/'+IntToSTR(actuel)+' est '+IntToSTR(Adr),clyellow) + else AfficheDebug('Pas trouvé de détecteur suvant aux éléments '+IntToSTR(prec)+'/'+IntToSTR(actuel),clyellow); + NivDebug:=AncDebug; +end; + +procedure TFormDebug.ButtonCanSuivSigClick(Sender: TObject); +var Adr,erreur,ancdebug : integer ; +begin + ancdebug:=NivDebug; + NivDebug:=3; + Val(EditSigSuiv.Text,Adr,erreur); if erreur<>0 then exit; + test_memoire_zones(Adr); + NivDebug:=AncDebug; +end; + + + end. diff --git a/UnitPilote.dcu b/UnitPilote.dcu index f6373d6..2ad41fc 100644 Binary files a/UnitPilote.dcu and b/UnitPilote.dcu differ diff --git a/UnitPrinc.dcu b/UnitPrinc.dcu index e29b65c..7883765 100644 Binary files a/UnitPrinc.dcu and b/UnitPrinc.dcu differ diff --git a/UnitPrinc.dfm b/UnitPrinc.dfm index 0acceb1..3469eec 100644 --- a/UnitPrinc.dfm +++ b/UnitPrinc.dfm @@ -1,6 +1,6 @@ object FormPrinc: TFormPrinc - Left = 30 - Top = 270 + Left = 12 + Top = 210 Width = 1212 Height = 664 Caption = 'Client TCP-IP CDM Rail ou USB - syst'#232'me LENZ' @@ -18,7 +18,7 @@ object FormPrinc: TFormPrinc OnClose = FormClose OnCreate = FormCreate DesignSize = ( - 1196 + 1179 606) PixelsPerInch = 96 TextHeight = 13 @@ -1188,7 +1188,7 @@ object FormPrinc: TFormPrinc Visible = False end object LabelEtat: TLabel - Left = 456 + Left = 439 Top = 16 Width = 152 Height = 18 @@ -1204,14 +1204,14 @@ object FormPrinc: TFormPrinc object ListBox1: TListBox Left = 8 Top = 48 - Width = 633 - Height = 520 + Width = 616 + Height = 505 Style = lbOwnerDrawFixed Anchors = [akLeft, akTop, akRight, akBottom] Color = clBlack Font.Charset = ANSI_CHARSET Font.Color = clBlue - Font.Height = -16 + Font.Height = 16 Font.Name = 'Arial' Font.Style = [] ItemHeight = 16 @@ -1220,10 +1220,10 @@ object FormPrinc: TFormPrinc OnDrawItem = ListBox1DrawItem end object ScrollBox1: TScrollBox - Left = 648 + Left = 631 Top = 176 Width = 537 - Height = 393 + Height = 377 HorzScrollBar.Smooth = True HorzScrollBar.Tracking = True VertScrollBar.Smooth = True @@ -1234,7 +1234,7 @@ object FormPrinc: TFormPrinc TabOrder = 1 end object GroupBox1: TGroupBox - Left = 648 + Left = 631 Top = 0 Width = 249 Height = 129 @@ -1317,8 +1317,8 @@ object FormPrinc: TFormPrinc end object StatusBar1: TStatusBar Left = 0 - Top = 576 - Width = 1196 + Top = 577 + Width = 1179 Height = 30 Panels = <> SimplePanel = True @@ -1334,7 +1334,7 @@ object FormPrinc: TFormPrinc 00020000802500000000080000000000000000003F00000011000000} end object Panel1: TPanel - Left = 904 + Left = 887 Top = 5 Width = 281 Height = 129 @@ -1428,7 +1428,7 @@ object FormPrinc: TFormPrinc end end object Panel2: TPanel - Left = 648 + Left = 631 Top = 136 Width = 153 Height = 25 @@ -1456,6 +1456,22 @@ object FormPrinc: TFormPrinc ParentFont = False end end + object StaticText: TStaticText + Left = 16 + Top = 560 + Width = 1145 + Height = 17 + Anchors = [akLeft, akRight, akBottom] + Caption = 'xx' + TabOrder = 7 + end + object StaticText1: TStaticText + Left = 8 + Top = 560 + Width = 4 + Height = 4 + TabOrder = 8 + end object Timer1: TTimer Interval = 100 OnTimer = Timer1Timer @@ -1481,11 +1497,6 @@ object FormPrinc: TFormPrinc Hint = 'Affiche l'#39#233'tat des d'#233'tecteurs' OnClick = AffEtatDetecteurs end - object ChronoDetect: TMenuItem - Caption = 'Chronologie des d'#233'tecteurs et aiguillages' - Hint = 'Affiche la chronologie des d'#233'tecteurs' - OnClick = ChronoDetectClick - end object Etatdesaiguillages1: TMenuItem Caption = 'Etat des aiguillages' OnClick = Etatdesaiguillages1Click diff --git a/UnitPrinc.pas b/UnitPrinc.pas index 8d47b7f..89a0f52 100644 --- a/UnitPrinc.pas +++ b/UnitPrinc.pas @@ -61,7 +61,6 @@ type Image6Dir: TImage; Codificationdesfeux1: TMenuItem; Divers1: TMenuItem; - ChronoDetect: TMenuItem; ClientSocketCDM: TClientSocket; FichierSimu: TMenuItem; ButtonEcrCV: TButton; @@ -91,6 +90,8 @@ type ButtonAffTCO: TButton; ButtonLanceCDM: TButton; Affichefentredebug1: TMenuItem; + StaticText: TStaticText; + StaticText1: TStaticText; procedure FormCreate(Sender: TObject); procedure MSCommUSBLenzComm(Sender: TObject); procedure FormClose(Sender: TObject; var Action: TCloseAction); @@ -130,7 +131,6 @@ type procedure Codificationdesfeux1Click(Sender: TObject); procedure ClientSocketLenzDisconnect(Sender: TObject; Socket: TCustomWinSocket); - procedure ChronoDetectClick(Sender: TObject); procedure FichierSimuClick(Sender: TObject); procedure ButtonEcrCVClick(Sender: TObject); procedure ButtonRepriseClick(Sender: TObject); @@ -174,34 +174,39 @@ NbCouleurTrain=8; couleurTrain : array[1..NbCouleurTrain] of Tcolor = (clYellow,clLime,clOrange,clAqua,clFuchsia,clLtGray,clred,clWhite); EtatSign : array[0..13] of string[20] =('carré','sémaphore','sémaphore cli','vert','vert cli','violet', 'blanc','blanc cli','jaune','jaune cli','ral 30','ral 60','rappel 30','rappel 60'); -decodeur : array[0..6] of string[20] =('rien','digital Bahn','CDF','LDT','LEB','NMRA','Unisemaf'); +NbDecodeur = 7; +decodeur : array[0..NbDecodeur-1] of string[20] =('rien','digital Bahn','CDF','LDT','LEB','NMRA','Unisemaf'); type TBranche = record - BType : integer ; // 1= détecteur 2= aiguillage 3=bis 4=Buttoir + BType : integer ; // 1= détecteur 2= aiguillage 4=Buttoir Adresse : integer ; // adresse du détecteur ou de l'aiguillage end; Taiguillage = record objet : integer; // objet dans CDM rail modele : integer; // 0=n'existe pas 1=aiguillage 2=TJD 3=TJS 4=aiguillage triple - position, // position actuelle : 1=dévié 2=droit + position, // position actuelle : 1=dévié 2=droit (positions centrale lenz) Adrtriple, // 2eme adresse pour un aiguillage triple temps, // temps de pilotage (durée de l'impulsion en x 100 ms) - inversion : integer; // pilotage inversé pour la commande (en mode sans CDM) 0=normal 1=inversé - InversionCDM : integer ; // inversion pour les aiguillages BIS en lecture - vitesse : integer; // vitesse de franchissement de l"aiguillage en position déviée (60 ou 90) + inversion : integer; // pilotage inversé pour la commande (en mode sans CDM) 0=normal 1=inversé (positionné dans fichier config_gl section_init + InversionCDM : integer ; // inversion pour les aiguillages en lecture (paramètre I) + vitesse : integer; // vitesse de franchissement de l'aiguillage en position déviée (60 ou 90) ADroit : integer ; // (TJD:identifiant extérieur) connecté sur la position droite en talon ADroitB : char ; // id de branche pour TJD - ADroitBis : integer ; // 0=pas connecté à aiguillage dont l'adresse est bis =1 connecté à un aig bis ADevie : integer ; // (TJD:identifiant extérieur) adresse de l'élément connecté en position déviée ADevieB : char; // caractère (D ou S)si aiguillage de l'élément connecté en position déviée - AdevieBis : integer ; // 0=pas connecté à aiguillage dont l'adresse est bis =1 connecté à un aig bis - APointe : integer; // adresse de l'élément connecté en position droite ; pour les TJD : adresse de l'autre tjd + APointe : integer; // adresse de l'élément connecté en position droite ; APointeB : char; - ApointeBis : integer; // 0=pas connecté à aiguillage dont l'adresse est bis =1 connecté à un aig bis + + DDroit : integer; // destination de la TJD en position droite + DDroitB : char ; + + DDevie : integer; // destination de la TJD en position déviée + DDevieB : char ; + tjsint : integer; tjsintb : char ; @@ -209,8 +214,9 @@ type TBranche = record // éléments connectés sur la branche déviée 2 (cas d'un aiguillage triple) Adevie2 : integer; Adevie2B : char ; - Adevie2Bis : integer; + // modifié + modifie : boolean ; end; Taccessoire = (aig,feu); @@ -237,19 +243,12 @@ var ancien_tablo_signalCplx,EtatsignalCplx : array[0..MaxAcc] of word; Enregistrement,chaine_Envoi,chaine_recue,Id_CDM,Af, entete,suffixe,ConfStCom,LAY : string; maxaiguillage,detecteur_chgt,Temps,Tempo_init,Suivant,TypeGen, - NbreImagePligne,NbreBranches,Index2_det,branche_det,Index_det, + NbreImagePligne,NbreBranches,Index2_det,Index2_aig,branche_det,Index_det, I_simule,maxTablo_act,NbreVoies,AdresseFeuSuivant,El_suivant : integer; Ancien_detecteur,detecteur : array[0..1024] of boolean; // anciens état des détecteurs et adresses des détecteurs et leur état Adresse_detecteur : array[0..60] of integer; // adresses des détecteurs par index mem : array[0..1024] of boolean ; // mémoire des états des détecteurs MemZone : array[0..1024,0..1024] of boolean ; // mémoires de zones - (* Train : array[1..30] of record - index : integer ; // nombre de routes pour ce train - route : array[1..2000] of record - Mem1,Mem2 : integer; - end; - end; - *) Tablo_actionneur : array[1..100] of record actionneur,etat,fonction,tempo : integer; @@ -268,7 +267,6 @@ var ancien_tablo_signalCplx,EtatsignalCplx : array[0..MaxAcc] of word; PresTrain : boolean; // mémoire de présence de train sur la voie end; end; - Tablo_Simule : array[0..Max_Simule] of record tick : longint; @@ -280,12 +278,9 @@ var ancien_tablo_signalCplx,EtatsignalCplx : array[0..MaxAcc] of word; fichier : text; tick,Premier_tick : longint; // modélisations des fichiers config - mod_aiguillages,mod_signaux,mod_branches,mod_act : array[1..100] of string; - + mod_branches,mod_act : array[1..100] of string; // l'indice du tableau aiguillage est son adresse aiguillage : array[0..MaxAcc] of Taiguillage; - aiguillageB : array[0..MaxAcc] of Taiguillage; - // signaux de la fenêtre de droite - L'index du tableau n'est pas l'adresse du feu feux : array[1..MaxAcc] of record adresse, aspect : integer; // adresse du feu, aspect (2 feux..9 feux 12=direction 2 feux .. 16=direction 6 feux) @@ -302,11 +297,12 @@ var ancien_tablo_signalCplx,EtatsignalCplx : array[0..MaxAcc] of word; Adr_el_suiv2 : integer; // adresse de l'élément2 suivant (si un signal est pour plusieurs voies) Adr_el_suiv3 : integer; // adresse de l'élément3 suivant (si un signal est pour plusieurs voies) Adr_el_suiv4 : integer; // adresse de l'élément4 suivant (si un signal est pour plusieurs voies) - Btype_suiv1 : integer ; // type de l'élément suivant (1=détecteur 2=aig ou TJD ou TJS 4=tri 5=bis - Btype_suiv2 : integer ; // type de l'élément suivant (1=détecteur 2=aig ou TJD ou TJS 4=tri 5=bis - Btype_suiv3 : integer ; // type de l'élément suivant (1=détecteur 2=aig ou TJD ou TJS 4=tri 5=bis - Btype_suiv4 : integer ; // type de l'élément suivant (1=détecteur 2=aig ou TJD ou TJS 4=tri 5=bis + Btype_suiv1 : integer ; // type de l'élément suivant (1=détecteur 2=aig ou TJD ou TJS 4=tri + Btype_suiv2 : integer ; // type de l'élément suivant (1=détecteur 2=aig ou TJD ou TJS 4=tri + Btype_suiv3 : integer ; // type de l'élément suivant (1=détecteur 2=aig ou TJD ou TJS 4=tri + Btype_suiv4 : integer ; // type de l'élément suivant (1=détecteur 2=aig ou TJD ou TJS 4=tri VerrouCarre : boolean ; // si vrai, le feu se verrouille au carré si pas de train avant le signal + modifie : boolean; // feu modifié EtatSignal : word ; // comme EtatSignalCplx UniSemaf : integer ; // définition supplémentaire de la cible pour les décodeurs UNISEMAF AigDirection : array[1..6] of array of record // pour les signaux directionnels : contient la liste des aiguillages associés @@ -319,12 +315,11 @@ var ancien_tablo_signalCplx,EtatsignalCplx : array[0..MaxAcc] of word; end; end; Fimage : Timage; - - BrancheN : array[1..100,1..200] of TBranche; + BrancheN : array[1..100,1..200] of TBranche; // {$R *.dfm} -// utilisation dans unité UnitPilote et configunit +// utilisation des procédures et fonctions dans les autres unités function Index_feu(adresse : integer) : integer; procedure dessine_feu2(Acanvas : Tcanvas;x,y : integer;frX,frY : real;EtatSignal : word;orientation : integer); procedure dessine_feu3(Acanvas : Tcanvas;x,y : integer;frX,frY : real;EtatSignal : word;orientation : integer); @@ -346,6 +341,10 @@ procedure deconnecte_usb; function IsWow64Process: Boolean; procedure Dessine_feu_mx(CanvasDest : Tcanvas;x,y : integer;FrX,frY : real;adresse : integer;orientation : integer); procedure pilote_acc(adresse : integer;octet : byte;Acc : TAccessoire); +function etat_signal_suivant(Adresse,rang : integer) : integer; +function suivant_alg3(prec : integer;typeELprec : integer;var actuel : integer;typeElActuel : integer;alg : integer) : integer; +function detecteur_suivant_El(el1: integer;TypeDet1 : integer;el2 : integer;TypeDet2 : integer) : integer ; +function test_memoire_zones(adresse : integer) : boolean; implementation @@ -490,7 +489,7 @@ begin Xvert:=13; Yvert:=11; xSem:=13; ySem:=22; xJaune:=13; yJaune:=33; - + if (orientation=2) then begin ech:=frY;frY:=frX;FrX:=ech; @@ -562,7 +561,7 @@ begin Temp:=LgImage-Xvert;Xvert:=Yvert;Yvert:=Temp; Temp:=LgImage-Xcarre;Xcarre:=Ycarre;Ycarre:=Temp; end; - + XJaune:=round(Xjaune*Frx)+x; YJaune:=round(Yjaune*Fry)+Y; Xvert:=round(Xvert*FrX)+x; Yvert:=round(Yvert*FrY)+Y; XSem:=round(XSem*FrX)+x; YSem:=round(YSem*FrY)+Y; @@ -778,7 +777,7 @@ begin Temp:=HtImage-yRap1;YRap1:=XRap1;XRap1:=Temp; Temp:=HtImage-yRap2;YRap2:=XRap2;XRap2:=Temp; end; - + if (orientation=3) then begin //rotation 90° vers la droite des feux @@ -898,7 +897,7 @@ begin cercle(ACanvas,33,13,6,grisF); cercle(ACanvas,43,13,6,GrisF); end; - if EtatSignal=3 then + if EtatSignal=3 then begin cercle(ACanvas,11,13,6,clWhite); cercle(ACanvas,22,13,6,clWhite); @@ -994,7 +993,7 @@ begin cercle(ACanvas,53,13,6,GrisF); cercle(ACanvas,63,13,6,GrisF); end; - if EtatSignal=2 then + if EtatSignal=2 then begin cercle(ACanvas,11,13,6,clWhite); cercle(ACanvas,22,13,6,clWhite); @@ -1076,8 +1075,6 @@ begin end; - - // renvoie l'index du feu dans le tableau feux[] en fonction de son adresse //si pas de feu renvoie 0 function Index_feu(adresse : integer) : integer; @@ -1179,7 +1176,6 @@ begin s:='@='+inttostr(feux[rang].Adresse)+' Decodeur='+intToSTR(feux[rang].Decodeur)+' Adresse détecteur associé='+intToSTR(feux[rang].Adr_det1)+ ' Adresse élement suivant='+intToSTR(feux[rang].Adr_el_suiv1); if feux[rang].Btype_suiv1=2 then s:=s+' (aig)'; - if feux[rang].Btype_suiv1=5 then s:=s+' (aig bis)'; Hint:=s; onClick:=Formprinc.Imageonclick; //width:=100; @@ -1597,7 +1593,7 @@ begin if aspect<>16 then s:=s+'+'; s:=s+etatSign[combine]; end; - chaine_signal:=s; + chaine_signal:=s; end; // mise à jour état signal complexe dans le tableau de bits du signal EtatSignalCplx */ @@ -3349,6 +3345,33 @@ begin //affiche('index2='+IntToSTR(index2_det),clWhite); end; +// trouve l'index d'un aiguillage dans une branche +// si pas trouvé, renvoie 0 +function index_aiguillage(AdrAig,Num_branche : integer) : integer; +var i,adr : integer; + trouve : boolean; + procedure recherche; + begin + repeat + adr:=BrancheN[Num_Branche,i].adresse; + trouve:=(AdrAig=adr) and ((BrancheN[Num_Branche,i].Btype=2) or (BrancheN[Num_branche,i].BType=3)); // cherche un aiguillage + //Affiche('cherche='+intToSTR(det)+'/explore='+intToSTR(adr)+' Branche='+intToStr(Num_branche)+' index='+intToStr(i),ClWhite); + if not(trouve) then inc(i); + //if trouve then Affiche('Trouvé en branche'+IntToSTR(Num_branche)+' index='+IntToSTR(i),clGreen); + until trouve or (adr=0) ; + end; +begin + i:=1;index2_aig:=0; + recherche; + if trouve then result:=i else result:=0; + //affiche(inttostr(ai+1),clOrange); + i:=2; // à voir + //affiche('------------------------',clWhite); + recherche; + //affiche('------------------------',clGreen); + if trouve then index2_aig:=i else index2_aig:=0; + //affiche('index2='+IntToSTR(index2_det),clWhite); +end; // si pas trouvé, IndexBranche_trouve=0 procedure trouve_detecteur(detecteur : integer); @@ -3365,23 +3388,72 @@ begin IndexBranche_trouve:=i; end; +// si pas trouvé, IndexBranche_trouve=0 +procedure trouve_aiguillage(adresse : integer); +var NBranche,i : integer; +begin + Nbranche:=1; + i:=1; + repeat + i:=index_aiguillage(Adresse,Nbranche); + if i=0 then inc(NBranche); + until (Nbranche>NbreBranches) or (i<>0); + //if (i<>0) then Affiche('aiguillage '+IntToSTR(adresse)+' trouvé en branche '+intToSTR(NBranche)+' index='+IntToSTR(i),clYellow); + branche_trouve:=NBranche; + IndexBranche_trouve:=i; +end; + + procedure lit_config; var s,sa,chaine,SOrigine: string; c,paig : char; - tec,bistec,tjd,tjs,s2,trouve,triple,debugConfig,multiple,fini,finifeux,bisBool : boolean; - bd,virgule,i_detect,i,erreur,aig,detect,offset,index, adresse,j,position,temporisation,invers,indexPointe,indexDevie,indexDroit, - ComptEl,Compt_IT,Num_Element,k,modele,aig2,adr,erreur2,l,t,bis,Nligne : integer; + tec,tjd,tjs,s2,trouve,triple,debugConfig,multiple,fini,finifeux : boolean; + bd,virgule,i_detect,i,erreur,aig,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, + postjd,postjs,nv,it : integer; function lit_ligne : string ; begin repeat readln(fichier,s); s:=uppercase(s); - //Affiche(s,clWhite); if length(s)>0 then c:=s[1]; until ((c<>'/') and (s<>'')) or eof(fichier) ; lit_ligne:=s; + //Affiche(s,clWhite); end; + procedure compile_section_init; + begin + //initialisation aiguillages + repeat + s:=lit_ligne; + j:=pos(',',s); + if j>1 then + begin + begin + adresse:=StrToINT(copy(s,1,j-1));Delete(s,1,j); // adresse aiguillage + if (adresse>0) and (AvecInitAiguillages=1) then + begin + j:=pos(',',s); + position:=StrToInt(copy(s,1,j-1));Delete(S,1,j);// position aiguillage + if (position<1) or (position>2) then position:=1; + aiguillage[adresse].position:=position; + + // temporisation aiguillage + j:=pos(',',s);if j=0 then j:=length(s); + val(s,temporisation,erreur);Delete(S,1,j); + if (temporisation<0) or (temporisation>10) then temporisation:=5; + aiguillage[adresse].temps:=temporisation; + + val(s,invers,erreur); + if (invers<0) or (invers>1) then invers:=0; // inversion commande + aiguillage[adresse].inversion:=invers; + end; + end; + end; + until (adresse=0); + end; + begin debugConfig:=false; // initialisation des aiguillages avec des valeurs par défaut @@ -3409,127 +3481,214 @@ begin Affiche('Fichier client-gl.cfg non trouvé',clred); end; {$I+} - + nv:=0; it:=0; {lecture du fichier de configuration} // taille de fonte - s:=lit_ligne; - TailleFonte:=StrToINT(s); - with FormPrinc.ListBox1 do - begin - Font.Height:=TailleFonte; - ItemHeight:=TailleFonte+1; - end; - - // adresse ip et port de CDM - s:=lit_ligne; - i:=pos(':',s); - if i<>0 then begin adresseIPCDM:=copy(s,1,i-1);Delete(s,1,i);portCDM:=StrToINT(s);end; - - // adresse ip et port de la centrale - // AfficheDet:=true; - s:=lit_ligne; - i:=pos(':',s); - if i<>0 then begin adresseIP:=copy(s,1,i-1);Delete(s,1,i);port:=StrToINT(s);end - else begin adresseIP:='0';parSocket:=false;end; - - // configuration du port com - s:=lit_ligne; // COM3:57600,N,8,1,2 - if not(config_com(s)) then Affiche('Erreur port com mal déclaré : '+s,clred); - portcom:=s; - - // temporisation entre 2 caractères - s:=lit_ligne; - val(s,TempoOctet,erreur); - if erreur<>0 then Affiche('Erreur temporisation entre 2 octets',clred); - - // temporisation attente maximale interface - s:=lit_ligne; - val(s,TimoutMaxInterface,erreur); - if erreur<>0 then Affiche('Erreur temporisation maximale interface',clred); - - // entete - s:=lit_ligne; - val(s,Valeur_entete,erreur); - entete:=''; - case Valeur_entete of - 0 : begin entete:='';suffixe:='';end; - 1 : begin entete:=#$FF+#$FE;suffixe:='';end; - 2 : begin entete:=#228;suffixe:=#13+#13+#10;end; - end; - if (erreur<>0) or (valeur_entete>2) then Affiche('Erreur déclaration variable entete',clred); - - - // avec ou sans initialisation des aiguillages - s:=lit_ligne; - AvecInitAiguillages:=StrToINT(s); - - //Affiche('Valeurs d''initialisation des aiguillages',clyellow); - //initialisation aiguillages repeat s:=lit_ligne; - j:=pos(',',s); - if j>1 then + //affiche(s,cllime); + sa:='FONTE='; + i:=pos(sa,s); + if i<>0 then begin + inc(nv); + delete(s,i,length(sa)); + TailleFonte:=StrToINT(s); + with FormPrinc.ListBox1 do begin - adresse:=StrToINT(copy(s,1,j-1));Delete(s,1,j); // adresse aiguillage - if (adresse>0) and (AvecInitAiguillages=1) then - begin - j:=pos(',',s); - position:=StrToInt(copy(s,1,j-1));Delete(S,1,j);// position aiguillage - if (position<1) or (position>2) then position:=1; - aiguillage[adresse].position:=position; - aiguillageB[adresse].position:=position; - - // temporisation aiguillage - j:=pos(',',s);if j=0 then j:=length(s); - val(s,temporisation,erreur);Delete(S,1,j); - if (temporisation<0) or (temporisation>10) then temporisation:=5; - aiguillage[adresse].temps:=temporisation; - aiguillageB[adresse].temps:=temporisation; - - val(s,invers,erreur); - if (invers<0) or (invers>1) then invers:=0; // inversion commande - aiguillage[adresse].inversion:=invers; - aiguillageB[adresse].inversion:=invers; - end; + Font.Height:=TailleFonte; + ItemHeight:=TailleFonte+1; end; end; - until (adresse=0); - // vérification de la version au démarrage - verifVersion:=true; - s:=lit_ligne; - val(s,i,erreur); - if erreur=0 then verifVersion:=i=1; + // adresse ip et port de CDM + sa:='IPV4_PC='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + i:=pos(':',s); + if i<>0 then begin adresseIPCDM:=copy(s,1,i-1);Delete(s,1,i);portCDM:=StrToINT(s);end; + end; + + // adresse ip et port de la centrale + // AfficheDet:=true; + sa:='IPV4_INTERFACE='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + i:=pos(':',s); + if i<>0 then begin adresseIP:=copy(s,1,i-1);Delete(s,1,i);port:=StrToINT(s);end + else begin adresseIP:='0';parSocket:=false;end; + end; + + // configuration du port com + sa:='PROTOCOLE_SERIE='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + if not(config_com(s)) then Affiche('Erreur port com mal déclaré : '+s,clred); + portcom:=s; + end; - // notification de nouvelle version au démarrage - s:=lit_ligne; - val(s,i,erreur); - notificationVersion:=i=1; + // temporisation entre 2 caractères + sa:='INTER_CAR='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + val(s,TempoOctet,erreur); + if erreur<>0 then Affiche('Erreur temporisation entre 2 octets',clred); + end; + + // temporisation attente maximale interface + sa:='TEMPO_MAXI='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + val(s,TimoutMaxInterface,erreur); + if erreur<>0 then Affiche('Erreur temporisation maximale interface',clred); + end; + + // entete + sa:='ENTETE='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + val(s,Valeur_entete,erreur); + entete:=''; + case Valeur_entete of + 0 : begin entete:='';suffixe:='';end; + 1 : begin entete:=#$FF+#$FE;suffixe:='';end; + 2 : begin entete:=#228;suffixe:=#13+#13+#10;end; + end; + if (erreur<>0) or (valeur_entete>2) then Affiche('Erreur déclaration variable entete',clred); + end; - // avec tco - s:=lit_ligne; - val(s,i,erreur); - AvecTCO:=i=1; + // avec ou sans initialisation des aiguillages + sa:='INIT_AIG='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + AvecInitAiguillages:=StrToINT(s); + end; - // lancement de CDM - s:=lit_ligne; - val(s,i,erreur); - LanceCDM:=i=1; + sa:='FENETRE='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + if StrToINT(s)=1 then Formprinc.windowState:=wsMaximized; + end; - // Nom du LAY - Lay:=Lit_Ligne; + sa:='SECTION_INIT'; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + compile_section_init; + end; - // Serveur d'interface de CDM - s:=lit_ligne; - val(s,i,erreur); - ServeurInterfaceCDM:=i; + sa:='VERIF_VERSION='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + // vérification de la version au démarrage + verifVersion:=true; + val(s,i,erreur); + if erreur=0 then verifVersion:=i=1; + end; + + sa:='NOTIF_VERSION='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + // vérification de la version au démarrage + i:=0; + val(s,i,erreur); + notificationVersion:=i=1; + end; + + sa:='TCO='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + // vérification de la version au démarrage + i:=0; + val(s,i,erreur); + AvecTCO:=i=1; + end; + + sa:='CDM='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + // vérification de la version au démarrage + i:=0; + val(s,i,erreur); + LanceCDM:=i=1; + end; + + sa:='LAY='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + lay:=s; + end; + + sa:='SERVEUR_INTERFACE='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + i:=0; + val(s,i,erreur); + ServeurInterfaceCDM:=i; + end; + + sa:='RETRO='; + i:=pos(sa,s); + if i<>0 then + begin + inc(nv); + delete(s,i,length(sa)); + i:=0; + val(s,i,erreur); + ServeurRetroCDM:=i; + end; + + inc(it); + + until (Nv>=17) or (it>30); + //affiche(IntToSTR(Nv)+' variables',clblue); + if it>30 then + begin affiche('ERREUR: manque variables dans config-gl.cfg',clred);exit;end; + //Affiche('Valeurs d''initialisation des aiguillages',clyellow); - // Serveur de rétrosignalisation de CDM - s:=lit_ligne; - val(s,i,erreur); - ServeurRetroCDM:=i; - closefile(fichier); Affiche('lecture du fichier de configuration config.cfg',clyellow); @@ -3547,11 +3706,12 @@ begin if Raz_Acc_signaux then Affiche('Avec Raz commande signaux',clYellow); Affiche('Définition des aiguillages',clyellow); - // définition des aiguillages dans les branches + // définition des aiguillages maxaiguillage:=0; Nligne:=1; repeat - s:=lit_ligne;sOrigine:=s;mod_aiguillages[Nligne]:=s;inc(Nligne); + s:=lit_ligne;sOrigine:=s;inc(Nligne); + //Affiche(s,ClLime); //chaine:=s; if debugconfig then Affiche(s,ClLime); if (s<>'0') then @@ -3559,33 +3719,34 @@ begin virgule:=pos(',',s); enregistrement:=copy(s,1,virgule-1); // adresse de l'aiguillage [TRI] delete(s,1,virgule); - triple:=pos('TRI',enregistrement)<>0; - if pos('B',enregistrement)<>0 then bis:=1 else bis:=0; - tjd:=pos('TJD',enregistrement)<>0; - tjs:=pos('TJS',enregistrement)<>0; + postriple:=pos('TRI',enregistrement);triple:=postriple<>0;if triple then delete(enregistrement,postriple,3); + postjd:=pos('TJD',enregistrement);tjd:=postjd<>0;if tjd then delete(enregistrement,postjd,3); + postjs:=pos('TJS',enregistrement);tjs:=postjs<>0;if tjs then delete(enregistrement,postjs,3); + // adresse de l'aiguillage Val(enregistrement,aig,erreur); // aig = adresse de l'aiguillage + if erreur<>0 then Affiche('Erreur aiguillage '+intToSTR(aig)+' ; caractère '+enregistrement[erreur]+' inconnu',clred); if aig>maxaiguillage then maxaiguillage:=aig; if debugConfig then Affiche('Adresse='+IntToSTR(aig)+' enregistrement='+Enregistrement,clyellow); - if bis=0 then begin aiguillage[aig].AdroitB:='Z'; aiguillage[aig].AdevieB:='Z'; aiguillage[aig].ApointeB:='Z'; aiguillage[aig].Adevie2B:='Z';end - else begin aiguillageB[aig].AdroitB:='Z';aiguillageB[aig].AdevieB:='Z';aiguillageB[aig].ApointeB:='Z';aiguillageB[aig].Adevie2B:='Z';end ; + aiguillage[aig].AdroitB:='Z'; aiguillage[aig].AdevieB:='Z'; + aiguillage[aig].DdroitB:='Z'; aiguillage[aig].DdevieB:='Z'; + + aiguillage[aig].ApointeB:='Z'; + aiguillage[aig].Adevie2B:='Z'; if (triple) then aiguillage[aig].modele:=4; if (tjs) then begin - if bis=0 then aiguillage[aig].modele:=3 - else aiguillageB[aig].modele:=3; + aiguillage[aig].modele:=3 end; if (tjd) then begin - if bis=0 then aiguillage[aig].modele:=2 - else aiguillageB[aig].modele:=2; + aiguillage[aig].modele:=2 ; end; if not(tjs) and not(tjd) and not(triple) then begin - if bis=0 then aiguillage[aig].modele:=1 - else aiguillageB[aig].modele:=1; + aiguillage[aig].modele:=1; end; //if debugConfig then Affiche(s,clyellow); @@ -3599,137 +3760,71 @@ begin ComptEl:=0;Compt_It:=0;Num_element:=Num_element+1; // préparer l'enregistrement pour la boucle de ligne virgule:=pos(',',s); - enregistrement:=copy(s,1,virgule-1); - delete(s,1,virgule); + if tjd then enregistrement:=s else + begin + enregistrement:=copy(s,1,virgule-1); + delete(s,1,virgule); + end; + + //Affiche('S='+s,clyellow); + //debugconfig:=true; repeat // parcoure la ligne if (debugConfig) then Affiche('boucle de ligne: '+s,clYellow); - if (length(enregistrement)<>0) then if (enregistrement[1]='P') then begin + if tjd then begin affiche('Erreur P interdit dans une TJD : '+sOrigine,clred);closefile(fichier);exit; end; if debugconfig then Affiche('Section P - enregistrement='+enregistrement,clYellow); ComptEl:=ComptEl+1; - decodeAig(enregistrement,detect,c,bisBool); + decodeAig(enregistrement,detect,c); if c='' then c:='Z'; - if (bis=1) and (bisBool=false) then - begin - aiguillageB[aig].ApointeBis:=0; - aiguillageB[aig].Apointe:=detect; - aiguillageB[aig].ApointeB:=c; - end; - if (bis=0) and (bisBool=true) then - begin - aiguillage[aig].ApointeBis:=1; - aiguillage[aig].Apointe:=detect; - aiguillage[aig].ApointeB:=c; - end; - if (bis=0) and (bisBool=false) then - begin - aiguillage[aig].ApointeBis:=0; - aiguillage[aig].Apointe:=detect; - aiguillage[aig].ApointeB:=c; - end; - if (bis=1) and (bisBool=true) then - begin - aiguillageB[aig].ApointeBis:=1; - aiguillageB[aig].Apointe:=detect; - aiguillageB[aig].ApointeB:=c; - end; + aiguillage[aig].Apointe:=detect; + aiguillage[aig].ApointeB:=c; - virgule:=pos(',',s);if virgule=0 then virgule:=length(s)+1; enregistrement:=copy(s,1,virgule-1); delete(s,1,virgule); - { - - delete(enregistrement,1,1); // supprime le P - detect:=0; - Val(enregistrement,detect,erreur); - if erreur<>0 then delete(enregistrement,1,erreur-1); - //if ((aig=0) and (erreur=0)) then Affiche('Erreur pas d''adresse dans section P: '+chaine,clRed); - if (erreur=0) then enregistrement:=copy(s,1,virgule-1); - if bis=0 then aiguillage[aig].Apointe:=detect else aiguillageB[aig].Apointe:=detect; - if (erreur<>0) then // si erreur<>0 peut être un B ou un S ou un , - begin - if (enregistrement[1]='B') then - begin - if bis=0 then aiguillage[aig].ApointeBis:=1 else aiguillageB[aig].ApointeBis:=1; - delete(enregistrement,1,1); - if (debugConfig) then affiche('connecté a aiguillage BIS'+s,clYellow); - end; - if bis=0 then aiguillage[aig].ApointeB:=enregistrement[1] else aiguillageB[aig].ApointeB:=enregistrement[1]; - delete(enregistrement,1,1); - Num_element:=Num_element+1; - end; - virgule:=pos(',',s);if virgule=0 then virgule:=length(s)+1; - enregistrement:=copy(s,1,virgule-1); - delete(s,1,virgule); - } - end; + + end; if (length(enregistrement)<>0) then // section droite if (enregistrement[1]='D') then begin if debugconfig then Affiche('Section D - enregistrement='+enregistrement,clYellow); ComptEl:=ComptEl+1; - decodeAig(enregistrement,detect,c,bisBool); - if c='' then c:='Z'; - if (bis=1) and (bisBool=false) then - begin - aiguillageB[aig].AdroitBis:=0; - aiguillageB[aig].Adroit:=detect; - aiguillageB[aig].AdroitB:=c; - end; - if (bis=0) and (bisBool=true) then - begin - aiguillage[aig].AdroitBis:=1; + + if tjd then + begin + s:=Enregistrement; + Delete(s,1,2); + decodeAig(s,detect,c); aiguillage[aig].Adroit:=detect; aiguillage[aig].AdroitB:=c; - end; - if (bis=0) and (bisBool=false) then + i:=pos(',',s);Delete(s,1,i); + decodeAig(s,detect,c); + aiguillage[aig].DDroit:=detect; + aiguillage[aig].DdroitB:=c; + i:=pos(')',enregistrement);if i=0 then begin Affiche('Erreur de syntaxe ligne '+SOrigine,clred);closefile(fichier);exit;end; + Delete(enregistrement,1,i+1); + i:=pos(')',s); delete(s,1,i); + // mettre en forme s + i:=pos(')',s); delete(s,1,i); + i:=pos(',',s); delete(s,1,i); + + //Affiche(enregistrement,clBlue); + end + else begin - aiguillage[aig].AdroitBis:=0; - aiguillage[aig].Adroit:=detect; + decodeAig(enregistrement,detect,c); + if c='' then c:='Z'; + aiguillage[aig].Adroit:=detect; aiguillage[aig].AdroitB:=c; - end; - if (bis=1) and (bisBool=true) then - begin - aiguillageB[aig].AdroitBis:=1; - aiguillageB[aig].Adroit:=detect; - aiguillageB[aig].AdroitB:=c; - end; - virgule:=pos(',',s);if virgule=0 then virgule:=length(s)+1; - enregistrement:=copy(s,1,virgule-1); - delete(s,1,virgule); - { - delete(enregistrement,1,1); // supprime le P - Val(enregistrement,detect,erreur); - if erreur<>0 then delete(enregistrement,1,erreur-1); - if debugconfig then Affiche(enregistrement,clyellow); - //if ((aig=0) and (erreur=0)) then Affiche('Erreur pas d''adresse dans section D: '+chaine,clRed); - if (erreur=0) then enregistrement:=''; - if bis=0 then aiguillage[aig].Adroit:=detect else aiguillageB[aig].Adroit:=detect; - if (erreur<>0) then // si erreur<>0 peut être un B ou un S ou un , - begin - if (enregistrement[1]='B') then - begin - if bis=0 then aiguillage[aig].AdroitBis:=1 else aiguillageB[aig].AdroitBis:=1; - delete(enregistrement,1,1); - if (debugConfig) then affiche('connecté a aiguillage BIS'+s,clYellow); - end; - if (enregistrement[1]<>',') then // copier si c'est S P D - begin - if bis=0 then aiguillage[aig].AdroitB:=enregistrement[1] else aiguillageB[aig].AdroitB:=enregistrement[1]; - delete(enregistrement,1,1); - if (debugConfig) then affiche('connecté a aiguillage BIS'+s,clYellow); - end; - delete(enregistrement,1,1); - Num_element:=Num_element+1; + + virgule:=pos(',',s);if virgule=0 then virgule:=length(s)+1; + enregistrement:=copy(s,1,virgule-1); + delete(s,1,virgule); end; - virgule:=pos(',',s);if virgule=0 then virgule:=length(s)+1; - enregistrement:=copy(s,1,virgule-1); - delete(s,1,virgule);} end; if (length(enregistrement)<>0) then @@ -3737,64 +3832,78 @@ begin begin if debugconfig then Affiche('Section S - enregistrement='+enregistrement,clYellow); ComptEl:=ComptEl+1; - delete(enregistrement,1,1); // supprime le S - erreur:=pos('2-',enregistrement); - S2:=erreur<>0; - if (S2) then delete(enregistrement,erreur,2); - erreur:=pos('S2',enregistrement); // description d'un rattachement à la branche S2 d'un aiguillage triple - tec:=erreur<>0; // ne supprimer que le 2 - if (tec) then delete(enregistrement,erreur+1,1); + if tjd then + begin + Delete(enregistrement,1,2); + decodeAig(enregistrement,detect,c); + aiguillage[aig].Adevie:=detect; + aiguillage[aig].AdevieB:=c; + i:=pos(',',enregistrement);Delete(enregistrement,1,i); + decodeAig(enregistrement,detect,c); + aiguillage[aig].DDevie:=detect; + aiguillage[aig].DDevieB:=c; + i:=pos(')',enregistrement);if i=0 then begin Affiche('Erreur de syntaxe ligne '+SOrigine,clred);closefile(fichier);exit;end; + Delete(enregistrement,1,i+1); + // mettre en forme s + i:=pos(')',s); delete(s,1,i); + i:=pos(',',s); delete(s,1,i); - erreur:=pos('B',enregistrement); // description d'un rattachement connecté à un aiguillage bis - bistec:=erreur<>0; - if (bistec) then delete(enregistrement,erreur,1); // ne supprime que le B - val(enregistrement,detect,erreur); // extraction de l'adresse - //if ((detect=0) and (erreur=0)) then Affiche('Erreur pas d''adresse dans section S: '+s,clred); - c:='Z'; - if (erreur<>0) then begin delete(enregistrement,1,erreur-1);c:=enregistrement[1];end; + //Affiche(enregistrement,clBlue); + end + else + begin + delete(enregistrement,1,1); // supprime le S + erreur:=pos('2-',enregistrement); + S2:=erreur<>0; + if (S2) then delete(enregistrement,erreur,2); - if (bis=0) and not(bistec) and not(S2) and not(tec) then begin aiguillage[aig].Adevie:=detect;aiguillage[aig].AdevieB:=c;end; - if (bis=0) and not(bistec) and S2 and not(tec) then begin aiguillage[aig].Adevie2:=detect;aiguillage[aig].Adevie2B:=c;end; - if (bis=0) and not(bistec) and S2 and tec then begin aiguillage[aig].Adevie2:=detect;aiguillage[aig].Adevie2B:='T';end; - if (bis=0) and (bistec) and not(S2) and not(tec) then begin aiguillage[aig].Adevie:=detect;aiguillage[aig].AdevieBis:=1;aiguillage[aig].AdevieB:=c;end; + erreur:=pos('S2',enregistrement); // description d'un rattachement à la branche S2 d'un aiguillage triple + tec:=erreur<>0; // ne supprimer que le 2 + if (tec) then delete(enregistrement,erreur+1,1); - if (bis=1) and not(bistec) and not(S2) and not(tec) then begin aiguillageB[aig].Adevie:=detect;aiguillageB[aig].AdevieB:=c;end; - if (bis=1) and not(bistec) and S2 and not(tec) then begin aiguillageB[aig].Adevie2:=detect;aiguillageB[aig].Adevie2B:=c;end; - if (bis=1) and not(bistec) and S2 and tec then begin aiguillageB[aig].Adevie2:=detect;aiguillageB[aig].Adevie2B:='T';end; - if (bis=1) and (bistec) and not(S2) and not(tec) then begin aiguillageB[aig].Adevie:=detect;aiguillageB[aig].AdevieBis:=1;aiguillageB[aig].AdevieB:=c;end; + val(enregistrement,detect,erreur); // extraction de l'adresse + //if ((detect=0) and (erreur=0)) then Affiche('Erreur pas d''adresse dans section S: '+s,clred); + c:='Z'; + if (erreur<>0) then begin delete(enregistrement,1,erreur-1);c:=enregistrement[1];end; - virgule:=pos(',',s);if virgule=0 then virgule:=length(s)+1; - enregistrement:=copy(s,1,virgule-1); - delete(s,1,virgule); + if not(S2) and not(tec) then begin aiguillage[aig].Adevie:=detect;aiguillage[aig].AdevieB:=c;end; + if S2 and not(tec) then begin aiguillage[aig].Adevie2:=detect;aiguillage[aig].Adevie2B:=c;end; + if S2 and tec then begin aiguillage[aig].Adevie2:=detect;aiguillage[aig].Adevie2B:='T';end; + + virgule:=pos(',',s);if virgule=0 then virgule:=length(s)+1; + enregistrement:=copy(s,1,virgule-1); + delete(s,1,virgule); + end; end; + if (length(enregistrement)<>0) then + if (enregistrement[1]='I') then + begin + delete(enregistrement,1,1); + Val(enregistrement,adr,erreur); + enregistrement:=''; + //Affiche(intTostr(adr),clblue); + Aiguillage[aig].inversionCDM:=adr; + end; + + //Affiche(s+'/'+Enregistrement,clLime); // si vitesse définie Val(enregistrement,adr,erreur); if erreur=0 then begin + Affiche('section vitesse définie aig='+intToSTR(aig)+'/'+intToSTR(adr),clyellow); aiguillage[aig].vitesse:=adr; enregistrement:=''; virgule:=pos(',',s);if virgule=0 then virgule:=length(s)+1; enregistrement:=copy(s,1,virgule-1); delete(s,1,virgule); - end; - - // si inversion aiguillage BIS - Val(enregistrement,adr,erreur); - if erreur=0 then - begin - if bis=0 then - begin - Affiche('Avertissement: le paramètre de lecture inversée de la position pour l''aiguillage non bis '+intToSTR(aig)+' sera ignorée',clOrange); - end; - if bis=1 then aiguillageB[aig].inversionCDM:=adr; - - enregistrement:=''; + s:='';enregistrement:=''; end; until enregistrement='' ; end; + // Affiche(s,clLime); until (s='0'); //Affiche(IntToSTR(maxaiguillage)+' Aiguillages',clYellow); @@ -3877,7 +3986,7 @@ begin s:=lit_ligne; if s<>'0' then begin - chaine:=s; mod_Signaux[Nligne]:=s;inc(Nligne); + chaine:=s; inc(Nligne); //Affiche(s,clYellow); finifeux:=s[1]='0'; if not(finifeux) then @@ -3985,7 +4094,7 @@ begin if (j=2) then feux[i].Adr_det2:=adr; if (j=3) then feux[i].Adr_det3:=adr; if (j=4) then feux[i].Adr_det4:=adr; - //type de l'élément suivant (1=détecteur 2=aig ou TJD ou TJS 4=tri 5=bis + //type de l'élément suivant (1=détecteur 2=aig ou TJD ou TJS 4=tri t:=0; if s[1]='A' then begin @@ -4008,17 +4117,7 @@ begin if (j=3) then feux[i].Btype_Suiv3:=4; if (j=4) then feux[i].Btype_Suiv4:=4; end; - l:=pos('B',s); - if l<>0 then - begin - t:=5; - delete(s,l,1); - //Affiche('détecté aiguillage bis',clyellow); - if (j=1) then feux[i].Btype_Suiv1:=5; - if (j=2) then feux[i].Btype_Suiv2:=5; - if (j=3) then feux[i].Btype_Suiv3:=5; - if (j=4) then feux[i].Btype_Suiv4:=5; - end; + if t=0 then //détecteur begin if (j=1) then feux[i].Btype_Suiv1:=1; @@ -4069,7 +4168,7 @@ begin //Affiche('Conditions supplémentaires pour le feu '+IntToSTR(adresse)+' parenthèse '+intToSTR(l),clyellow); k:=pos(')',s); sa:=copy(s,t+1,k-t-1); // contient l'intérieur des parenthèses sans les parenthèses - //Affiche(sa,clRed); + //Affiche(sa,clLime); delete(s,1,k);//Affiche(s,clYellow); // boucle dans la parenthèse bd:=0; @@ -4085,13 +4184,13 @@ begin if chaine[1]='A' then begin delete(chaine,1,1); + //Affiche(chaine,ClOrange); val(chaine,adresse,erreur); feux[i].condCarre[l][bd].Adresse:=adresse; if erreur<>0 then feux[i].condCarre[l][bd].PosAig:=chaine[erreur] else - Affiche('Définition du feu '+IntToSTR(adresse)+': erreur dans les conditions de carré des aiguillages',clred); + Affiche('Définition du feu '+IntToSTR(feux[i].adresse)+': Manque D ou S dans les conditions de carré des aiguillages',clred); end; - - + k:=pos(',',sa);if k<>0 then delete(sa,1,k); //Affiche(sa,clyellow); until k=0; @@ -4209,7 +4308,7 @@ begin closefile(fichier); // vérification de la cohérence1 - // parcoure les branches des détecteurs jusqu'à trouver un aiguillage pour voir s'il a été décrit + // parcoure les branches jusqu'à trouver un aiguillage pour voir s'il a été décrit for i:=1 to NbreBranches do begin j:=1; @@ -4229,8 +4328,25 @@ begin // vérification de la cohérence2 // parcoure les aiguillages pour voir si les détecteurs sont en branches des détecteurs + // et les tjd pour voir si pb de cohérence for aig:=1 to maxaiguillage do begin + // tjd + if aiguillage[aig].modele=2 then + begin + if aiguillage[aig].Ddroit<>aiguillage[aig].Ddevie then + Affiche('Erreur 7: la TJD '+IntToStr(aig)+' a des adresses de destination différentes ('+intToSTR(aiguillage[aig].Ddroit)+' et '+intToSTR(aiguillage[aig].Ddevie)+')',clred); + // vérifier si son homologue est une tjd + adr2:=aiguillage[aig].Ddroit; + if aiguillage[adr2].modele<>2 then Affiche('Erreur 8: l''aiguillage '+intToStr(Adr2)+' n''est pas une TJD, mais apparait dans la TJD '+IntToSTR(aig),clred); + end; + // vérifier si l'aiguillage est dans les branches + if aiguillage[aig].modele<>0 then + begin + trouve_aiguillage(aig); + if (IndexBranche_trouve=0) then + Affiche('Erreur 6: aiguillage '+intToSTR(aig)+' décrit dans les aiguillages mais absent dans la description des branches',clred); + end; adr:=aiguillage[aig].Adroit; if (aiguillage[aig].AdroitB='Z') then begin @@ -4259,7 +4375,7 @@ begin adr:=aiguillage[aig].Adevie2; trouve_detecteur(adr); // branche_trouve IndexBranche_trouve if (IndexBranche_trouve=0) then - Affiche('Erreur 5 : détecteur '+intToSTR(adr)+' décrit dans l''aiguillage '+intToSTR(aig)+' mais absent dans la description des branches',clRed); + Affiche('Erreur 5 : détecteur '+intToSTR(adr)+' décrit dans l''aiguillage '+intToSTR(aig)+' mais absent dans la description des branches',clRed); end; end; end; @@ -4290,37 +4406,38 @@ begin result:=0; end; -// trouve un élément dans les branches, renvoie branche_trouve IndexBranche_trouve +// trouve un élément dans les branches à partir de la branche offset renvoie branche_trouve IndexBranche_trouve // el : adresse de l'élément TypeEL=(1=détécteur 2=aig 3=aig Bis 4=aig triple) -procedure trouve_element(el : integer;TypeEl : integer); +procedure trouve_element(el, TypeEl, Offset : integer); var i,Btype,adr,Branche : integer ; s : string; sort : boolean; begin - Branche:=1; + //Affiche('cherche'+IntToSTR(el)+'/'+IntToSTR(TypeEl),clred); + Branche:=Offset; branche_trouve:=0; IndexBranche_trouve:=0; i:=1; repeat adr:=BrancheN[Branche,i].Adresse; Btype:=BrancheN[Branche,i].BType; + //Affiche(IntToSTR(adr)+'/'+IntToSTR(BType),clred); if ((adr=0) and (Btype=0)) then begin inc(Branche);i:=0;end; inc(i); - sort:=(Branche>NbreBranches) or - ((adr=el) and (TypeEl=5) and (Btype=3)) or //typeEl=5=aig bis + sort:=(Branche>NbreBranches) or // 1= détecteur 2= aiguillage 3=bis 4=Buttoir ((adr=el) and (TypeEl=4) and (Btype=2)) or //typeEl=4=aig triple ((adr=el) and (TypeEl=3) and (Btype=3)) or ((adr=el) and (TypeEl=2) and (Btype=2)) or - ((adr=el) and (TypeEl=1) and (Btype=1)) or + ((adr=el) and (TypeEl=1) and (Btype=1)) or ((adr=el) and (TypeEl=1) and (Btype=4)) ; //buttoir until (sort); if (adr=el) then begin branche_trouve:=Branche; IndexBranche_trouve:=i-1; + //Affiche('trouvé',clgreen); end else begin s:='Erreur 175 - élément '+intToSTR(el); - if (TypeEl=3) then s:=s+'bis'; s:=s+' non trouvé';Affiche(s,clred); branche_trouve:=0; IndexBranche_trouve:=0; if NivDebug>=1 then AfficheDebug(s,clred); @@ -4341,13 +4458,30 @@ end; // 9998= arret sur aiguillage en talon mal positionnée // 9997: arrêt sur aiguillage dévié // 9996: arrêt sur position inconnue d'aiguillage +// 9995: TJD non résolue // typeGen : 1=detecteur 2=aiguillage 3=aiguillage bis -function suivant_alg3(prec : integer;typeELprec : integer;actuel : integer;typeElActuel : integer;alg : integer) : integer; +function suivant_alg3(prec : integer;typeELprec : integer;var actuel : integer;typeElActuel : integer;alg : integer) : integer; var Btype,Adr,AdrPrec,BtypePrec,indexBranche_prec,branche_trouve_prec,indexBranche_actuel,branche_trouve_actuel, - tjsc1,tjsc2,AdrTjdP,Adr2,Abis,TypeEl,N_iteration : integer; + tjsc1,tjsc2,AdrTjdP,Adr2,TypeEl,N_iteration : integer; tjscourbe1,tjscourbe2,tjd,tjs : boolean; A,Aprec,tjsc1B,tjsc2B: char; s : string; + + procedure substitue; + begin + if (typeGen=2) then // si le précédent est une TJD/S et le suivant aussi , substituer pointe (chgt de actuel en VAR dans la déclaration de alg3) + begin + if ((aiguillage[Adr].modele=2) or (aiguillage[Adr].modele=3)) and + ((aiguillage[Actuel].modele=2) or (aiguillage[Actuel].modele=3)) then + begin + if nivDebug=3 then AfficheDebug('500 - Détection Précédent=TJD/S Suivant=TJD/S',clyellow); + // subsituer la pointe + Actuel:=aiguillage[Actuel].APointe; + end; + end; + end; + + label recommence; begin n_iteration:=0; @@ -4362,7 +4496,7 @@ begin end; if NivDebug=3 then AfficheDebug('Alg3 précédent='+intToSTR(prec)+'/'+intToStr(TypeElprec)+' actuel='+intToSTR(actuel)+'/'+IntToSTR(typeElActuel),clyellow); // trouver les éléments du précédent - trouve_element(prec,TypeELPrec); // branche_trouve IndexBranche_trouve + trouve_element(prec,TypeELPrec,1); // branche_trouve IndexBranche_trouve if IndexBranche_trouve=0 then begin if NivDebug=3 then AfficheDebug('Element '+intToSTR(prec)+' non trouvé',clred); @@ -4374,7 +4508,7 @@ begin BtypePrec:=BrancheN[branche_trouve_prec,indexBranche_prec].Btype; // if BTypePrec=2 then aiguillage[prec].A - trouve_element(actuel,typeElActuel); // branche_trouve IndexBranche_trouve + trouve_element(actuel,typeElActuel,1); // branche_trouve IndexBranche_trouve if IndexBranche_trouve=0 then begin if NivDebug=3 then AfficheDebug('Element '+intToSTR(actuel)+' non trouvé',clred); @@ -4400,12 +4534,11 @@ begin A:='Z'; Adr:=BrancheN[branche_trouve_actuel,indexBranche_actuel+1].Adresse; typeGen:=BrancheN[branche_trouve_actuel,indexBranche_actuel+1].Btype; - if NivDebug=3 then + if NivDebug=3 then begin s:='41 - Le suivant est :'+intToSTR(adr); - if Btype=1 then s:=s+'(bis)'; AfficheDebug(s,clwhite); - end; + end; suivant_alg3:=adr; exit; end; @@ -4417,27 +4550,26 @@ begin A:='Z'; Adr:=BrancheN[branche_trouve_actuel,indexBranche_actuel-1].Adresse; typeGen:=BrancheN[branche_trouve_actuel,indexBranche_actuel-1].Btype; - if NivDebug=3 then + if NivDebug=3 then begin s:='43 - Le suivant est :'+intToSTR(adr); - if typeGen=1 then s:=s+'(bis)'; AfficheDebug(s,clwhite); - end; + end; suivant_alg3:=adr; exit; end; // ici, les éléments sont non consécutifs. voir si l'un des deux est une TJD/TJS if (btypePrec=2) or (btypePrec=3) then begin - if NivDebug=3 then AfficheDebug('Le précedent est une TJD/S - substitution du precédent par la pointe de la TJD',clYellow); // changer l'adresse du précédent par l'autre adresse de la TJD/S - prec:=Aiguillage[prec].APointe; + prec:=Aiguillage[prec].Ddroit; + if NivDebug=3 then AfficheDebug('Le précedent est une TJD/S - substitution du precédent par la pointe de la TJD qui est '+intToSTR(prec),clYellow); inc(n_iteration); - if n_iteration>50 then + if n_iteration>50 then begin s:='Erreur fatale 9999, trop d''itérations'; Affiche(s,clRed); - AfficheDebug(s,clRed); + AfficheDebug(s,clRed); suivant_alg3:=9999; exit; end; @@ -4465,12 +4597,10 @@ begin end; BtypePrec:=Btype; Aprec:=a; - ABis:=aiguillage[Adr].AdroitBis; // Abis=1 si aiguillage bis A:=aiguillage[Adr].AdroitB; Adr:=aiguillage[Adr].Adroit; if A='Z' then TypeEl:=1 else TypeEL:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then TypeEl:=3; - trouve_element(adr,typeEl); // branche_trouve IndexBranche_trouve + trouve_element(adr,typeEl,1); // branche_trouve IndexBranche_trouve typeGen:=BrancheN[branche_trouve,IndexBranche_trouve].Btype; suivant_alg3:=adr; exit; @@ -4493,11 +4623,9 @@ begin BtypePrec:=Btype; Aprec:=A; A:=aiguillage[Adr].AdevieB; - ABis:=aiguillage[Adr].AdevieBis; // Abis=1 si aiguillage bis Adr:=aiguillage[Adr].Adevie; if A='Z' then TypeEl:=1 else TypeEL:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then TypeEl:=3; - trouve_element(adr,TypeEl); // branche_trouve IndexBranche_trouve + trouve_element(adr,TypeEl,1); // branche_trouve IndexBranche_trouve typeGen:=BrancheN[branche_trouve,IndexBranche_trouve].Btype; suivant_alg3:=adr;exit; end; @@ -4541,13 +4669,11 @@ begin end; BtypePrec:=Btype; APrec:=A; - // Affiche('trouvé'+intToSTR(adr),clyellow); A:=aiguillage[Adr].ApointeB; - ABis:=aiguillage[Adr].ApointeBis; Adr:=aiguillage[Adr].Apointe; + // Affiche('trouvé '+intToSTR(adr),clyellow); if A='Z' then TypeEl:=1 else TypeEL:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then TypeEl:=3; - trouve_element(adr,TypeEl); // branche_trouve IndexBranche_trouve + trouve_element(adr,TypeEl,1); // branche_trouve IndexBranche_trouve typeGen:=BrancheN[branche_trouve,IndexBranche_trouve].Btype; suivant_alg3:=adr; exit; @@ -4557,114 +4683,17 @@ begin suivant_alg3:=9999;exit; end; - if (aiguillageB[Adr].modele=1) and (Btype=3) then // aiguillage normal bis - begin - // aiguillage pris en pointe - if (aiguillageB[Adr].Apointe=Prec) then - begin - if (aiguillageB[Adr].position=const_droit) then - begin - if NivDebug=3 then AfficheDebug('140 - Aiguillage '+intToSTR(adr)+' bis pris en pointe droit',clyellow); - AdrPrec:=Adr; - if (Adr=0) then begin Affiche('141 - Erreur fatale',clred);suivant_alg3:=9999;exit;end; - BtypePrec:=Btype; - APrec:=A; - A:=aiguillageB[Adr].AdroitB; - ABis:=aiguillageB[Adr].AdroitBis; - Adr:=aiguillageB[Adr].Adroit; - if A='Z' then TypeEl:=1 else TypeEL:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then TypeEl:=3; - trouve_element(Adr,TypeEl); // branche_trouve IndexBranche_trouve - typeGen:=BrancheN[branche_trouve,IndexBranche_trouve].BType; - suivant_alg3:=Adr; - exit; - end; - if (aiguillageB[Adr].position<>const_droit) then - begin - if NivDebug=3 then AfficheDebug('142 - Aiguillage '+intToSTR(adr)+' bis pris en pointe dévié',clyellow); - AdrPrec:=Adr; - if alg=3 then // on demande d'arreter si l'aiguillage pris en pointe est dévié - begin - typeGen:=3; - AdrDevie:=Adr; - suivant_alg3:=9997;exit; - end; - if (Adr=0) then begin Affiche('144 - Erreur fatale',clred);suivant_alg3:=9999;exit;end; - BtypePrec:=Btype; - APrec:=A; - A:=aiguillageB[Adr].AdevieB; - ABis:=aiguillageB[Adr].AdevieBis; - Adr:=aiguillageB[Adr].Adevie; - if A='Z' then TypeEl:=1 else TypeEL:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then TypeEl:=3; - trouve_element(Adr,TypeEl); // branche_trouve IndexBranche_trouve - typeGen:=BrancheN[branche_trouve,IndexBranche_trouve].BType; - suivant_alg3:=Adr; - exit; - end; - end - else - begin - if (NivDebug=3) then AfficheDebug('145 - Aiguillage '+IntToSTR(adr)+' bis pris en talon',clyellow); - if alg=2 then // on demande d'arreter si l'aiguillage en talon est mal positionné - begin - if aiguillageB[adr].position=const_droit then - begin - if prec<>aiguillageB[Adr].Adroit then - begin - if NivDebug=3 then AfficheDebug('135.3 - Aiguillage '+intToSTR(adr)+'bis mal positionné',clyellow); - suivant_alg3:=9998;exit; - end - else - begin - if NivDebug=3 then AfficheDebug('135.4 - Aiguillage '+intToSTR(adr)+'bis bien positionné',clyellow); - end; - end - else - begin - if prec<>aiguillageB[Adr].Adevie then - begin - if NivDebug=3 then AfficheDebug('Aiguillage '+intToSTR(adr)+'bis mal positionné',clyellow); - suivant_alg3:=9998;exit; - end - else - begin - if NivDebug=3 then AfficheDebug('Aiguillage '+intToSTR(adr)+'bis bien positionné',clyellow); - end; - end; - end; - AdrPrec:=Adr; - if Adr=0 then - begin Affiche('139 - Erreur fatale',clRed); - if NivDebug>=1 then AfficheDebug('139 - Erreur fatale',clRed); - suivant_alg3:=9999;exit; - end; - BtypePrec:=Btype; - APrec:=A; - // Affiche('trouvé'+intToSTR(adr),clyellow); - A:=aiguillageB[Adr].ApointeB; - ABis:=aiguillageB[Adr].ApointeBis; - Adr:=aiguillageB[Adr].Apointe; - if A='Z' then TypeEl:=1 else TypeEL:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then TypeEl:=3; - trouve_element(adr,TypeEl); // branche_trouve IndexBranche_trouve - typeGen:=BrancheN[branche_trouve,IndexBranche_trouve].Btype; - suivant_alg3:=adr; - exit; - end; - end; - if (aiguillage[Adr].modele=2) or (aiguillage[Adr].modele=3) then // TJD ou TJS begin // récupérer les élements de la TJD/S - AdrTjdP:=aiguillage[Adr].Apointe; // 2eme adresse de la TJD/S + AdrTjdP:=aiguillage[Adr].Ddroit; // 2eme adresse de la TJD/S tjd:=aiguillage[Adr].modele=2; tjs:=aiguillage[Adr].modele=3; tjsc1:=aiguillage[Adr].tjsint; // adresses de la courbe de la TJS tjsc2:=aiguillage[AdrTjdP].tjsint; tjsc1B:=aiguillage[Adr].tjsintB; tjsc2B:=aiguillage[AdrTjdP].tjsintB; - if tjsc1<>0 then + if tjsc1<>0 then // si tjs begin tjscourbe1:=(aiguillage[Adr].tjsintB='S') and (aiguillage[tjsc1].position<>const_droit); tjscourbe1:=((aiguillage[Adr].tjsintB='D') and (aiguillage[tjsc1].position=const_droit)) or tjscourbe1; @@ -4674,32 +4703,94 @@ begin tjscourbe2:=(aiguillage[AdrTjdP].tjsintB='S') and (aiguillage[tjsc2].position<>const_droit); tjscourbe2:=((aiguillage[AdrTjdP].tjsintB='D') and (aiguillage[tjsc2].position=const_droit)) or tjscourbe2; end; + + if NivDebug=3 then AfficheDebug('137 - TJD '+intToSTR(Adr)+'/'+IntToSTR(AdrTjdP),clYellow); - AdrTjdP:=aiguillage[Adr].Apointe; // adresse TJD homologue + s:='adr='+IntToSTR(adr)+'='; + if aiguillage[Adr].position=const_droit then s:=s+'droit' + else if aiguillage[Adr].position=const_devie then s:=s+'dévié' + else s:=s+'inconnu' ; + s:=s+'/adrTjdP='+IntToSTR(adrTJDP)+'='; + if aiguillage[AdrTJDP].position=const_droit then s:=s+'droit' + else if aiguillage[AdrTJDP].position=const_devie then s:=s+'dévié' + else s:=s+'inconnu' ; + + + // rechercher le port de destination de la tjd + Adr2:=0;A:=#0; + if aiguillage[Adr].position=const_droit then + begin + A:=aiguillage[Adr].DDroitB; + adr2:=aiguillage[Adr].DDroit; + end; + if aiguillage[Adr].position=const_devie then + begin + A:=aiguillage[Adr].DDevieB; + adr2:=aiguillage[Adr].DDevie; + end; + if nivDebug=3 then Affichedebug('le port de destination de la tjd est '+IntToSTR(adr2)+a,clyellow); + + // extraire l'élément connecté au port de destination de la tjd + if A='S' then + begin + A:=aiguillage[adr2].AdevieB; + adr2:=aiguillage[adr2].Adevie; + //Affichedebug('element connecté:'+inttostr(adr)+A,clred); + end + else + if A='D' then + begin + A:=aiguillage[adr2].AdroitB; + adr2:=aiguillage[adr2].Adroit; + end + else + begin + s:='Erreur 1021 TJD '+intToSTR(adr)+' non résolue'; + affichedebug(s,clred); + affiche(s,clred); + adr2:=9996; + end; + + if nivDebug=3 then AfficheDebug('tjd: '+s+' Suiv='+intToSTR(adr2)+A,clYellow); + if A='Z' then typeGen:=1 else typeGen:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) + suivant_alg3:=adr2; + exit; + // determiner la position de la première section de la TJD (4 cas) // cas 1 : droit droit - if (( aiguillage[Adr].position=const_droit) and - (aiguillage[AdrTjdP].position=const_droit) and tjd) then + if (( aiguillage[AdrTJdP].position=const_droit) and + (aiguillage[Adr].position=const_droit) and tjd) then begin - if NivDebug=3 then AfficheDebug('cas1 tjd',clYellow); - if aiguillage[AdrTjdP].Adroit=prec then + // d'où vient ton sur la tjd + if aiguillage[Adr].Adroit=prec then begin - A:=aiguillage[Adr].AdroitB; - Adr:=aiguillage[Adr].Adroit; - Abis:=aiguillage[Adr].AdroitBis; + + A:=aiguillage[Adr].DdroitB; + Adr:=aiguillage[Adr].Ddroit; + if A='D' then + begin + Adr:=aiguillage[AdrTjDP].Adroit; + A:=aiguillage[AdrTjDP].AdroitB; + end; + if A='S' then + begin + Adr:=aiguillage[AdrTjDP].Adevie; + A:=aiguillage[AdrTjDP].AdevieB; + end; + if NivDebug=3 then AfficheDebug('cas1.1 tjd: '+s+' Adr='+intToSTR(adr)+A,clYellow); if A='Z' then typeGen:=1 else typeGen:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then typeGen:=3; suivant_alg3:=adr; + substitue; exit; end; - if aiguillage[Adr].Adroit=prec then + if aiguillage[Adr].Adevie=prec then begin A:=aiguillage[AdrTjdP].AdroitB; Adr:=aiguillage[AdrTjdP].Adroit; - Abis:=aiguillage[AdrTjdP].AdroitBis; + if NivDebug=3 then AfficheDebug('cas1.2 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); if A='Z' then typeGen:=1 else typeGen:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then typeGen:=3; suivant_alg3:=adr; + substitue; exit; end; s:='Erreur 1021, TJD '+IntToSTR(Adr)+'/'+IntToSTR(AdrTjdP)+' mal positionnée'; @@ -4708,27 +4799,29 @@ begin Suivant_alg3:=9998;exit; end; // cas 2 TJD - if (aiguillage[Adr].position<>const_droit) + if (aiguillage[Adr].position=const_devie) and (aiguillage[AdrTjdP].position=const_droit) and tjd then begin - if NivDebug=3 then AfficheDebug('cas2 tjd',clYellow); - if aiguillage[AdrTjdP].Adroit=prec then - begin - A:=aiguillage[Adr].AdevieB; - Adr:=aiguillage[Adr].Adevie; - Abis:=aiguillage[Adr].AdevieBis; - if A='Z' then typeGen:=1 else typeGen:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then typeGen:=3; - suivant_alg3:=adr;exit; - end; if aiguillage[Adr].Adevie=prec then begin A:=aiguillage[AdrTjdP].AdroitB; - Adr:=aiguillage[AdrTjdP].Adroit; - Abis:=aiguillage[AdrTjdP].AdroitBis; + Adr:=aiguillage[AdrTJDP].Adroit; + if NivDebug=3 then AfficheDebug('cas2.1 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); if A='Z' then typeGen:=1 else typeGen:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then typeGen:=3; - suivant_alg3:=adr;exit; + substitue; + suivant_alg3:=adr; + exit; + end; + if (aiguillage[Adr].Adroit=prec) then + begin + A:=aiguillage[AdrTJDP].AdevieB; + Adr:=aiguillage[AdrTjdP].Adevie; + if NivDebug=3 then AfficheDebug('cas2.2 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); + + if A='Z' then typeGen:=1 else typeGen:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) + substitue; + suivant_alg3:=adr; + exit; end; s:='Erreur 1022, TJD '+IntToSTR(Adr)+'/'+IntToSTR(AdrTjdP)+' mal positionnée'; if nivDebug=3 then AfficheDebug(s,clred); @@ -4737,26 +4830,40 @@ begin end; // cas 3 TJD if (aiguillage[Adr].position=const_droit) - and (aiguillage[AdrTjdP].position<>const_droit) and tjd then + and (aiguillage[AdrTjdP].position=const_devie) and tjd then begin - if NivDebug=3 then AfficheDebug('cas3 tjd',clYellow); - if (aiguillage[AdrtjdP].Adevie=prec) then - begin - A:=aiguillage[AdrTjdP].AdroitB; - Adr:=aiguillage[Adr].Adroit; - Abis:=aiguillage[Adr].AdroitBis; - if A='Z' then typeGen:=1 else typeGen:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then typeGen:=3; - suivant_alg3:=adr;exit; - end; + // si on vient de if (aiguillage[Adr].Adroit=prec) then begin - A:=aiguillage[Adr].AdevieB; - Adr:=aiguillage[Adr].Adevie; - Abis:=aiguillage[Adr].AdevieBis; + if NivDebug=3 then AfficheDebug('cas3.1 tjd: '+s,clYellow); + A:=aiguillage[Adr].DdroitB; + Adr:=aiguillage[Adr].Ddroit; + if A='D' then + begin + Adr:=aiguillage[AdrTjDP].Adroit; + A:=aiguillage[AdrTjDP].AdroitB; + end; + if A='S' then + begin + Adr:=aiguillage[AdrTjDP].Adevie; + A:=aiguillage[AdrTjDP].AdevieB; + end; + if A='Z' then typeGen:=1 else typeGen:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then typeGen:=3; - suivant_alg3:=adr;exit; + //substitue; + suivant_alg3:=adr; + exit; + end; + // si on vient de + if (aiguillage[Adr].Adevie=prec) then + begin + A:=aiguillage[AdrTJDP].AdroitB; + Adr:=aiguillage[AdrTJDP].Adroit; + if NivDebug=3 then AfficheDebug('cas3.2 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); + if A='Z' then typeGen:=1 else typeGen:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) + substitue; + suivant_alg3:=adr; + exit; end; s:='Erreur 1023, TJD '+IntToSTR(Adr)+'/'+IntToSTR(AdrTjdP)+' mal positionnée'; if nivDebug=3 then AfficheDebug(s,clred); @@ -4764,32 +4871,34 @@ begin Suivant_alg3:=9998;exit; end; // cas 4 tjd - if (aiguillage[Adr].position<>const_droit) - and (aiguillage[AdrTjdP].position<>const_droit) then + if (aiguillage[Adr].position=const_devie) + and (aiguillage[AdrTjdP].position=const_devie) then begin - if NivDebug=3 then AfficheDebug('cas4 tjd',clYellow); - if aiguillage[AdrTjdP].Adevie=prec then - begin - A:=aiguillage[Adr].AdevieB; - Adr:=aiguillage[Adr].Adevie; - Abis:=aiguillage[Adr].AdevieBis; - if A='Z' then typeGen:=1 else typeGen:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then typeGen:=3; - suivant_alg3:=adr;exit; - end; if aiguillage[Adr].Adevie=prec then begin A:=aiguillage[AdrtjdP].AdevieB; Adr:=aiguillage[AdrtjdP].Adevie; - Abis:=aiguillage[AdrtjdP].AdevieBis; + if NivDebug=3 then AfficheDebug('cas4.1 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); if A='Z' then typeGen:=1 else typeGen:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then typeGen:=3; - suivant_alg3:=adr;exit; + substitue; + suivant_alg3:=adr; + exit; end; - s:='Erreur 1025, TJD '+IntToSTR(Adr)+'/'+IntToSTR(AdrTjdP)+' mal positionnée'; + if aiguillage[Adr].Adroit=prec then + begin + A:=aiguillage[AdrtjdP].AdevieB; + Adr:=aiguillage[AdrtjdP].Adevie; + if NivDebug=3 then AfficheDebug('cas4.2 tjd: '+s+' Suiv='+intToSTR(adr)+A,clYellow); + if A='Z' then typeGen:=1 else typeGen:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) + substitue; + suivant_alg3:=adr; + exit; + end; + s:='Erreur 1024, TJD '+IntToSTR(Adr)+'/'+IntToSTR(AdrTjdP)+' mal positionnée'; if nivDebug=3 then AfficheDebug(s,clred); Affiche(s,clred); - Suivant_alg3:=9998;exit; + Suivant_alg3:=9998; + exit; end; // cas TJS prise dans sa position courbe if ((aiguillage[Adr].Adevie=Prec) and (aiguillage[Adr].AdevieB=Aprec) and (aiguillage[Adr].position<>const_droit) @@ -4798,10 +4907,10 @@ begin if NivDebug=3 then AfficheDebug('cas tjs en courbe1',clYellow); A:=aiguillage[AdrTjdP].AdevieB; Adr:=aiguillage[AdrTjdP].Adevie; - ABis:=aiguillage[AdrTjdP].Adeviebis; if A='Z' then typeGen:=1 else typeGen:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then typeGen:=3; - suivant_alg3:=adr;exit; + substitue; + suivant_alg3:=adr; + exit; end; // cas 3 TJS prise dans sa 2eme position courbe if ((aiguillage[Adr].Adroit=Prec) and (aiguillage[Adr].AdroitB=Aprec) and (aiguillage[Adr].position=const_droit) @@ -4810,13 +4919,14 @@ begin if NivDebug=3 then AfficheDebug('cas1 tjs en courbe 2',clYellow); A:=aiguillage[AdrTjdP].AdevieB; Adr:=aiguillage[AdrTjdP].Adevie; - Abis:=aiguillage[AdrTjdP].AdevieBis; if A='Z' then typeGen:=1 else typeGen:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then typeGen:=3; - suivant_alg3:=adr;exit; + suivant_alg3:=adr; + substitue; + exit; end; - Affiche('139 - Erreur fatale - Aucun cas TJD/S : adr='+IntToSTR(Adr)+' '+intToSTR(AdrTJDP)+' prec='+IntTOSTR(prec),clred); - AfficheDebug('139 - Erreur fatale - Aucun cas TJD/S : adr='+IntToSTR(Adr)+' '+intToSTR(AdrTJDP)+' prec='+IntTOSTR(prec),clred); + s:='1025 - Erreur fatale - position TJD/S '+IntToSTR(Adr)+'/'+intToSTR(AdrTJDP)+' inconnue'; + Affiche(s,clred); + AfficheDebug(s,clred); suivant_alg3:=9999;exit; end; @@ -4830,36 +4940,30 @@ begin if (aiguillage[Adr].position=const_droit) and (aiguillage[Adr2].position=const_droit) then begin if NivDebug=3 then AfficheDebug('Aiguillage triple pris en pointe droit',clYellow); - typeGen:=aiguillage[Adr].AdroitBis+1; A:=aiguillage[Adr].AdroitB; Adr:=aiguillage[Adr].Adroit; if A='Z' then TypeEl:=1 else TypeEL:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then TypeEl:=3; - trouve_element(Adr,TypeEl); // branche_trouve IndexBranche_trouve + trouve_element(Adr,TypeEl,1); // branche_trouve IndexBranche_trouve typeGen:=BrancheN[branche_trouve,IndexBranche_trouve].BType; suivant_alg3:=adr;exit; end; if (aiguillage[Adr].position<>const_droit) and (aiguillage[Adr2].position=const_droit) then begin if NivDebug=3 then AfficheDebug('Aiguillage triple dévié1 (à gauche)',clYellow); - typeGen:=aiguillage[Adr].AdevieBis+1; A:=aiguillage[Adr].AdevieB; Adr:=aiguillage[Adr].Adevie; if A='Z' then TypeEl:=1 else TypeEL:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then TypeEl:=3; - trouve_element(Adr,TypeEl); // branche_trouve IndexBranche_trouve + trouve_element(Adr,TypeEl,1); // branche_trouve IndexBranche_trouve typeGen:=BrancheN[branche_trouve,IndexBranche_trouve].BType; suivant_alg3:=adr;exit; end; if (aiguillage[Adr].position=const_droit) and (aiguillage[Adr2].position<>const_droit) then begin if NivDebug=3 then AfficheDebug('Aiguillage triple dévié2 (à droite)',clYellow); - typeGen:=aiguillage[Adr].Adevie2Bis+1; A:=aiguillage[Adr].Adevie2B; Adr:=aiguillage[Adr].Adevie2; if A='Z' then TypeEl:=1 else TypeEL:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then TypeEl:=3; - trouve_element(Adr,TypeEl); // branche_trouve IndexBranche_trouve + trouve_element(Adr,TypeEl,1); // branche_trouve IndexBranche_trouve typeGen:=BrancheN[branche_trouve,IndexBranche_trouve].BType; suivant_alg3:=adr;exit; end; @@ -4918,8 +5022,7 @@ begin A:=aiguillage[Adr].ApointeB; Adr:=aiguillage[Adr].Apointe; if A='Z' then TypeEl:=1 else TypeEL:=2; //TypeEL=(1=détécteur 2=aig 3=aig Bis) - if Abis=1 then TypeEl:=3; - trouve_element(Adr,TypeEl); // branche_trouve IndexBranche_trouve + trouve_element(Adr,TypeEl,1); // branche_trouve IndexBranche_trouve typeGen:=BrancheN[branche_trouve,IndexBranche_trouve].BType; suivant_alg3:=Adr;exit; end; @@ -4949,30 +5052,51 @@ end; // renvoie l'adresse du détecteur suivant des deux éléments contigus // TypeElprec/actuel: 1= détecteur 2= aiguillage 3=bis 4=Buttoir function detecteur_suivant(prec : integer;TypeElPrec : integer;actuel : integer;TypeElActuel : integer) : integer ; -var actuelCalc,PrecCalc,etat,i,j,AdrSuiv : integer; - BisprecCalc,BisActuelCalc : integer; +var actuelCalc,PrecCalc,etat,i,j,AdrSuiv , + TypeprecCalc,TypeActuelCalc : integer; begin if NivDebug>=2 then AfficheDebug('cherche détecteur suivant aux '+IntToSTR(prec)+'/'+IntToSTR(typeElPrec)+' - '+intToSTR(actuel)+'/'+intToSTR(TypeElActuel),clyellow); j:=0; PrecCalc:=prec; - bisprecCalc:=TypeElprec; + TypeprecCalc:=TypeElprec; ActuelCalc:=actuel; - BisActuelCalc:=TypeELActuel; + TypeActuelCalc:=TypeELActuel; // étape 1 trouver le sens repeat - inc(j); - AdrSuiv:=suivant_alg3(precCalc,BisPrecCalc,actuelCalc,BisActuelCalc,1); + inc(j); + AdrSuiv:=suivant_alg3(precCalc,TypeprecCalc,actuelCalc,TypeActuelCalc,1); + if (typeGen=2) and false then // si le précédent est une TJD/S et le suivant aussi + begin + if ((aiguillage[AdrSuiv].modele=2) or (aiguillage[AdrSuiv].modele=3)) and + ((aiguillage[actuelCalc].modele=2) or (aiguillage[ActuelCalc].modele=3)) then + begin + if nivDebug=3 then AfficheDebug('501 - Détection Précédent=TJD/S Suivant=TJD/S',clyellow); + // subsituer la pointe + actuelCalc:=aiguillage[ActuelCalc].APointe; + end; + end; precCalc:=actuelCalc; - BisPrecCalc:=BisActuelCalc; + TypeprecCalc:=TypeActuelCalc; actuelCalc:=AdrSuiv; - BisActuelCalc:=typeGen; + TypeActuelCalc:=typeGen; //Affiche('Suivant signalaig='+IntToSTR(AdrSuiv),clyellow); - until (j=10) or (typeGen=1) or (AdrSuiv=0) or (AdrSuiv>=9998); // arret si détecteur zizi + until (j=10) or (typeGen=1) or (AdrSuiv=0) or (AdrSuiv>=9998); // arret si détecteur // si trouvé le sens, trouver le suivant if AdrSuiv=actuel then begin AdrSuiv:=suivant_alg3(prec,TypeElPrec,actuel,TypeElActuel,1); + {if (typeGen=2) then // si le précédent est une TJD/S et le suivant aussi + begin + if ((aiguillage[AdrSuiv].modele=2) or (aiguillage[AdrSuiv].modele=3)) and + ((aiguillage[actuel].modele=2) or (aiguillage[Actuel].modele=3)) then + begin + if nivDebug=3 then AfficheDebug('501 - Détection Précédent=TJD/S Suivant=TJD/S',clyellow); + // subsituer la pointe + actuel:=aiguillage[Actuel].APointe; + end; + end; + } end; if NivDebug=3 then AfficheDebug('Le suivant est le '+intToSTR(AdrSuiv),clYellow); detecteur_suivant:=AdrSuiv; @@ -4984,7 +5108,7 @@ procedure Det_Adj(adresse : integer); var Adr,BtypePrec,AdrFonc,Branche,BtypeFonc,AdrPrec,IndexBranche,i,Dir : integer; sortie : boolean; begin - trouve_element(adresse,1); // branche_trouve IndexBranche_trouve + trouve_element(adresse,1,1); // branche_trouve IndexBranche_trouve if (IndexBranche_trouve=0) then begin Affiche('Erreur 380 : élément '+IntToSTR(adresse)+' non trouvé',clred); @@ -5006,7 +5130,20 @@ begin i:=0; repeat if BtypeFonc<>1 then - Adr:=suivant_alg3(AdrPrec,BtypePrec,AdrFonc,BtypeFonc,2) // élément suivant mais arret sur aiguillage en talon mal positionnée + begin + Adr:=suivant_alg3(AdrPrec,BtypePrec,AdrFonc,BtypeFonc,2); // élément suivant mais arret sur aiguillage en talon mal positionnée + { if (typeGen=2) then // si le précédent est une TJD/S et le suivant aussi + begin + if ((aiguillage[Adr].modele=2) or (aiguillage[Adr].modele=3)) and + ((aiguillage[adrFonc].modele=2) or (aiguillage[AdrFonc].modele=3)) then + begin + if nivDebug=3 then AfficheDebug('502 - Détection Précédent=TJD/S Suivant=TJD/S',clyellow); + // subsituer la pointe + AdrFonc:=aiguillage[AdrFonc].APointe; + end; + end; } + end + else begin Adr:=AdrFonc;TypeGen:=BtypeFonc;end; if Adr>9990 then typeGen:=1; @@ -5014,7 +5151,7 @@ begin AdrPrec:=AdrFonc;BtypePrec:=BtypeFonc; AdrFonc:=Adr;BtypeFonc:=typeGen; i:=i+1; - sortie:=(i=20) or (Adr=0) or (Adr>9997) or (TypeGen=1); + sortie:=(i=20) or (Adr=0) or (Adr>=9996) or (TypeGen=1); until (sortie) ; // boucle de parcours if (typeGen=1) and (Dir=1) then begin Adj1:=Adr;end; if (typeGen=1) and (Dir=2) then begin Adj2:=Adr;end; @@ -5024,153 +5161,149 @@ end; // renvoie l'adresse du détecteur suivant des deux éléments // El1 et El2 peuvent être séparés par des aiguillages -// en sortie : 1= det1 non trouvé 2= det2 non trouvé -// code erreur>=9997 ou 0 +// en sortie : 9999= det1 ou det2 non trouvé +// 9996 : non trouvé function detecteur_suivant_El(el1: integer;TypeDet1 : integer;el2 : integer;TypeDet2 : integer) : integer ; var IndexBranche_det1,IndexBranche_det2,branche_trouve_det1,branche_trouve_det2,i, - j,AdrPrec,Adr,AdrFonc,Btype,BisPrec,BisFonc,BisSuiv : integer; + j,AdrPrec,Adr,AdrFonc,TypePrec,TypeFonc,i1,i2,index : integer; Sortie : boolean; s : string; - + label reprise; + begin - if NivDebug>=2 then AfficheDebug('cherche détecteur_suivant_El aux '+IntToSTR(el1)+'/'+intToSTR(TypeDet1)+'-'+intToSTR(el2)+'/'+intToSTr(TypeDet2),clyellow); -// if (El1=553) and (el2=521) then -// begin -// TraceListe:=true; -// NivDebug:=3; -// end; + if NivDebug>=2 then + AfficheDebug('Proc Detecteur_suivant_EL '+intToSTR(el1)+','+intToSTR(Typedet1)+'/'+intToSTR(el2)+','+intToSTR(Typedet2)+'-------------------------',clLime); + if (el1>9000) or (el2>9000) then + begin + if NivDebug=3 then AfficheDebug('paramètres incorrects >9000',clred); + detecteur_suivant_El:=9999; + end; + // trouver détecteur 1 - trouve_element(el1,Typedet1); // branche_trouve IndexBranche_trouve + trouve_element(el1,Typedet1,1); // branche_trouve IndexBranche_trouve if (IndexBranche_trouve=0) then begin - s:='Erreur 381 : élément '+IntToSTR(el1)+' non trouvé'; - Affiche(s,clred); - if NivDebug=3 then AfficheDebug(s,clred); - detecteur_suivant_El:=1;exit; + if NivDebug=3 then + begin + s:='611. '+IntToSTR(el1)+' non trouvé'; + AfficheDebug(s,clred); + AfficheDebug(s,clOrange); + end; + detecteur_suivant_El:=9999;exit; end; IndexBranche_det1:=IndexBranche_trouve; branche_trouve_det1:=branche_trouve; - // trouver élément 2 - trouve_element(el2,TypeDet2); // branche_trouve IndexBranche_trouve + // trouver détecteur 2 + trouve_element(el2,Typedet2,1); // branche_trouve IndexBranche_trouve if (IndexBranche_trouve=0) then begin - s:='Erreur 382 : élément '+IntToSTR(el2)+' non trouvé'; - Affiche(s,clred); - if NivDebug=3 then AfficheDebug(s,clred); - detecteur_suivant_El:=2;exit; + if NivDebug=3 then + begin + s:='612. '+IntToSTR(el2)+' non trouvé'; + AfficheDebug(s,clred); + AfficheDebug(s,clOrange); + end; + detecteur_suivant_El:=9999;exit; end; - IndexBranche_det2:=IndexBranche_trouve; branche_trouve_det2:=branche_trouve; + j:=1; // J=1 test en incrément J=2 test en décrément - j:=1; // étape 1 : trouver le sens de progression (en incrément ou en décrément) - repeat // boucle d'incrément décrément - if (NivDebug=3) then + + repeat + //préparer les variables + AdrPrec:=el1;TypePrec:=typeDet1; + if j=1 then i1:=IndexBranche_det1+1; + if j=2 then i1:=IndexBranche_det1-1; + if NivDebug=3 then begin - s:='Test 1 route en '; - if (j=1) then s:=s+'décrément ' else s:=s+'incrément '; - s:=s+'- départ depuis détecteur '+IntToSTR(el1);AfficheDebug(s,clyellow); + s:='Test 1 en '; + if (j=1) then s:=s+'incrément ' else s:=s+'décrément '; + s:=s+'- départ depuis élément '+IntToSTR(el1)+' trouvé en index='+intToSTR(IndexBranche_det1)+' Branche='+intToSTR(branche_trouve_det1); + AfficheDebug(s,clyellow); end; - AdrPrec:=el1; - BisPrec:=typeDet1; - if (j=1) then i:=IndexBranche_det1-1 else i:=IndexBranche_det1+1; - if i=0 then Affiche('Erreur élément '+intToSTR(el1)+' en index 1',clred); - //trouve_element(det1,FALSE); - Adr:=BrancheN[branche_trouve_det1,i].Adresse; // élément suivant le det1 - AdrFonc:=Adr; - Btype:=BrancheN[branche_trouve_det1,i].BType; // élément suivant/précédent - BisFonc:=Btype; + AdrFonc:=BrancheN[branche_trouve_det1,i1].adresse; + typeFonc:=BrancheN[branche_trouve_det1,i1].Btype ; + + i:=0; - if (el2<>Adr) then + if AdrFonc<>El2 then // si pas déja trouvé le sens de progression repeat - Adr:=suivant_alg3(AdrPrec,BisPrec,AdrFonc,BisFonc,1); // donne l'élément suivant de AdrPrec à AdrFonc et dans Bis si c'est un aig bis - if (Adr>=9997) then begin detecteur_suivant_el:=Adr;exit;end; - if (NivDebug=3) then AfficheDebug('trouvé='+intToSTR(Adr)+' type='+intToSTR(typeGen),clorange); - trouve_element(Adr,typeGen); - Btype:=BrancheN[branche_trouve,IndexBranche_trouve].BType; - BisSuiv:=Btype; // si aiguillage bis - //Affiche(intToSTR(adr)+'/'+intToStr(Btype),clorange); - AdrPrec:=AdrFonc;AdrFonc:=Adr; - BisPrec:=BisFonc;BisFonc:=typeGen; - i:=i+1; - sortie:=(Adr=El2) or (i=20) or (Adr=0) or (Adr>9997) or ((Adr<>el2) and (btype=1)); - until (sortie) ; // boucle de parcours - - if (i=20) then + //AfficheDebug('Engage '+IntToSTR(AdrPrec)+','+IntToSTR(typePrec)+'/'+IntToSTR(AdrFonc)+','+IntToSTR(typeFonc),clyellow); + Adr:=suivant_alg3(AdrPrec,TypePrec,AdrFonc,TypeFonc,1); + //AfficheDebug('Sortie Alg3: '+IntToSTR(Adr)+'/'+intToSTR(typeGen),clyellow); + + if NivDebug=3 then begin - Affiche('Erreur fatale 300 : Itération trop longue',clred); - AfficheDebug('Erreur fatale 300 : Itération trop longue',clred); - detecteur_suivant_el:=3; - end; - if ((Btype=1) and (Adr<>el2) and (NivDebug=3)) then AfficheDebug('N''est pas le détecteur attendu '+intToSTR(Adr)+' pour '+intToSTR(el2),clyellow); - inc(j); // changement de sens - sortie:=(Adr=el2) or (j=3) or (Adr=0); - until sortie; - - // si arret sur buttoir - if Adr=0 then begin detecteur_suivant_el:=0;exit;end; - - if ((j=3) and (Adr<>el2)) then - begin - if NivDebug=3 then AfficheDebug('El - Pas de suivant sur séquence '+IntToSTR(el1)+' à '+intToStr(el2),clyellow); - detecteur_suivant_el:=0;exit; - end; - - // étape 2 : on a trouvé le sens de progression, trouver le détecteur suivant - if (Adr=el2) then - begin - // trouvé la route si j=2 : - si j=3 : + - if (NivDebug=3) then AfficheDebug('El - Route trouvée',clyellow); - i:=0; - AdrFonc:=Adr; - BisFonc:=1; - //typeGen:=0; //? - repeat - Adr:=suivant_alg3(AdrPrec,BisPrec,AdrFonc,BisFonc,1); - if Adr>9997 then - begin - detecteur_suivant_el:=Adr; - exit; - end; - if NivDebug=3 then - begin - s:='trouvé 2: Adr='+intToSTR(Adr); + s:='613 : trouvé='+intToSTR(Adr); case typeGen of 1 : s:=s+' detecteur'; 2 : s:=s+' aiguillage'; 3 : s:=s+' aiguillage bis'; end; AfficheDebug(s,clorange); - end; - trouve_element(Adr,typeGen); - Btype:=BrancheN[branche_trouve,IndexBranche_trouve].BType; - BisSuiv:=Btype; // si aiguillage bis - if (NivDebug=3) then - begin - s:='Suivant='+intToSTR(Adr); - case Btype of - 1 : s:=s+' detecteur'; - 2 : s:=s+' aiguillage'; - 3 : s:=s+' aiguillage bis'; - end; - AfficheDebug(s,clorange); - end; - AdrPrec:=AdrFonc;AdrFonc:=Adr; - BisPrec:=BisFonc;BisFonc:=typeGen; + end; + + AdrPrec:=AdrFonc;TypePrec:=TypeFonc; + AdrFonc:=Adr;TypeFonc:=typeGen; inc(i); - sortie:=(Btype=1) or (Adr=0) or (i=20); - until sortie; - if NivDebug>=2 Then AfficheDebug('Détecteur suivant='+intToSTR(Adr),clOrange); - if (bType=1) or (Adr=0) then detecteur_suivant_el:=Adr; - if (i=20) then begin - if NivDebug=3 then AfficheDebug('Erreur fatale 201 : Itération trop longue',clred); - Affiche('Erreur fatale 201 : Itération trop longue',clred);detecteur_suivant_el:=3;end; - end; + sortie:=((typeDet2=TypeGen) and (Adr=el2)) or (Adr=0) or (Adr>=9996) or (i=20); + until sortie + + else + begin + // déja trouvé + adr:=el2;typeGen:=TypeDet2; + end; + + if (typeDet2=TypeGen) and (Adr=el2) then + begin + if Nivdebug=3 then AfficheDebug('614 : Trouvé '+intToSTR(el2),clYellow); + i:=0; + repeat + //AfficheDebug('Engage '+IntToSTR(AdrPrec)+','+IntToSTR(typePrec)+'/'+IntToSTR(AdrFonc)+','+IntToSTR(typeFonc),clyellow); + Adr:=suivant_alg3(AdrPrec,TypePrec,AdrFonc,TypeFonc,1); + //AfficheDebug('Sortie Alg3: '+IntToSTR(Adr)+'/'+intToSTR(typeGen),clyellow); + + if NivDebug=3 then + begin + s:='614 : trouvé='+intToSTR(Adr); + case typeGen of + 1 : s:=s+' detecteur'; + 2 : s:=s+' aiguillage'; + 3 : s:=s+' aiguillage bis'; + end; + AfficheDebug(s,clorange); + end; + + AdrPrec:=AdrFonc;TypePrec:=TypeFonc; + AdrFonc:=Adr;TypeFonc:=typeGen; + inc(i); + sortie:=(TypeGen=1) or (Adr=0) or (Adr>=9996) or (i=20); + until sortie; + if TypeGen=1 then + begin + if NivDebug=3 then + begin + AfficheDebug('le détecteur suivant est le '+IntToSTR(Adr),clyellow); + affichedebug('------------------',clyellow); + end; + detecteur_suivant_el:=Adr; + exit; + end; + end; + if (i=20) then if NivDebug=3 then AfficheDebug('201 : Itération trop longue',clred); + inc(j); + //AfficheDebug('j='+intToSTR(j),clyellow); + until j=3; + detecteur_suivant_el:=9996; + if NivDebug=3 then affichedebug('------------------',clyellow); end; + function cond_carre(adresse : integer) : boolean; var i,l,k,NCondCarre,adrAig : integer; resultatET,resultatOU: boolean; @@ -5178,7 +5311,7 @@ var i,l,k,NCondCarre,adrAig : integer; begin i:=index_feu(adresse); NCondCarre:=Length(feux[i].condcarre[1]); - + l:=1; resultatOU:=false; @@ -5237,6 +5370,18 @@ begin repeat inc(j); AdrSuiv:=suivant_alg3(prec,typeElPrec,actuel,typeELActuel,2); + {if (typeGen=2) then // si le précédent est une TJD/S et le suivant aussi + begin + if ((aiguillage[AdrSuiv].modele=2) or (aiguillage[AdrSuiv].modele=3)) and + ((aiguillage[actuel].modele=2) or (aiguillage[actuel].modele=3)) then + begin + if nivDebug=3 then AfficheDebug('505 - Détection Précédent=TJD/S Suivant=TJD/S',clyellow); + // subsituer la pointe + actuel:=aiguillage[actuel].APointe; + end; + end; } + + if (AdrSuiv=9999) or (AdrSuiv=9996) then // élément non trouvé ou position aiguillage inconnu begin carre_signal:=true; @@ -5269,6 +5414,7 @@ begin end; + // renvoie l'état du signal suivant // si renvoie 0, pas trouvé le signal suivant. // rang=1 pour feu suivant, 2 pour feu suivant le 1, etc @@ -5279,8 +5425,7 @@ var num_feu,AdrDet,etat,AdrFeu,i,j,prec,AdrSuiv : integer; s : string; begin //traceDet:=true; - if NivDebug>=2 then - AfficheDebug('Cherche état du signal suivant au '+IntToSTR(adresse),clyellow); + if NivDebug>=2 then AfficheDebug('Cherche état du signal suivant au '+IntToSTR(adresse),clyellow); i:=Index_feu(adresse); if feux[i].aspect>10 then begin @@ -5293,7 +5438,8 @@ begin if i=0 then begin - Affiche('Erreur 600 - feu non trouvé',clred); + Affiche('Erreur 600 - feu '+IntToSTR(adresse)+' non trouvé',clred); + if NivDebug=3 then AfficheDebug('Erreur 600 - feu '+IntToSTR(adresse)+' non trouvé',clred); etat_signal_suivant:=0; AdresseFeuSuivant:=0; exit; @@ -5306,45 +5452,65 @@ begin if prec=0 then begin Affiche('Msg 601 - feu '+intToSTR(adresse)+' non renseigné ',clOrange); + if NivDebug=3 then AfficheDebug('Msg 601 - feu '+intToSTR(adresse)+' non renseigné ',clOrange); etat_signal_suivant:=0; AdresseFeuSuivant:=0; exit; end; TypePrec:=1; // détecteur actuel:=feux[i].Adr_el_suiv1; + if nivDebug=3 then AfficheDebug('Actuel ='+IntToSTR(actuel),clyellow); if feux[i].Btype_suiv1=1 then TypeActuel:=1; if feux[i].Btype_suiv1=2 then TypeActuel:=2; if feux[i].Btype_suiv1=4 then TypeActuel:=2; // aiguillage triple if feux[i].Btype_suiv1=5 then TypeActuel:=3; // le type du feu 1=détécteur 2=aig 5=bis - // si actuel est un détecteur, regarder si il ya un feu + repeat inc(j); + if nivDebug=3 then AfficheDebug('Itération '+IntToSTR(j),clyellow); + // à la première itération, si "actuel" est déja un détecteur, ne pas faire de recherche sur le suivant if (j=1) and (TypeActuel=1) then begin - AdrSuiv:=actuel; - actuel:=prec; - TypeActuel:=1; - TypePrec:=1; + // AdrSuiv:=actuel; + // actuel:=prec; + // TypeActuel:=1; + // TypePrec:=1; + // if nivDebug=3 then AfficheDebug('Substitution precedent='+intToSTR(prec)+' Actuel='+IntToSTR(actuel),clyellow); end else + begin + //if nivDebug=3 then AfficheDebug('Engagement j='+IntToSTR(j)+' '+IntToSTR(prec)+'/'+IntToSTR(actuel),clyellow); + AdrSuiv:=suivant_alg3(prec,TypePrec,actuel,TypeActuel,1); + {if (typeGen=2) then // si le précédent est une TJD/S et le suivant aussi begin - AdrSuiv:=suivant_alg3(prec,TypePrec,actuel,TypeActuel,1); - prec:=actuel;TypePrec:=TypeActuel; - actuel:=AdrSuiv;TypeActuel:=typeGen; + if ((aiguillage[Adrsuiv].modele=2) or (aiguillage[AdrSuiv].modele=3)) and + ((aiguillage[actuel].modele=2) or (aiguillage[actuel].modele=3)) then + begin + if nivDebug=3 then AfficheDebug('507 - Détection Précédent=TJD/S Suivant=TJD/S',clyellow); + // subsituer la pointe + Actuel:=aiguillage[Actuel].APointe; + end; + end; } + + + if Nivdebug=3 then AfficheDebug('Suivant='+intToSTR(AdrSuiv),clyellow); + prec:=actuel;TypePrec:=TypeActuel; + actuel:=AdrSuiv;TypeActuel:=typeGen; + + if (AdrSuiv=9999) or (AdrSuiv=9996) then + begin + Etat_signal_suivant:=0; + AdresseFeuSuivant:=0; + exit; + end; + if (AdrSuiv=0) then + begin + if NivDebug=3 then AfficheDebug(intToSTR(j)+' Le suivant est un buttoir',clyellow); + Etat_signal_suivant:=carre_F; // faire comme si c'était un signal au carré + AdresseFeuSuivant:=0; + exit; end; - if (AdrSuiv=9999) or (AdrSuiv=9996) then - begin - Etat_signal_suivant:=0; - AdresseFeuSuivant:=0; - exit; - end; - if (AdrSuiv=0) then - begin - if NivDebug=3 then AfficheDebug('Le suivant est un buttoir',clyellow); - Etat_signal_suivant:=carre_F; // faire comme si c'était un signal au carré - AdresseFeuSuivant:=0; - exit; end; // si le suivant est un détecteur comporte t-il un signal? @@ -5352,30 +5518,35 @@ begin AdrFeu:=0; if (TypeActuel=1) then // détecteur? begin - i:=Index_feu_det(AdrSuiv); + i:=Index_feu_det(Actuel); AdrFeu:=Feux[i].Adresse; - //affiche(intToSTR(Feux[i].Adr_el_suiv)+'/'+intTostr(prec),clyellow); - if (adrFeu=Adresse) then // si on ne reboucle sur le même signal dont on cherche le suivant + if adrFeu<>0 then begin - AdrFeu:=0;j:=10; // on ne trouve pas de suivant - end; - if (AdrFeu<>0) then // si l'adresse est <>0 - begin - if (Feux[i].Adr_el_suiv1<>prec) then // le feu est-il dans le bon sens de progression? + if nivdebug=3 then afficheDebug('Détecteur='+IntToSTR(AdrSuiv)+' AdrFeu='+IntToSTR(AdrFeu)+' prec='+IntToSTR(prec),clyellow ); + if (adrFeu=Adresse) then // si on ne reboucle sur le même signal dont on cherche le suivant begin - // oui - inc(num_feu); - Etat:=EtatSignalCplx[AdrFeu]; - Signal_suivant:=AdrFeu; - - if NivDebug=3 then AfficheDebug('Trouvé feu suivant Adr='+IntToSTR(AdrFeu)+'='+IntToSTR(etat),clOrange); - end - else - begin - if NivDebug=3 then AfficheDebug('Trouvé feu '+intToSTR(AdrFeu)+' mais dans le mauvais sens',clOrange); - AdrFeu:=0; + AdrFeu:=0;j:=10; // on ne trouve pas de suivant end; - end; + + if (AdrFeu<>0) then // si l'adresse est <>0 + begin + if (Feux[i].Adr_el_suiv1<>prec) then // le feu est-il dans le bon sens de progression? + begin + // oui + inc(num_feu); + Etat:=EtatSignalCplx[AdrFeu]; + Signal_suivant:=AdrFeu; + + if NivDebug=3 then AfficheDebug('Trouvé feu suivant Adr='+IntToSTR(AdrFeu)+'='+IntToSTR(etat),clOrange); + end + else + begin + if NivDebug=3 then AfficheDebug('Trouvé feu '+intToSTR(AdrFeu)+' mais dans le mauvais sens',clOrange); + AdrFeu:=0; + end; + end + end + else if nivDebug=3 then AfficheDebug('Pas de feu pour le det '+IntToSTR(AdrSuiv),clyellow); end; until (j=10) or ((AdrFeu<>0) and (num_feu=rang)); if etat=0 then Signal_Suivant:=0; @@ -5418,6 +5589,7 @@ begin // 3=demande si le suivant est un aiguillage en pointe dévié oui si AdrSuiv=9997 // dans ce cas la variable globale AdrDevie est mise à jour AdrSuiv:=suivant_alg3(prec,TypePrec,actuel,TypeActuel,3); + if NivDebug=3 then AfficheDebug('701 - Suivant signalaig='+IntToSTR(AdrSuiv),clyellow); if ADrSuiv<>9997 then begin @@ -5432,7 +5604,7 @@ begin if NivDebug=3 then AfficheDebug('trouvé signal '+intToSTR(AdrFeu)+' associé au détecteur '+IntToSTR(AdrSuiv),clyellow); end; end; - until (j=10) or (AdrSuiv=9997) or (AdrFeu<>0) ; + until (j=10) or (AdrSuiv>=9996) or (AdrFeu<>0) ; if (AdrSuiv=9997) then begin s:='le signal '+intToSTR(adresse)+' doit afficher un rappel car l''aiguillage '+intToSTR(AdrDevie); @@ -5507,7 +5679,7 @@ function test_memoire_zones(adresse : integer) : boolean; var AdrSuiv,prec,TypePrec,TypeActuel,ife,actuel,AdrDet,Etat,AdrFeu,i,j,PresTrain01,PrecInitial : integer; Pres_train,sort : boolean; - + s : string; begin if NivDebug>=1 then AfficheDebug('Proc test_memoire_zones - Cherche mémoire à 1 du signal '+intToSTR(adresse)+' au signal suivant ',clyellow); i:=Index_feu(adresse); @@ -5524,7 +5696,7 @@ begin j:=0; if NivDebug=3 then AfficheDebug('Boucle de test feu '+intToSTR(ife)+'/4',clred); if (ife=1) then - begin + begin prec:=feux[i].Adr_det1; actuel:=feux[i].Adr_el_suiv1; if feux[i].Btype_suiv1=1 then TypeActuel:=1; @@ -5533,7 +5705,7 @@ begin if feux[i].Btype_suiv1=5 then TypeActuel:=3; // le type du feu 1=détecteur 2=aig 5=bis end; //détecteur sur le signal courant if (ife=2) then - begin + begin prec:=feux[i].Adr_det2;actuel:=feux[i].Adr_el_suiv2; if feux[i].Btype_suiv2=1 then TypeActuel:=1; if feux[i].Btype_suiv2=2 then TypeActuel:=2; @@ -5580,16 +5752,17 @@ begin else begin AdrSuiv:=suivant_alg3(prec,TypePrec,actuel,TypeActuel,1); + prec:=actuel;TypePrec:=TypeActuel; actuel:=AdrSuiv;TypeActuel:=typeGen; - if AdrSuiv>9990 then - begin + if AdrSuiv>9990 then + begin test_memoire_zones:=false;exit; end; - + end; - if NivDebug=3 then AfficheDebug('suivant='+IntToSTR(adrsuiv),clred); + if NivDebug=3 then AfficheDebug('130 - suivant='+IntToSTR(adrsuiv),clred); if actuel=0 then begin // si c'est un buttoir @@ -5606,7 +5779,7 @@ begin Pres_train:=MemZone[PrecInitial][actuel] or Pres_train; // mémoire de zone if Pres_Train then PresTrain01:=1 else PresTrain01:=0; if NivDebug=3 then AfficheDebug('de '+IntToSTR(PrecInitial)+' à '+intToSTR(actuel)+'='+IntToSTR(PresTrain01),clyellow); - // prec:=actuel; // pour préparer le suivant + precInitial:=actuel; // pour préparer le suivant i:=index_feu_det(AdrSuiv); // renvoie l'index du signal se trouvant au détecteur "AdrSuiv": il peut y avoir 4 détecteurs par signal AdrFeu:=feux[i].adresse; // adresse du feu @@ -5618,10 +5791,11 @@ begin begin if (feux[i].Adr_el_suiv1<>prec) then // le feu est-il dans le bon sens de progression? begin - if (NivDebug=3) And Pres_Train then AfficheDebug('Sortie proced:Mémoire de zone à 1',clyellow); - if (NivDebug=3) And (not(Pres_Train)) then AfficheDebug('Sortie proced:Mémoire de zone à 0',clyellow); + s:='Trouvé feu '+IntToSTR(AdrFeu); + if (NivDebug=3) And Pres_Train then AfficheDebug(s+' et sortie proced:Mémoire de zone à 1',clyellow); + if (NivDebug=3) And (not(Pres_Train)) then AfficheDebug(s+' et sortie proced:Mémoire de zone à 0',clyellow); test_memoire_zones:=Pres_train;exit; - + end else begin @@ -5701,25 +5875,27 @@ end; // les détecteurs doivent être consécutifs // trouve le détecteur suivant de det1 à det2 si la route est correcte. (détecteurs en entrée obligatoires) // transmis dans le tableau Event_det -// Variable globale: El_suivant : adresse du détecteur suivant le détecteur "actuel" // Résultat: -// si 0 : pas de route -// si 1 : détecteur det1 non trouvé -// si 2 : détecteur det2 non trouvé -// si 3 : erreur fatale +// si >=9996 : pas de route // si 10 : ok route trouvée -function test_route_valide(det1,det2,det3 : integer) : integer; +function test_route_valide(det1,det2,det3 : integer) : integer; var det_suiv,resultat : integer; begin + if TraceListe then AfficheDebug('test route valide '+IntToSTR(det1)+' '+IntToSTR(det2)+' vers '+IntToSTR(det3)+' ',clyellow); det_suiv:=detecteur_suivant_el(det1,1,det2,1); - if (det_suiv<=2) or (det_suiv>=9997) or (det3<>det_suiv) then begin resultat:=0;end; + if det_suiv=det3 then begin test_route_valide:=10;exit;end; + + test_route_valide:=9999; + exit; + + if (det_suiv>=9996) or (det3<>det_suiv) then begin resultat:=0; NivDebug:=0;end; // test sens inverse.... - if resultat=0 then + if resultat=0 then begin - test_route_valide:=0;exit; + test_route_valide:=0;exit; // si manipulation proche aiguillage det_suiv:=detecteur_suivant_el(det3,1,det2,1); - if (det_suiv<=2) or (det_suiv>=9997) or (det1<>det_suiv) then begin test_route_valide:=0;exit;end; + if (det_suiv>=9996) or (det1<>det_suiv) then begin test_route_valide:=0; NivDebug:=0;exit;end; end; test_route_valide:=10 ; end; @@ -5734,6 +5910,7 @@ var i,j,k1,k2,BtypeSuiv,Adr_det,etat,Adr,Aig,DetPrec1,DetPrec2,Detprec3,Detprec4 s : string; begin s:='Traitement du feu '+intToSTR(Adrfeu)+'------------------------------------'; + //if adrfeu=197 then affsignal:=true else affsignal:=false; if AffSignal then AfficheDebug(s,clOrange); i:=index_feu(Adrfeu); if AdrFeu<>0 then @@ -5752,9 +5929,9 @@ begin exit; end; - // signal non directionnel + // signal non directionnel etat:=etat_signal_suivant(AdrFeu,1) ; // état du signal suivant + adresse du signal suivant dans Signal_Suivant - if AffSignal then + if AffSignal then begin code_to_aspect(etat,code,combine); s:='Etat signal suivant ('+intToSTR(AdresseFeuSuivant)+') est '; @@ -5764,6 +5941,7 @@ begin end; // signaux traités spécifiquement + { if (AdrFeu=201) then begin if ((aiguillage[28].position<>const_droit) and (aiguillage[29].position<>const_droit) and @@ -5779,19 +5957,20 @@ begin envoi_LEB(AdrFeu); exit; end; - + } + // signal à 2 feux = carré violet+blanc if (Feux[i].aspect=2) then //or (feux[i].check<>nil) then // si carré violet begin // si aiguillage après signal mal positionnées if carre_signal(AdrFeu) then - begin - Maj_Etat_Signal(AdrFeu,violet); + begin + Maj_Etat_Signal(AdrFeu,violet); Envoi_signauxCplx; exit; end - else - begin + else + begin Maj_Etat_Signal(AdrFeu,blanc); Envoi_signauxCplx; exit; @@ -5803,7 +5982,7 @@ begin if (Feux[i].aspect>=3) and (EtatSignalCplx[AdrFeu]<>violet_F) then begin // 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[i].VerrouCarre then + if (Feux[i].VerrouCarre) and (Feux[i].aspect>=4) then begin if AffSignal then AfficheDebug('Le feu est verrouillable au carré',clyellow); // **** un feu peut être associé à 4 détecteurs (pour 4 voies convergentes) ***** @@ -5842,13 +6021,13 @@ begin if (det_initial<>0) then begin DetPrec1:=detecteur_suivant(Adr_El_Suiv,Btype_el_suivant,det_initial,1); - if DetPrec1<9997 then // route bloquée par aiguillage mal positionné + if DetPrec1<9996 then // route bloquée par aiguillage mal positionné begin DetPrec2:=detecteur_suivant_El(det_initial,1,DetPrec1,1); - if DetPrec2<9997 then + if DetPrec2<9996 then begin DetPrec3:=detecteur_suivant_El(DetPrec1,1,DetPrec2,1); - if DetPrec3<9997 then + if DetPrec3<9996 then begin //DetPrec4:=detecteur_suivant_det(DetPrec2,DetPrec3); if AffSignal then AfficheDebug('les détecteurs précédents au feu '+IntToSTR(Adrfeu)+' sont:'+intToSTR(Det_initial)+' '+intToSTR(DetPrec1)+' '+intToSTR(DetPrec2)+' '+intToSTR(DetPrec3)+' ',clyellow); @@ -5859,7 +6038,7 @@ begin if MemZone[DetPrec3,detPrec2] then AfficheDebug('1.présence train '+IntToSTR(DetPrec3)+' '+IntToSTR(detPrec2),clyellow); if MemZone[DetPrec2,detPrec1] then AfficheDebug('2.présence train '+IntToSTR(DetPrec2)+' '+IntToSTR(detPrec1),clyellow); if MemZone[DetPrec1,det_initial] then AfficheDebug('3.présence train '+IntToSTR(DetPrec1)+' '+IntToSTR(det_Initial),clyellow); - + //if PresTrain then AfficheDebug('présence train',clyellow) else afficheDebug('abscence train',clyellow); end; //if AffSignal then AfficheDebug('MemZone'+intToSTR(DetPrec3)+' '+IntToSTR(detPrec2) = '+MemZone[DetPrec3,detPrec2] @@ -5871,12 +6050,13 @@ begin until (j>=5); if presTrain and AffSignal Then afficheDebug('présence train feu '+intToSTR(AdrFeu),clorange); end; + if AffSignal then afficheDebug('Fin de la recherche des 4 détecteurs précédents-----',clOrange); // si le signal peut afficher un carré et les aiguillages après le signal sont mal positionnées ou que pas présence train avant signal et signal // verrouillable au carré, afficher un carré car:=carre_signal(AdrFeu); // conditions supplémentaires de carré en fonction des aiguillages décrits - car:=cond_carre(AdrFeu) or car; + car:=cond_carre(AdrFeu) or car; if AffSignal and car then AfficheDebug('le signal a des aiguilles en talon aval mal positionnées',clYellow); if (NivDebug>=1) and car then AfficheDebug('le signal a des aiguilles en talon aval mal positionnées',clYellow); if (Feux[i].aspect>=4) and ( (not(PresTrain) and Feux[i].VerrouCarre) or car) then Maj_Etat_Signal(AdrFeu,carre) @@ -5885,8 +6065,10 @@ begin // si on quitte le détecteur on affiche un sémaphore : attention 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 adrFeu=197 then NivDebug:=3; if AffSignal then AfficheDebug('test du sémaphore',clYellow); Aff_semaphore:=test_memoire_zones(AdrFeu); // test si présence train après signal + //Nivdebug:=0; if Aff_Semaphore then begin if AffSignal then AfficheDebug('Présence train après signal'+intToSTR(AdrFeu)+' -> sémaphore ou carré',clYellow); @@ -6020,16 +6202,17 @@ begin Nbre:=event_det_train[i].NbEl ; // Nombre d'éléments du tableau courant exploré if Nbre=2 then begin - if TraceListe then AfficheDebug('traitement Train n°'+intToSTR(i)+' 2 détecteurs',clyellow); + if TraceListe or (NivDebug=3) then AfficheDebug('traitement Train n°'+intToSTR(i)+' 2 détecteurs',clyellow); det1:=event_det_train[i].det[1]; det2:=event_det_train[i].det[2]; resultat:=test_route_valide(det1,det2,det3); if resultat=10 then begin AdrSuiv:=detecteur_suivant_el(det2,1,det3,1); // ici on cherche le suivant à det2 det3 - if (Adrsuiv<=2) or (Adrsuiv>=9997) then + if (Adrsuiv>=9996) then begin Affiche('Erreur 1500 : pas de suivant sur la route de '+intToSTR(det2)+' à '+intToSTR(det3),clRed); + if NivDebug=3 then AfficheDebug('Erreur 1500 : pas de suivant sur la route de '+intToSTR(det2)+' à '+intToSTR(det3),clRed); end else begin @@ -6040,7 +6223,7 @@ begin begin s:='train '+IntToSTR(i)+' '+intToStr(det2)+' à '+intToStr(det3)+' => Mem '+IntToSTR(det3)+' à '+IntTOStr(AdrSuiv); Lines.Add(s); - RE_ColorLine(FormDebug.RichEdit,lines.count,CouleurTrain[((i - 1) mod NbCouleurTrain)+1 ]); + RE_ColorLine(FormDebug.RichEdit,lines.count-1,CouleurTrain[ ((i - 1) mod NbCouleurTrain) +1] ); end; if TraceListe then AfficheDebug(s,clyellow); Affiche(s,clyellow); @@ -6103,18 +6286,18 @@ begin AfficheDebug('Nouveau Tampon train '+intToStr(i)+'--------',clyellow); AfficheDebug(intToSTR(event_det_train[i].det[1]),clyellow ); AfficheDebug(intToSTR(event_det_train[i].det[2]),clyellow ); - end; + end; exit; // sortir absolument - end; + end; end; end; - + // créer un train, donc un tableau - if N_Trains>=Max_Trains then + if N_Trains>=Max_Trains then begin Affiche('Erreur nombre de train maximal atteint',clRed); end; - Inc(N_trains); + Inc(N_trains); // vérifier si le détecteur du nouveau train est associé à un feu vers un buttoir for i:=1 to NbreFeux do @@ -6128,9 +6311,9 @@ begin if AdrPrec=0 then begin if TraceListe then Affiche('FD - Le feu '+IntToSTR(AdrFeu)+' est précédé d''un buttoir',clyellow); - MemZone[0,AdrDetFeu]:=false; + MemZone[0,AdrDetFeu]:=false; //NivDebug:=3; - AffSignal:=true; + AffSignal:=true; maj_feu(AdrFeu); end; end; @@ -6248,6 +6431,13 @@ begin end; end; +Procedure affiche_memoire; +var s: string; +begin + s:='Mémoire évènements '+IntToSTR( 100*N_Event_tick div Max_Event_det_tick)+' %'; + Formprinc.statictext.caption:=s; +end; + // traitement sur les évènements détecteurs procedure Event_Detecteur(Adresse : integer;etat : boolean); var i,AdrSuiv,AdrFeu,AdrDetfeu,TrainActuel,Etat01,typeSuiv,AdrPrec : integer; @@ -6270,7 +6460,9 @@ begin if Traceliste then AfficheDebug('--------------------- détecteur '+intToSTR(Adresse)+' à '+intToSTR(etat01)+'-----------------------------',clOrange); if AffAigDet then begin - s:='Evt Det '+intToSTR(adresse)+'='+intToSTR(etat01); + //s:='Evt Det '+intToSTR(adresse)+'='+intToSTR(etat01); + s:=IntToSTR(i)+' Tick='+IntToSTR(tick)+' Det='+IntToSTR(adresse)+'='+intToSTR(etat01); + Affiche(s,clyellow); if not(TraceListe) then AfficheDebug(s,clyellow); end; @@ -6288,6 +6480,7 @@ begin event_det_tick[N_event_tick].tick:=tick; event_det_tick[N_event_tick].detecteur:=Adresse; event_det_tick[N_event_tick].etat:=etat01; + if (n_Event_tick mod 10) =0 then affiche_memoire; // Affiche('stockage de '+intToSTR(N_event_tick)+' '+IntToSTR(Adresse)+' à '+intToSTR(etat01),clyellow); end; @@ -6380,13 +6573,6 @@ begin aiguillage[adresse].position:=pos; - if aiguillageB[adresse].inversionCDM=0 then aiguillageB[adresse].position:=pos - else - begin - if pos=const_devie then aiguillageB[adresse].position:=const_droit; - if pos=const_droit then aiguillageB[adresse].position:=const_devie; - end; - // ------------- stockage évènement aiguillage dans tampon event_det_tick ------------------------- if (N_Event_tick32 then - cdm_lanceLoc:=true; + ,SW_SHOWNORMAL)>32 then + begin + cdm_lanceLoc:=true; + //Affiche('lancé1',clyellow); + end; if not(cdm_lanceLoc) then begin // si çà marche pas essayer depuis le répertoire de base sur un OS32 + Affiche('2eme lancement',clyellow); if ShellExecute(Formprinc.Handle, 'open',PChar('C:\Program Files\CDM-Rail\cdr.exe'), Pchar('-f '+lay), // paramètre @@ -6991,6 +7183,7 @@ begin if cdm_lanceLoc then begin + Formprinc.caption:=af+' - '+lay; // On a lancé CDM, déconnecter l'USB deconnecte_USB; Affiche('lance les fonctions automatiques de CDM',clyellow); @@ -7080,6 +7273,7 @@ begin Lance_CDM:=true; end; + procedure TFormPrinc.FormCreate(Sender: TObject); var i,j : integer; @@ -7098,7 +7292,7 @@ begin Srvc_PosTrain:=false; Srvc_sig:=false; - AF:='Client TCP-IP CDM Rail ou USB - système LENZ - Version '+Version; + AF:='Client TCP-IP CDM Rail ou USB - système LENZ - Version '+Version+' en cours 3'; Caption:=AF; Application.onHint:=doHint; @@ -7118,7 +7312,7 @@ begin TempoAct:=0; DebugOuv:=True; - AvecInit:=false; //&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& + AvecInit:=false; //&&&& Diffusion:=AvecInit; Application.processMessages; @@ -7138,6 +7332,7 @@ begin // lecture fichiers de configuration client_GL.cfg et config.cfg lit_config; + Application.processMessages; // lancer CDM rail et le connecte si on le demande if LanceCDM then Lance_CDM; @@ -7146,9 +7341,9 @@ begin // tenter la liaison vers CDM rail if not(CDM_connecte) then connecte_CDM; - + // si CDM n'est pas connecté, on ouvre la liaison vers la centrale - if not(CDM_connecte) then + if not(CDM_connecte) then begin Affiche('CDM absent - Ouverture liaison vers centrale Lenz',clYellow); // ouverture par USB @@ -7186,6 +7381,8 @@ begin // Initialisation des images des signaux NbreImagePLigne:=Formprinc.ScrollBox1.Width div (largImg+5); + if not(diffusion) then LireunfichierdeCV1.enabled:=true; + // ajoute une image dynamiquement for i:=1 to NbreFeux do begin @@ -7218,12 +7415,49 @@ begin //créée la fenêtre TCO non modale FormTCO:=TformTCO.Create(nil); FormTCO.show; - end; + end; - //essai + //essai &&&&&&&&&& Affiche('Fin des initialisations',clyellow); LabelEtat.Caption:=' '; + Affiche_memoire; + //--------------------------------- + { + aiguillage[20].position:=const_droit; + aiguillage[21].position:=const_droit; + aiguillage[25].position:=const_devie; + aiguillage[26].position:=const_droit; + aiguillage[27].position:=const_droit; + aiguillage[28].position:=const_devie; + aiguillage[31].position:=const_devie; + aiguillage[77].position:=const_droit; + aiguillage[78].position:=const_droit; + aiguillage[79].position:=const_droit; + aiguillage[83].position:=const_devie; + aiguillage[85].position:=const_droit; + aiguillage[87].position:=const_devie; + + aiguillage[89].position:=const_devie; + aiguillage[90].position:=const_droit; + + aiguillage[91].position:=const_droit; + aiguillage[92].position:=const_devie; + + aiguillage[105].position:=const_droit; + aiguillage[106].position:=const_devie; + aiguillage[111].position:=const_devie; + + NivDebug:=3; + FormDebug.show; + //i:=Detecteur_suivant_El(591,1,602,1); + //i:=Detecteur_suivant_El(597,1,601,1); + // posent pb: + i:=Detecteur_suivant_El(598,1,599,1); + //i:=Detecteur_suivant_El(520,1,518,1); + AfficheDebug(IntToSTR(i),clyellow); + } + end; @@ -7407,23 +7641,22 @@ begin N_event_det:=0; N_trains:=0; for i:=1 to Max_Trains do Event_det_Train[i].NbEl:=0; + i_simule:=0; FormDebug.MemoEvtDet.Clear; FormDebug.Richedit.Clear; + // AffTickSimu:=true; end; while tick=Tablo_simule[i_simule+1].tick do + //while i_simule0 then begin - // if i_simule=164 then - // begin - // if Tablo_simule[i_simule].detecteur=538 then Affiche('création evt 538 index '+intToSTR(i_simule),clorange); - // end; - if AffTickSimu then Affiche('Simulation '+intToSTR(I_simule)+' Tick='+IntToSTR(tick)+' det='+intToSTR(Tablo_simule[i_simule].detecteur)+'='+IntToSTR(Tablo_simule[i_simule].etat),Cyan); Event_Detecteur(Tablo_simule[i_simule].detecteur, Tablo_simule[i_simule].etat=1); // créer évt détecteur + // statusBar1.Hint:=' det='+intToSTR(Tablo_simule[i_simule].detecteur)+'='+IntToSTR(Tablo_simule[i_simule].etat); end; // evt aiguillage ? @@ -7431,9 +7664,11 @@ begin begin if AffTickSimu then Affiche('Simulation '+intToSTR(I_simule)+' Tick='+IntToSTR(tick)+' aig='+intToSTR(Tablo_simule[i_simule].aiguillage)+'='+IntToSTR(Tablo_simule[i_simule].etat),Cyan); Event_Aig(Tablo_simule[i_simule].Aiguillage,Tablo_simule[i_simule].etat,0); // créer évt aiguillage + // statusBar1.Hint:=' aig='+intToSTR(Tablo_simule[i_simule].aiguillage)+'='+IntToSTR(Tablo_simule[i_simule].etat); end; end; + if i_Simule>=Index_simule then begin Index_Simule:=0; // fin de simulation @@ -7510,11 +7745,8 @@ begin 10061 : s:=s+': Connexion refusée'; 10065 : s:=s+': Port non connecté'; end; - if ErrorCode<>10060 then - begin - affiche(s,ClRed); - afficheDebug(s,ClRed); - end; + affiche(s,clOrange); + if nivDebug=3 then afficheDebug(s,clOrange); parSocket:=false; ErrorCode:=0; end; @@ -7532,10 +7764,11 @@ begin 10061 : s:=s+': Connexion refusée'; 10065 : s:=s+': Port non connecté'; end; - affiche(s,ClRed); - afficheDebug(s,ClRed); + affiche(s,ClOrange); + afficheDebug(s,ClOrange); CDM_connecte:=false; if (portCommOuvert=false) and (parsocket=false) then LabelTitre.caption:=titre; + caption:=AF; ErrorCode:=0; end; @@ -7573,7 +7806,7 @@ begin Affiche('En blanc : Trames reçues de l''interface',ClWhite); Affiche('En violet : Trames brutes reçues de l''interface',ClWhite); Affiche('En rouge : erreurs et défauts',ClWhite); - Affiche('En orange : pilotage des signaux',ClWhite); + 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); end; @@ -7656,7 +7889,6 @@ procedure TFormPrinc.Etatdesaiguillages1Click(Sender: TObject); var i,j,model,objet : integer; s : string; begin - Affiche('les positions des aiguillages BIS sont les mêmes que leurs homologues non bis',Cyan); for i:=1 to MaxAcc do begin model:=aiguillage[i].modele ; @@ -7692,39 +7924,30 @@ begin if aiguillage[i].modele<>0 then begin if aiguillage[i].modele=1 then s:=s+' Pointe='; - if aiguillage[i].modele=2 then s:=s+' TJD: centre TJD='; + if aiguillage[i].modele=2 then + begin + s:=s+' TJD:'; + if aiguillage[i].inversionCDM=1 then s:=s+'(INV) '; + end; if aiguillage[i].modele=3 then s:=s+' TJS:'; if aiguillage[i].modele=4 then s:=s+' Triple: Pointe='; - s:=s+IntToSTR(aiguillage[i].APointe)+aiguillage[i].APointeB+ - ' Dévie='+IntToSTR(aiguillage[i].ADevie)+aiguillage[i].ADevieB+ + + if (aiguillage[i].modele=1) or (aiguillage[i].modele=4) then s:=s+IntToSTR(aiguillage[i].APointe)+aiguillage[i].APointeB; + s:=s+' Dévie='+IntToSTR(aiguillage[i].ADevie)+aiguillage[i].ADevieB+ ' Droit='+IntToSTR(aiguillage[i].ADroit)+aiguillage[i].ADroitB; + if aiguillage[i].modele=2 then + begin + s:=s+' DestDroit='+intToSTR(aiguillage[i].Ddroit)+aiguillage[i].DdroitB; + s:=s+' DestDévié='+intToSTR(aiguillage[i].DDevie)+aiguillage[i].DdevieB; + end; if aiguillage[i].modele=4 then s:=s+' Dévié2='+intToSTR(aiguillage[i].ADevie2)+aiguillage[i].ADevie2B; if aiguillage[i].vitesse<>0 then s:=s+' Vitesse déviée='+intToSTR(aiguillage[i].vitesse); if aiguillage[i].inversion<>0 then s:=s+' pilotage inversé'; - + Affiche(s,clYellow); end; end; - for i:=1 to MaxAiguillage do - begin - s:=IntToSTR(i)+'BIS'; - if aiguillageB[i].modele<>0 then - begin - if aiguillageB[i].modele=1 then s:=s+' Pointe='; - if aiguillageB[i].modele=2 then s:=s+' TJD: centre TJD='; - if aiguillageB[i].modele=3 then s:=s+' TJS:'; - if aiguillageB[i].modele=4 then s:=s+' Triple: Pointe='; - s:=s+IntToSTR(aiguillageB[i].APointe)+aiguillageB[i].APointeB+ - ' Dévie='+IntToSTR(aiguillageB[i].ADevie)+aiguillageB[i].ADevieB+ - ' Droit='+IntToSTR(aiguillageB[i].ADroit)+aiguillageB[i].ADroitB; - if aiguillageB[i].modele=4 then s:=s+' Dévié2='+intToSTR(aiguillageB[i].ADevie2)+aiguillageB[i].ADevie2B; - if aiguillageB[i].vitesse<>0 then s:=s+' Vitesse déviée='+intToSTR(aiguillageB[i].vitesse); - if aiguillageB[i].inversion<>0 then s:=s+' pilotage inversé'; - if aiguillageB[i].inversionCDM<>0 then s:=s+' lecture CDM inversée'; - Affiche(s,clYellow); - end; - end; end; @@ -7750,12 +7973,12 @@ begin MenuConnecterUSB.enabled:=false; DeConnecterUSB.enabled:=false; ConnecterCDMRail.enabled:=false; - + DeConnecterCDMRail.enabled:=true; end; procedure Interprete_trameCDM(recuCDM : string); var i,objet,posST,posAC,posDT,posSG,posXY,k,l,erreur, adr,adr2,etat,etataig, - vitesse,etatAig2,name : integer ; + vitesse,etatAig2,name,prv : integer ; x,y,x2,y2 : longint ; s,ss,train : string; traite,sort : boolean; @@ -7784,10 +8007,13 @@ begin val(ss,adr,erreur); //Affiche(copy(recuCDM,j,i+80),clOrange); - //i:=posEx('AD2=',recuCDM,i);ss:=copy(recuCDM,i+3,10); Affiche('j='+IntToSTR(j)+' i='+intToSTR(i),clred); - //val(ss,adr2,erreur); - i:=posEx('STATE=',recuCDM,i);ss:=copy(recuCDM,i+6,10); //Affiche('j='+IntToSTR(j)+' i='+intToSTR(i),clred); + i:=posEx('AD2=',recuCDM,i);ss:=copy(recuCDM,i+4,10); // Affiche('i='+intToSTR(i),clOrange); if i0 then begin Delete(recuCDM,posST,i+5-posST) ;end else begin s:='Erreur 95 posST='+IntToSTR(posST)+' i='+intToSTR(i); @@ -7801,25 +8027,32 @@ begin // conversion en position : // CDM: 0=droit 1=droite 3=gauche // logiciel : 1=dévié 2=droit - + // aiguillage normal - if aiguillage[adr].modele=1 then - begin - //Affiche('Normal',clyellow); + if aiguillage[adr].modele=1 then + begin + //Affiche('Normal',clyellow); if etat=0 then etatAig:=2 else etatAig:=1; Event_Aig(adr,etatAig,objet); end; // TJD TJS - if (aiguillage[adr].modele=2) or (aiguillage[adr].modele=3) then - begin - //Affiche('TJDS',clyellow); - adr2:=aiguillage[adr].Apointe; // 2eme adresse de la TJD + if (aiguillage[adr].modele=2) or (aiguillage[adr].modele=3) then + begin + //Affiche('TJD/S',clyellow); + //adr2:=aiguillage[adr].Apointe; // 2eme adresse de la TJD case etat of 1 : begin etatAig:=1;EtatAig2:=2;end; 4 : begin etatAig:=1;EtatAig2:=1;end; 5 : begin etatAig:=2;EtatAig2:=1;end; 0 : begin etatAig:=2;EtatAig2:=2;end; end; + if (aiguillage[adr].inversionCDM=1) or (aiguillage[adr2].inversionCDM=1) then + begin + //Affiche('inverse',clyellow); + prv:=adr; + adr:=adr2; + adr2:=prv; + end; Event_Aig(adr,etatAig,objet); Event_Aig(adr2,etatAig2,objet); end; @@ -7940,11 +8173,11 @@ begin end; inc(k); - sort:=(k>100) or (posST=0) and (posDT=0) and (posAC=0) and (posSG=0); + sort:=(k>200) or (posST=0) and (posDT=0) and (posAC=0) and (posSG=0); until (sort); //Affiche('Ligne traitée'+recuCDM,clLime); - if k>=100 then begin Affiche('Erreur 90 : Longrestante='+IntToSTR(length(recuCDM)),clred); Affiche(recuCDM,clred); end; + if k>=200 then begin Affiche('Erreur 90 : Longrestante='+IntToSTR(length(recuCDM)),clred); Affiche(recuCDM,clred); end; Nbre_recu_cdm:=0; end; @@ -7976,6 +8209,7 @@ begin LabelTitre.caption:=Titre; Affiche('CDM rail déconnecté',Cyan); AfficheDebug('CDM rail déconnecté',Cyan); + caption:=AF; CDM_connecte:=False; SocketCDM_connecte:=false; MenuConnecterUSB.enabled:=true; @@ -8053,40 +8287,6 @@ begin parSocket:=False; end; -procedure TFormPrinc.ChronoDetectClick(Sender: TObject); -var i,j,etat : integer; - s : string; -begin - if N_event_tick=0 then - begin - Affiche('Aucun évenèment détecteur ou aiguillage',clYellow); - end; - for i:=1 to N_Event_tick do - begin - - //for j:=1 to 1100 do - begin - j:=event_det_tick[i].detecteur; - if j<>-1 then - begin - s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick); - s:=s+' Det='+IntToSTR(j)+'='+intToSTR(event_det_tick[i].etat); - // s:=s+' Det suiv='+intTostr(event_det_tick[i].suivant); - Affiche(s,clyellow); - end; - end; - - j:=event_det_tick[i].aiguillage; - if j<>-1 then - begin - s:=IntToSTR(i)+' Tick='+IntToSTR(event_det_tick[i].tick); - s:=s+' Aig='+intToSTR(j)+'='+intToSTR(event_det_tick[i].etat); - Affiche(s,clyellow); - end; - end; - -end; - procedure TFormPrinc.FichierSimuClick(Sender: TObject); begin @@ -8242,7 +8442,7 @@ begin Affiche(sa,clyellow);sa:=''; end else - Affiche('Pas de réponse de l''interface',clOrange); + Affiche('Pas de réponse de l''interface après demande de passage en mode prog',clOrange); end; @@ -8344,7 +8544,11 @@ end; procedure TFormPrinc.ButtonLanceCDMClick(Sender: TObject); begin + + // ButtonArretSimu.Setfocus; Lance_CDM ; +// ButtonLanceCDM.unfocused; + end; procedure TFormPrinc.Affichefentredebug1Click(Sender: TObject); @@ -8355,4 +8559,5 @@ end; begin + end. diff --git a/UnitSimule.dcu b/UnitSimule.dcu index 33ca9cb..4ff3823 100644 Binary files a/UnitSimule.dcu and b/UnitSimule.dcu differ diff --git a/UnitSimule.pas b/UnitSimule.pas index df74fc7..7beeaba 100644 --- a/UnitSimule.pas +++ b/UnitSimule.pas @@ -53,6 +53,7 @@ begin index_simule:=1; repeat readln(fte,s); + Affiche(s,clLime); i:=pos('Tick=',s); if i<>0 then begin @@ -61,12 +62,14 @@ begin if intervalle<>0 then k:=Index_Simule*Intervalle*10+tick+80 else // démarre dans 8s k:=Index_Simule+tick+80 ; Tablo_simule[index_simule].tick:=k; - + // détecteur? - i:=pos('Det=',s); + i:=pos('Det',s); if i<>0 then begin - Delete(s,1,i+3); + Delete(s,1,i+2); + if s[1]='=' then delete(s,1,1); + if s[1]=' ' then delete(s,1,1); val(s,k,erreur); Tablo_simule[index_simule].detecteur:=k; i:=pos('=',s); @@ -76,20 +79,22 @@ begin val(s,k,erreur); Tablo_simule[index_simule].etat:=k; - {s:=IntToSTR(Index_simule)+' Tick='+intToSTR(Tablo_simule[index_simule].tick)+ - ' Detecteur='+intToSTR(Tablo_simule[index_simule].detecteur)+ - '='+intToSTR(Tablo_simule[index_simule].etat); - Affiche(s,ClLime); } + //s:=IntToSTR(Index_simule)+' Tick='+intToSTR(Tablo_simule[index_simule].tick)+ + // ' Detecteur='+intToSTR(Tablo_simule[index_simule].detecteur)+ + // '='+intToSTR(Tablo_simule[index_simule].etat); + //Affiche(s,ClLime); inc(index_simule); end; end; // aiguillage? - i:=pos('Aig=',s); + i:=pos('Aig',s); if i<>0 then begin - Delete(s,1,i+3); + Delete(s,1,i+2); + if s[1]='=' then delete(s,1,1); + if s[1]=' ' then delete(s,1,1); val(s,k,erreur); Tablo_simule[index_simule].aiguillage:=k; i:=pos('=',s); @@ -116,10 +121,10 @@ begin closeFile(fte); formprinc.ButtonArretSimu.Visible:=true; formprinc.ButtonArretSimu.top:=88; - + FormSimulation.Close; - end; - Affiche('Fichier simulation : '+nF ,clyellow); + end; + Affiche('Fichier simulation : '+nF ,clyellow); end; diff --git a/UnitTCO.dcu b/UnitTCO.dcu index b7b22c6..fc1097a 100644 Binary files a/UnitTCO.dcu and b/UnitTCO.dcu differ diff --git a/UnitTCO.pas b/UnitTCO.pas index 1f16006..c5e7549 100644 --- a/UnitTCO.pas +++ b/UnitTCO.pas @@ -2366,7 +2366,7 @@ begin if aiguillage[adresse].Adevie=AdrSuiv then Bimage:=4; // ou 4 // connecté sur pointe : la pointe est à droite - if aiguillage[adresse].Apointe=AdrSuiv then + if aiguillage[adresse].Apointe=AdrSuiv then Bimage:=5; // ou 2 TCO[i,ligne].BImage:=Bimage; end; @@ -2890,9 +2890,9 @@ begin // tjd ou tjs if adresse<>0 then begin - pos:=aiguillage[adresse].position; - pos2:=aiguillage[aiguillage[adresse].Apointe].position; // 2eme adresse de la TJD - if (pos=const_droit) and (pos2=const_droit) then + //pos:=aiguillage[adresse].position; + //pos2:=aiguillage[aiguillage[adresse].Apointe].position; // 2eme adresse de la TJD + if (pos=const_droit) and (pos2=const_droit) then begin inc(x); end; @@ -2921,8 +2921,8 @@ begin if adresse<>0 then begin pos:=aiguillage[adresse].position; - pos2:=aiguillage[aiguillage[adresse].Apointe].position; // 2eme adresse de la TJD - if (pos=const_droit) and (pos2=const_droit) then + //pos2:=aiguillage[aiguillage[adresse].Apointe].position; // 2eme adresse de la TJD + if (pos=const_droit) and (pos2=const_droit) then begin inc(x);inc(y); end; diff --git a/client-GL.cfg b/client-GL.cfg index 5100249..cc2c579 100644 --- a/client-GL.cfg +++ b/client-GL.cfg @@ -1,6 +1,6 @@ /****************************************** / fichier de configuration de client-GL.log -/ gily - f1iwq - 2018 +/ JFP - 2020 /****************************************** / ce programme permet de commander les signaux complexes avec ou sans / CDM rail. Il a trois modes de fonctionnement: @@ -18,17 +18,17 @@ / / / Taille de la fonte de la fenêtre -16 +Fonte=16 / / Adresse IP V4 du PC sur lequel s'execute CDM : port -127.0.0.1:9999 +IpV4_PC=127.0.0.1:9999 / / ========================================================================== / D é f i n i t i o n de l'interface XpressNet pour utilisation en mode autonome / Adresse IP V4 de l'interface LI-USB Ethernet : port / par défaut le port est 5550 / ne pas connecter le port ou mettre 0 si on travaille avec l'interface USB -192.168.1.23:5550 +IPV4_Interface=192.168.1.55:5550 / / port COM de l'adresse USB de l'interface LU-USB - LI100 - LI100F - LI101F - GENLI / attention de COM1 à 9 - Si le port de l'interface USB >9, il faut le changer @@ -38,62 +38,126 @@ / Com:vitesse,parité,nombre de bits,bits de stop,protocole: 0=aucun 1=Xon-Xoff 2=RTS-CTS 3=RTS-Xon-Xoff 4=CTS / voir notice page 29 / -COM3:57600,N,8,1,2 -/COM8:9600,N,8,1,0 +Protocole_serie=COM5:9600,N,8,1,0 / / Temporisation en ms d'envoi entre deux octets de la trame -50 +Inter_Car=30 / Temporisation maximale de contrôle après non réponse de l'interface, en tranches de 100ms / à adapter en fonction de l'interface. Ex 7=700ms d'attente maxi -7 +Tempo_maxi=7 / / Entete: préfixe ajouté aux trames : / Entete=0 - n'ajoute rien aux trames - pour une interface RS232 ou GENLI / Entete=1 - Ajoute FF FE au début de chaque trame envoyée à l'interface : pour une interface USB, entete=1 / Entete=2 - Ajoute E4 au début de chaque trame et 0D 0D 0A en fin de chaque trame : pour compatibilité arduino -1 +Entete=0 / =============================================================================== / / Avec (1) ou sans (0) initialisation des aiguillages au démarrage selon le tableau ci après -0 +Init_Aig=0 +/ +/ Fenêtre d'exécution en plein écran (1) ou réduite (0) +Fenetre=0 +/ +/ Vérification des versions au démarrage +verif_version=1 +/ Notification de nouvelle version +notif_version=0 +/ Avec TCO +TCO=0 +/ Lancement de CDM Rail au démarrage +CDM=0 +/ Nom du fichier LAY à ouvrir depuis CDM sans caractères spéciaux ( : / ) +/reseau_gily_signal_ajoute.lay +lay=DJEFF252RETROSIGNALISATION23.LAY +/ +/ Démarrage du serveur d'interface automatique +/ 0=ne pas démarrer automatiquement le serveur d'interfaces +/ 1=XpressNet (lenz.roco) +/ 2=P50X intellibox +/ 3=Sprog +/ 4=HSI88/HSI88-USB +/ 5=ECOS ESU +/ 6=FIS88 FeedBack (S88/S88N) +/ 7=RS2PC (Rs FeedBack interface) +/ 8=DCC++ +Serveur_interface=1 +/ +/ Interface de rétrosignalisation pour LENZ/DCC++ +/ 1=auto +/ 2=LI-USB +/ 3=LI-101F +/ 4=LI-100F +/ 5=LI-100 +/ 6=GENLI +retro=6 +/ +/ / / Valeurs des initialisations des aiguillages au démarrage ----------------------------------------------- / @ aiguillage, position 1=dévié 2=droit, temporisation de manoeuvre en 1/10eme de seconde , / 0=pilotage normal 1=pilotage inversé / une position différente de 1 ou 2 sera à 1. Une temporisation de 0 sera à 5. / la liste doit être terminée par 0,0,0 -1,2,3,0 -2,2,3,0 -3,2,3,0 -4,2,3,0 -5,1,3,0 -6,2,3,0 -7,1,3,0 -8,2,3,0 -9,2,3,0 -10,2,3,0 -11,2,3,0 -12,1,3,0 -13,1,3,0 -14,1,3,0 -15,1,3,0 -16,1,4,0 -17,1,3,0 -18,2,4,0 -19,1,4,0 -20,2,4,0 -21,2,3,0 -22,1,3,0 -23,1,3,0 -24,1,3,0 -25,1,3,0 -26,2,3,0 -27,2,3,0 -28,2,3,0 -29,2,3,0 -30,2,3,0 -31,1,3,0 -32,1,3,0 +[section_init] +77,2,3,0 +78,2,3,0 +79,2,3,0 +81,2,3,0 +82,2,3,0 +83,2,3,0 +84,2,3,0 +85,2,3,0 +86,2,3,0 +87,2,3,0 +88,2,3,0 +89,2,3,0 +90,2,3,0 +91,2,3,0 +92,2,3,0 +93,2,3,0 +94,2,3,0 +95,2,3,0 +96,2,3,0 +97,2,3,0 +98,2,3,0 +99,2,3,0 +100,2,3,0 +101,2,3,0 +102,2,3,0 +103,2,3,0 +104,2,3,0 +105,2,3,0 +106,2,3,0 +107,2,3,0 +108,2,3,0 +109,2,3,0 +110,2,3,0 +111,2,3,0 +112,2,3,0 +113,2,3,0 +114,2,3,0 +115,2,3,0 +116,2,3,0 +117,2,3,0 +118,2,3,0 +119,2,3,0 +120,2,3,0 +121,2,3,0 +122,2,3,0 +123,2,3,0 +124,2,3,0 +125,2,3,0 +126,2,3,0 +127,2,3,0 +128,2,3,0 +128,2,3,0 +130,2,3,0 +131,2,3,0 +132,2,3,0 +133,2,3,0 +134,2,3,0 +135,2,3,0 +136,2,3,0 0,0,0,0 -/ - +/ \ No newline at end of file diff --git a/config.cfg b/config.cfg index ecbaa5e..8b14bf6 100644 --- a/config.cfg +++ b/config.cfg @@ -1,128 +1,158 @@ /****************************************** -/ fichier de configuration de signaux complexes -/ cap de bouheyre avec signaux - 2018 -/**************************************** +/ fichier de configuration de signaux_complexes +/ JFP - 2020 - nouvelles tjd +/****************************************** / Sans Log=0 / Avec Log=1 : génère un fichier log Log=0 / Affichage du débug du calcul des routes, et enregistrement dans le log si la variable précédente est à 1 TraceDet=0 -/ si 1 envoie un 0 après le pilotage des décodeurs LEB +/ Envoie un 0 après le pilotage des décodeurs LEB RazSignaux=0 / / modélisation des aiguillages : détermine les éléments connectés aux 3 branches des aiguilles (Pointe, Droit, Dévié (S) -/ adresse d'aiguillage[B],P=élément vers pointe D=élément vers Droit, S=élément vers dévié -/ B pour adresse d'aiguillage déja utilisée -/ Elément = détecteur (valeur uniquement numérique) ou aiguillage (adresse [TRI,TJS,TJD]+branche de connexion (P S ou D) -/ Exemples : 1,P518,D523,S3P signifie : définition de l'aiguillage @1 : sur pointe relié au détecteur 518 +/ adresse d'aiguillage [TJS,TJD,TRI],P=élément vers pointe D=élément vers Droit, S=élément vers dévié, INV si aiguillage inversé +/ Elément = détecteur (valeur uniquement numérique) ou aiguillage (adresse+branche de connexion (P S ou D) +/ Exemple : 1,P518,D523,S3P signifie : définition de l'aiguillage @1 : sur pointe relié au détecteur 518 / sur Droit relié au détecteur 518 / sur Dévié, relié à l'aiguillage 3 en pointe -/ Voir la documentation des signaux complexes pour une description complete +/ Pour une TJD : 26TJD,D(connectD,DirectionD),S(connectS,DirectionS) +/ / S'il n'y a pas de détecteur connecté à une branche d'aiguillage, mettre 0. -1,S1BS,P2P,D3P,0 -1B,P553,D16P,S1S -2,P1P,D4P,S2BS -2B,P521,D16D,S2S -3,P1D,D522,S5BP -4,P2D,D554,S6BP -5,P9P,S15P,D5BS -5B,P3S,S5D,D545,0,1 -6,P10P,S546,D6BS -6B,P4S,D545,S6D -7,P15S,D566,S565 -8,P20P,D566,S565 -9,P5P,D530,S17P -10,P6P,D530,S18P -13,P17S,D563,S564 -14,P18S,D563,S564 -15,P5S,D546,S7P -16,P1BD,S16BS,D2BD -16B,P0,S16S,D557 -17,P9S,D531,S13P -18,P10S,D562,S14P -20,P8P,D547,S548 -21,P25P,S537,D23S -22,P24P,S561,D25S -23,P569,S21D,D538 -24,P22P,S26P,D513 -25,P21P,S22D,D570 -26,P24S,S515,D514 -28,P30P,S29P,D570 -29,P28S,D516,S31P -30,P28P,D32S,S539 -31TRI,27,P29S,D518,S0,S2-517 -32,P571,D538,S30D +/77TJD,P78,D599,S600 +/78TJD,P77,D598,S79D +77TJD,D(599,78D),S(600,78S),I1 +78TJD,D(598,S77D),S(79D,77S),I1 +79,P601,D78S,S597 +81,P515,D513,S82S +82,P83P,D516,S81S +83,P82P,D514,S517 +85,P524,D89D,S86D +86,P87P,D85S,S525 +87,P86P,D88P,S89S +88,P87D,D548,S94D +89TJD,D(85D,90D),S(87S,90S),I1 +90TJD,D(547,89D),S(91S,89S),I1 +/89TJD,P90,D85D,S87S +/90TJD,P89,D547,S91S +/91TJD,P92,D540,S90S +/92TJD,P91,D546,S96S +91TJD,D(540,92D),S(90S,92S),I1 +92TJD,D(546,91D),S(96S,91S),I1 +/93TJD,P94,D95S,S549 +/94TJD,P93,D88S,S542 +93TJD,D(88S,94D),S(542,94S) +94TJD,D(549,93D),S(95S,93S) +95,P97S,D543,S93D +96,P545,D538,S92S +97,P102S,D544,S95P +98,P550,D555,S101S +99,P101D,D551,S100D +100,P552,D99S,S553 +101,P556,D99P,S98S +102,P103D,D557,S97P +/103TJD,P104,D102P,S563 +/104TJD,P103,D564,S109D +103TJD,D(102P,104D),S(563,104S),I1 +104TJD,D(564,103D),S(109D,103S),I1 +105,P558,D106P,S107D +106,P105D,D566,S568 +/107TJD,P108,D105S,S559 +/108TJD,P107,D110S,S581 +107TJD,D(105S,108D),S(559,108S),I1 +108TJD,D(110S,107D),S(581,107S),I1 +109,P112S,D104S,S562 +110,P111P,S108D,D560 +111,P110P,D589,S113S +112,P113D,D561,S109P +113,P590,D112P,S111S +114,P603,D115P,S604 +115,P114D,D116S,S606 +116,P607,D605,S115D +117,P602,D591,S118P +118,P117S,D119P,S592 +119,P118D,D120P,S593 +120,P119D,D595,S594 +121,P122D,D588,S587 +122,P123D,D121P,S586 +123,P124S,D122P,S585 +124,P583,D584,S123P +125,P579,D577,S578 +126,P580,D569,S127P +127,P126S,D128P,S570 +128,P127D,D129P,S571 +129,P128D,D130P,S572 +130,P129D,D574,S573 +131,P132D,D529,S530 +132,P133D,D131P,S531 +133,P134D,D132P,S532 +134,P135D,D133P,S533 +135,P523,D134p,S534 +136,P522,D535,S536 0 -// +/ / modélisation du réseau par branche -/ 1 ligne par branche - le sens de parcours de la description n'a pas d'importance. -/ Chaque ligne (branche) doit comporter au moins un détecteur et au moins aiguillage +/ 1 ligne par branche - le sens de parcours de la branche est arbitraire. +/ Chaque ligne (branche) doit commmencer et finir par un aiguilage ou un buttoir (0) / @ détecteur A=@aiguillage -/ chaque ligne doit commencer par un aiguillage et se terminer par un aiguillage -/ Terminer par les brances par 0 -/ Exemple : 519 est un détecteur - A2 est l'aiguillage 2 - A1B est l'aiguillage 1bis +/ Terminer par 0 +/ Exemple : 519 est un détecteur - A2 est l'aiguillage 2 / -/ rouge - jaune -A20,547,561,A22,A24,A26,515,518,A31,A29,A28,A30,539,522,A3,A1,A2,A4,A6B,545,A5B,A3 -A26,514,517,A31 -A26,515,518,A31 -A24,513,516,A29 -/grande boucle extérieure départ de couche rouge: de 569 à 569 -A23,538,A32,571,553,A1B,A16,A2B,521,569,A23 -/ grande boucle intérieure -A21,A25,570,A28 -A4,554,537,A21 -/ couche jaune -A10,530,A9,A5,A15,546,A6 -A18,562,531,A17 -A14,563,A13 -A14,564,A13 -/ -A7,565,A8 -A7,566,A8 -A16B,557,0 -A20S,548,0 +A83,514,518,520,524,A85,A89,A90,547,560,A110,A111,589,597,A79 +A77,599,590,A113,A112,561,548,A88,A87,A86,525,521,519,513,A81 +A106,A105,558,545,A96,538,537,0 +A108,581,582,0 +A107,559,546,A92,A91,537,540,0 +A112,A109,562,549,A93,A94,542,541,0 +A104,564,565,0 +A103,A102,A97,A95,543,528,0 +A97,544,0 +A102,557,555,A98,550,0 +A103,563,556,A101,A99,551,0 +A99,A100,552,0 +A100,553,554,0 +A106,566,567,0 +A106,568,603,A114,604,0 +A114,A115,606,608,0 +A115,A116,607,0 +A116,605,0 +A135,534,574,A130 +A134,533,573,A130 +A133,532,572,A129 +A132,531,571,A128 +A131,530,570,A127 +A82,516,527,576,580,A126,569,529,A131,A132,A133,A134,A135,523,515,A81 +A136,536,578,A125 +A77,600,579,A125,577,535,A136,522,517,A83 +A79,601,596,583,A124,584,595,A120,A119,A118,A117,602,598,A78 +A117,591,588,A121 +A118,592,587,A121 +A119,593,586,A122 +A120,594,585,A123 0 / -/ liste des signaux +/ liste signaux / la liste doit être terminée par une adresse à 0 / forme : 2=2 feux(carré violet/blanc) / 3=3 feux / 4=4 feux (carré) / 5=5 feux (carré + blanc) / 7=7 feux (carré+blanc + ralentissement / 9=9 feux (blanc ou violet + rappel ralentissement) -/ type de décodeur : 0=feu virtuel 1=digital Bahn 2=CDF 3=LDT 4=LEB +/ type de décodeur : 0=virtuel 1=digital Bahn 2=CDF 3=LDT 4=LEB 5=NMRA 6=Unisemaf Paco / l'énumération des détecteurs ne nécessite pas de parenthèses si il est seul, mais il faut des parenthèses si / le signal concerne plusieurs voies (donc détecteurs) / Notation de chaque ligne: / adresse de base du signal, forme, réserve, type de décodeur [, (détecteur,..detecteur , élément suivant ..) , / avec ou sans demande de verrouillage du feu au carré (0 ou 1)] -161,4,0,4,(538,A32),0 -169,9,0,4,(539,A30),0, -177,9,0,4,(569,A23),0 -185,4,0,4,(570,A25),0 -193,4,0,4,(516,A29),0 -201,2,0,4,(517,31TRI,518,31TRI),0 -209,9,0,4,(513,A24),0 -217,2,0,4,(514,A26,515,A26),0 -225,9,0,4,(561,A22),0 -233,4,0,4,(547,A20),0 -241,4,0,4,(548,A20),1 -1001,3,0,0,(537,554),0 -1003,3,0,0,(553,A1B),0 -1005,3,0,0,(571,553),0 -1007,3,0,0,(554,A4),0 -1009,3,0,0,(522,539),0 -1011,3,0,0,(521,569),0 -1013,3,0,0,(565,A7),0 -1015,3,0,0,(562,A18),0 -1017,3,0,0,(563,A14),0 -1019,3,0,0,(564,A14),0 +197,3,0,6,(598,A78),1,3 +201,4,0,6,(597,A79),1,4 +205,9,0,6,(590,A113),1,93 +209,9,0,6,(560,A110),1,92 +213,9,0,6,(548,A88),1,92 +217,9,0,6,(524,A85),1,93 +221,7,0,6,(518,520),1,73 +225,3,0,6,(521,519),1,3 +229,9,0,6,(516,A82),1,92 +233,4,0,6,(513,A81),1,92 0 / / Fonctions Fx à envoyer aux locomotives sur passage d'un actionneur / Uniquement en mode connecté à CDM / actionneur,état,Nom de la loco,fonction,temporisation en ms avant remise à 0 -/815,1,CC406526,F2,400 -/(815,830),(820,840),PN(121+,121-) -/(815,809),PN(121+,121-) 0 - - - diff --git a/verif_version.dcu b/verif_version.dcu index 3d511ee..dfac4b2 100644 Binary files a/verif_version.dcu and b/verif_version.dcu differ diff --git a/verif_version.pas b/verif_version.pas index 026e897..45eeb07 100644 --- a/verif_version.pas +++ b/verif_version.pas @@ -23,7 +23,7 @@ var Lance_verif : integer; verifVersion,notificationVersion : boolean; -Const Version='1.75'; // sert à la comparaison de la version publiée +Const Version='2.0'; // sert à la comparaison de la version publiée implementation diff --git a/versions.txt b/versions.txt index ebbb7e2..35c3083 100644 --- a/versions.txt +++ b/versions.txt @@ -28,7 +28,11 @@ version 1.73 : Am Affichage d'aide sur les éléments décrits dans le panneau de configuration version 1.74 : Amélioration des affichages du TCO - Pilotage des aiguillages depuis le TCO - Amélioration du séquençage d'ouverture de CDM Rail Version 1.75 : conditions supplémentaires permettant l'affichage d'un carré sur un signal en fonction des aiguillages dans le fichier config.cfg - +version 1.76 : Modification des aiguillages modélisés depuis le menu de configuration générale + Les aiguillages BIS ne sont plus supportés car ils induisent des erreurs. + Correction d'un bug sur les feux dont l'élément suivant est un détecteur +version 2.0 : Changement de description des TJD + Amélioration de l'algorithme des routes