18
Signal Acquisition and Net VI (Virtual Net Instruments) © Zahner 05/2011

Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Embed Size (px)

Citation preview

Page 1: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI (Virtual Net Instruments)

© Zahner 05/2011

Page 2: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI - 2 -

Page 3: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI - 3 -

Introduction _________________________________ 4

1. Signal Acquisition Setup ____________________ 5

1.1 Edit Internal Output Channels......................................................5

1.2 Edit Internal Input Channels.........................................................6

2. Signal Acquisition __________________________ 7

3. Net VI ____________________________________ 8

3.1 Configuring Net VI.........................................................................8

3.2 Net VI Programmer’s Reference ................................................11 3.2.1 DevCli.dll Communication Functions.............................................................................. 11 3.2.2 Net VI Communication Protocol....................................................................................... 13 3.2.3 LabVIEW Sample Application........................................................................................... 14

3.3 Troubleshooting Net VI...............................................................17

4. LabVIEW VI (Remote Control) _______________ 18

Page 4: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI - 4 -

Introduction During electrochemical measurements additional parameters like temperature, pressure or pH can influence the system. So monitoring these quantities or doing measurements while controlling additional parameters can be of great use. For this task Zahner supplies two different solutions. Plug in boards directly integrated into the Zennium provide additional inputs (TEMP/U, FE42) or outputs (DA4). External devices like the Eurotherm 2408 temperature controller are supported as net instruments. In this case communication is realized over TCP/IP, so net instruments can be located distant from the Zennium. Even the Zennium can be controlled via TCP/IP which is used by a LabVIEW front-end.

Page 5: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI - 5 -

1. Signal Acquisition Setup

Starts the setup page of signal acquisition: Selected channels have continuous display numbers. Select or deselect input channels for display and logging. Edit input channels (only for plug-in add on cards). The input channels of the most common add on card (TEMP/U) are predefined. Net VIs (Eurotherm) are automatically de-tected with a channel offset of 6144.

Close ACQ setup. Edit output channels manually (only for plug-in add on cards). Net VIs output chan-nels are automatically detected. Manually start auto-matic detection Signal acquisition menu

There are 32 input channels available. For detailed information about editing input channels refer to the corresponding manual of the add on card.

1.1 Edit Internal Output Channels

Click on “Edit Output” to setup existing or new output channels manually.

Edit existing output channel. Define new output channel.

Enter parameters for output channel and finish by clicking the checkbox-icon. physical channel

Integer [1..16] DAC16/4-channel 1..16 [257..272] EPC42-channel 1..16

physical meaning

String Name of physical meaning

physical unit

String Unit of physical meaning

prop. factor V/V

Real Proportional factor: physical meaning/V

minimal set value

Real Minimal value of output channel

maximal set value

Real Maximal value of output channel

Page 6: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI - 6 -

1.2 Edit Internal Input Channels

Click on “Edit Input” to setup existing or new input channels manually. Edit existing input channel. Define new input channel.

Enter parameters for output channel and finish by clicking the checkbox-icon. channel Integer [16..4095] internal channel for

ANDI addon-cards For further information refer to addon hardware manual

module Integer 5 TEMP/U 11 FE42

physical meaning

String Name of physical meaning

physical unit

String Unit of physical meaning

display format

e# f# -###.## -@@@.@@ -#.###^^^^-@.@@@^^^^

engineering format with # significant digits floating point with # significant digits fixed display, incl. zeroes-suppression fixed display, without zeroes-suppression exponential exponential

polynom order

Integer [1] for linear scaling (only gain) [2..9] for nonlinear scaling (i.e. thermocouples)

offset Real Value bias at zero input voltage gain Real Proportional factor:

Full Range / 4000 coef. [2..9]

Real Coefficient for higher order (nonlinear)

Example: Pressure sensor at Potential0 input of TEMP/U addon-card. The Potential0 input is set to ± 4V input range (8V full input range). The sensor supply 0V at air pressure (1 Bar) and a potential difference of 100mV each Bar. Setup Input Channel 34: meaning Pressure unit Bar display format

-##.## fixed display, incl. zeroes-suppression

