当前位置:   article > 正文

用m语言检查Arxml文件的连线问题

arxml

 什么是ARXML文件?

ARXML(AUTOSAR XML)是AUTOSAR(AUTomotive Open System ARchitecture)标准中定义的一种XML格式的文件,用于描述汽车电子系统的软件和硬件架构。ARXML文件包含了汽车电子系统的各种信息,如ECU(Electronic Control Unit)的定义和配置,信号和参数定义,软件组件和接口定义等。

ARXML文件使用XML(eXtensible Markup Language)格式,可以被计算机系统和工具软件轻松解析和处理。它提供了一种统一且可扩展的方式来描述汽车电子系统,以便在不同的开发环境中共享和处理系统的信息。

ARXML文件的结构由AUTOSAR标准定义,包含了一系列的元素和属性,用于表示系统的各个方面。例如,ARXML文件可以包含ECU描述、设备描述、信号描述、参数描述、变量描述、软件组件描述等元素。这些元素之间可以定义层级关系,以便表示系统的组织结构。

通过使用ARXML,汽车电子系统的开发者可以在不同的开发环境中共享和处理系统的信息,例如系统架构设计、软件组件的定义和配置、通信接口的定义等。这样可以提高系统开发的效率和质量,并支持系统的模块化和可重用性。

总之,ARXML是一种用于描述汽车电子系统的XML格式文件,用于表示系统的软件和硬件架构,以及各种相关的信息。它是AUTOSAR标准的一部分,为汽车电子系统的开发和集成提供了统一的描述方式。

ARXML文件中的连线

如下所示,ARXML文件中的连线有特定的格式:

  1. <ASSEMBLY-SW-CONNECTOR UUID="09e3fd1a-f316-4af7-9825-c62942eec3e5">
  2. <SHORT-NAME>Assembly169</SHORT-NAME>
  3. <PROVIDER-IREF>
  4. <CONTEXT-COMPONENT-REF DEST="SW-COMPONENT-PROTOTYPE">/Composition/AC/BO_VC_SystemCtrl</CONTEXT-COMPONENT-REF>
  5. <TARGET-P-PORT-REF DEST="P-PORT-PROTOTYPE">/SoftwareTypes/ComponentTypes/BO_VC_SystemCtrl/FF_CoolingFan_PWM_Adjust_AcTx</TARGET-P-PORT-REF>
  6. </PROVIDER-IREF>
  7. <REQUESTER-IREF>
  8. <CONTEXT-COMPONENT-REF DEST="SW-COMPONENT-PROTOTYPE">/Composition/AC/BO_VC_AcTx</CONTEXT-COMPONENT-REF>
  9. <TARGET-R-PORT-REF DEST="R-PORT-PROTOTYPE">/SoftwareTypes/ComponentTypes/BO_VC_AcTx/FF_CoolingFan_PWM_Adjust_AcTx</TARGET-R-PORT-REF>
  10. </REQUESTER-IREF>
  11. </ASSEMBLY-SW-CONNECTOR>

因此,可以通过对特定字符的检索,来达到检查有没有连线的目的。

代码

