Coder Social home page Coder Social logo

autosar's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

autosar's Issues

Trouble creating constant

Hello,

Is there a way to create the following structure?

<AR-PACKAGE>
  <SHORT-NAME>Constants</SHORT-NAME>
  <ELEMENTS>
    <CONSTANT-SPECIFICATION UUID="9B2B418A-CA6C-4E3B-9562-D49D1C2695B1">
      <SHORT-NAME>CDiagNv_NvMServiceRequestType</SHORT-NAME>
      <VALUE-SPEC>
        <ARRAY-VALUE-SPECIFICATION>
          <ELEMENTS>
            <RECORD-VALUE-SPECIFICATION>
              <FIELDS>
                <NUMERICAL-VALUE-SPECIFICATION>
                  <SHORT-LABEL>ServiceId</SHORT-LABEL>
                  <VALUE>0</VALUE>
                </NUMERICAL-VALUE-SPECIFICATION>
                <NUMERICAL-VALUE-SPECIFICATION>
                  <SHORT-LABEL>RequestResult</SHORT-LABEL>
                  <VALUE>0</VALUE>
                </NUMERICAL-VALUE-SPECIFICATION>
              </FIELDS>
            </RECORD-VALUE-SPECIFICATION>

I tried creating array data type, record data type and RECORD-VALUE-SPECIFICATION and ARRAY-VALUE-SPECIFICATION are reversed.

Description attribute in record elements

I found a mismatch behavior, for tooling convention like a System Desk from DSpace it's possible to create a description attribute inside Record elements.
So to solve those issue i suggest to add between line 84 and 85 of file datatype_writer.py the following code:

tmp = self.writeDescXML(childElem)
if tmp is not None: lines.extend(self.indent(tmp,3))

This is the same code are used in other classes.

0.5.2: Type hint for make_packages should be "*refs: str"

Hi all, great package - thank you!

I am updating a script that was at 0.4 with PyCharm. The make_packages call takes a comma separated list of package name strings but the type hint in the function definition says '*refs: list[str]'. This causes PyCharm to flag the call with a warning since I am not passing a list of strings but the comma separated strings themselves.

Let me know if you'd like me to make a pull request with this change.

Thank you.

Info: missing Pdu:elements

hi,
i was playing around with autosar and was pretty happy about this nice packages.
But still some element missing.
Question: did i got a wrong version?

e.g.

INCOMPAT_TAGS = [
    'LONG-NAME',
    'DESC',
    'PROVIDER-IREF',
    'SDG-CAPTION',
    'SDX-REF',
    'CATEGORY',
    'CLIENT-ID-DEFINITION-SET-REFS',
    'CONTAINER-I-PDU-HEADER-BYTE-ORDER',
    'ECU-EXTRACT-VERSION',
    'FIBEX-ELEMENTS',
    'MAPPINGS', # todo for each self.parseSystemMapping?
    'PNC-VECTOR-LENGTH',
    'PNC-VECTOR-OFFSET',
    'ROOT-SOFTWARE-COMPOSITIONS',
    'SYSTEM-VERSION',
    'REQUESTER-IREF']

Up- and Downwards-Compatibility

Hello cogu,

and greets to Sweden.

Currently I am loading real-world example and came across several NotImplementedErrors, e.g. for:

  • DIAGNOSTIC-EVENT-NEEDS
  • SUPERVISED-ENTITY-NEEDS
  • BSW-MGR-NEEDS
  • CATEGORY
  • ECU-EXTRACT-VERSION
  • etc.

Then I realized that I was parsing a AUTOSAR_00049 file instead of AUTOSAR_4-2-2

My questions are:

  • How have you planned to support several versions of XSDs in one tool? Should the parser only expect the items defined in XSD or should it be in "umbrella" mode -> so take what is known. Both strategies seem to be not supported yet (at least parser seems to be quite sensible on anything unknown and parsing is workspace version independent)
  • I am currently wondering if I should create a fork for introducing some AUTOSAR_00049 measures or make the tool more upwards compatible and less strict or if that strategy ever gets the chance of a pull request by creating a branch here. What is your suggestion?

Best regards,
Tom

0.5.2 Feature Request: Reader parse-only mode.

I am reading ARXML we have generated and it is not to the Reader's liking. I have iterated through fixing each raised exception. A nice feature would be a 'parse-only' flag that would return a list of all lines in an ARXML file needing attention and why it is a problem.