polynom order

1 linear scaling

offset 1 Pressure [Bar] at 0V sensor potential gain 2e-2 Full Range Input = 8V/100mV = 80 (Bar)

Gain = 80/4000 = 0,02 = 2e-2

Page 7: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI - 7 -

2. Signal Acquisition

Starts the main page of the signal acquisition: Selected displays are shown here in order of display number given in setup page.

Close signal acquisition. Set values of analog output channels. Set digital output channels (special add on cards) ACQ setup menu Activate logging option (red marked) to enable logging of data during measurement (EIS,…).

! Remember that the acquired signals are only logged to data during measurement when logging option is activated.

Page 8: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI - 8 -

3. Net VI External devices i.e. the Eurotherm 2408 temperature controller or the HP 34401A digital multimeter are supported as Net VIs (virtual net instruments). In this case communication is realized over TCP/IP, so Net VIs can be located distant from the Zennium. Zahner can also support Net VI technology to the instrument you apply. The only requirement is a RS232 interface able instrument. For detailed information about supported instruments or special customized solutions please contact our company.

Net VIPC

Net VIapplication

Net VI

TermPC

Thalessoftware

RouterSwitch

IM6/6eX

USBLANLANRS232

3.1 Configuring Net VI Net instruments are controlled by a small Net VI application (netinstrument.EXE) running on the PC the device is connected to. This Net VI application manages the communication with the device and links it to Zahner’s TCP/IP interface. All required setup information for running a Net VI can be done by editing the corresponding Net VI initialization file (netinstrument.INI).

Open the initialisation file located in C:\FLINK\NetVI folder: COMPort port number, the net instrument

is connect to (normally 1 or 2). To identify your communication ports you can open the device manager in the hardware tab of your system properties.

DeviceSrv TCP/IP address of the PC running Thales software as device server. (127.0.0.1 for local host)

DeviceName device name shown in Thales. Configure adjust IO type, channel number,

physical meaning, physical dimension, display settings and ranges by editing the string.

Save changes of the INI file. Configure = IOtype;SymbolicChannel;PhyMeaning;PhyDimension;

DisplaySettings;MinValue;MaxValue IOtype I: process value input only O: set value output only IO: controlled value input/output SymbolicChannel Integer symbolic input/output channel (I & IO types) or output channel (O only type), individual channel numbers for each NetVI PhyMeaning String e.g. “voltage”, “current”, “temperature”, … PhyDimension String e.g. “V”, “A”, “C”, … DisplaySettings e# engineering format with # significant digits f# floating point with # significant digits -###.## fixed display, incl. zeroes-suppression

Page 9: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI - 9 - -@@@.@@ fixed display, without zeroes-suppression -#.###^^^^ exponential -@.@@@^^^^ exponential the leading sign mask character allows three different modes - only negative with leading “-“ + positive with leading “+” and negative with leading “-“ “no sign” display absolute value without “+” or “-“

! Use different symbolic channel numbers for each Net VI, connected to the Zahner TCP/IP device to ensure the correct signal acquisition of more than one channel.

Example 1: Net VI at remote pc connected via LAN

PC 1192.168.1.14

Net VIapplication

Eurotherm2408

PC 2192.168.1.86

ThalessoftwareRouter

SwitchIM6/6eX

USBLANLANRS232

COM1

[setup] DeviceName=Eurotherm COMPort=1 DeviceSrv=192.168.1.86 Example 2: Net VI at same pc as Thales software

PC 1

Thalessoftware &

Net VIapplication

Eurotherm2408 IM6/6eX

USBRS232

COM1

[setup] DeviceName=Eurotherm COMPort=1 DeviceSrv=127.0.0.1

! The TCP/IP address 127.0.0.1 is fix assigned as localhost (here PC1) and describes the computer itself.

Example 3: Display process value = -3.1415692e-2 with different display settings e5 -> "-31.416m" f3 -> "-3.14e-02" -###.## -> " -0.03" -@@@.@@ -> "-000.03" -#.###^^^^ -> "-3.141e-02"

