Although two previous parts of this article were focused on the internal mechanics behind Measurement System Wizard tool, you don't always need to get involved with programming. In fact, the main purpose of this tool - namely, to integrate and configure several instruments (in various combinations) into working measurement system - can be achieved in minutes by end users with little or no programming background. Certainly, some development efforts may be required to create device drivers, but this step must be accomplished only once.
To run Measurement System Wizard, open DM2003 Script Editor (click Options|Script|Script Editor item in the DM2003 main menu), then select Help|Wizards|DAQ Wizard menu item in the Script Editor menu. You will see following dialog box:
Here you can load so-called Measurement System Profile (1). Profile is a standard Windows configuration file (*.ini) that keeps user input collected by the wizard. You can save profiles at the last page of wizard. Typically you will create several HTML applications based on the same profile with slightly changed settings, such as different measurement instruments assigned to the data channels. Besides, profile can include custom code generation templates (you should define templates by manual editing appropriate entries in the *.ini file). Click Next button to proceed to General page.
At this page you can enter or edit various parameters of your HTML application (1). Notice that Title is HTML attribute, while Window Title is the caption of DM2003 data window. Applet ID is any valid identifier that is used to remember applet configuration in the Windows registry. Page width must be sufficient to display all elements of device driver panel.
Two checkboxes (2) are very important. In fact, their combination selects one of four code generation templates, which in turn, determine application measurement control cycle. If you have selected these checkboxes, you must define Scanner or/and Commutator devices at the Devices page (see below). Also you must provide Commutator state codes (3) for Commutator device if you will use it.
Devices page is where you configure logical representation of your measurement equipment. You must use at least one device driver specially created for use by this wizard. Select port number and, probably, Scan or/and Comm device function (1) and click Add Device button (2). Standard Open File dialog box will appear prompting you to select HTML file of device driver. If you click OK, appropriate record will be added to the list of devices (3). You can rearrange this list and delete items using appropriate buttons (4). If you select Use relative file names checkbox, the name of file in the URL parameter of scriptlet container will not include path, so that all files must be placed in the same folder. Keep in mind that some characters in file name or path may require correct code page settings in your HTML code, otherwise driver file may be not found. Also notice that you can add several instances of the same device driver on different ports (of course, driver must support this feature).
There are instruments that have more than one channel, that is, the same device can be used to measure several physical quantities. Appropriate logical abstraction here also was named channel. To configure channel table, you should select device from the list of devices created at the previous step, enter channel number (if the device has only one channel, leave the default zero value) and identifier (1), and click Add Channel button (2). You can also delete (4) and test (5) selected channel. Channel tester is a special dialog box that creates and displays temporary HTML page with scriptlet container for selected device driver. This page loads and configures device driver so you can obtain "live" data. Channel tester feature helps you to correctly assign actual device channels to the values of physical parameters that you intend to measure.
Columns table determines labels of values that will be inserted into data window when your application generates data point. These labels will appear in the worksheet header, and current values are displayed by the HTML application itself. To add new column, enter label text and select column function using appropriate fields (1) and click Add Column button (3). New item will appear in the Columns Table (2). You can also delete and rearrange columns in this table.
If you select Manual window control checkbox, you will have to create data window, visualize and manage data stream "by hands". In this mode, the script will use IDMApplication.RecordPoint() method that inserts data point into first document window whose IsRecording property is set to true. Otherwise, all window management operations will be automatic. Notice that you can easily change this mode: just find constant named ManualWindowControl in the script code of your HTML application and change its value.
At the last step of this wizard, you must provide VBScript function that converts "raw" channel data into column values. You type calculation algorithm in the special text editor field (1). Function header area (2) is not editable. This function must return array of numbers, corresponding to the worksheet columns. Typically you will use VBScript Array() function with appropriate arguments as shown on the screenshot. If your calculation algorithm is too complicated, you can use custom code generation templates that include (or link to) additional scripts. Input arguments are channel identifiers (if you use commutation, these variables are zero-based arrays whose size corresponds to the number of commutation states).
Before you click OK button to insert application code into the Script Editor, you have an option to save all settings made in this wizard to the disk (or create Measurement System Profile). You will be prompted to enter *.ini file name. Notice that function body will be saved into separate file with the same name and *.vbs extension.