1 - PAGe_ReleaseNotes

2 - PAGe_ReleaseNotes_ind

Outline
Page 1
Page 2
Page 3

3 - PAGe_ReleaseNotess


Release Notes PAGe
Project
adaptive BMW AUTOSAR Core Rel. 1
Author
BMW AG
Release Date
2017-11-09
Version
1.1.0
Status
Release
Hotline
+49 89 382 - 22522
Contact
abac@bmw.de
https://asc.bmw.com/jira/browse/BSUP (extern)
https://asc.bmwgroup.net/jira/browse/BSUP (intern)
Revision History
Version
Date
Issues
1.1.0
2017-11-09
BAC-6409, BAC-6509, BAC-6150
1.0.0
2017-06-29
Company
Bayerische
Motoren Werke
Aktiengesellschaft
Postal address
BMW AG
80788 München
Office address
Forschungs- und
Innovationszentrum
(FIZ)
Hufelandstr. 1
80937 München
Telephone
Switchboard
+49 89 382-0
Internet
www.bmwgroup.com
ReleaseNotes_PAGe, Version 1.1.0, Software Platforms
Page 1 of 3


1
Module Description
Tool to generate text from AUTOSAR paramconf.
2
Revisions and Modifications
Revision 1.1.0 [Released]
Item
Description
CR ID:
BAC-6409
CR Headline:
PAGe should only rely on Python std library modules.
Description of Issues:
The dependecy of lxml shall be removed
Description of Changes:
The parsing of the XML was changed so PAGe now builds an
internal model and does not rely on xpath expressions.
Changed Files:
utility/utility.py
utility/exceptions.py
core/command.py
codeparts/codepart.py
utility/xpath_resolver.py
core/model.py
core/xmlcache.py
core/verify.py
Compatibility:
Item
Description
CR ID:
BAC-6509
CR Headline:
PAGe must be more robust for shortnames
Description of Issues:
Improve Robustness of Shortnamepath operations
Description of Changes:
Allow strings and trailing slashes in shortnamepaths.
Changed Files:
codeparts/inputtext.py
utility/utility.py
codeparts/inputpart.py
core/model.py
Compatibility:
Item
Description
CR ID:
BAC-6150
CR Headline:
BAC 4.3: Provide shell wrapper/.cmd-file for PAGe
Description of Issues:
Add a shell script to wrap page call
Description of Changes:
A shell script is provided in the bin directory. This allows calling
page without manually setting the PYTHONPATH.
Changed Files:
bin/page
Compatibility:
ReleaseNotes_PAGe, Version 1.1.0, Software Platforms
Page 2 of 3


Revision 1.0.0 [Released]
Item
Description
CR ID:
CR Headline:
Initial Release for SP2021
Description of Issues:
Initial Release for SP2021
Description of Changes:
Initial Release for SP2021
Changed Files:
Compatibility:
ReleaseNotes_PAGe, Version 1.1.0, Software Platforms
Page 3 of 3

Document Outline


4 - PAGe_Review


Overview

Summary Sheet
Synergy Project
help
Version History


Sheet 1: Summary Sheet
























Rev 2.0121-Feb-18




Nexteer EA4 SWC Implementation Peer Review Summary Sheet

































Component Short Name:



PAGe
Revision / Baseline:


TL125A_PAGe_1.1.0_0
































Change Owner:


Kevin Smith
Work CR ID:


EA4#20630


































Modified File Types:






Check the file types that needed modification for the Work CR(s); macros for the check boxes will populate the appropriate checklist tabs for the review.
























































































































































































Review Checklist Summary:





































Reviewed:








At start of review, all items below should be marked "No". At the end of the review, all items should be marked "Yes" or "N/A" where N/A indicates the reviewers have reviewed the existing (unchanged) item and confirmed no updates were needed for the Work CR(s).




























































N/AMDD


N/ASource Code


N/APolySpace

















































N/AIntegration Manual


N/ADavinci Files




















































































All required reviewers participated




























































Comments:

This is a python script provided by BMW with the BAC releases for code generation.










This replaces Artt for the BAC modules


































































































Time spent ( to the nearest half hour)








review preparation



review meeting


review follow-up










Change owner:









0.5



0.5


0









Component developer reviewers:









0



0


0


1





Other reviewers:









0



0


0









Total hours









0.5



0.5


0


1




































Content reviewed





























Lines of code:






Elements of .arxml content:







Pages of documentation:



































































































General Guidelines:
- The reviews shall be performed over the portions of the component that were modified as a result of the Change Request.
- New components should include SWC Owner and/or SWC Design author and Integrator and/or SW Lead as apart of the Group Review Board (Source Code, Integration Manual, and Davinci Files)
- Enter any rework required into the comment field and select No. When the rework is complete, review again using this same review sheet and select Yes. Add date and additional comment stating that the rework is completed.
- To review a component with multiple source code files use the "Add Source" button to create a Source code tab for each source file.
- .h file should be reviewed with the source file as part of the source file.

Each peer review shall start with a clean copy of the latest peer review checklist template. Save in the doc folder of the component implementation, with the file name in the format SWCShortName_Review.xlsx. If the existing review in Synergy has a different name, the name must be changed IN SYNERGY (rather than by syncing in a new file with the new name) so that the file history will be properly maintained.

Before the peer review, the change owner shall: (NOTE - time for completing these items is to be counted as the Change Owner Review Prep Time)
o Review the previous component peer review and copy any relevant comments to the new review sheet.
o Review all checklist items and make all corrections needed, so that the component is ready for peer review. The expectation is that peer review should find very few issues,
because the change owner has already used the checklist to ensure the component changes are complete and correct.
o Fill in all file name and version information as needed on peer review checklist tabs (file names may be copied from the previous peer review where appropriate)
o Fill in checklist answers (Yes/No/NA pulldowns) ONLY on those items which are NA for the current change. All other checklist items should be blank going into the review
meeting.

During the peer review meeting:
o For each page of the review, first review the items already marked as N/A for this change, to confirm that reviewers agree with this assessment; change the checklist box to
blank if it is found that the item does apply.
o Then review the items with the checklist box blank. After reviewing each of these items, the checklist box will be marked as "Yes", or the checklist box will be marked as
"No" with needed rework indicated or with rationale indicated.
o If any items are marked "No" with rationale indicated, this must be approved by a software supervisor or the software manager; there is a line in the "Review Board" section
of each tab to indicate who approved the "No" items on that tab.





Sheet 2: Synergy Project






















Rev 2.0121-Feb-18

























Peer Review Meeting Log (Component Synergy Project Review)



















































Quality Check Items:




































