nidaqmx.system.watchdog
- class nidaqmx.system.watchdog.WatchdogTask(device_name, task_name='', timeout=10, grpc_options=None)[source]
Bases:
object
Represents the watchdog configurations for a DAQmx task.
- __init__(device_name, task_name='', timeout=10, grpc_options=None)[source]
Creates and configures a task that controls the watchdog timer of a device. The timer activates when you start the task.
Use the DAQmx Configure Watchdog Expiration States functions to configure channel expiration states. This class does not program the watchdog timer on a real-time controller.
- Parameters:
device_name (str) – Specifies is the name as configured in MAX of the device to which this operation applies.
task_name (str) – Specifies the name to assign to the task. If you use this constructor in a loop and specify a name for the task, you must use the DAQmx Clear Task method within the loop after you are finished with the task. Otherwise, NI-DAQmx attempts to create multiple tasks with the same name, which results in an error.
timeout (float) – Specifies the amount of time in seconds until the watchdog timer expires. A value of -1 means the internal timer never expires. Set this input to -1 if you use an Expiration Trigger to expire the watchdog task. If this time elapses, the device sets the physical channels to the states you specify with the digital physical channel expiration states input.
grpc_options (Optional[
GrpcSessionOptions
]) – Specifies the gRPC session options.
- __weakref__
list of weak references to the object (if defined)
- cfg_watchdog_ao_expir_states(expiration_states)[source]
Configures the expiration states for an analog watchdog timer task.
- Parameters:
expiration_states –
(List[nidaqmx.system.watchdog.AOExpirationState]): Contains the states to which to set analog physical channels when the watchdog timer expires. Each element of the list contains an analog physical channel name, the corresponding expiration state, and the output type for that analog physical channel. The units of “expiration state” must be specified in volts for an analog output voltage expiration state, or amps for an analog output current expiration state.
- physical_channel (str): Specifies the analog output channel to
modify. You cannot modify dedicated analog input lines.
- expiration_state (float): Specifies the value to set the
channel to upon expiration.
- output_type (nidaqmx.constants.WatchdogAOExpirState):
Specifies the output type of the physical channel.
- Returns:
Indicates the list of objects representing the configured expiration states.
- Return type:
List[nidaqmx.system._watchdog_modules.expiration_state.ExpirationState]
- cfg_watchdog_co_expir_states(expiration_states)[source]
Configures the expiration states for a counter watchdog timer task.
- Parameters:
expiration_states –
(List[nidaqmx.system.watchdog.COExpirationState]): Contains the states to which to set counter physical channels when the watchdog timer expires. Each element of the list contains a counter physical channel name and the corresponding state for that counter physical channel.
- physical_channel (str): Specifies the counter output channel to
modify. You cannot modify dedicated counter input lines.
- expiration_state (nidaqmx.constants.WatchdogCOExpirState):
Specifies the value to set the channel to upon expiration.
- Returns:
Indicates the list of objects representing the configured expiration states.
- Return type:
List[nidaqmx.system._watchdog_modules.expiration_state.ExpirationState]
- cfg_watchdog_do_expir_states(expiration_states)[source]
Configures the expiration states for a digital watchdog timer task.
- Parameters:
expiration_states –
(List[nidaqmx.system.watchdog.DOExpirationState]): Contains the states to which to set digital physical channels when the watchdog timer expires. Each element of the list contains a digital physical channel name and the corresponding state for that digital physical channel.
- physical_channel (str): Specifies the digital output channel to
modify. You cannot modify dedicated digital input lines.
- expiration_state (nidaqmx.constants.Level): Specifies the
value to set the channel to upon expiration.
- Returns:
Indicates the list of objects representing the configured expiration states.
- Return type:
List[nidaqmx.system._watchdog_modules.expiration_state.ExpirationState]
- clear_expiration()[source]
Unlock a device whose watchdog timer expired.
This function does not program the watchdog timer on a real-time controller. Use the Real-Time Watchdog VIs to program the watchdog timer on a real-time controller.
- close()[source]
Clears the task.
Before clearing, this method aborts the task, if necessary, and releases any resources the task reserved. You cannot use a task after you clear it unless you recreate the task.
If you create a DAQmx Task object within a loop, use this method within the loop after you are finished with the task to avoid allocating unnecessary memory.
- control(action)[source]
Alters the state of a task according to the action you specify.
- Parameters:
action (nidaqmx.constants.TaskMode) – Specifies how to alter the task state.
- property expir_trig_dig_edge_edge
Specifies on which edge of a digital signal to expire the watchdog task.
- Type:
- property expir_trig_dig_edge_src
Specifies the name of a terminal where a digital signal exists to use as the source of the Expiration Trigger.
- Type:
str
- property expir_trig_trig_on_network_conn_loss
Specifies the watchdog timer behavior when the network connection is lost between the host and the chassis. If set to true, the watchdog timer expires when the chassis detects the loss of network connection.
- Type:
bool
- property expir_trig_trig_type
Specifies the type of trigger to use to expire a watchdog task.
- property expiration_states
Gets the collection of expiration states for this watchdog task.
- property expired
Indicates if the watchdog timer expired. You can read this property only while the task is running.
- Type:
bool
- property name
Indicates the name of the task.
- Type:
str
- reset_timer()[source]
Reset the internal timer. You must continually reset the internal timer to prevent it from timing out and locking the device.
This function does not program the watchdog timer on a real-time controller. Use the Real-Time Watchdog VIs to program the watchdog timer on a real-time controller.
- start()[source]
Transitions the task to the running state to begin the measurement or generation. Using this method is required for some applications and is optional for others.
- stop()[source]
Stops the task and returns it to the state the task was in before the DAQmx Start Task method ran.
- property timeout
Specifies in seconds the amount of time until the watchdog timer expires. A value of -1 means the internal timer never expires. Set this input to -1 if you use an Expiration Trigger to expire the watchdog task.
- Type:
float