Configuration files
A configuration file describes the channels of the modules of a bench, so that you do not have to enter them again each time a plugin starts. It is a TOML file, and it works as a state manager built into the plugin and dedicated to DAQmx: the state manager of the Dashboard cannot restore the channels of a plugin, which exist only once it has started, whereas a configuration describes them. Each file is a configuration, and the plugin offers the list of the configurations in a drop-down menu, so that the choice is saved with the preset of the plugin.
Where the files are
All the files live in the daqmx folder of the PyMoDAQ system configuration folder (for instance
C:\ProgramData\.pymodaq\daqmx on Windows), so that every user of the computer sees the same configurations. A
configuration is named by its suffix: config_daqmx_<suffix>.toml is the configuration <suffix>, and
config_daqmx.toml is the configuration shown as default. When you save a configuration from the plugin, you
give the suffix only.
Example
version = 1
description = "The bench of config_daqmx_bench.toml, in the current format"
[devices.cDAQ1]
product = "cDAQ-9174"
[modules.cDAQ1Mod1]
product = "NI 9211"
[modules.cDAQ1Mod1.ai.ai2]
type = "thermocouple"
thermocouple_type = "K"
units = "DEG_C"
min_val = 0.0
max_val = 50.0
info = "Example of AI thermocouple channel"
[modules.cDAQ1Mod1.ai.ai1]
type = "thermocouple"
thermocouple_type = "K"
units = "DEG_C"
min_val = 0.0
max_val = 50.0
info = "Example of AI thermocouple channel"
[modules.cDAQ1Mod2]
product = "NI 9217"
[modules.cDAQ1Mod3]
product = "NI 9205"
[modules.cDAQ1Mod3.ai.ai0]
type = "voltage"
terminal_config = "RSE"
min_val = -10.0
max_val = 10.0
info = "Example of AI voltage channel"
[modules.cDAQ1Mod3.ai.ai5]
type = "voltage"
terminal_config = "RSE"
min_val = -10.0
max_val = 10.0
info = "Example of AI voltage channel"
[modules.cDAQ1Mod4]
product = "NI 9203"
Format
versionRequired. The version of the format,
1. Another value is refused.descriptionFree text.
[devices.<name>]Optional, one table for each device (a cDAQ chassis for instance).
productis its product type, which is informative.[modules.<name>]One table for each module, named as in NI MAX (
cDAQ1Mod3, orDev1for a board). The name of a channel is its module and its key:[modules.cDAQ1Mod3.ai.ai0]is the channelcDAQ1Mod3/ai0, so the module of a channel is the device its name starts with.productis the product type of the module, informative.[modules.<name>.ai.<key>]One table for each analog input channel. The channel is
<module>/<key>(cDAQ1Mod3/ai0) and the order of the tables in the file is the order of the data of an acquisition.typeselects the kind of channel and its other keys.infois a free note, kept when the file is saved again. A key that does not belong to the type is an error, so that a typo cannot go unnoticed.
The names of the keys are the names of the arguments of the channels of the Python API (see Reference), and a value that is a constant of the driver is written with its name.
|
Key |
Value |
Default |
|---|---|---|---|
|
|
Volts, |
-10, 10 |
|
|
|
|
|
|
Amperes, |
-0.02, 0.02 |
|
same as |
|
|
|
|
|
|
|
|
|
|
|
In |
0, 100 |
|
|
|
|
|
|
|
|
|
|
Amperes, positive |
0.0025 |
|
|
Ohms at 0 °C |
100 |
|
|
as |
|
Only the analog input channels are described for now.
Default values
Only type is required in a channel. A key you leave out takes the default value of the table above, which is the
default of the Python API, and nothing tells you when it happens. In particular, a voltage channel without
min_val and max_val is measured on the range -10 V to 10 V, and a thermocouple channel without them on 0 to
100 degrees. The range is passed to the driver, which may round it to a range the module supports, so write the
ranges you rely on explicitly:
[modules.cDAQ1Mod3.ai.ai0]
type = "voltage" # measured from -10 V to 10 V, RSE not set: DEFAULT terminal configuration
[modules.cDAQ1Mod3.ai.ai1]
type = "voltage"
min_val = -1.0 # explicit, nothing is left to the defaults
max_val = 1.0
terminal_config = "RSE"
terminal_config = "DEFAULT" lets the driver choose the terminal configuration of the module. The settings tree of
the plugin shows the values that were read, defaults included, once a configuration is chosen.
Mistakes
A file the plugin cannot use is refused with a message that names the file and the entry, for instance:
config_daqmx.toml: [cDAQ1Mod3.ai.ai0] unknown terminal_config 'FLOATING', expected one of ['DEFAULT', 'RSE', ...]
Files of the previous versions
The files of the previous versions of the plugin (a NIDAQ_Devices table with DEVICE01 and MODULE01
tables) can still be read, with their voltage, current and thermocouple channels. Choosing such a file and saving it
under a new suffix writes it in the current format; the original is never modified. The keys were renamed:
value_min and value_max became min_val and max_val, termination became terminal_config, and
thermo_type became thermocouple_type. The keys source and analog_type are replaced by type.