Rationale is required for all answers of No










New baseline version name from Summary Sheet follows








Yes
Comments:



naming convention





































Project contains necessary subprojects








Yes
Comments:










































Project contains the correct version of subprojects








Yes
Comments:










































Design subproject is correct version








N/A
Comments:

Design not required for TL projects









































.gpj file in tools folder matches .gpj generated by TL109 script








N/A
Comments:

Not required for TL projects










































File/folder structure is correct per documentation in









N/A
Comments:

Not required for TL projects

TL109A_SwcSuprt







































General Notes / Comments:
























































Review Board:


























Change Owner:

Kevin Smith


Review Date :

03/15/18
































Lead Peer Reviewer:


Shameel


Approved by Reviewer(s):



Yes































Other Reviewer(s):










































































Rationale/justification for items marked "No" approved by:












































Sheet 3: help

Summary sheet:






Intended Use: Identify which component is being reviewed. This should match the component short name from the DataDict.m fileand the middle part of the Synergy project name, e.g. Assi for the SF001A_Assi_Impl Synergy project







Intended Use: Identify the implementation baseline name intended to be used for the changed component when changes are approved E.g. SF001A_Assi_Impl_1.2.0





Intended Use: Identify the developer who made the change(s) being reviewed




Intended Use: Identify the Implementation Work CR whose work is being reviewed (may be more than one)




Intended Use: Intended to identify at a high level to the reviewers which areas of the component have been changed.





Source code:





This item includes looking at all layers of Simulink model for possible color coding not reflected at a higher level, and includes looking at any intermediate SWC Design versions between the version being implemented and the version that was included as a subproject in the previous implementation.
Intended Use: Synergy version number of the file being reviewed. (Version number that Synergy displays on the checked out or unmodified
file in the working project)





Intended Use: Synergy version number of the file being reviewed. (Version number that Synergy displays on the checked out or unmodified file in the working project)



Intended Use: Synergy version number of the file being reviewed. (Version number that Synergy displays on the checked out or unmodified file in the working project)







Intended Use: For SWC Designs, list the Synergy baseline number (just the number part of the Synergy baseline name) of the SWC Design baseline being implemented. E.g., for SF001A_Assi_Design_1.3.1, this field would say "1.3.1"









Intended Use: Indicate that the the versioning was confirmed by the peer reviewer(s).















Intended Use: To confirm no compiler errors or warnings exist for the code under review (warnings from contract header files may be ignored).













Intended Use: list version/revision of latest released Software Design and Coding Standards document.





Davinci Files





Intended Use: Identify if previous version was compared and only the expected change(s) was present. This is for text files only, not binary or GUIs








Polyspace





eg. 2013b





Integration manual





Intended Use: Identify which file is being reviewed





Intended Use: Identify which version of the integration manual has been reviewed.



Synergy





Refer to EA4 Common Naming Conventions document, section “Synergy Baseline Names for core components”





The following subprojects should be included for all component implementations:
• AR200A_ArSuprt_Impl
• AR201A_ArCplrSuprt_Impl
• TL101A_CptRteGen
• TL103A_CplrSuprt
• TL109A_SwcSuprt
• Corresponding _Design project used for the implementation

The following subprojects should be included as needed by each component:
• AR10xx_Nxtr*_Impl library components as needed by each component
• AR202x_MicroCtrlrSuprt_Impl as needed (for register header files for components making direct register access)[add notes about when to add a stub header file]
• Xx999x_xxxxGlbPrm_Impl as needed by each component
• TL105A_Artt for components with generated content

The following should NOT be included as subprojects:
• TL107x_DavinciSuprt (aka StdDef)
• TL100A_QACSuprt (QAC subproject was previously included but should be removed going forward)
• Any other component (not mentioned anywhere above) whose .h file is needed. For these components, a “stub” .h file should be created, containing only the multiple include protection and the definitions and function prototypes actually needed by the component with the #include, and placed in the “including” component’s local\include folder.

misc in Summary sheet





(integrator, designer, unit test coordinator, etc.)





For a new component, use number of lines in all source files reviewed, including files in the src and include folders and any generated cfg.h and cfg.c files.  For a changed component, try to add up how many lines, including comments and blank lines, were in the changed areas that were reviewed. Not just the actual changed lines, but the number of lines in the blocks of code you had to look at to review the change.
add up the number of ports, number of PIM variables, number if IRVs, number of runnables, number of NVM blocks in the component  (all of them for review of a new component, the new and modified ones for review of a change)
add the number of pages in the MDD and integration manual for a new component; for a modified component, count the number of pages that contained a change.












ReviewerRequired attendance for this type of changeReview spreadsheet tab(s)
Component group peerAllAll
Component owner and/or SWC Design author*Initial creation of any new component
*Simulink model changes (any change to the model other than just updating the change log)
Source
Integrator and/or SW lead of first program planning to use the component*Initial creation of any new component
*new or changed NVM blocks, NVM datatypes, or NVM usage (added or removed or changed NVM API calls in any runnable)
*Major rev (X changed in the X.Y.X design baseline number; means there was a component interface change)
*new or changed config params
*all MM component changes
Davinci files, Integration manual, source for NVM changes and for all MM component changes.
Unit test coordinatorFixes for coverage issuesSource
SQANoneNone








For each reviewer category listed on each tab, there should either be
• the name of the reviewer who attended
or
• a comment indicating
o why that reviewer was not required for this change
or
o who approved holding the review without that required reviewer (approval must
be from the software manager or a software supervisor)


Sheet 4: Version History















File Version History





VersionDescriptionAuthor(s)Revision DateApproved ByApproved DateStatus






Draft/ Released






































































Template Version History