END-TO-END set in NONQUEUED-SENDER-COM-SPEC shal

in file b \Lib\site-packages\autosar-0.3.11-py3.9.egg\autosar\writer\component_writer.py:365
应该改为
lines.append(self.indent('{}'.format(self.toBooleanStr(comspec.useEndToEndProtection)), 1))
否则 arxml文件E2E的属性无法正常解析

Support for nested subElement in ImplementationDataType and ImplementationDataTypeElement

Hi @cogu

Before starting, I'm big fan of your autosar module and it's very useful for my works.
As far as i know, ImplementationDataTypeElement can have subElement like belows.

       <IMPLEMENTATION-DATA-TYPE UUID="ffc534fa-9e89-4a14-82a1-eff8e4acaf50">
          <SHORT-NAME>Dt_RECORD_Reaction</SHORT-NAME>
          <CATEGORY>STRUCTURE</CATEGORY>
          <SUB-ELEMENTS>
            <IMPLEMENTATION-DATA-TYPE-ELEMENT UUID="931668fd-65e0-46f9-8768-fc6760c494c1">
              <SHORT-NAME>FCA</SHORT-NAME>
              <CATEGORY>STRUCTURE</CATEGORY>
              <SUB-ELEMENTS>
                <IMPLEMENTATION-DATA-TYPE-ELEMENT UUID="b56869c7-2039-4421-ad04-994f7773eebd">
                  <SHORT-NAME>Ro_Inhibit</SHORT-NAME>
                  <CATEGORY>TYPE_REFERENCE</CATEGORY>
                  <SW-DATA-DEF-PROPS>
                    <SW-DATA-DEF-PROPS-VARIANTS>
                      <SW-DATA-DEF-PROPS-CONDITIONAL>
                        <IMPLEMENTATION-DATA-TYPE-REF DEST="IMPLEMENTATION-DATA-TYPE">/AUTOSAR_DataTypes/ImplementationDataTypes/uint8</IMPLEMENTATION-DATA-TYPE-REF>
                      </SW-DATA-DEF-PROPS-CONDITIONAL>
                    </SW-DATA-DEF-PROPS-VARIANTS>
                  </SW-DATA-DEF-PROPS>
                </IMPLEMENTATION-DATA-TYPE-ELEMENT>
                <IMPLEMENTATION-DATA-TYPE-ELEMENT UUID="20ed6f15-f125-4d10-88db-7346cf01e403">
                  <SHORT-NAME>Sf2_Inhibit</SHORT-NAME>
                  <CATEGORY>TYPE_REFERENCE</CATEGORY>
                  <SW-DATA-DEF-PROPS>
                    <SW-DATA-DEF-PROPS-VARIANTS>
                      <SW-DATA-DEF-PROPS-CONDITIONAL>
                        <IMPLEMENTATION-DATA-TYPE-REF DEST="IMPLEMENTATION-DATA-TYPE">/AUTOSAR_DataTypes/ImplementationDataTypes/uint8</IMPLEMENTATION-DATA-TYPE-REF>
                      </SW-DATA-DEF-PROPS-CONDITIONAL>
                    </SW-DATA-DEF-PROPS-VARIANTS>
                  </SW-DATA-DEF-PROPS>
                </IMPLEMENTATION-DATA-TYPE-ELEMENT>
              </SUB-ELEMENTS>
            </IMPLEMENTATION-DATA-TYPE-ELEMENT>
          </SUB-ELEMENTS>
        </IMPLEMENTATION-DATA-TYPE>

Is it possible to generate above code by using your module? If not, you have some plans for support? (I hope module had createImplementationDataElement APIs)
Thank you in advance

Environment configuration error

Hello,I'm trying to preconfigure,But there was a problem with the last part
image
As you can see in the picture,What should I do, please

run ar4 tutorial2\components failed as 'Workspace' object has no attribute 'defaultPackages'

Hi cogu:
I am parai, and I am using this project branch feature/ar4_api for my own AUTOSAR project https://github.com/parai/as which is a study platform of AUTOSAR with python toolchain support for the BSW configuration and CAN COM/DCM/BOOTLOADER tools.
Now I am trying to use your project as RTE configuration and related C source code generator. So I started from the tutorial2, but I failed as below exception, could you help to have a look and how to fix this issue.