Page 10: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI - 10 - For correct operation it is necessary to start the Net VI application with the corresponding INI-file as parameter. A practical way is to create a new shortcut for your Net VI on the desktop:

Right click on your desktop, open New and select Shortcut.

Type c:\flink\eurotherm.exe eurotherm.ini and continue by clicking Next.

Type your favoured shortcut title, i.e. Eurotherm and close shortcut wizard by clicking Finish.

Now there is a new shortcut icon on your desktop.

! Please ensure that the Thales software is running on the PC connected to the Zennium before starting the Net VI application on the other PC.

Thales detects net instruments automatically each time signal acquisition setup is started. No manual configuration is necessary.

Page 11: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI - 11 -

3.2 Net VI Programmer’s Reference

3.2.1 DevCli.dll Communication Functions The dynamic link library DevCli.dll provides functions for communication with the Thales window over TCP/IP. These functions are used for Net VIs and remote control of the Zennium (see manual “Remote Control”). Although the functions are presented in Delphi syntax, their use is not limited to a dedicated development platform. The LabVIEW sample application (see 3.2.3 LabVIEW Sample Application) uses the functions of DevCli.dll encapsulated in a LabVIEW library. The following functions are available: function DevNew(IPAddr,DevName:PChar;Size:SmallInt):Integer;stdcall; function DevDel(DevIdx:Byte):Integer;stdcall; function DevNMI(DevIdx:Byte):Integer;stdcall; function DevWrite(DevIdx:Byte;var Data;N:Integer):Integer;stdcall; function DevRead(DevIdx:Byte;var Data;N:Integer):Integer;stdcall; function DevWriteEx(DevIdx:Byte;var Data;N:Integer):Integer;stdcall; function DevReadEx(DevIdx:Byte;var Data;N:Integer):Integer;stdcall; function DevWriteCont(DevIdx:Byte;var Data;N:Integer):Integer;stdcall; function DevReadCont(DevIdx:Byte;var Data;N:Integer):Integer;stdcall; DevNew(IPAddr,DevName:PChar;Size:SmallInt):Integer;stdcall; This function initialises the TCP/IP communication with the Thales window and has to be called before using any other function.

Parameters

IPAddr pointer to string containing IP-address or computer name, e.g. “127.0.0.1” DevName pointer to string containing name of device, choose a descriptive name for the Net VI, use

“ScriptRemote” for remote control Size integer (16 bit) setting the buffer size used by Thales for communication in bytes, e.g. 256

Return Value

-1, 0 setup of communication to device failed > 0 device index (DevIdx) for further communication DevDel(DevIdx:Byte):Integer;stdcall; This function should be called to terminate the TCP/IP communication properly when the Net VI is shutting down.

Parameters

DevIdx device index obtained from DevNew

Return Value

-1 error, e.g. invalid device index 0 success DevNMI(DevIdx:Byte):Integer;stdcall; Initiate an NMI (non maskable interrupt) on the Zennium, can be used to boot an Zennium remote.

Parameters

DevIdx device index obtained from DevNew

Return value

-1 error, e.g. invalid device index 0 success

Page 12: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI - 12 - Remark on read/write functions There are three pairs of read/write functions called DevRead/DevWrite, DevReadEx/DevWriteEx and DevReadCont/DevWriteCont which use different data buffers and are therefore not exchangeable. Watch out which function is used by Thales in each special case and use the appropriate counterpart. DevWrite(DevIdx:Byte;var Data;N:Integer):Integer;stdcall; Write to Thales, overwrite last data in buffer.

Parameters

DevIdx device index obtained from DevNew Data pointer to write data buffer N number of bytes to write, 32 bit integer

Return Value

-1 error, e.g. invalid device index > -1 number of bytes written DevRead(DevIdx:Byte;var Data;N:Integer):Integer;stdcall; Read data from Thales, clear source buffer.

Parameters

DevIdx device index obtained from DevNew Data pointer to buffer for received data N not used

Return value

-1 error, e.g. invalid device index > -1 number of read characters (including 0) DevWriteEx(DevIdx:Byte;var Data;N:Integer):Integer;stdcall; Write data to Thales, overwrite last data in buffer.