VersionDescriptionAuthor(s)Revision DateApproved ByApproved DateStatus
1.0Initial VersionSW Engineering team24-May-15NANAReleased
1.01Changed name to be EA4 specificSW Engineering team25-Jun-15NANAReleased
1.02Modified Summary Sheet General Guidelines, Clarified wording on first item in Synergy project sheet.SW Engineering team30-Jul-15NANAReleased
1.02Made corrections and clarifications to Source Code check list.SW Engineering team30-Jul-15NANAReleased
1.02updated Davinci, MDD, and Polyspace/QAC tabsSW Engineering team30-Jul-15NANAReleased
1.03Aligned to portal version guidelinesUmesh Sambhari21-Nov-17NANAReleased
2.00Summary sheet template:
Changed title to indicate Implementation Peer Review
Corrected and/or clarified mouse hover comments, added instructions, renamed some fields.
Changed the default setting to "No" on the items reviewed
SW Engineering team29-Nov-17Lonnie Newton, Steven Horwath, Kevin Smith, Lucas Wendling, Vinod ShankarNAReleased
Source code template:
Removed hyperlink for naming conventions, corrected name of naming conventions document, added version field for naming conventions document.
Changed item about requirements tags to reflect that they should be removed
Added clarification that all combinations of conditionally compiled code must be checked
Item about accurately implementing SWC Design is modified and a new item added, both to clarify where to look when determining needed changes.
Added point for version of common naming conventions
Reworded multiple items for clarity
SW Engineering team29-Nov-17
Synergy project template:
added items for file/folder structure
added point on .gpj file in tools folder
SW Engineering team29-Nov-17
Davinci files template:
Clarified the StdDef item
Added new item for OBSOLETE
Clarified item on datadict.m comparison
Removed the references to .m file helper tool
Updated to reflect that all component should now use only implementation data types
Added points on PIMs and NVMs
SW Engineering team29-Nov-17
All template tabs:
Added/clarified/removed mouse hover comments.
Updated Review Board section
Removed the gridlines from all tabs
Updated titles to say "Nexteer SWC Implementation Peer Review"
Changed all occurences of "FDD" to "SWC Design"
SW Engineering team29-Nov-17
2.01Added a help tab and appropriate links
Added field on Summary sheet to report hours spent and content reviewed
Changed wording in an item in Polyspace tab and Source code tab
SW Engineering team21-Feb-18Lonnie Newton, Steven Horwath, Kevin Smith, Lucas Wendling, Vinod Shankar21-Feb-18Released

5 - PAGe_UserManual

7 - PAGe_UserManuals


User Guide PAGe
Project
BMW AUTOSAR Core 4 Rel. 3 and adaptive BMW AUTOSAR Core Rel. 1
Author
BMW AG
Release Date
2017-11-09
Version
1.1.0
Status
Release
Hotline
+49 89 382 - 32233 (classic) / +49 89 382 - 22522 (adaptive)
Contact
bac@bmw.de (classic) / abac@bmw.de (adaptive)
https://asc.bmw.com/jira/browse/BSUP (extern)
https://asc.bmwgroup.net/jira/browse/BSUP (intern)
Revision History
Version
Date
Changed by
Description
1.1.0
2017-11-09
JC-42
Initial Documentation Release
Company
Bayerische
Motoren Werke
Aktiengesellschaft
Postal address
BMW AG
80788 München
Office address
Forschungs- und
Innovationszentrum
(FIZ)
Hufelandstr. 1
80937 München
Telephone
Switchboard
+49 89 382-0
Internet
www.bmwgroup.com
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 1 of 22


Table of Contents
1 Overview
3
1.1
Purpose
3
1.2
Usage
3
1.2.1
Generation
3
1.2.2
Validation
3
1.2.3
verb
3
2 Acronyms and Abbreviations
4
3 Functionality
5
3.1
Command Line Usage
5
3.2
Fileformat
5
3.3
Available Function and Objects
6
3.4
Handling of paramconf
7
3.5
Notes ARXML shortcuts
7
3.6
Loops
7
4 Examples
8
4.1
Basic Navigation
8
4.1.1
ARXML Files
8
4.1.1.1
input.arxml
8
4.1.2
pgen Files
9
4.1.2.1
input.pgen
9
4.1.3
Command line
10
4.1.4
Console Output
10
4.1.5
File Output
10
4.2
Logging
11
4.2.1
pgen Files
11
4.2.1.1
input.pgen
11
4.2.2
Command line
11
4.2.3
Console Output
11
4.2.4
File Output
11
4.3
Usage of Code Blocks
11
4.3.1
pgen Files
12
4.3.1.1
input.pgen
12
4.3.2
Command line
12
4.3.3
Console Output
12
4.3.4
File Output
12
4.4
Conditionals
13
4.4.1
ARXML Files
13
4.4.1.1
input.arxml
13
4.4.2
pgen Files
14
4.4.2.1
input.pgen
14
4.4.3
Command line
14
4.4.4
Console Output
15
4.4.5
File Output
15
4.5
More Functions
15
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 2 of 22


4.5.1
ARXML Files
15
4.5.1.1
input.arxml
15
4.5.2
pgen Files
17
4.5.2.1
input.pgen
17
4.5.3
Command line
17
4.5.4
Console Output
17
4.5.5
File Output
17
4.6
ARXML Stuff
17
4.6.1
ARXML Files
18
4.6.1.1
input.arxml
18
4.6.2
pgen Files
19
4.6.2.1
input.pgen
19
4.6.3
Command line
19
4.6.4
Console Output
19
4.6.5
File Output
20
4.7
Filtering Elements
20
4.7.1
ARXML Files
20
4.7.1.1
input.arxml
20
4.7.2
pgen Files
21
4.7.2.1
input.pgen
21
4.7.3
Command line
21
4.7.4
Console Output
21
4.7.5
File Output
22
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 3 of 22


1
Overview
Purpose
This user guide describes the functionality and usage of the Python AUTOSAR Generator (PAGe).
PAGe is a generator for text templates which has some knowledge of the AUTOSAR Meta Model
regarding parameter configuration. It allows easy access of modules, containers and values as well as
providing loops and verify a paramconf against a paramdef. These options are also available for postbuild.
PAGe is based on Python 3. It uses only modules of the standard library.
PAGe is designed for the usage with the BMW AUTOSAR Core modules.
Input files must have the ending .pgen which is removed from the output filename.
Usage
Generation
To generate a pgen file.
python3 -m page example.pgen
If arxmls should be used pass them to the commandline as well.
python3 -m page -o /tmp example.pgen input.arxml
Also multiple pgen files and arxml files work.
python3 -m page -o /tmp example1.pgen example2.pgen input.arxml input_new.arxml
Validation
In case you want to check a paramconf against its corresponding paramdef you can use the following
commandline
python3 -m page paramconf.arxml paramdef.arxml
The validation will be performed for all the variants if an ecuc configuration is provided, too.
python3 -m page paramconf.arxml paramdef.arxml ecuc.arxml
verb
To enable a more verbose output add -v to -vvvv to the command line.
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 4 of 22


2
Acronyms and Abbreviations
API
Application Programming Interface
Application Application stands for the high-level part of software that uses the APIs
provided by the modules. It can also mean the driving application that does
not belong to the Bootloader.
AUTOSAR Automotive Open System Architecture
OS
Operating System
PAGe
Python AUTOSAR Generator
pgen
Page generation file
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 5 of 22