And the major feature I want is the RTE C source code generator, can you provide much more demo on this?

D:\repository\as\release\download\autosar\tutorial2\components>python RealTimeClock.py
Traceback (most recent call last):
File "RealTimeClock.py", line 35, in
ws.apply(RealTimeClock)
File "../..\autosar\workspace.py", line 446, in apply
template.apply(self)
File "RealTimeClock.py", line 12, in apply
package = ws.getComponentTypePackage()
File "../..\autosar\workspace.py", line 510, in getComponentTypePackage
packageName = self.defaultPackages["ComponentType"]
AttributeError: 'Workspace' object has no attribute 'defaultPackages'

manually add one line code after ws created "package=ws.createPackage("ComponentType", role="ComponentType")", but still get below error

D:\repository\as\release\download\autosar\tutorial2\components>python RealTimeClock.py
Traceback (most recent call last):
File "RealTimeClock.py", line 36, in
ws.apply(RealTimeClock)
File "../..\autosar\workspace.py", line 446, in apply
template.apply(self)
File "RealTimeClock.py", line 15, in apply
cls.addPorts(swc)
File "RealTimeClock.py", line 21, in addPorts
swc.apply(Signals.RtcHours.Send)
File "../..\autosar\component.py", line 120, in apply
template.apply(self)
File "..\SignalsHelper.py", line 26, in apply
_createProvidePortHelper(swc, cls.name, cls.portInterfaceTemplate, cls.initValueTemplate)
File "..\SignalsHelper.py", line 7, in _createProvidePortHelper
ws.apply(portInterfaceTemplate)
File "../..\autosar\workspace.py", line 446, in apply
template.apply(self)
File "..\PortInterfaces.py", line 10, in apply
package = ws.getPortInterfacePackage()
File "../..\autosar\workspace.py", line 480, in getPortInterfacePackage
package = self.find(self.defaultPackages["PortInterface"])
AttributeError: 'Workspace' object has no attribute 'defaultPackages'

Elements not imported when Loading package

Hi, First thanks to the contributors for this lib. it's very useful.
I have an issue when loading ARXML file. when i use loadpackage the package is correctly loaded but the elements are staying empty. In the same time in the subpackages elements are loaded perfectly.
If somebody know what is my mistake i will be thankfull !
here the simple code that I a use for the loading :
ws = autosar.workspace("4.1.1") ws.openXML("myfile.arxml") for role in ws.listPackages(): ws.loadPackage(role)

I tried with differents files but I have the same issue each time

<PR-PORT-PROTOTYPE>

Hello,

i have 3 questions:

  1. Is there a way to add to an element?
  2. It is possible to create Provider receiver port?
  3. Why i can not crate ProvidePort if i have many elements in a PortInterface?

Capture

Thank you,
Tofeni

AR4 programmers API

Create API methods to allow users to programattically create new AR4 components, data types etc.

the demo always has error,about module 'autosar' has no attribute 'workspace'

the demo always has error,about module 'autosar' has no attribute 'workspace'

Traceback (most recent call last):
File "C:\Users\gz03232\Documents\autosar.py", line 1, in
import autosar
File "C:\Users\gz03232\Documents\autosar.py", line 3, in
ws = autosar.workspace(version='4.2.2')
AttributeError: module 'autosar' has no attribute 'workspace'

demo application as follow:
import autosar

ws = autosar.workspace(version='4.2.2')

ws.createPackage('DataTypes', role='DataType')
ws.createPackage('Constants', role="Constant")
ws.createPackage('PortInterfaces', role="PortInterface")
ws.createPackage('ModeDclrGroups', role="ModeDclrGroup")
ws.createPackage('ComponentTypes', role='ComponentType')

#save the file as XML
ws.saveXML('Workspace.arxml')

ws = autosar.workspace(version='4.2.2')

ws.createPackage('DataTypes', role='DataType')
ws.createPackage('Constants', role="Constant")
ws.createPackage('PortInterfaces', role="PortInterface")
ws.createPackage('ModeDclrGroups', role="ModeDclrGroup")
ws.createPackage('ComponentTypes', role='ComponentType')

#save workspace packages into XML files
ws.saveXML('DataTypes.arxml', filters=['/DataTypes'])
ws.saveXML('Constants.arxml', filters=['/Constants'])
ws.saveXML('PortInterfaces.arxml', filters=['/PortInterfaces', '/ModeDclrGroups'])
ws.saveXML('ComponentTypes.arxml', filters=['/ComponentTypes'])