Parameters

DevIdx device index obtained from DevNew Data pointer to write data N number of bytes to write, 32 bit integer

Return Value

-1 error, e.g. invalid device index > -1 number of bytes written DevReadEx(DevIdx:Byte;var Data;N:Integer):Integer;stdcall; Read data from Thales, keep data in buffer. Subsequent calls of DevReadEx return the same result until it is overwritten by Thales.

Parameters

DevIdx device index obtained from DevNew Data pointer to buffer for received data N not used

Return value

-1 error, e.g. invalid device index > -1 number of read characters (including 0)

Page 13: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI - 13 - DevWriteCont(DevIdx:Byte;var Data;N:Integer):Integer;stdcall; Write to Thales using a FIFO buffer.

Parameters

DevIdx device index obtained from DevNew Data pointer to write data buffer N number of bytes to write, 32 bit integer

Return Value

-1 error, e.g. invalid device index > -1 number of bytes written DevReadCont(DevIdx:Byte;var Data;N:Integer):Integer;stdcall; Read data from Thales using a FIFO buffer.

Parameters

DevIdx device index obtained from DevNew Data pointer to buffer for received data N not used

Return value

-1 error, e.g. invalid device index > -1 number of read characters (including 0)

3.2.2 Net VI Communication Protocol Communication between the Net VI application and Thales is done by exchanging ASCII-strings using the functions described in Fehler! Verweisquelle konnte nicht gefunden werden.. Commands issued by Thales are read by the Net VI application using the DevRead function. The following command strings are sent: CONF Each time Thales scans for new Net VIs, e.g. because the user has activated the refresh button, it sends CONF to the Net VI. The Net VI has to answer by sending a configuration string using the DevWrite function. For information about the configuration string confer to Fehler! Verweisquelle konnte nicht gefunden werden.. IN When Thales explicitly acquires actual data of an input channel it sends a IN command followed by the number of the channel. The Net VI has to respond by sending the string “00,value” using DevWrite. The usual way Thales acquires data is reading the Ex-channel which is written periodically by the Net VI application. This way the Net VI can determine the optimal point of time for getting data from the device and providing it to Thales. The latter is done by sending an ASCII-string containing the value with DevWriteEx. Please note: Numeric values can be transferred either in floating point (0.1234) or exponential representation (1.234e-01). When using exponential representation ensure to use a small letter “e” to indicate the exponent. OUT Thales sends setpoint values in the format “OUTchannel,setpoint value”. No response of the NET VI is required.

Page 14: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI - 14 -

3.2.3 LabVIEW Sample Application

The LabVIEW sample VIs provided by Zahner can be used as basis for user projects. So all instruments supported by LabVIEW can be integrated as Virtual Instruments in Thales. The folder THALES\VI\LabVIEW Net VI contains:

• Eurotherm Net VI.vi – top level VI for the Eurotherm 2408 temperature controller • Dummy Net VI.vi – top level VI without interface to a physical instrument • NetVI.llb – LabVIEW library with VIs implementing the Net VI to Thales communication, used

by Eurotherm Net VI.vi and Dummy Net VI.vi • EurothermRS232.llb – LabVIEW library with VIs implementing the device interface for the

Eurotherm 2408 temperature controller, used by Eurotherm Net VI.vi • flclient6.llb – LabVIEW library encapsulating the functions of DevCli.dll, used by NetVI.llb • DevCli.dll – Dynamic Link Library providing the low level communication functions to Thales

The Eurotherm Net VI interfaces the Eurotherm 2408 temperature controller and offers the same functionality as the application in chapter 3.1 Configuring Net VI.

The front panel contains the following elements: Server IP: IP of computer running Thales. DevName: A descriptive name used to identify the Net VI in Thales. Symbolic Channel: If several Net VIs are running simultaneously each one has to use a different channel number. In case of only one Net VI stay with the default of 0. Set Value: Set point value given by Thales, which is transferred to the Eurotherm controller. Actual Value: Temperature read from the Eurotherm controller and transferred to Thales. The STOP button should be used to terminate the communication correctly.

