dcs.hal.device
Device abstraction layer for digital casting system machines.
This module defines the abstract Machine interface and concrete implementations for various digital casting system devices including inline mixers, concrete pumps, and dosing pumps. Each machine class provides standardized interfaces for accessing device parameters, input/output variables, and communication settings.
ConcretePump
dataclass
Bases: Machine
Concrete pump machine implementation for material transport operations.
The ConcretePump class represents a concrete pumping device that transports mixed concrete from the mixer to the casting location. This machine provides control of pumping parameters and monitoring of system status.
Attributes:
Name | Type | Description |
---|---|---|
machine_id |
int
|
Unique identifier for this pump instance. |
machine_input |
List[object]
|
List of input parameter objects for pump control. |
machine_output |
List[object]
|
List of output parameter objects for pump monitoring. |
machine_error_num |
int
|
Current error count or error state indicator (default: 0). |
__str__()
String representation of the concrete pump.
device_id()
Get the unique device identifier for this pump.
get_input_var_name()
Get an iterator of input variable names.
get_output_var_name()
Get an iterator of output variable names.
input_list()
Get the list of input parameters for pump control.
output_list()
Get the list of output parameters for pump monitoring.
parameter_id(param_name)
Get the parameter ID for a specific parameter name.
set_input_dict()
Generate input variable dictionary for PLC communication.
set_output_dict()
Generate output variable dictionary for PLC communication.
Controller
dataclass
Bases: Machine
System controller for coordinating multiple machine operations.
The Controller class represents the main system controller that coordinates the operation of multiple machines in the digital casting system and manages global system parameters.
Attributes:
Name | Type | Description |
---|---|---|
machine_id |
int
|
Unique identifier for this controller instance. |
machine_input |
List[object]
|
List of input parameter objects for system control. |
machine_output |
List[object]
|
List of output parameter objects for system monitoring. |
machine_error_num |
int
|
Current error count or error state indicator (default: 0). |
__str__()
String representation of the system controller.
device_id()
Get the unique device identifier for this controller.
get_input_var_name()
Get an iterator of input variable names.
get_output_var_name()
Get an iterator of output variable names.
input_list()
Get the list of input parameters for system control.
output_list()
Get the list of output parameters for system monitoring.
parameter_id(param_name)
Get the parameter ID for a specific parameter name.
set_input_dict()
Generate input variable dictionary for PLC communication.
set_output_dict()
Generate output variable dictionary for PLC communication.
DosingPumpHigh
dataclass
Bases: Machine
High-precision dosing pump for precise additive injection.
The DosingPumpHigh class represents a high-precision dosing pump used for injecting additives, accelerators, or other chemicals into the concrete mix with high accuracy requirements.
Attributes:
Name | Type | Description |
---|---|---|
machine_id |
int
|
Unique identifier for this dosing pump instance. |
machine_input |
List[object]
|
List of input parameter objects for dosing control. |
machine_output |
List[object]
|
List of output parameter objects for dosing monitoring. |
machine_error_num |
int
|
Current error count or error state indicator (default: 0). |
__str__()
String representation of the high-precision dosing pump.
device_id()
Get the unique device identifier for this dosing pump.
get_input_var_name()
Get an iterator of input variable names.
get_output_var_name()
Get an iterator of output variable names.
input_list()
Get the list of input parameters for dosing control.
output_list()
Get the list of output parameters for dosing monitoring.
parameter_id(param_name)
Get the parameter ID for a specific parameter name.
set_input_dict()
Generate input variable dictionary for PLC communication.
set_output_dict()
Generate output variable dictionary for PLC communication.
DosingPumpLow
dataclass
Bases: Machine
Low-precision dosing pump for bulk additive injection.
The DosingPumpLow class represents a dosing pump used for injecting larger volumes of additives or materials where high precision is not critical.
Attributes:
Name | Type | Description |
---|---|---|
machine_id |
int
|
Unique identifier for this dosing pump instance. |
machine_input |
List[object]
|
List of input parameter objects for dosing control. |
machine_output |
List[object]
|
List of output parameter objects for dosing monitoring. |
machine_error_num |
int
|
Current error count or error state indicator (default: 0). |
__str__()
String representation of the low-precision dosing pump.
device_id()
Get the unique device identifier for this dosing pump.
get_input_var_name()
Get an iterator of input variable names.
get_output_var_name()
Get an iterator of output variable names.
input_list()
Get the list of input parameters for dosing control.
output_list()
Get the list of output parameters for dosing monitoring.
parameter_id(param_name)
Get the parameter ID for a specific parameter name.
set_input_dict()
Generate input variable dictionary for PLC communication.
set_output_dict()
Generate output variable dictionary for PLC communication.
InlineMixer
dataclass
Bases: Machine
Inline mixer machine implementation for concrete mixing operations.
The InlineMixer class represents an inline concrete mixing device that blends cement, water, and additives in a continuous process. This machine provides real-time control of mixing parameters and monitoring of process variables.
Attributes:
Name | Type | Description |
---|---|---|
machine_id |
int
|
Unique identifier for this mixer instance. |
machine_input |
List[object]
|
List of input parameter objects for mixer control. |
machine_output |
List[object]
|
List of output parameter objects for mixer monitoring. |
machine_error_num |
int
|
Current error count or error state indicator (default: 0). |
Example
mixer_inputs = [param1, param2, param3] # Parameter objects mixer_outputs = [status1, status2] # Status objects mixer = InlineMixer(machine_id=1, machine_input=mixer_inputs, machine_output=mixer_outputs) print(f"Mixer ID: {mixer.device_id()}")
__str__()
String representation of the inline mixer.
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
Human-readable string describing the mixer configuration. |
device_id()
Get the unique device identifier for this mixer.
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
The machine_id assigned to this inline mixer instance. |
get_input_var_name()
Get an iterator of input variable names.
Yields:
Name | Type | Description |
---|---|---|
Any |
Any
|
Variable name for each input parameter of this mixer. |
get_output_var_name()
Get an iterator of output variable names.
Yields:
Name | Type | Description |
---|---|---|
Any |
Any
|
Variable name for each output parameter of this mixer. |
input_list()
Get the list of input parameters for mixer control.
Returns:
Type | Description |
---|---|
list[object]
|
List[object]: List of input parameter objects that can be used to control mixer operation (flow rates, mixing speeds, etc.). |
output_list()
Get the list of output parameters for mixer monitoring.
Returns:
Type | Description |
---|---|
list[object]
|
List[object]: List of output parameter objects that provide mixer status and measurement data. |
parameter_id(param_name)
Get the parameter ID for a specific parameter name.
Searches through both input and output parameter lists to find a parameter with the specified name and returns its ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
param_name
|
str
|
Name of the parameter to look up. |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Parameter ID if found, 0 if parameter not found or has no ID. |
set_input_dict()
Generate input variable dictionary for PLC communication.
Creates dictionary entries for active input variables with their PLC variable names, data types, and configuration flags.
Yields:
Name | Type | Description |
---|---|---|
dict |
dict
|
Dictionary with variable name as key and list containing PLC variable name, pyads data type, and flag as value. Format: {var_name: [var_name_IN, "pyads.DATA_TYPE", 1]} |
set_output_dict()
Generate output variable dictionary for PLC communication.
Creates dictionary entries for active output variables with their PLC variable names, data types, and configuration flags.
Yields:
Name | Type | Description |
---|---|---|
dict |
dict
|
Dictionary with variable name as key and list containing PLC variable name, pyads data type, and flag as value. Format: {var_name: [var_name_IN, "pyads.DATA_TYPE", 1]} |
Machine
Bases: ABC
Abstract base class for digital casting system machines.
This abstract class defines the interface that all machine implementations must follow. It provides standard methods for accessing device information, parameter lists, and variable configurations needed for PLC communication.
All concrete machine classes must implement the abstract methods to provide device-specific functionality while maintaining a consistent interface.
device_id()
abstractmethod
Get the unique device identifier for this machine.
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Unique identifier for the device, used for communication routing and device management within the digital casting system. |
get_input_var_name()
abstractmethod
Get an iterator of input variable names.
Yields:
Name | Type | Description |
---|---|---|
Any |
Any
|
Variable names for all input parameters of this machine. |
get_output_var_name()
abstractmethod
Get an iterator of output variable names.
Yields:
Name | Type | Description |
---|---|---|
Any |
Any
|
Variable names for all output parameters of this machine. |
input_list()
abstractmethod
Get the list of input parameters for this machine.
Returns:
Type | Description |
---|---|
list[object]
|
List[object]: List of input parameter objects that can be written to the machine for control and configuration purposes. |
output_list()
abstractmethod
Get the list of output parameters for this machine.
Returns:
Type | Description |
---|---|
list[object]
|
List[object]: List of output parameter objects that can be read from the machine for status monitoring and feedback. |
parameter_id(param_name)
abstractmethod
Get the parameter ID for a specific parameter name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
param_name
|
str
|
Name of the parameter to look up. |
required |
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
Unique identifier for the specified parameter, or 0 if not found. |
set_input_dict()
abstractmethod
Generate input variable dictionary for PLC communication.
Yields:
Name | Type | Description |
---|---|---|
dict |
dict
|
Dictionary entries containing variable name mappings and data type information for active input variables. |
set_output_dict()
abstractmethod
Generate output variable dictionary for PLC communication.
Yields:
Name | Type | Description |
---|---|---|
dict |
dict
|
Dictionary entries containing variable name mappings and data type information for active output variables. |