什么是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文件中的连线有特定的格式:

<ASSEMBLY-SW-CONNECTOR UUID="09e3fd1a-f316-4af7-9825-c62942eec3e5">
              <SHORT-NAME>Assembly169</SHORT-NAME>
              <PROVIDER-IREF>
                <CONTEXT-COMPONENT-REF DEST="SW-COMPONENT-PROTOTYPE">/Composition/AC/BO_VC_SystemCtrl</CONTEXT-COMPONENT-REF>
                <TARGET-P-PORT-REF DEST="P-PORT-PROTOTYPE">/SoftwareTypes/ComponentTypes/BO_VC_SystemCtrl/FF_CoolingFan_PWM_Adjust_AcTx</TARGET-P-PORT-REF>
              </PROVIDER-IREF>
              <REQUESTER-IREF>
                <CONTEXT-COMPONENT-REF DEST="SW-COMPONENT-PROTOTYPE">/Composition/AC/BO_VC_AcTx</CONTEXT-COMPONENT-REF>
                <TARGET-R-PORT-REF DEST="R-PORT-PROTOTYPE">/SoftwareTypes/ComponentTypes/BO_VC_AcTx/FF_CoolingFan_PWM_Adjust_AcTx</TARGET-R-PORT-REF>
              </REQUESTER-IREF>
</ASSEMBLY-SW-CONNECTOR>

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

代码

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