3
Functionality
PAGe builds a model of the provided ARXML paramconf and paramdefs. Within the pgen files you have
access to this model and can navigate and retrieve values easily. Besides the access to the data you have
the full power of python.
Command Line Usage
Either you install page or you add the main directory to the source path. Installation can be achieved by
python3 setup.py install
after that the page command will be available. So you can call PAGe using:
page input.pgen test.arxml -vvvv
But you may want to do install page only in a virtualenv so it does not harm any other installation.
-o Specify the output directory, default is the current directory.
--stdout do not write files, print output to stdout instead.
-vvv change level of verbosity.
-l Location to write the logfile to. Default is stdout.
-m Specify delimiter to be used in pgen files. This allows you to specify other delimiters than the default
e.g. you have files, where the defaults have a special meaning and you don't like to escape the every
time used.
-d Enable debug mode (trap functions become active)
-V Verifies given paramconf against the paramdefs which ara supplied.
-i Add paths for the search of includes.
-D Pass variables to the pgen files (params dictionary)
-O Change the optimisedb. This database stores the hash and the filename, so file with no change will
not be overwritten.
-f Forces write of files, even if no output change has been detected.
Fileformat
The pgen files shall be utf-8 encoded files. The files shall use unix file endings, windows file endings \r\n
are transformed to \n.
A file consists of text and several blocks that are interpreted by PAGe. These blocks are enclosed by a
special sequence of characters. %{ marks the beginning of a block and }% marks the end. The first
character occuring directly after the opening tag has a special meaning an defines the type of the block.
The following distinct blocks are supported:
The result of the statement within the tags are printed as output. A single statement shall be used but
can contain newline and indentiation. The result of the statement will appear in the output file.
This marker indicates a section of code. The code can consist of any valid piece of python code and is
also able to use the access functions for the data of the ARXMLs. It can be indentiated and consist
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 6 of 22


of multiple lines. For indentiation the first line is taken for reference, the rest of the indentiation has
to follow Pythons rules.
For conditions the colon is used as a marker. It occurs at least two times, one for the condition and one
time (without extra text) for the closure. This is needed for the correct handling. You still have to use
if, elif and else keywords.
For quick conditionals you can use a question mark. It works also directly as output. The condition
followed by a colon which seperates it from the part which is written in case of success. And an
optional second colon to seperate the ouput in the case the condition is not fullfilled.
This one loops over a statement. You can loop over a number of container instances, or any other
python iterateable. To iterate over a python iterateable use the syntax myitem in mycontainer which
makes the current item available as myitem. For loop over arxml elements, please have a look at ??
Use the plus sign for including other pgen or python files. These files are included and interpreted at
the current point within the file which they are included. A file can be included several times. Pure
python files can be included, too. By default the current path of the currently leaded source files (or
included files) is used as search directory. You can add directories using the command line switch -i
This mark is for special handling of post build variation. It loops over the configured pre defined variants
that are configured for the ecu. Within the context of this mark, you have two special variables
available: predefined_variant_name which is the name of the current variant or None if no
variantation is configured. And predefined_variant_postfix which contains an underscore
followed by the variant name or an empty string else. This can be used to build the name of the
configuration according to ECUConfiguration.
Available Function and Objects
The following functions are provided as part of PAGe:
comment Format a given string as a comment in the current context. If no delimiter are given, the
functions calls the automatic delimiter resolution. The string is splitted into single lines and enclosed
in the delimiter
set_comment_delimiter Set the comment markers
count Count elements found by shortname/search expression.
current_file Get the current filename of the file processed (pgen file).
current_shortname Get the AUTOSAR shortname of the current scope.
current_shortname_path Get the AUTOSAR shortname path.
each Get unique shortname paths of the elements that match the given search expression.
exists Checks existence of elements specified by search expression or shortname in current context.
generation_file_fullpath Full path of the source file.
generation_file_modification Date of modification of the source file.
generation_info Info about the generation as dict.
generation_timestamp Timestamp of generation.
generation_tool name of the generation tool.
generation_version_info Version of Generator.
get_elements Get list of elements matching search expression.
get_xpaths Deprecated for get_elements.
into Change context to given target, resets if target is None. The scope is held in a stack
join Join a set of values referenced by the search expression.
leave Leave the current scope.
reset Resets the context to the root node.
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 7 of 22


set_debug Enable pdb debugging.
shortname Get the shortname at the given shortname path expression,
trap Traps if debugging is enabled.
value Fetching the value or value-ref of a search expression. Values are automatically casted to the
correct type.
write Write arguments to the output.
container Selects containers that refere to a given definition ref.
module Selects modules that refere to a given definition ref.
ref Get the elements in the model, which refere to the given shortnamepath as definition ref.
snpath Get the element at the given shortname path.
Additionally to the functions and objects there is a dictionary called params which contains parameters
passed to page by the command line (-D test=hello).
Handling of paramconf
In general when using the data of a paramconf you should never enter a specific path you expect to be in
the configuration. You should only use paths you define in the parameter definition or that are contained
in the configuration as value (value refs).
Notes ARXML shortcuts
The shortnamepaths snpath are looked up in the following order:
return element
.. return parent
contains * Search children
startwith / lookup full path from root node
else lookup relative path
This means, whenever you want to get a grandchild of the current scope you need to prepend a star to
the node you are looking for or use the search.
Loops
In case you loop over VALUE or VALUE-REF elements, you can access its value using value() without a
target specified.
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 8 of 22


4
Examples
Basic Navigation
This example will demonstrate basic navigation through an ARXML document.
The example contains a module named MyModule which is of type TestModule and located in the
package /TestPackage/TestModule
It will demonstrate the following commands:
into
reset
ref
module
current_shortname_path
with
ARXML Files
input.arxml
<?xml version=’1.0’?>
<AUTOSAR xmlns="http://autosar.org/schema/r4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://autosar.org/schema/r4.0 autosar.xsd">
<AR-PACKAGES>
<AR-PACKAGE>
<SHORT-NAME>TestPackage</SHORT-NAME>
<AR-PACKAGES>
<AR-PACKAGE>
<SHORT-NAME>TestModule</SHORT-NAME>
<ELEMENTS>
<ECUC-MODULE-CONFIGURATION-VALUES>
<SHORT-NAME>MyModule</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-MODULE-DEF">/BMW_DEF/TestModule</DEFINITION-REF>
<CONTAINERS>
<ECUC-CONTAINER-VALUE>
<SHORT-NAME>NumericalValues</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/BMW_DEF/TestModule/
NumericalValues</DEFINITION-REF>
<PARAMETER-VALUES>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-INTEGER-PARAM-DEF">/BMW_DEF/TestModule/
NumericalValues/ValueInt</DEFINITION-REF>
<VALUE>5</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-INTEGER-PARAM-DEF">/BMW_DEF/TestModule/
NumericalValues/ValueInt</DEFINITION-REF>
<VALUE>8</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
<ECUC-NUMERICAL-PARAM-VALUE>
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 9 of 22