A dummy Net VI without interface to a physical instrument is provided for testing purposes. This VI can be executed without additional hardware. The set point value is only displayed on the front panel and the actual value can be entered to simulate the measured values of the instrument. Apart from the missing device interface it is identical to the Eurotherm Net VI.

Page 15: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI - 15 -

Communication between the Net VI and Thales is done by using VIs of the LabVIEW library NetVI.llb. The diagram of the Eurotherm Net VI reveals the way communication to Thales is realized. As soon as a Thales window is active, Net VIs can register with NetVI Init. Devices with more than one input or output channel can be realized by registering several Net VIs. The cluster DevRef returned by NetVI Init is used as handle for all following actions. When quitting the Net VI application, NetVI Close should be called to terminate communication properly. NetVI Get CMD checks every 50 ms whether Thales has issued a new command and returns it. Thales can issue the following commands: CONF When scanning for Net VIs Thales requests a configure string from every Net VI with the CONF command. CONF is sent during automatic scans and every time the refresh button in signal acquisition setup is pressed (cf. chapter 1. Signal Acquisition Setup). The configure string returned informs Thales how to display the data. For further information about configure strings see also chapter 3.1 Configuring Net VI. NetVI Write Config is a convenient way of building up a configure string out of the following settings: IOType: I for input, O for output and IO for input & output Symbolic Channel: unique number for each Net VI, starting at 0 PhyMeaning: e.g. “voltage”, “current”, “temperature” PhyDimension: e.g. “V”, “A”, “C” DisplaySettings: format string for display in Thales, cf. 3.1 Configuring Net VI and andiBASIC manual command “using” MinVal, MaxVal: Allowed range of output quantities in Thales (user inputs are limited to this range)

Page 16: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI - 16 - IN Apart from using the values the Net VI sends by itself (see below), Thales can acquire a measurement by the IN command. After receiving an IN command the Net VI has to read the latest value from the instrument and return it using Net VI Write Data. Make sure to set the polling input to FALSE, otherwise the value will not be accepted. OUT Each time the set point value is changed in Thales, an OUT command is sent to the Net VI. Net VI Get CMD extracts and returns the numerical value of the new set point. The Net VI has to send this value to the device. Automatic polling of values Issuing an IN command is not the only way Thales receives data from a Net VI. Thales also reads acquired data sent by the Net VI periodically using a special transfer method. This method is activated by setting the polling input of Net VI Write Data to TRUE. This way the Net VI can choose the optimal data rate and point of time for updating the value. Thales uses these values during measurements (EIS, CV) and the signal acquisition display (cf. chapter 2. Signal Acquisition). In the sample application the actual temperature determined by the Eurotherm controller is sent to Thales every second.

Page 17: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI - 17 -

3.3 Troubleshooting Net VI

The Net VI application can’t find Zahner device server at the remote pc. Ensure that Thales software is running before starting the Net VI application.

Please check TCP/IP address of the remote PC and adjust DeviceSrv= in the Net VI initialisation file (*.INI) located in C:\FLINK\. If the error still exists check the network connection to the remote pc:Click on Net VI pc windows start button and open run… Type in cmd.exe and click OK Type command ping tcp/ip-address and press enter.

There is no network connection to the remote pc. Contact your network administrator.

The Net VI pc is connected to the remote pc. Ensure that Thales software is running on the remote pc.

You have connected several Net VIs correctly but the signal acquisition setup misses some acquisition channels.

Please check the symbolic channel numbers of the Net VIs in the Configure= string of the corresponding Net VI initialisation file (*.INI) located in C:\FLINK\. Set unique integer numbers (e.g. 0, 1, 2, …) for each Net VI.

Page 18: Signal Acquisition and Net VI (Virtual Net Instruments)zahner.de/pdf/ACQ.pdf · Signal Acquisition and Net VI ... COMPort port number, ... Although the functions are presented in

Signal Acquisition and Net VI - 18 -

4. LabVIEW VI (Remote Control) The Zennium can be controlled via TCP/IP which is used by a LabVIEW front-end. For more information refer to separate manual “Remote Control” (15_Remote.pdf).