classdef ARXMLConnectCheck < matlab.apps.AppBase

    % Properties that correspond to app components
    properties (Access = public)
        UIFigure            matlab.ui.Figure
        Hyperlink           matlab.ui.control.Hyperlink
        Button_2            matlab.ui.control.Button
        ARXMLEditField      matlab.ui.control.EditField
        ARXMLLabel          matlab.ui.control.Label
        WriteTextArea       matlab.ui.control.TextArea
        WriteLabel          matlab.ui.control.Label
        Button              matlab.ui.control.Button
        PortEditField       matlab.ui.control.EditField
        PortEditFieldLabel  matlab.ui.control.Label
        SWCEditField        matlab.ui.control.EditField
        SWCEditFieldLabel   matlab.ui.control.Label
        ArxmlLabel          matlab.ui.control.Label
    end

    
    properties (Access = public)
        SWC_Name % Description
        NewPort_Name
        XML
    end
    

    % Callbacks that handle component events
    methods (Access = private)

        % Value changed function: SWCEditField
        function SWCEditFieldValueChanged(app, event)
            value = app.SWCEditField.Value;
            app.SWC_Name = char(value);
        end

        % Value changed function: PortEditField
        function PortEditFieldValueChanged(app, event)
            value = app.PortEditField.Value;
            app.NewPort_Name = char(value);
        end

        % Button pushed function: Button
        function ButtonPushed(app, event)
            app.WriteTextArea.Value = ArxmlConnectCheck1(app.SWC_Name, app.NewPort_Name, app.XML);
            app.WriteTextArea.Value = strcat(app.WriteTextArea.Value, "   More imformantion for the trace");
        end

        % Value changed function: ARXMLEditField
        function ARXMLEditFieldValueChanged(app, event)
            value = app.ARXMLEditField.Value;
            app.XML = char(value);
        end

        % Value changed function: WriteTextArea
        function WriteTextAreaValueChanged(app, event)

            
        end

        % Button pushed function: Button_2
        function Button_2Pushed(app, event)
            app.ARXMLEditField.Value = uigetfile(".arxml","请选择输入的ARXML文件", "THS_VC_SystemCtrl.arxml","MultiSelect","on");
            app.XML = char(app.ARXMLEditField.Value);
        end
    end

    % Component initialization
    methods (Access = private)

        % Create UIFigure and components
        function createComponents(app)

            % Create UIFigure and hide until all components are created
            app.UIFigure = uifigure('Visible', 'off');
            app.UIFigure.Position = [100 100 640 480];
            app.UIFigure.Name = 'MATLAB App';

            % Create ArxmlLabel
            app.ArxmlLabel = uilabel(app.UIFigure);
            app.ArxmlLabel.BackgroundColor = [0.502 0.502 0.502];
            app.ArxmlLabel.HorizontalAlignment = 'center';
            app.ArxmlLabel.FontSize = 18;
            app.ArxmlLabel.FontWeight = 'bold';
            app.ArxmlLabel.FontAngle = 'italic';
            app.ArxmlLabel.Position = [1 444 640 37];
            app.ArxmlLabel.Text = 'Arxml校验脚本';

            % Create SWCEditFieldLabel
            app.SWCEditFieldLabel = uilabel(app.UIFigure);
            app.SWCEditFieldLabel.HorizontalAlignment = 'right';
            app.SWCEditFieldLabel.Position = [342 384 45 22];
            app.SWCEditFieldLabel.Text = 'SWC:';

            % Create SWCEditField
            app.SWCEditField = uieditfield(app.UIFigure, 'text');
            app.SWCEditField.ValueChangedFcn = createCallbackFcn(app, @SWCEditFieldValueChanged, true);
            app.SWCEditField.Position = [393 384 196 22];

            % Create PortEditFieldLabel
            app.PortEditFieldLabel = uilabel(app.UIFigure);
            app.PortEditFieldLabel.HorizontalAlignment = 'right';
            app.PortEditFieldLabel.Position = [28 384 75 22];
            app.PortEditFieldLabel.Text = 'Port口名称:';

            % Create PortEditField
            app.PortEditField = uieditfield(app.UIFigure, 'text');
            app.PortEditField.ValueChangedFcn = createCallbackFcn(app, @PortEditFieldValueChanged, true);
            app.PortEditField.Position = [121 385 186 21];

            % Create Button
            app.Button = uibutton(app.UIFigure, 'push');
            app.Button.ButtonPushedFcn = createCallbackFcn(app, @ButtonPushed, true);
            app.Button.Position = [271 244 100 23];
            app.Button.Text = '开始校验';

            % Create WriteLabel
            app.WriteLabel = uilabel(app.UIFigure);
            app.WriteLabel.HorizontalAlignment = 'right';
            app.WriteLabel.Position = [28 193 57 22];
            app.WriteLabel.Text = 'Write窗口';

            % Create WriteTextArea
            app.WriteTextArea = uitextarea(app.UIFigure);
            app.WriteTextArea.ValueChangedFcn = createCallbackFcn(app, @WriteTextAreaValueChanged, true);
            app.WriteTextArea.Position = [112 42 454 173];

            % Create ARXMLLabel
            app.ARXMLLabel = uilabel(app.UIFigure);
            app.ARXMLLabel.HorizontalAlignment = 'right';
            app.ARXMLLabel.Position = [28 314 83 22];
            app.ARXMLLabel.Text = 'ARXML文件:';

            % Create ARXMLEditField
            app.ARXMLEditField = uieditfield(app.UIFigure, 'text');
            app.ARXMLEditField.ValueChangedFcn = createCallbackFcn(app, @ARXMLEditFieldValueChanged, true);
            app.ARXMLEditField.Position = [121 312 186 24];

            % Create Button_2
            app.Button_2 = uibutton(app.UIFigure, 'push');
            app.Button_2.ButtonPushedFcn = createCallbackFcn(app, @Button_2Pushed, true);
            app.Button_2.Position = [416 313 100 23];
            app.Button_2.Text = '选择';

            % Create Hyperlink
            app.Hyperlink = uihyperlink(app.UIFigure);
            app.Hyperlink.URL = 'file:///C:/Users/34357/Desktop/Made.html';
            app.Hyperlink.Position = [36 42 59 22];

            % Show the figure after all components are created
            app.UIFigure.Visible = 'on';
        end
    end

    % App creation and deletion
    methods (Access = public)

        % Construct app
        function app = ARXMLConnectCheck

            % Create UIFigure and components
            createComponents(app)

            % Register the app with App Designer
            registerApp(app, app.UIFigure)

            if nargout == 0
                clear app
            end
        end

        % Code that executes before app deletion
        function delete(app)

            % Delete UIFigure when app is deleted
            delete(app.UIFigure)
        end
    end
end

输出结果:

Logo

魔乐社区(Modelers.cn) 是一个中立、公益的人工智能社区,提供人工智能工具、模型、数据的托管、展示与应用协同服务,为人工智能开发及爱好者搭建开放的学习交流平台。社区通过理事会方式运作,由全产业链共同建设、共同运营、共同享有,推动国产AI生态繁荣发展。

更多推荐