Contenido principal

getDataDefaults

R2026b

Get default data properties for AUTOSAR component model

Since R2022b

    Description

    dataDefault = getDataDefaults(slMap,"InportsOutports","EndToEndProtectionMethod") returns the default end-to-end (E2E) protection method for root-level inports and outports of an AUTOSAR component model.

    Supported protection methods are E2E Transformer Error and E2E Protection Wrapper.

    example

    dataDefault = getDataDefaults(slMap,elementCategory,"SwAddrMethod") returns the default software address method for the specified element category. Specify "InternalData" for internal data structures or "Constants" for constant data structures.

    example

    Examples

    collapse all

    Return the default E2E protection method setting for an AUTOSAR component model.

    Open example model autosar_swc and get the default E2E protection method.

    modelName = "autosar_swc";
    openExample(modelName);
    
    slMap = autosar.api.getSimulinkMapping(modelName);
    e2eMethod = getDataDefaults(slMap, ...
       "InportsOutports","EndToEndProtectionMethod")
    
    e2eMethod =
        'ProtectionWrapper'
    

    Set and then display the default E2E protection method.

    setDataDefaults(slMap,"InportsOutports", ...
       "EndToEndProtectionMethod","TransformerError");
    e2eMethod = getDataDefaults(slMap, ...
       "InportsOutports","EndToEndProtectionMethod")
    
    e2eMethod =
        'TransformerError'

    Return the default software address method settings for the internal data and constants categories of an AUTOSAR component model.

    Open example model autosar_swc_counter and add a software address method for constants by using the addPackageableElement function.

    modelName = "autosar_swc_counter";
    openExample(modelName);
    
    arProps = autosar.api.getAUTOSARProperties(modelName);
    addPackageableElement(arProps,"SwAddrMethod",...
        "/Company/Powertrain/DataTypes/SwAddrMethods","Constant",...
        "SectionType","Const");
    

    Use the setDataDefaults function to set the default software address method for internal data and constants. If no data default is set, the getDataDefaults function returns an empty character vector.

    slMap = autosar.api.getSimulinkMapping(modelName);
    setDataDefaults(slMap,"InternalData","SwAddrMethod","VAR");
    getDataDefaults(slMap,"InternalData","SwAddrMethod")
    setDataDefaults(slMap,"Constants","SwAddrMethod","Constant");
    getDataDefaults(slMap,"Constants","SwAddrMethod")
    ans =
    
        'VAR'
    
    
    ans =
    
        'Constant'

    Input Arguments

    collapse all

    Simulink to AUTOSAR mapping information for a model, previously returned by slMap = autosar.api.getSimulinkMapping(modelName). modelName is a handle, character vector, or string scalar representing the model name.

    Example: slMap = autosar.api.getSimulinkMapping("modelName")

    Category of model data elements, specified as one of the following:

    • "InternalData" — Get the SwAddrMethod property for internal data structures. The software address method must have section type Var.

    • "Constants" — Get the SwAddrMethod property for constant data structures. The software address method must have section type Const.

    Data Types: char | string

    Output Arguments

    collapse all

    Name of the data default, returned as either name of the default software address method for constants or internal data in the model or as one of these end to end protection methods for root-level inports and outports:

    • 'ProtectionWrapper' — Generated code uses an E2E protection wrapper in support of E2E data consistency checks.

    • 'TransformerError' — E2E Transformer configures RTE calls to use a transformer error argument in the generated code.

      When the data type of the error status port is uint16, the error status value combines the return value of the Rte_Read function and the transformer error code to create a 16-bit error code, where the least significant eight bits are the output of the Rte_Read function and the most significant eight bits are the transformer error code.

      The TransformerError protection method is supported only when using AUTOSAR schema version 4.2 or later.

    Data Types: char

    Version History

    Introduced in R2022b

    expand all