Computation
XML tag |
<COMPU-INTERNAL-TO-PHYS> or <COMPU-PHYS-TO-INTERNAL> |
Module |
autosar.datatype |
Inherits |
Represents one computation (internal to physical, physical to internal). Contains a list of CompuScaleElement objects as well as an optional default value. Instances of this class are used as internal objects of CompuMethod.
Factory Methods
See CompuMethod.
Constructor
- datatype.Computation([defaultValue = None])
- 参数
defaultValue (None, str, int or float) – Optional default value.
Attributes
Name |
Type |
Description |
---|---|---|
elements |
str |
List of CompuScaleElement |
defaultValue |
None, str, int, float |
Optional default value |
Public Properties
Name |
Type |
Access Type |
---|---|---|
lowerLimit |
int, float |
Get |
upperLimit |
int, float |
Get |
lowerLimit
Returns lowerLimit of first element. Raises KeyError if elements list is empty.
upperLimit
Returns upperLimit of first element. Raises KeyError if elements list is empty.
Public Methods
Method Description
createValueTable
- Computation.createValueTable(elements[, autoLabel = True])
- 参数
elements (list) – Elements of new value table.
autoLabel (bool) – Automatically create <SHORT-LABEL> for each element.
Creates a list of CompuScaleElements with text values.
When elements is a list of strings:
Creates one CompuScaleElement per list item and automatically calculates lower and upper limits.
When elements is a list of tuples:
If 2-tuple: First element is both lowerLimit and upperLimit, second element is textValue.
If 3-tuple: First element is lowerLimit, second element is upperLimit, third element is textValue.
createRationalScaling
- Computation.createRationalScaling(offset, numerator, denominator, lowerLimit, upperLimit[, lowerLimitType = 'CLOSED'][, upperLimitType = 'CLOSED'][, label = None][, symbol = None][, adminData = None])
- 参数
offset (int, float) – Scaling offset.
numerator (int, float) – Scaling numerator.
denominator (int, float) – Scaling denominator.
lowerLimit (int, float) – lower limit.
upperLimit (int, float) – upper limit.
lowerLimitType (str) – lower limit type (
'OPEN'
,'CLOSED'
).upperLimitType (str) – upper limit type (
'OPEN'
,'CLOSED'
).label (None, str) – Optional label (used instead of name attribute).
symbol (None, str) – Optional symbol name.
adminData (AdminData) – AdminData.
Creates CompuScaleElement with it rational scaling properties.
createBitMask
- Computation.createBitMask(elements[, autoLabel = True])
- 参数
elements (list) – list of 2-tuples.
autoLabel (bool) – Automatically create <SHORT-LABEL> for each element.
Creates a list of CompuScaleElements with text values.
The element parameter is expected to be a list tubles.
If 2-tuple: First element is both lowerLimit and upperLimit, second element is textValue.