本文使用的是m语言,写了个简易脚本:

  1. classdef ARXMLConnectCheck < matlab.apps.AppBase
  2. % Properties that correspond to app components
  3. properties (Access = public)
  4. UIFigure matlab.ui.Figure
  5. Hyperlink matlab.ui.control.Hyperlink
  6. Button_2 matlab.ui.control.Button
  7. ARXMLEditField matlab.ui.control.EditField
  8. ARXMLLabel matlab.ui.control.Label
  9. WriteTextArea matlab.ui.control.TextArea
  10. WriteLabel matlab.ui.control.Label
  11. Button matlab.ui.control.Button
  12. PortEditField matlab.ui.control.EditField
  13. PortEditFieldLabel matlab.ui.control.Label
  14. SWCEditField matlab.ui.control.EditField
  15. SWCEditFieldLabel matlab.ui.control.Label
  16. ArxmlLabel matlab.ui.control.Label
  17. end
  18. properties (Access = public)
  19. SWC_Name % Description
  20. NewPort_Name
  21. XML
  22. end
  23. % Callbacks that handle component events
  24. methods (Access = private)
  25. % Value changed function: SWCEditField
  26. function SWCEditFieldValueChanged(app, event)
  27. value = app.SWCEditField.Value;
  28. app.SWC_Name = char(value);
  29. end
  30. % Value changed function: PortEditField
  31. function PortEditFieldValueChanged(app, event)
  32. value = app.PortEditField.Value;
  33. app.NewPort_Name = char(value);
  34. end
  35. % Button pushed function: Button
  36. function ButtonPushed(app, event)
  37. app.WriteTextArea.Value = ArxmlConnectCheck1(app.SWC_Name, app.NewPort_Name, app.XML);
  38. app.WriteTextArea.Value = strcat(app.WriteTextArea.Value, " More imformantion for the trace");
  39. end
  40. % Value changed function: ARXMLEditField
  41. function ARXMLEditFieldValueChanged(app, event)
  42. value = app.ARXMLEditField.Value;
  43. app.XML = char(value);
  44. end
  45. % Value changed function: WriteTextArea
  46. function WriteTextAreaValueChanged(app, event)
  47. end
  48. % Button pushed function: Button_2
  49. function Button_2Pushed(app, event)
  50. app.ARXMLEditField.Value = uigetfile(".arxml","请选择输入的ARXML文件", "THS_VC_SystemCtrl.arxml","MultiSelect","on");
  51. app.XML = char(app.ARXMLEditField.Value);
  52. end
  53. end
  54. % Component initialization
  55. methods (Access = private)
  56. % Create UIFigure and components
  57. function createComponents(app)
  58. % Create UIFigure and hide until all components are created
  59. app.UIFigure = uifigure('Visible', 'off');
  60. app.UIFigure.Position = [100 100 640 480];
  61. app.UIFigure.Name = 'MATLAB App';
  62. % Create ArxmlLabel
  63. app.ArxmlLabel = uilabel(app.UIFigure);
  64. app.ArxmlLabel.BackgroundColor = [0.502 0.502 0.502];
  65. app.ArxmlLabel.HorizontalAlignment = 'center';
  66. app.ArxmlLabel.FontSize = 18;
  67. app.ArxmlLabel.FontWeight = 'bold';
  68. app.ArxmlLabel.FontAngle = 'italic';
  69. app.ArxmlLabel.Position = [1 444 640 37];
  70. app.ArxmlLabel.Text = 'Arxml校验脚本';
  71. % Create SWCEditFieldLabel
  72. app.SWCEditFieldLabel = uilabel(app.UIFigure);
  73. app.SWCEditFieldLabel.HorizontalAlignment = 'right';
  74. app.SWCEditFieldLabel.Position = [342 384 45 22];
  75. app.SWCEditFieldLabel.Text = 'SWC:';
  76. % Create SWCEditField
  77. app.SWCEditField = uieditfield(app.UIFigure, 'text');
  78. app.SWCEditField.ValueChangedFcn = createCallbackFcn(app, @SWCEditFieldValueChanged, true);
  79. app.SWCEditField.Position = [393 384 196 22];
  80. % Create PortEditFieldLabel
  81. app.PortEditFieldLabel = uilabel(app.UIFigure);
  82. app.PortEditFieldLabel.HorizontalAlignment = 'right';
  83. app.PortEditFieldLabel.Position = [28 384 75 22];
  84. app.PortEditFieldLabel.Text = 'Port口名称:';
  85. % Create PortEditField
  86. app.PortEditField = uieditfield(app.UIFigure, 'text');
  87. app.PortEditField.ValueChangedFcn = createCallbackFcn(app, @PortEditFieldValueChanged, true);
  88. app.PortEditField.Position = [121 385 186 21];
  89. % Create Button
  90. app.Button = uibutton(app.UIFigure, 'push');
  91. app.Button.ButtonPushedFcn = createCallbackFcn(app, @ButtonPushed, true);
  92. app.Button.Position = [271 244 100 23];
  93. app.Button.Text = '开始校验';
  94. % Create WriteLabel
  95. app.WriteLabel = uilabel(app.UIFigure);
  96. app.WriteLabel.HorizontalAlignment = 'right';
  97. app.WriteLabel.Position = [28 193 57 22];
  98. app.WriteLabel.Text = 'Write窗口';
  99. % Create WriteTextArea
  100. app.WriteTextArea = uitextarea(app.UIFigure);
  101. app.WriteTextArea.ValueChangedFcn = createCallbackFcn(app, @WriteTextAreaValueChanged, true);
  102. app.WriteTextArea.Position = [112 42 454 173];
  103. % Create ARXMLLabel
  104. app.ARXMLLabel = uilabel(app.UIFigure);
  105. app.ARXMLLabel.HorizontalAlignment = 'right';
  106. app.ARXMLLabel.Position = [28 314 83 22];
  107. app.ARXMLLabel.Text = 'ARXML文件:';
  108. % Create ARXMLEditField
  109. app.ARXMLEditField = uieditfield(app.UIFigure, 'text');
  110. app.ARXMLEditField.ValueChangedFcn = createCallbackFcn(app, @ARXMLEditFieldValueChanged, true);
  111. app.ARXMLEditField.Position = [121 312 186 24];
  112. % Create Button_2
  113. app.Button_2 = uibutton(app.UIFigure, 'push');
  114. app.Button_2.ButtonPushedFcn = createCallbackFcn(app, @Button_2Pushed, true);
  115. app.Button_2.Position = [416 313 100 23];
  116. app.Button_2.Text = '选择';
  117. % Create Hyperlink
  118. app.Hyperlink = uihyperlink(app.UIFigure);
  119. app.Hyperlink.URL = 'file:///C:/Users/34357/Desktop/Made.html';
  120. app.Hyperlink.Position = [36 42 59 22];
  121. % Show the figure after all components are created
  122. app.UIFigure.Visible = 'on';
  123. end
  124. end
  125. % App creation and deletion
  126. methods (Access = public)
  127. % Construct app
  128. function app = ARXMLConnectCheck
  129. % Create UIFigure and components
  130. createComponents(app)
  131. % Register the app with App Designer
  132. registerApp(app, app.UIFigure)
  133. if nargout == 0
  134. clear app
  135. end
  136. end
  137. % Code that executes before app deletion
  138. function delete(app)
  139. % Delete UIFigure when app is deleted
  140. delete(app.UIFigure)
  141. end
  142. end
  143. end

输出结果:

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/不正经/article/detail/514089
推荐阅读
相关标签
  

闽ICP备14008679号