Helper functions
Resolver functions for IODD parsing.
This module contains helper functions that resolve references in IODD data structures, merging information from standard definitions and device-specific IODD files.
resolve_errors(std_error_collection, device_error_collection, texts)
Resolve errors from standard definitions and device error collection.
Combines referenced standard errors (code=128) with device-specific errors (code=129) into a unified dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
std_error_collection
|
IoddstandardErrorTypeCollectionT
|
Standard error types from definitions XML. |
required |
device_error_collection
|
ErrorTypeCollectionT | None
|
Device-specific error collection, may be None. |
required |
texts
|
dict[str, str]
|
Dictionary of resolved text strings. |
required |
Returns:
| Type | Description |
|---|---|
dict[tuple[int, int], ResolvedError]
|
Dictionary of resolved errors keyed by (code, additional_code) tuple. |
Source code in src/iodd_parser/resolvers.py
resolve_process_data(process_data_collection, texts, datatypes)
Resolve process data from the ProcessDataCollection.
Process data defines the structure of cyclic data exchanged between master and device. Multiple ProcessData elements can exist with Condition elements for switching between configurations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
process_data_collection
|
ProcessDataCollectionT | None
|
The process data collection, may be None. |
required |
texts
|
dict[str, str]
|
Dictionary of resolved text strings. |
required |
datatypes
|
dict[str, DatatypeT]
|
Dictionary of available datatypes. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, ResolvedProcessData]
|
Dictionary of resolved process data keyed by ProcessData id. |
Source code in src/iodd_parser/resolvers.py
resolve_texts(loaded_definitions, loaded_units, device, lang, standard_lang_texts, device_lang_texts)
Resolve text collections with language support.
Texts are resolved in the following priority order (later sources override earlier ones):
- Primary language (English) from standard definitions
- Primary language from device IODD
- Primary language from standard unit definitions (English only)
- Pre-loaded language-specific standard definitions file (if available)
- Language sections within main standard definitions file
- Language sections within main device IODD file
- Device-specific language file (e.g.,
*-IODD1.1-de.xml) - highest priority
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loaded_definitions
|
IoddstandardDefinitions
|
The loaded standard definitions. |
required |
loaded_units
|
IoddstandardUnitDefinitions
|
The loaded standard unit definitions. |
required |
device
|
Iodevice
|
The parsed device IODD. |
required |
lang
|
str | None
|
Optional language code (e.g., "de", "fr"). |
required |
standard_lang_texts
|
dict[str, dict[str, str]]
|
Pre-loaded language-specific standard definitions texts, mapping language code to text dictionaries. |
required |
device_lang_texts
|
dict[str, dict[str, str]]
|
Texts from device-specific language files, mapping language code to text dictionaries. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, str]
|
Dictionary of resolved text strings keyed by text id. |
Source code in src/iodd_parser/resolvers.py
resolve_units(unit_definitions, texts)
Resolve units from standard unit definitions.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
unit_definitions
|
IoddstandardUnitDefinitions
|
The parsed standard unit definitions XML. |
required |
texts
|
dict[str, str]
|
Dictionary of resolved text strings. |
required |
Returns:
| Type | Description |
|---|---|
dict[int, ResolvedUnit]
|
Dictionary of resolved units keyed by unit code. |
Source code in src/iodd_parser/resolvers.py
resolve_user_interface(user_interface, texts)
Resolve the UserInterface element to a ResolvedUserInterface.
The UserInterface contains: - ProcessDataRefCollection (optional): Display info for process data - MenuCollection: All menu definitions - Three role-based MenuSets: Observer, Maintenance, Specialist
Each role has fixed top-level menus (Identification, Parameter, Observation, Diagnosis) that reference menus from the MenuCollection.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_interface
|
UserInterfaceT
|
The user interface element from DeviceFunction. |
required |
texts
|
dict[str, str]
|
Dictionary of resolved text strings. |
required |
Returns:
| Type | Description |
|---|---|
ResolvedUserInterface
|
Resolved user interface with all menus and role assignments. |
Source code in src/iodd_parser/resolvers.py
resolve_variables(std_variable_collection, device_variable_collection, texts, datatypes)
Resolve variables from standard definitions and device variable collection.
Variables come from three sources:
- StdVariableRef: references to standard variables from IODD-StandardDefinitions1.1.xml
- DirectParameterOverlay: device-specific data within DirectParameter page
- Variable: vendor-specific variables with a device-specific index
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
std_variable_collection
|
IoddstandardVariableCollectionT
|
Standard variables from definitions XML. |
required |
device_variable_collection
|
VariableCollectionT
|
Device variable collection from IODD. |
required |
texts
|
dict[str, str]
|
Dictionary of resolved text strings. |
required |
datatypes
|
dict[str, DatatypeT]
|
Dictionary of available datatypes. |
required |
Returns:
| Type | Description |
|---|---|
dict[str, ResolvedVariable]
|
Dictionary of resolved variables keyed by variable id. |
Source code in src/iodd_parser/resolvers.py
411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 | |