The example runs with error: d = Decimal(float(version)) ValueError: could not convert string to float: '4.2.2'

Hi, I use the example like as bellows:
import autosar

#Create some packages and data types

ws = autosar.workspace('4.2.2')
datatypes = ws.createPackage('DataTypes', role='DataType')
basetypes = datatypes.createSubPackage('BaseTypes')
u8Type = basetypes.createSwBaseType('uint8', 8, nativeDeclaration='uint8')
u16Type = basetypes.createSwBaseType('uint16', 16, nativeDeclaration='uint16')
u32Type = basetypes.createSwBaseType('uint32', 32, nativeDeclaration='uint32')
ws.saveXML('basetypes.arxml')

#Print reference and name for the created objects
print('u8Type.name: ' + u8Type.name)
print('u8Type.ref: ' + u8Type.ref)
print('u16Type.name: ' + u16Type.name)
print('u16Type.ref: ' + u16Type.ref)
print('u32Type.name: ' + u32Type.name)
print('u32Type.ref: ' + u32Type.ref)

and it fails with:
d = Decimal(float(version))
ValueError: could not convert string to float: '4.2.2'

Support for AUTOSAR 4.4.0 ?

Hello @cogu
I am new to the AUTOSAR world and was wondering do you have any plans to support AUTOSAR 4.4.0 version? Many thanks in advance.

Parser support for AR 4.x Complex Driver Component Type

First thanks for this great package. For AR 4.x the element name of an complex driver component type shall be "COMPLEX-DEVICE-DRIVER-SW-COMPONENT-TYPE'" instead of "COMPLEX-DEVICE-DRIVER-COMPONENT-TYPE". See /autosar/parser/component_parser.py

How do I import autosar.xml

After I use
pip install autosar.xml and run the code with import autosar.xml, the python says no module name autosar.xml

use lxml to generate arxml?

With a glance of the code, I found you generate the arxml by hand. Is there any plan to port the writer to lxml? I personally use lxml to generate arxml and the pretty_print can perfectly fit the AUTOSAR indentation standard.

multiply arxmls in one workspace

i want to load create RPort in A workspace's componentType, using Port interface in another arxml.
how to create one workspace with multiply arxmls.
how to load multiply arxmls into one workspace.

thanks

AUTOSAR NVM configuration

Now to implement such a function when writing data to the NVM after shutdown, a wake-up source is detected, and the controller will wake up again at this time the ECU will be reseted again. and the data in NVM is incomplete. At this time, the RAM will reload the previous data in NVM after reset, but at this time we do not want to use Nvm_ReadAll () to read the previously stored data from NVM, but want to keep the last unsaved data in RAM

NV_Data_Interface

Hello,

i have to generate an arxml file, which will be imported in a davinci workspace.

I can not find a function to create an NV_DATA_INTERFACE element.
Can someone tell me if this can be done or not, and if it will be implemented in a future version?

Here is a model how it is look like:
Capture

Thank you,
Marius

PortApi update

Not able to create the numerical value variation point for PortApi.

i need to create 1)port defined argument value
2)Numerical value specification
3)numerical value variation point

Change the parser to use lxml.etree instead of xml.etree.ElementTree

The current parser uses the lightweight standard API xml.etree.ElementTree that support the current needs of the library.

One problem with the current parser is that on an ARXML error there is no feedback on where in the input files the problem is found.

Using the etree module from lxml instead more accurate error information can be printed as the lxml keeps track of xml element file location.

Changing line 1 in base.py to
from lxml import etree as ElementTree
its all that is needed to use lxml. The API is compatible and I tested with the current unit tests and all test passes.

lxml do also support XML schema and schema validation. With lxml as base schema validation can be added.

pyecore usage

Have you considered using pyecore as infrastructure? It looks like a good fit for this project.

DEXT format

I would like to generate a DEXT (Autosar Diagnostic Extract) like file using Python and one library.
Is there an extension to this library or something similar that can help me?

Thank you!

Filters

In order to better support what parts of the data model goes into the XML file when saving it we need better control. Currently we have the packages=[] attribute but that is clearly not good enough.

Proposal is to replace packages attributes with a filters attributes where filters attribute can give the user the ability to control even on individual element level (instead of package level) what goes into the XML.

