Part 3 : Data Assembly Set¶
Data Assembly - the base type for all MTP objects¶
mtppy.part3.data_assembly_set.data_assembly.DataAssembly(tag_name, tag_description='')
¶
Bases: DataItemCollection
DataAssembly is the base class for all the DataAssemblies that serve as interface between POL and PEA and are specified in PNO MTP 2.0 Part 3 (Library) and PNO MTP 2.0 Part 4 (Services).
It defines the aliases TagName and TagDescription
DataAssembly itself is quite simple, the heavy lifting of providing simple pythonic access paths (dict, attribute, setter/getter) to the elements and managing the callback logic on change requests is done by the baseclass DataItemCollection.
Initialize the DataAssembly.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tag_name
|
str
|
value for |
required |
tag_description
|
str
|
value for |
''
|
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
Definitions¶
BaseFunctions¶
mtppy.part3.data_assembly_set.base_functions.operation_mode.OperationMode()
¶
Bases: DataItemCollection
Represents the operation mode BaseFunction.
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
mtppy.part3.data_assembly_set.base_functions.oslevel.OSLevelBaseFunction()
¶
Bases: DataItemCollection
Initialize the OSLevel BaseFunction.
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
mtppy.part3.data_assembly_set.base_functions.source_mode.SourceMode()
¶
Bases: DataItemCollection
Implements the operation and source modes BaseFunction.
This class manages the source mode states and transitions according to the MTP 2.0 specification. It handles the interaction between different source mode components like channel, internal and manual modes.
Initialize the SourceMode instance.
The data items defined CLASS_DATA_ITEMS are set up by the DataItemCollection. This class registers the callback functions for automatic and manual operation mode changes.
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
set_src_channel(value)
¶
Set the source channel value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
The boolean value to set for the source channel. |
required |
set_src_int_aut(value)
¶
Set the internal automatic mode.
If the source channel is active and the value is True, transitions to internal mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
The boolean value to set for the internal automatic mode. |
required |
set_src_int_op(value)
¶
Set the internal operation mode.
If the source channel is not active and the value is True, transitions to internal mode. Also resets the internal operation mode to False to prevent infinite loops.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
The boolean value to set for the internal operation mode. |
required |
set_src_man_aut(value)
¶
Set the manual automatic mode.
If the source channel is active and the value is True, transitions to manual mode.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
The boolean value to set for the manual automatic mode. |
required |
set_src_man_op(value)
¶
Set the manual operation mode.
If the source channel is not active and the value is True, transitions to manual mode. Also resets the manual operation mode to False.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
bool
|
The boolean value to set for the manual operation mode. |
required |
mtppy.part3.data_assembly_set.base_functions.wqc.WQCBaseFunction()
¶
Bases: DataItemCollection
Base function for Write Quality Control operations.
This class implements the basic WQC functionality that can be extended by derived classes to provide specific write quality control behaviors.
Defines
WQC_: Class constant representing the WQC data item name.
Initialize the WQC BaseFunction.
Sets up the WQC data item with the appropriate write callback.
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
set_wqc(value)
¶
Set the WQC value.
This method is intended to be overridden by derived classes to provide specific write quality control behavior.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
ANY_TYPE
|
The value to set for the WQC data item. |
required |
ActiveElements¶
mtppy.part3.data_assembly_set.active_elements.active_element.ActiveElement(tag_name, tag_description)
¶
Bases: DataAssembly
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
mtppy.part3.data_assembly_set.active_elements.drives.bin_drv.BinDrv(tag_name, tag_description='', rev_fbk_calc=True, fwd_fbk_calc=True, safe_pos=0, fwd_en=True, rev_en=False, perm_en=False, intl_en=False, prot_en=False)
¶
Bases: ActiveElement
Binary Drive (BinDrv).
Implements a binary drive element according to MTP 2.0 specification.
Initialize the BinDrv element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tag_name
|
str
|
Name of the tag. |
required |
tag_description
|
str
|
Description of the tag. |
''
|
rev_fbk_calc
|
bool
|
Reverse feedback calculation flag. |
True
|
fwd_fbk_calc
|
bool
|
Forward feedback calculation flag. |
True
|
safe_pos
|
int
|
Safe position value. |
0
|
fwd_en
|
bool
|
Forward enable flag. |
True
|
rev_en
|
bool
|
Reverse enable flag. |
False
|
perm_en
|
bool
|
Permission enable flag. |
False
|
intl_en
|
bool
|
Interlock enable flag. |
False
|
prot_en
|
bool
|
Protection enable flag. |
False
|
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
get_fwd_fbk()
¶
Get forward feedback status.
get_rev_fbk()
¶
Get reverse feedback status.
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
set_fwd_aut(value)
¶
Set forward automatic command.
set_fwd_fbk(value)
¶
Set forward feedback.
set_fwd_op(value)
¶
Set forward operation command.
set_interlock(value)
¶
Set interlock status.
set_permit(value)
¶
Set permit status.
set_protect(value)
¶
Set protection status.
set_reset_aut(value)
¶
Set reset automatic command.
set_reset_op(value)
¶
Set reset operation command.
set_rev_aut(value)
¶
Set reverse automatic command.
set_rev_fbk(value)
¶
Set reverse feedback.
set_rev_op(value)
¶
Set reverse operation command.
set_stop_aut(value)
¶
Set stop automatic command.
set_stop_op(value)
¶
Set stop operation command.
set_trip(value)
¶
Set trip status.
mtppy.part3.data_assembly_set.active_elements.drives.ana_drv.AnaDrv(tag_name, tag_description='', rpm_min=0, rpm_max=1000, rpm_scl_min=0, rpm_scl_max=1000, rpm_unit=0, rev_fbk_calc=True, fwd_fbk_calc=True, rpm_fbk_calc=True, safe_pos=0, fwd_en=True, rev_en=False, perm_en=False, intl_en=False, prot_en=False)
¶
Bases: ActiveElement
Analog Drive (AnaDrv).
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
mtppy.part3.data_assembly_set.active_elements.drives.mon_bin_drv.MonBinDrv(tag_name, tag_description='', rev_fbk_calc=True, fwd_fbk_calc=True, safe_pos=0, fwd_en=True, rev_en=False, perm_en=False, intl_en=False, prot_en=False, mon_en=True, mon_safe_pos=True, mon_stat_ti=1, mon_dyn_ti=1)
¶
Bases: BinDrv
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
compare_states_control_signals(monitor_time, first_ready=None)
async
¶
Compare states of drive and control signals.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
monitor_time
|
float
|
MonStatTi or MonDynTi times |
required |
first_ready
|
Event | None
|
optional event signalled after the first snapshot so start_monitor() can guarantee a baseline is captured before a caller issues its first control signal. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[list[bool], list[bool]]
|
results of states and control signals comparisons |
get_fwd_fbk()
¶
Get forward feedback status.
get_rev_fbk()
¶
Get reverse feedback status.
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
set_fwd_fbk(value)
¶
Set forward feedback.
set_interlock(value)
¶
Set interlock status.
set_permit(value)
¶
Set permit status.
set_protect(value)
¶
Set protection status.
set_rev_fbk(value)
¶
Set reverse feedback.
set_stop_monitor()
¶
Stop the periodic monitor coroutines and wait for them to finish.
Blocks the calling thread until all monitor coroutines have completed,
replacing the need for explicit thread.join() calls.
set_trip(value)
¶
Set trip status.
start_monitor()
¶
Start the periodic monitor coroutines on the private event loop.
Idempotent: if the monitors are already running this is a no-op.
mtppy.part3.data_assembly_set.active_elements.drives.mon_ana_drv.MonAnaDrv(tag_name, tag_description, rpm_min=0, rpm_max=1000, rpm_scl_min=0, rpm_scl_max=1000, rpm_unit=0, rev_fbk_calc=True, fwd_fbk_calc=True, rpm_fbk_calc=True, safe_pos=0, fwd_en=True, rev_en=False, perm_en=False, intl_en=False, prot_en=False, mon_en=True, mon_safe_pos=True, mon_stat_ti=1, mon_dyn_ti=1, rpm_ah_en=True, rpm_al_en=True, rpm_ah_lim=900, rpm_al_lim=50)
¶
Bases: AnaDrv
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
set_stop_monitor()
¶
Stop the monitoring coroutines and wait for them to finish.
Blocks the calling thread until all monitor coroutines have
completed, replacing the need for explicit thread.join() calls.
start_monitor()
¶
Start the monitoring coroutines on the private event loop.
Idempotent: if the monitors are already running this is a no-op.
mtppy.part3.data_assembly_set.active_elements.pid.pid_ctrl.PIDCtrl(tag_name, tag_description='', pv_scl_min=0, pv_scl_max=100, pv_unit=0, sp_scl_min=0, sp_scl_max=100, sp_unit=0, sp_int_min=0, sp_int_max=100, sp_man_min=0, sp_man_max=100, mv_min=0, mv_max=1000, mv_unit=0, mv_scl_min=0, mv_scl_max=100, prop=100, ti=10, td=1)
¶
Bases: ActiveElement
PID controller active element.
Computes a manipulated variable (MV) from the process value (PV)
and a setpoint (SP) while in automatic operation mode. The control
loop runs as a single asyncio task on a private daemon-thread event loop,
replacing the two daemon threads of the legacy implementation.
Configure the PID controller and its data items.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tag_name
|
str
|
Name of the data assembly tag. |
required |
tag_description
|
str
|
Optional human-readable description. |
''
|
pv_scl_min
|
float
|
PV scaling minimum. |
0
|
pv_scl_max
|
float
|
PV scaling maximum. |
100
|
pv_unit
|
float
|
PV engineering unit. |
0
|
sp_scl_min
|
float
|
SP scaling minimum. |
0
|
sp_scl_max
|
float
|
SP scaling maximum. |
100
|
sp_unit
|
float
|
SP engineering unit. |
0
|
sp_int_min
|
float
|
Internal setpoint lower bound. |
0
|
sp_int_max
|
float
|
Internal setpoint upper bound. |
100
|
sp_man_min
|
float
|
Manual setpoint lower bound. |
0
|
sp_man_max
|
float
|
Manual setpoint upper bound. |
100
|
mv_min
|
float
|
Manipulated variable lower bound. |
0
|
mv_max
|
float
|
Manipulated variable upper bound. |
1000
|
mv_unit
|
float
|
MV engineering unit. |
0
|
mv_scl_min
|
float
|
MV scaling minimum. |
0
|
mv_scl_max
|
float
|
MV scaling maximum. |
100
|
prop
|
float
|
Proportional gain (Kp). |
100
|
ti
|
float
|
Integral gain (Ki). |
10
|
td
|
float
|
Derivative gain (Kd). |
1
|
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
get_mv()
¶
Return the current manipulated variable value.
get_sp()
¶
Return the current active setpoint value.
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
set_mv_man(value)
¶
Manual manipulated-variable write, applied in operator mode.
set_p(value)
¶
Apply a new proportional gain to the controller.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float
|
New proportional gain (Kp). |
required |
set_pv(value)
¶
Update the process value in both the data item and the PID.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
float
|
New process value. |
required |
set_sp_int(value)
¶
Internal setpoint write, applied in automatic + internal source.
set_sp_man(value)
¶
Manual setpoint write, applied in automatic + manual source.
mtppy.part3.data_assembly_set.active_elements.valves.ana_vlv.AnaVlv(tag_name, tag_description='', pos_min=0, pos_max=100, pos_scl_min=0, pos_scl_max=100, pos_unit=1342, open_fbk_calc=True, close_fbk_calc=True, pos_fbk_calc=True, safe_pos=0, safe_pos_en=False, perm_en=False, intl_en=False, prot_en=False)
¶
Bases: ActiveElement
Analog Valve (AnaVlv).
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
mtppy.part3.data_assembly_set.active_elements.valves.bin_vlv.BinVlv(tag_name, tag_description='', open_fbk_calc=True, close_fbk_calc=True, safe_pos=0, safe_pos_en=False, perm_en=False, intl_en=False, prot_en=False)
¶
Bases: ActiveElement
Binary Valve (BinVlv).
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
mtppy.part3.data_assembly_set.active_elements.valves.mon_ana_vlv.MonAnaVlv(tag_name, tag_description='', pos_min=0, pos_max=100, pos_scl_min=0, pos_scl_max=100, pos_unit=1342, open_fbk_calc=True, close_fbk_calc=True, pos_fbk_calc=True, safe_pos=0, safe_pos_en=False, perm_en=False, intl_en=False, prot_en=False, mon_en=True, mon_safe_pos=True, mon_stat_ti=1, mon_dyn_ti=1, pos_tolerance=1, mon_pos_ti=1)
¶
Bases: AnaVlv
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
compare_states_control_signals(monitor_time, first_ready=None)
async
¶
compare states of valve and control signals
Argument
monitor_time: MonStatTi or MonDynTi times first_ready: optional event signalled after the first snapshot so start_monitor() can guarantee a baseline is captured before a caller issues its first control signal.
Returns:
| Type | Description |
|---|---|
tuple[list[bool], list[bool]]
|
results of states and control signals comparisons (a list including True or False) |
monitor_dynamic_error(first_ready=None)
async
¶
monitor dynamic error
monitor_position_reached()
async
¶
monitor position error
One-shot: runs once per position change and must complete even when
the periodic monitors are not active, so it does not gate on
_stop_event.
monitor_static_error(first_ready=None)
async
¶
monitor static error
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
set_stop_monitor()
¶
Stop the periodic monitor coroutines and wait for them to finish.
Blocks the calling thread until all periodic monitor coroutines have
completed, replacing the need for explicit thread.join() calls.
start_monitor()
¶
Start the periodic monitor coroutines on the private event loop.
Idempotent: if the monitors are already running this is a no-op.
Uses _monitor_futures (not _loop) for the check because
_set_pos may create the loop before start_monitor is called.
mtppy.part3.data_assembly_set.active_elements.valves.mon_bin_vlv.MonBinVlv(tag_name, tag_description='', open_fbk_calc=True, close_fbk_calc=True, safe_pos=0, safe_pos_en=False, perm_en=False, intl_en=False, prot_en=False, mon_en=True, mon_safe_pos=True, mon_stat_ti=1, mon_dyn_ti=1)
¶
Bases: BinVlv
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
compare_states_control_signals(monitor_time, first_ready=None)
async
¶
compare states of valve and control signals
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
monitor_time
|
SupportsFloat | SupportsIndex
|
MonStatTi or MonDynTi times |
required |
first_ready
|
Event | None
|
optional event signalled after the first snapshot so start_monitor() can guarantee a baseline is captured before a caller issues its first control signal. |
None
|
Returns:
| Type | Description |
|---|---|
tuple[list[bool], list[bool]]
|
results of states and control signals comparisons (a list including True or False) |
monitor_dynamic_error(first_ready=None)
async
¶
monitor dynamic error
monitor_static_error(first_ready=None)
async
¶
monitor static error
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
set_stop_monitor()
¶
Stop the periodic monitor coroutines and wait for them to finish.
Blocks the calling thread until all monitor coroutines have completed,
replacing the need for explicit thread.join() calls.
start_monitor()
¶
Start the periodic monitor coroutines on the private event loop.
Idempotent: if the monitors are already running this is a no-op.
DiagnosticElements¶
mtppy.part3.data_assembly_set.diagnostic_elements.diagnostic_element.DiagnosticElement(tag_name, tag_description)
¶
Bases: DataAssembly
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
IndicatorElements¶
mtppy.part3.data_assembly_set.indicator_elements.indicator_element.IndicatorElement(tag_name, tag_description)
¶
Bases: DataAssembly
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
mtppy.part3.data_assembly_set.indicator_elements.views.ana_view.AnaView(tag_name, tag_description='', v_scl_min=0, v_scl_max=100, v_unit=1998)
¶
Bases: IndicatorElement
Analog View (AnaView).
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
mtppy.part3.data_assembly_set.indicator_elements.views.bin_view.BinView(tag_name, tag_description='', v_state_0='state_0_active', v_state_1='state_1_active')
¶
Bases: IndicatorElement
Binary View (BinView).
Implements a binary view according to MTP 2.0 specification.
Initialize the BinView element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tag_name
|
str
|
Name of the tag. |
required |
tag_description
|
str
|
Description of the tag. |
''
|
v_state_0
|
str
|
Value for the state 0 description. |
'state_0_active'
|
v_state_1
|
str
|
Value for the state 1 description. |
'state_1_active'
|
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
mtppy.part3.data_assembly_set.indicator_elements.views.dint_view.DIntView(tag_name, tag_description='', v_scl_min=0, v_scl_max=100, v_unit=1998)
¶
Bases: IndicatorElement
Discrete Integer View (DIntView).
Implements a discrete integer view according to MTP 2.0 specification.
Initialize the DIntView element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tag_name
|
str
|
Name of the tag. |
required |
tag_description
|
str
|
Description of the tag. |
''
|
v_scl_min
|
int
|
Minimum scale value. |
0
|
v_scl_max
|
int
|
Maximum scale value. |
100
|
v_unit
|
int
|
Unit value. |
1998
|
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
mtppy.part3.data_assembly_set.indicator_elements.views.string_view.StringView(tag_name, tag_description='')
¶
Bases: IndicatorElement
String View (StringView).
Implements a string view according to MTP 2.0 specification.
Initialize the StringView element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tag_name
|
str
|
Name of the tag. |
required |
tag_description
|
str
|
Description of the tag. |
''
|
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
OperationElements¶
mtppy.part3.data_assembly_set.operation_elements.operation_element.OperationElement(tag_name, tag_description)
¶
Bases: DataAssembly
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
PeaElements¶
mtppy.part3.data_assembly_set.pea_elements.pea_element.PeaElement(tag_name, tag_description)
¶
Bases: DataAssembly
Base class for Process Element Assembly (PEA) elements.
This class serves as the foundation for all PEA elements in the system. It inherits from DataAssembly and provides common functionality for process element assemblies.
Initialize a PEA element.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tag_name
|
str
|
The name identifier for the PEA element. |
required |
tag_description
|
str
|
A descriptive text for the PEA element. |
required |
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
mtppy.part3.data_assembly_set.pea_elements.pea_information_label.pea_information_label.PeaInformationLabel(tag_name, tag_description, *, asset_id='', component_name='', device_class='', device_health=255, device_manual='', device_revision='', hardware_revision='', manufacturer='', manufacturer_uri='', model='', product_code='', product_instance_uri='', revision_counter=0, serial_number='', software_revision='')
¶
Bases: PeaElement
Process Equipment Assembly (PEA) Information Label.
This class represents an information label for PEA elements, containing various identification and metadata fields for devices and components. It inherits from PeaElement and provides specific data items for asset identification, device specifications, and manufacturing information.
Initialize a PeaInformationLabel instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tag_name
|
str
|
The name identifier for the PEA element |
required |
tag_description
|
str
|
A descriptive text for the PEA element |
required |
asset_id
|
str
|
Asset identification string |
''
|
component_name
|
str
|
Component name string |
''
|
device_class
|
str
|
Device class string |
''
|
device_health
|
int
|
Device health status (0-255) |
255
|
device_manual
|
str
|
Device manual reference string |
''
|
device_revision
|
str
|
Device revision string |
''
|
hardware_revision
|
str
|
Hardware revision string |
''
|
manufacturer
|
str
|
Manufacturer name string |
''
|
manufacturer_uri
|
str
|
Manufacturer URI string |
''
|
model
|
str
|
Model name string |
''
|
product_code
|
str
|
Product code string |
''
|
product_instance_uri
|
str
|
Product instance URI string |
''
|
revision_counter
|
int
|
Revision counter value |
0
|
serial_number
|
str
|
Serial number string |
''
|
software_revision
|
str
|
Software revision string |
''
|
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |
set_asset_id(value)
¶
Set the asset ID value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
The asset ID string to set. |
required |
mtppy.part3.data_assembly_set.pea_elements.web_server_url_info.web_server_url_info.WebServerUrlInfo(tag_name, tag_description, url='')
¶
Bases: PeaElement
Web Server URL Information.
This class represents web server URL information for PEAs. It inherits from PeaElement and provides a data item for storing web server URLs.
Initialize a WebServerUrlInfo instance.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
tag_name
|
str
|
The name identifier for the PEA element |
required |
tag_description
|
str
|
A descriptive text for the PEA element |
required |
url
|
str
|
The web server URL string to initialize with |
''
|
attach_loop(loop)
¶
Bind this collection to the run-task event loop of its service.
Once bound, every write made from a foreign thread is scheduled onto that loop so that all mutations happen on the single run task (the single-writer principle). Writes made from the run task itself execute inline. Collections that are never bound keep the legacy synchronous, inline behaviour.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
loop
|
AbstractEventLoop
|
The running event loop owned by the service's run task. |
required |
attach_wake(wake_fn)
¶
Register the run-task wake callable for this collection.
When a guarded write (e.g. a service op-mode or command change) is
scheduled onto the bound loop from a foreign thread, the owning
service's run task may be parked in the offline undefined state.
Registering its wake callable lets such a write release that wait
immediately instead of waiting out the next poll interval.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wake_fn
|
Callable[[], None]
|
Zero-argument callable that signals the run task to wake. |
required |
run_on_loop(fn)
¶
Run fn on the bound loop, deferring from foreign threads.
This is the single-writer primitive. Three cases:
- No bound loop -> run
fninline (unbound / test / offline). - Caller already on the bound loop -> run
fninline (avoids a re-post loop for nested / cascade writes fired inside a posted operation). - Caller on a foreign thread -> schedule
fnvialoop.call_soon_threadsafeso it runs on the run task.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
fn
|
Callable[[], None]
|
Zero-argument callable that mutates this collection. |
required |