<DEFINITION-REF DEST="ECUC-FLOAT-PARAM-DEF">/BMW_DEF/TestModule/
NumericalValues/ValueFloat</DEFINITION-REF>
<VALUE>3.1415</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
</PARAMETER-VALUES>
</ECUC-CONTAINER-VALUE>
</CONTAINERS>
</ECUC-MODULE-CONFIGURATION-VALUES>
<ECUC-MODULE-CONFIGURATION-VALUES>
<SHORT-NAME>NotMyModule</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-MODULE-DEF">/BMW_DEF/AnotherTestModule</DEFINITION-
REF>
<CONTAINERS>
<ECUC-CONTAINER-VALUE>
<SHORT-NAME>StringValues</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/BMW_DEF/
AnotherTestModule/StringValues</DEFINITION-REF>
<PARAMETER-VALUES>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-STRING-PARAM-DEF">/BMW_DEF/
AnotherTestModule/StringValues/ValueString</DEFINITION-REF>
<VALUE>Hello World the value is: </VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
</PARAMETER-VALUES>
</ECUC-CONTAINER-VALUE>
</CONTAINERS>
</ECUC-MODULE-CONFIGURATION-VALUES>
</ELEMENTS>
</AR-PACKAGE>
</AR-PACKAGES>
</AR-PACKAGE>
</AR-PACKAGES>
</AUTOSAR>
pgen Files
input.pgen
%{# i n t o ( r e f ( ' TestModule ' ) ) }%
%{= current_shortname_path ( ) }%
This w i l l change i n t o the ∗FIRST∗ element found
%{# i n t o ( r e f ( ' V a l u e I n t ' ) ) }%
The shortname w i l l be taken from the p a r e n t element ,
as t h i s element i s not an i d e n t i f y a b l e .
%{= current_shortname_path ( ) }%
%{= v a l u e ( ) }%
%{# l e a v e ( ) }%
I f you expect more than one use a loop
For the loop the c o n t e x t i s a u t o m a t i c a l l y changed
%{@ r e f ( ' V a l u e I n t ' ) }%
%{= v a l u e ( ) }%
%{@}%
%{# i n t o ( r e f ( ' V a l u e F l o a t ' ) ) }%
%{= current_shortname_path ( ) }%
%{= v a l u e ( ) }%
%{# r e s e t ( ) }%
%{= current_shortname_path ( ) }%
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 10 of 22


%{# i n t o ( r e f ( ' TestModule ' ) ) }%
%{= current_shortname_path ( ) }%
%{# i n t o ( ) }%
%{= current_shortname_path ( ) }%
For a s h o r t i n t e r a c t i o n w i t h a c e r t a i n element w i t h i n a code block ,
you can a l s o use the w i t h statement o f python
%{#
w i t h module ( ' TestModule ' ) :
i n p u t = v a l u e ( r e f ( ' V a l u e F l o a t ' ) )
i n p u t = i n p u t ∗ 2
w i t h module ( ' AnotherTestModule ' ) :
s t r i n g = v a l u e ( r e f ( ' V a l u e S t r i n g ' ) )
}%
%{= ' { } { } ' . format ( s t r i n g , i n p u t ) }%
Command line
page −vvvv i n p u t . a r x m l i n p u t . pgen
Console Output
BMW PAGe
: INFO
Reading XML : i n p u t . a r x m l
BMW PAGe
: INFO
Reading XML took : 0.000859 s
BMW PAGe
: INFO
Reading a l l XMLs took : 0.00104 s
BMW PAGe
: INFO
processing Pgen : i n p u t . pgen
BMW PAGe
: INFO
Open f i l e / 0 0 1 / i n p u t . pgen
BMW PAGe
: INFO
Processing Pgen took : 0.00317 s
BMW PAGe
: INFO
F i l e does not e x i s t
BMW PAGe
: INFO
Wr ite / 0 0 1 / i n p u t
File Output
/ TestPackage / TestModule / MyModule
This w i l l change i n t o the ∗FIRST∗ element found
The shortname w i l l be taken from the p a r e n t element ,
as t h i s element i s not an i d e n t i f y a b l e .
/ TestPackage / TestModule / MyModule / NumericalValues
5
I f you expect more than one use a loop
For the loop the c o n t e x t i s a u t o m a t i c a l l y changed
5
8
/ TestPackage / TestModule / MyModule / NumericalValues
3.1415
ROOT
/ TestPackage / TestModule / MyModule
ROOT
For a s h o r t i n t e r a c t i o n w i t h a c e r t a i n element w i t h i n a code block ,
you can a l s o use the w i t h statement o f python
H e l l o World the v a l u e i s :
6.283
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 11 of 22


Logging
This example will demonstrate the logging functionality.
There are several log levels that depend on the -vs provided on the command line.
It will demonstrate the following commands:
logger.debug
logger.info
logger.warning
logger.error
logger.fatal
pgen Files
input.pgen
Logging o f some i n f o r m a t i o n
%{# l o g g e r . debug ( ' This i s a message f o r debugging so you have to s p e c i f y a few v on the command l i n e ' ) }%
%{# l o g g e r . i n f o ( ' This t e x t w i l l appear i n the INFO log ' ) }%
%{# l o g g e r . warning ( ' You ' ' ve been warned ')}%
%{# l o g g e r . e r r o r ( ' This w i l l not work , ok I \ ' l l l e t you continue ')}%
%{# l o g g e r . f a t a l ( ' Oh noooo ! ' ) } %
Command line
page −vvvv i n p u t . pgen
Console Output
BMW PAGe
: INFO
processing Pgen : i n p u t . pgen
BMW PAGe
: INFO
Open f i l e / 0 0 2 / i n p u t . pgen
BMW PAGe
: DEBUG
This i s a message f o r debugging so you have to s p e c i f y a few v on the command l i n e
BMW PAGe
: INFO
This t e x t w i l l appear i n the INFO l o g
BMW PAGe
: WARNING
Youve been warned
BMW PAGe
: ERROR
This w i l l not work , ok I ' l l l e t you continue
BMW PAGe
: CRITICAL Oh noooo !
BMW PAGe
: INFO
Processing Pgen took : 0.00185 s
BMW PAGe
: INFO
F i l e does not e x i s t
BMW PAGe
: INFO
Wr ite / 0 0 2 / i n p u t
File Output
Logging o f some i n f o r m a t i o n
Usage of Code Blocks
This example will show a few details about the code block
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 12 of 22


The code block is one of PAGes super power. It allows to use any python code from within it. You can still
use PAGes functions but also any other python statement you could think of.
It will demonstrate the following commands:
write
CodeBlock
pgen Files
input.pgen
Usage o f Code Blocks
Besides the output blocks you can use code blocks :
%{#
# The f i r s t l i n e d e f i n e s the b a s i c i n d e n t i a t i o n .
# a l l l i n e s are i n t e r p r e t e d as pure python .
def MyFunction ( a , b ) :
r e t u r n ( a+b ) ∗ b
}%
A l l v a r i a b l e s , f u n c t i o n s , ect . w i l l remain u n t i l the end o f the pgen f i l e .
You can now see the r e s u l t o f the p r e v i o u s f u n c t i o n : %{= MyFunction ( 3 , 5 ) }%
I f you want to w r i t e to the output from w i t h i n a code block , you should use the ∗ w r i t e ∗ command
%{#
f o r x i n range ( 1 , 1 5 ) :
i f ' 3 ' i n s t r ( x ) or x % 3 == 0 :
w r i t e ( ' buzz \ n ' )
e l s e :
w r i t e ( ' { } \ n ' . format ( x ) )
}%
NB : w r i t e does not a u t o m a t i c a l l y add a newline .
Command line
page −vvvv i n p u t . pgen
Console Output
BMW PAGe
: INFO
processing Pgen : i n p u t . pgen
BMW PAGe
: INFO
Open f i l e / 0 0 3 / i n p u t . pgen
BMW PAGe
: INFO
Processing Pgen took : 0.00171 s
BMW PAGe
: INFO
F i l e does not e x i s t
BMW PAGe
: INFO
Wr ite / 0 0 3 / i n p u t
File Output
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 13 of 22


Usage o f Code Blocks
Besides the output blocks you can use code blocks :
A l l v a r i a b l e s , f u n c t i o n s , ect . w i l l remain u n t i l the end o f the pgen f i l e .
You can now see the r e s u l t o f the p r e v i o u s f u n c t i o n : 40
I f you want to w r i t e to the output from w i t h i n a code block , you should use the ∗ w r i t e ∗ command
1
2
buzz
4
5
buzz
7
8
buzz
10
11
buzz
buzz
14
NB : w r i t e does not a u t o m a t i c a l l y add a newline .
Conditionals
This example will show the usage of conditional parts within a pgen file
The example contains a module named MyModule which is of type TestModule and located in the
package /TestPackage/TestModule
It will demonstrate the following commands:
if
elif
else
ShortIfBlock
ConditionalBlock
value
ARXML Files
input.arxml
<?xml version=’1.0’?>
<AUTOSAR xmlns="http://autosar.org/schema/r4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 14 of 22


xsi:schemaLocation="http://autosar.org/schema/r4.0 autosar.xsd">
<AR-PACKAGES>
<AR-PACKAGE>
<SHORT-NAME>TestPackage</SHORT-NAME>
<ELEMENTS>
<ECUC-MODULE-CONFIGURATION-VALUES>
<SHORT-NAME>MyModule</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-MODULE-DEF">/BMW_DEF/TestModule</DEFINITION-REF>
<CONTAINERS>
<ECUC-CONTAINER-VALUE>
<SHORT-NAME>NumericalValues</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/BMW_DEF/TestModule/
NumericalValues</DEFINITION-REF>
<PARAMETER-VALUES>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-INTEGER-PARAM-DEF">/BMW_DEF/TestModule/
NumericalValues/ValueInt</DEFINITION-REF>
<VALUE>5</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
</PARAMETER-VALUES>
</ECUC-CONTAINER-VALUE>
</CONTAINERS>
</ECUC-MODULE-CONFIGURATION-VALUES>
</ELEMENTS>
</AR-PACKAGE>
</AR-PACKAGES>
</AUTOSAR>
pgen Files
input.pgen
C o n d i t i o n a l s can be done as seen here :
%{: i f v a l u e ( r e f ( ' V a l u e I n t ' ) ) < 6 }%
Test
%{: e l i f e x i s t s ( r e f ( ' V a l u e F l o a t ' ) ) }%
This w i l l not occur i n the output
%{: e l s e }%
This won ' t appear
%{:}%
Want some s h o r t e r i f ?
These w r i t e the t e x t provided dependent on the r e s u l t o f the statement e v a l u a t i o n
# Both o p t i o n s provided
True :
%{? True : For sure ! : Nooooo!}%
False : %{? False : For sure ! : Nooooo!}%
# No i s not an o p t i o n
True :
%{? True : For sure !}%
False : %{? False : For sure !}%
# Only output something i f the r e s u l t i s f a l s e
True :
%{? True : : NO! ! ! ! } %
False : %{? False : : NO! ! ! ! } %
Command line
page −vvvv i n p u t . a r x m l i n p u t . pgen
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 15 of 22


Console Output
BMW PAGe
: INFO
Reading XML : i n p u t . a r x m l
BMW PAGe
: INFO
Reading XML took : 0.000677 s
BMW PAGe
: INFO
Reading a l l XMLs took : 0.000871 s
BMW PAGe
: INFO
processing Pgen : i n p u t . pgen
BMW PAGe
: INFO
Open f i l e / 0 0 4 / i n p u t . pgen
BMW PAGe
: INFO
Processing Pgen took : 0.00211 s
BMW PAGe
: INFO
F i l e does not e x i s t
BMW PAGe
: INFO
Wr ite / 0 0 4 / i n p u t
File Output
C o n d i t i o n a l s can be done as seen here :
Test
Want some s h o r t e r i f ?
These w r i t e the t e x t provided dependent on the r e s u l t o f the statement e v a l u a t i o n
# Both o p t i o n s provided
True :
For sure !
False : Nooooo !
# No i s not an o p t i o n
True :
For sure !
False :
# Only output something i f the r e s u l t i s f a l s e
True :
False : NO ! ! ! !
More Functions
This example will contain usages of different functions.
The example contains a module named MyModule which is of type TestModule and located in the
package /TestPackage/TestModule
It will demonstrate the following commands:
count
current_shortname
exists
with
ARXML Files
input.arxml
<?xml version=’1.0’?>
<AUTOSAR xmlns="http://autosar.org/schema/r4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://autosar.org/schema/r4.0 autosar.xsd">
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 16 of 22


<AR-PACKAGES>
<AR-PACKAGE>
<SHORT-NAME>TestPackage</SHORT-NAME>
<AR-PACKAGES>
<AR-PACKAGE>
<SHORT-NAME>TestModule</SHORT-NAME>
<ELEMENTS>
<ECUC-MODULE-CONFIGURATION-VALUES>
<SHORT-NAME>MyModule</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-MODULE-DEF">/BMW_DEF/TestModule</DEFINITION-REF>
<CONTAINERS>
<ECUC-CONTAINER-VALUE>
<SHORT-NAME>NumericalValues</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/BMW_DEF/TestModule/
NumericalValues</DEFINITION-REF>
<PARAMETER-VALUES>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-INTEGER-PARAM-DEF">/BMW_DEF/TestModule/
NumericalValues/ValueInt</DEFINITION-REF>
<VALUE>5</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-INTEGER-PARAM-DEF">/BMW_DEF/TestModule/
NumericalValues/ValueInt</DEFINITION-REF>
<VALUE>8</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-FLOAT-PARAM-DEF">/BMW_DEF/TestModule/
NumericalValues/ValueFloat</DEFINITION-REF>
<VALUE>3.1415</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
</PARAMETER-VALUES>
</ECUC-CONTAINER-VALUE>
</CONTAINERS>
</ECUC-MODULE-CONFIGURATION-VALUES>
<ECUC-MODULE-CONFIGURATION-VALUES>
<SHORT-NAME>NotMyModule</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-MODULE-DEF">/BMW_DEF/AnotherTestModule</DEFINITION-
REF>
<CONTAINERS>
<ECUC-CONTAINER-VALUE>
<SHORT-NAME>StringValues</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/BMW_DEF/
AnotherTestModule/StringValues</DEFINITION-REF>
<PARAMETER-VALUES>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-STRING-PARAM-DEF">/BMW_DEF/
AnotherTestModule/StringValues/ValueString</DEFINITION-REF>
<VALUE>Hello World the value is: </VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
</PARAMETER-VALUES>
</ECUC-CONTAINER-VALUE>
</CONTAINERS>
</ECUC-MODULE-CONFIGURATION-VALUES>
</ELEMENTS>
</AR-PACKAGE>
</AR-PACKAGES>
</AR-PACKAGE>
</AR-PACKAGES>
</AUTOSAR>
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 17 of 22


pgen Files
input.pgen
%{# i n t o ( r e f ( ' TestModule ' ) ) }%
%{= current_shortname_path ( ) }%
We can a l s o check the number o f elements :
There are %{= count ( r e f ( ' V a l u e I n t ' ) ) }% V a l u e I n t elements .
There e x i s t s a t l e a s t one V a l u e F l o a t : %{= e x i s t s ( r e f ( ' V a l u e F l o a t ' ) ) }%.
You can use the p r e v i o u s o p t i o n s a l s o as an asignment statement :
%{# pre viou s_sn = current_shortname ( ) }%
%{# l e a v e ()}%
and use i t l a t e r
%{= pr evio us_s n }%
Command line
page −vvvv i n p u t . a r x m l i n p u t . pgen
Console Output
BMW PAGe
: INFO
Reading XML : i n p u t . a r x m l
BMW PAGe
: INFO
Reading XML took : 0.0012 s
BMW PAGe
: INFO
Reading a l l XMLs took : 0.00162 s
BMW PAGe
: INFO
processing Pgen : i n p u t . pgen
BMW PAGe
: INFO
Open f i l e / 0 0 5 / i n p u t . pgen
BMW PAGe
: INFO
Processing Pgen took : 0.00212 s
BMW PAGe
: INFO
F i l e does not e x i s t
BMW PAGe
: INFO
Wr ite / 0 0 5 / i n p u t
File Output
/ TestPackage / TestModule / MyModule
We can a l s o check the number o f elements :
There are 2 V a l u e I n t elements .
There e x i s t s a t l e a s t one V a l u e F l o a t : 1 .
You can use the p r e v i o u s o p t i o n s a l s o as an asignment statement :
and use i t l a t e r
MyModule
ARXML Stuff
This example will demonstrate some more ARXML selection stuff which can be usefull.
It will demonstrate the following commands:
into
module
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 18 of 22


each
container
ref
snpath
ARXML Files
input.arxml
<?xml version=’1.0’?>
<AUTOSAR xmlns="http://autosar.org/schema/r4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://autosar.org/schema/r4.0 autosar.xsd">
<AR-PACKAGES>
<AR-PACKAGE>
<SHORT-NAME>TestPackage</SHORT-NAME>
<AR-PACKAGES>
<AR-PACKAGE>
<SHORT-NAME>TestModule</SHORT-NAME>
<ELEMENTS>
<ECUC-MODULE-CONFIGURATION-VALUES>
<SHORT-NAME>MyModule</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-MODULE-DEF">/BMW_DEF/TestModule</DEFINITION-REF>
<CONTAINERS>
<ECUC-CONTAINER-VALUE>
<SHORT-NAME>NumericalValues</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/BMW_DEF/TestModule/
NumericalValues</DEFINITION-REF>
<PARAMETER-VALUES>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-INTEGER-PARAM-DEF">/BMW_DEF/TestModule/
NumericalValues/ValueInt</DEFINITION-REF>
<VALUE>5</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-INTEGER-PARAM-DEF">/BMW_DEF/TestModule/
NumericalValues/ValueInt</DEFINITION-REF>
<VALUE>8</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-FLOAT-PARAM-DEF">/BMW_DEF/TestModule/
NumericalValues/ValueFloat</DEFINITION-REF>
<VALUE>3.1415</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
</PARAMETER-VALUES>
</ECUC-CONTAINER-VALUE>
</CONTAINERS>
</ECUC-MODULE-CONFIGURATION-VALUES>
<ECUC-MODULE-CONFIGURATION-VALUES>
<SHORT-NAME>NotMyModule</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-MODULE-DEF">/BMW_DEF/AnotherTestModule</DEFINITION-
REF>
<CONTAINERS>
<ECUC-CONTAINER-VALUE>
<SHORT-NAME>StringValues</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/BMW_DEF/
AnotherTestModule/StringValues</DEFINITION-REF>
<PARAMETER-VALUES>
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 19 of 22


<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-STRING-PARAM-DEF">/BMW_DEF/
AnotherTestModule/StringValues/ValueString</DEFINITION-REF>
<VALUE>Hello World the value is: </VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
</PARAMETER-VALUES>
<REFERENCE-VALUES>
<ECUC-REFERENCE-VALUE>
<DEFINITION-REF DEST="ECUC-REFERENCE-DEF">/BMW_DEF/AnotherTestModule/
StringValues/ReferenceToNumericals</DEFINITION-REF>
<VALUE-REF DEST="ECUC-CONTAINER-VALUE">/TestPackage/TestModule/
MyModule/NumericalValues</VALUE-REF>
</ECUC-REFERENCE-VALUE>
</REFERENCE-VALUES>
</ECUC-CONTAINER-VALUE>
</CONTAINERS>
</ECUC-MODULE-CONFIGURATION-VALUES>
</ELEMENTS>
</AR-PACKAGE>
</AR-PACKAGES>
</AR-PACKAGE>
</AR-PACKAGES>
</AUTOSAR>
pgen Files
input.pgen
Find a Module and change the c u r r e n t scope to i t
%{# i n t o ( module ( ' TestModule ' ) ) }%
The next element to get to i s a ( sub ) c o n t a i n e r
%{# i n t o ( c o n t a i n e r ( ' NumericalValues ' ) ) }%
But we need a d i f f e r e n t c o n t a i n e r
%{#
r e s e t ( )
i n t o ( c o n t a i n e r ( ' AnotherTestModule / S t r i n g V a l u e s ' ) )
}%
You can search f o r elements references , too :
%{= v a l u e ( r e f ( ' ReferenceToNumericals ' ) ) }%
You can use these to go i n t o but you have to use v a l u e
to get the s t r i n g o f the r e f e r e n c e
%{# i n t o ( v a l u e ( r e f ( ' ReferenceToNumericals ' ) ) ) }%
%{= current_shortname_path ( ) }%
%{# r e s e t ( ) }%
Command line
page −vvvv i n p u t . a r x m l i n p u t . pgen
Console Output
BMW PAGe
: INFO
Reading XML : i n p u t . a r x m l
BMW PAGe
: INFO
Reading XML took : 0.00095 s
BMW PAGe
: INFO
Reading a l l XMLs took : 0.00114 s
BMW PAGe
: INFO
processing Pgen : i n p u t . pgen
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 20 of 22


BMW PAGe
: INFO
Open f i l e / 0 0 6 / i n p u t . pgen
BMW PAGe
: INFO
Processing Pgen took : 0.00228 s
BMW PAGe
: INFO
F i l e does not e x i s t
BMW PAGe
: INFO
Wr ite / 0 0 6 / i n p u t
File Output
Find a Module and change the c u r r e n t scope to i t
The next element to get to i s a ( sub ) c o n t a i n e r
But we need a d i f f e r e n t c o n t a i n e r
You can search f o r elements references , too :
/ TestPackage / TestModule / MyModule / NumericalValues
You can use these to go i n t o but you have to use v a l u e
to get the s t r i n g o f the r e f e r e n c e
/ TestPackage / TestModule / MyModule / NumericalValues
Filtering Elements
This example will demonstrate some techniques that can be used to filter some elements out of a larger
list.
It will demonstrate the following commands:
into
reset
ref
module
current_shortname_path
with
ARXML Files
input.arxml
<?xml version=’1.0’?>
<AUTOSAR xmlns="http://autosar.org/schema/r4.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://autosar.org/schema/r4.0 autosar.xsd">
<AR-PACKAGES>
<AR-PACKAGE>
<SHORT-NAME>TestPackage</SHORT-NAME>
<AR-PACKAGES>
<AR-PACKAGE>
<SHORT-NAME>TestModule</SHORT-NAME>
<ELEMENTS>
<ECUC-MODULE-CONFIGURATION-VALUES>
<SHORT-NAME>MyModule</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-MODULE-DEF">/BMW_DEF/TestModule</DEFINITION-REF>
<CONTAINERS>
<ECUC-CONTAINER-VALUE>
<SHORT-NAME>NumericalValues</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/BMW_DEF/TestModule/
NumericalValues</DEFINITION-REF>
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 21 of 22


<PARAMETER-VALUES>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-INTEGER-PARAM-DEF">/BMW_DEF/TestModule/
NumericalValues/ValueInt</DEFINITION-REF>
<VALUE>5</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-INTEGER-PARAM-DEF">/BMW_DEF/TestModule/
NumericalValues/ValueInt</DEFINITION-REF>
<VALUE>8</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-FLOAT-PARAM-DEF">/BMW_DEF/TestModule/
NumericalValues/ValueFloat</DEFINITION-REF>
<VALUE>3.1415</VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
</PARAMETER-VALUES>
</ECUC-CONTAINER-VALUE>
</CONTAINERS>
</ECUC-MODULE-CONFIGURATION-VALUES>
<ECUC-MODULE-CONFIGURATION-VALUES>
<SHORT-NAME>NotMyModule</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-MODULE-DEF">/BMW_DEF/AnotherTestModule</DEFINITION-
REF>
<CONTAINERS>
<ECUC-CONTAINER-VALUE>
<SHORT-NAME>StringValues</SHORT-NAME>
<DEFINITION-REF DEST="ECUC-PARAM-CONF-CONTAINER-DEF">/BMW_DEF/
AnotherTestModule/StringValues</DEFINITION-REF>
<PARAMETER-VALUES>
<ECUC-NUMERICAL-PARAM-VALUE>
<DEFINITION-REF DEST="ECUC-STRING-PARAM-DEF">/BMW_DEF/
AnotherTestModule/StringValues/ValueString</DEFINITION-REF>
<VALUE>Hello World the value is: </VALUE>
</ECUC-NUMERICAL-PARAM-VALUE>
</PARAMETER-VALUES>
</ECUC-CONTAINER-VALUE>
</CONTAINERS>
</ECUC-MODULE-CONFIGURATION-VALUES>
</ELEMENTS>
</AR-PACKAGE>
</AR-PACKAGES>
</AR-PACKAGE>
</AR-PACKAGES>
</AUTOSAR>
pgen Files
input.pgen
Command line
page −vvvv i n p u t . a r x m l i n p u t . pgen
Console Output
BMW PAGe
: INFO
Reading XML : i n p u t . a r x m l
BMW PAGe
: INFO
Reading XML took : 0.000903 s
BMW PAGe
: INFO
Reading a l l XMLs took : 0.00111 s
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 22 of 22


BMW PAGe
: INFO
processing Pgen : i n p u t . pgen
BMW PAGe
: INFO
Open f i l e / 0 0 7 / i n p u t . pgen
BMW PAGe
: INFO
Processing Pgen took : 0.00141 s
BMW PAGe
: INFO
Empty content −> no f i l e w r i t t e n
BMW PAGe
: INFO
Skipping w r i t e o f / 0 0 7 / i n p u t , no changes detected
File Output
UserGuide_PAGe, Version 1.1.0, Software Platforms
Page 23 of 22

Document Outline