Load or create element ECUC-MODULE-CONFIGURATION-VALUES (DCM)

I want to read an existing element: ECUC-MODULE-CONFIGURATION-VALUES with the SHORT-NAME Dcm but it gives the following error:
[PackageParser] unhandled: ECUC-MODULE-CONFIGURATION-VALUES.
Does this means this is not supported?

Code snip:

ws = autosar.workspace()
ws.openXML("Dcm.arxml")
ws.loadPackage('shortNameOfPackage')

I also want to be able to create the ECUC-MODULE-CONFIGURATION-VALUES myself but I also don't see this in the documentation.

Test arxml "Dcm.arxml":

<?xml version="1.0" encoding="utf-8"?>
<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_4-0-3.xsd">
  <AR-PACKAGES>
    <AR-PACKAGE>
      <SHORT-NAME>shortNameOfPackage</SHORT-NAME>
      <ELEMENTS>
        <ECUC-MODULE-CONFIGURATION-VALUES UUID="8e3b6bec-9cd0-4347-b931-ef4a8b022f21">
          <SHORT-NAME>Dcm</SHORT-NAME>
          <ADMIN-DATA>
          </ADMIN-DATA>
          <DEFINITION-REF DEST="ECUC-MODULE-DEF">/EcucDefs/Generic/Dcm</DEFINITION-REF>
          <IMPLEMENTATION-CONFIG-VARIANT>VARIANT-PRE-COMPILE</IMPLEMENTATION-CONFIG-VARIANT>
          <MODULE-DESCRIPTION-REF DEST="BSW-IMPLEMENTATION">/EcucDefs/Generic/Implementations/Dcm</MODULE-DESCRIPTION-REF>
          <CONTAINERS>
          </CONTAINERS>
        </ECUC-MODULE-CONFIGURATION-VALUES>
      </ELEMENTS>
    </AR-PACKAGE>
  </AR-PACKAGES>
</AUTOSAR>

createConstant issue

as i want to createConst in my own const package, but the reference implication datatype is in the external arxml
this is an array type ,
the parent implication datatype has no dataType.variantProps , but the subelement has it.
it report errror:
_autosar\builder.py", line 28, in createFromDataTypeInternal
variantProps = dataType.variantProps[0]
IndexError: list index out of range

@cogu how could i solve this problem.

<IMPLEMENTATION-DATA-TYPE UUID="0409b9fa-3809-50bd-7866-18186f47cabd"> <SHORT-NAME>rt_Array_UInt8_6</SHORT-NAME> <CATEGORY>ARRAY</CATEGORY> <ADMIN-DATA> <SDGS> <SDG GID="DV_SDG"> <SD GID="DV_ReadOnly">1</SD> </SDG> </SDGS> </ADMIN-DATA> <SUB-ELEMENTS> <IMPLEMENTATION-DATA-TYPE-ELEMENT UUID="4dc31bd7-14f2-502e-08a6-3eed92b75371"> <SHORT-NAME>rt_Array_UInt8_6</SHORT-NAME> <CATEGORY>TYPE_REFERENCE</CATEGORY> <ARRAY-SIZE>6</ARRAY-SIZE> <ARRAY-SIZE-SEMANTICS>FIXED-SIZE</ARRAY-SIZE-SEMANTICS> <SW-DATA-DEF-PROPS> <SW-DATA-DEF-PROPS-VARIANTS> <SW-DATA-DEF-PROPS-CONDITIONAL> <IMPLEMENTATION-DATA-TYPE-REF DEST="IMPLEMENTATION-DATA-TYPE">/AFA_pkg/AFA_dt/UInt8</IMPLEMENTATION-DATA-TYPE-REF> </SW-DATA-DEF-PROPS-CONDITIONAL> </SW-DATA-DEF-PROPS-VARIANTS> </SW-DATA-DEF-PROPS> </IMPLEMENTATION-DATA-TYPE-ELEMENT> </SUB-ELEMENTS> </IMPLEMENTATION-DATA-TYPE>

How to : Implicit data access

CreateRunnable API:
SwcInternalBehavior.createRunnable(name[, portAccess=None][, symbol=None][, concurrent=False][, exclusiveAreas=None][, adminData=None])
I do not see an option for the data access (implicit/explicit).
By default it is taking explicit access.
Can you help me in providing implicit access?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.