lvDCOM
An EPICS support module to export LabVIEW values as process variables
|
lvDCOM is an EPICS support module that can exports front panel variables from National Instruments LabVIEW software applications as EPICS process variables on computers running the Microsoft Windows operating system. The program allows you to rapidly "EPICS enable" existing LabVIEW applications as it is not necessary to modify a Virtual Instruments (VIs) internals, so it could be used to conveniently wrap third party applications. As the program uses DCOM for communication, this (ActiveX) needs to be selected in the "VI Server" options of LabVIEW, but this is the only required change to a VI.
For a brief introduction to lvDCOM see the following presentation from the EPICS 2013 spring meeting (also available as PDF in doc directory of distribution)
lvDCOM allows LabVIEW variables to be accessed by EPICS aware tools, if you wish to instead display existing EPICS process variables on LabVIEW front panels then CA Lab is the program to use.
Features of lvDCOM are:
The lvDCOM software is an EPICS Asyn driver that uses DCOM to communicate with LabVIEW. LabVIEW front panel items (controls and indicators) are mapped to asyn driver parameters via an XML configuration file lvinput.xml, each "section" in the XML file being accessed via a specified asyn "port name". These driver parameters can then be linked to process variables via example.db.
The syntax of the XML configuration file is described in the comments in lvinput.xml and lvDCOMinput.xsd . An initial XML file can first be generated by the procedure below and then adjusted accordingly. This procedure will also attempt to map LabVIEW rings/enums into EPICS MBBI/MBBO records, but as some of the value information is not available in the LabVIEW controls export process the resulting enum/ring numeric values may need to be adjusted before use.
See the doc directory of the distribution for further information.
Source code and a pre-build Windows binary of lvDCOM can be downloaded from the ISIS EPICS homepage.
It is not necessary to create a new lvDCOM IOC to talk to a different set of VIs. Everything is configured from st.cmd via lvinput.xml and so the same executable can be re-used. The lvinput.xml file supports multiple VI definition section and so can also be shared between IOCs.
The sed and xsltproc programs are required to generate an initial configuration file from the "exported strings" of a LabVIEW front panel. Windows binaries for these are available from http://gnuwin32.sourceforge.net/packages/sed.htm and http://gnuwin32.sourceforge.net/packages/libxslt.htm, alternatively these steps could be carried out on a Linux computer and the results transferred back to Windows.
Building lvDCOM from source requires the full version of the Microsoft Visual Studio C++ compiler (ATL is used for DCOM and that is not available in the express compiler version). A pre-built win32 lvDCOM binary can, however, be downloaded from http://epics.isis.stfc.ac.uk/ and this does not require any additional Microsoft tools/libraries to be installed.
To build from source, unpack the ZIP file, adjust configure/RELEASE in the usual way to reflect your setup, then type make.
We first need to obtain a list of the available controls/indicators on the VI via:
For the next couple of steps you need both the xsltproc and sed programs in your PATH - see requirements section above.
First we need to adjust the "exported strings" from LabVIEW so they can be read by XML utilities, via:
fix_xml.cmd controls.txt controls.xml
which generates a controls.xml file. Then to generate the initial LvDCOM XML input file run:
xsltproc lvstrings2input.xsl controls.xml > lvinput.xml
you can now edit lvinput.xml to remove or rename items etc. An XML schema definition file lvDCOMinput.xsd is also provided and, if present in the same directory as lvinput.xml, should be picked up automatically by XML aware editors to make editing easier. Finally, to generate an initial EPICS DB file run:
xsltproc lvinput2db.xsl lvinput.xml > example.db
As before, example.db can then be adjusted as appropriate. The fix_xml.cmd and xsltproc commands above should not produce any screen output - if they do it is probably because they encountered an error parsing the file.
If you wish to run an lvDCOM IOC and LabVIEW on different computers, then you will probably need to configure some additional DCOM options on the target (LabVIEW) computer via the dcomcnfg command. Typical LabVIEW.Application DCOM options to modify would be:
If you find that your DCOM settings are being ignored (e.g. a second instance of LabVIEW is started when one is already running locally despite "Interactive User" been specified in the "Identity" tab) then it may be that the LabVIEW AppId is missing from one part of the Windows registry. In this case you should check your LabVIEW installation and/or consult a Windows registry/DCOM expert. Feel free to contact me too (see Support below) as it may be the same problem we had, I haven't detailed the fix here as it might not be appropriate for all cases and modifying the Windows registry needs to be undertaken with care.
If you need further help, or discover any problems, or have any suggestions for new features/improvements, please contact Freddie Akeroyd (fredd) ie.a keroy d@st fc.ac .uk
lvDCOM is Copyright (c) 2013 STFC ISIS Facility, Rutherford Appleton Laboratory, GB. All rights reserved.
It is distributed under the EPICS Open License as detailed in the included LICENSE.txt file.
When distributed in binary form, lvDCOM will have been linked against the EPICS BASE, autosave and ASYN driver software. These works are covered by licences detailed in the LICENSE_EPICS_BASE.txt, LICENSE_AUTOSAVE.txt and LICENSE_ASYN.txt files contained within the distribution and the following copyright notices:
Copyright (c) 1991-2011 UChicago Argonne LLC. Copyright (c) 1991-2006 The Regents of the University of California. Copyright (c) 2006-2011. Los Alamos National Security, LLC. Some of this material was produced under U.S. Government contract DE-AC52-06NA25396 for Los Alamos National Laboratory (LANL), which is operated by Los Alamos National Security, LLC for the U.S. Department of Energy.
Copyright (c) 2005 University of Chicago and the Regents of the University of California. All rights reserved.
Copyright (c) 2002 University of Chicago, The Regents of the University of California, and Berliner Elektronenspeicherring Gesellschaft fuer Synchrotronstrahlung m.b.H. (BESSY) All rights reserved.
Copyright (c) 2004 by Danfysik and Cosylab (Danfysik has funded the work performed by Cosylab).