Unit¶
| XML tag | <UNIT> |
| Module | autosar.datatype |
| Inherits | autosar.element.Element |
Units are used to name physical units.
Usage¶
import autosar
def setup():
ws = autosar.workspace(version="4.2.2")
package=ws.createPackage('ApplicationTypes', role='DataType')
package.createSubPackage('Units', role='Unit')
return ws
ws = setup()
package = ws.findRolePackage('Unit')
package.createUnit('Percent', '%')
ws.saveXML('DataTypes.arxml', filters=['/ApplicationTypes'])
Factory Methods¶
Units can also be created automatically while creating application or implementation data types. For this mechanism to work you must first set the Unit package rols.
Constructor¶
Attributes¶
For inherited attributes see autosar.element.Element.
| Name | Type | Description |
|---|---|---|
| displayName | str | <DISPLAY-NAME> (Could be the same as shortName) |
| factor | None, int or float | <FACTOR-SI-TO-UNIT> |
| offset | None, int or float | <OFFSET-SI-TO-UNIT> |