Getting Started
The purpose of this exercise is to modify the data record XML used by GDK to properly scale analog IO when using non-default settings for AQ and DQ. The following are the required components to perform this exercise.
- GDK supported Galil controller with analog ranges settable by AQ or DQ.
- A computer running the latest version of GDK software.
- A text editor such as gedit on Linux, or Notepad++ on Windows.
- The controller's command reference page for AQ and/or DQ
GDK's XML
Setting non-default analog scaling involves editing GDK's data record xml. The following two chapters are helpful before continuing.
Analog Inputs, AQ, Determine the Needed Settings
Note the AQ settings that shall be set for each analog input. From the desired setting, note the <t>, <m>, and <p> element values to be used from the following tables.
12 Bit Analog Inputs, I12B
Voltage Range | Data Type | Counts per volt | <t> Element | <m> Element | <p> Element |
---|---|---|---|---|---|
-5 to +5 | 12 bit Word | 409.6 | 204 | 0.00244140625 | 3 |
-10 to +10 (default) | 12 bit Word | 204.8 | 204 | 0.0048828125 | 3 |
0 to +5 | 12 bit Unsigned Word | 819.2 | 205 | 0.001220703125 | 3 |
0 to +10 | 12 bit Unsigned Word | 409.6 | 205 | 0.00244140625 | 3 |
Example, Default Analog Input 1
<f i="I12B" s="@AN[1]"><d>Analog Input 1</d><o>110</o><t>204</t><m>0.0048828125</m><p>3</p></f>
16 Bit Analog Inputs, I16B
Voltage Range | Data Type | Counts per volt | <t> Element | <m> Element | <p> Element |
---|---|---|---|---|---|
-5 to +5 | Word | 6553.6 | 202 | 0.000152587890625 | 4 |
-10 to +10 (default) | Word | 3276.8 | 202 | 0.00030517578125 | 4 |
0 to +5 | Unsigned Word | 13107.2 | 203 | 0.0000762939453125 | 5 |
0 to +10 | Unsigned Word | 6553.6 | 203 | 0.000152587890625 | 4 |
Example, Default Analog Input 1
<f i="I16B" s="@AN[1]"><d>Analog Input 1</d><o>110</o><t>202</t><m>0.00030517578125</m><p>4</p></f>
Analog Ouputs, DQ, Determine the Needed Settings
Note the DQ settings that shall be set for each analog output. From the desired setting, note the <t>, <m>, <b>, and <p> element values to be used from the following table.
12 and 16 Bit Analog Outputs, O12B, O16B
Voltage Range | Data Type | Counts per volt | <t> Element | <m> Element | <b> Element | <p> Element |
---|---|---|---|---|---|---|
-5 to +5 | Unsigned Word | 6553.6 | 203 | 0.000152587890625 | -5.0 | 3 |
-10 to +10 (default) | Unsigned Word | 3276.8 | 203 | 0.00030517578125 | -10.0 | 3 |
0 to +5 | Unsigned Word | 13107.2 | 203 | 0.0000762939453125 | 0.0 | 3 |
0 to +10 | Unsigned Word | 6553.6 | 203 | 0.000152587890625 | 0.0 | 3 |
Example, Default Analog Ouput 0
<f s="@AO[0]"><d>Analog output 0</d><o>8</o> <t>203</t><m>0.00030517578125</m><b>-10.0</b><p>4</p><u>volts</u></f>
Make the Changes
Open record.xml in a text editor.
- In GDK's main options menu
, open the settings directory by clicking Settings... and then click the Files button.
- Open the xml subdirectory to view the files.
- Open record.xml in a text editor.
Find the analog entry in the data record structure for the analog I/O point(s) using nonstandard AQ and/or DQ. Many editors have a find feature. Searching for @AN for analog inputs or @AO for analog outputs will help to quickly find the analog I/O.
Be sure that the correct entry has been found for the product. See Content Filtering.
Be sure that the correct entry has been found for the resolution of the I/O, e.g. I16B, O16B or I12B, O12B.
Once the correct I/O point has been found, enter the new values for <t>, <m>, <b>, and <p>.
Save the changes, close record.xml, and restart GDK. The analog values should now be scaled in areas where scaled values are used by GDK.
Conclusion
Much of GDK's data formatting is taken care of behind-the-scenes without user interaction. For AQ and DQ, this formatting is not automatic. However, by editing GDK's XML content, the desired scaling can easily be set.