Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
Carsten Winkler committed May 17, 2022
1 parent d0003be commit a103b99
Show file tree
Hide file tree
Showing 13 changed files with 3,806 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
################################################################################

/.vs/CALab/FileContentIndex
/.vs
10 changes: 10 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Copyright (C) 2010 Helmholtz-Zentrum Berlin f�r Materialien und Energie GmbH, Berlin, Germany (HZB)
This software is copyrighted by the HELMHOLTZ-ZENTRUM BERLIN FUER MATERIALIEN UND ENERGIE G.M.B.H., BERLIN, GERMANY (HZB).
The following terms apply to all files associated with the software.

HZB hereby grants permission to use, copy, and modify this software and its documentation for non-commercial educational or research purposes, provided that existing copyright notices are retained in all copies.
The receiver of the software provides HZB with all enhancements, including complete translations, made by the receiver.
IN NO EVENT SHALL HZB BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OF THIS SOFTWARE,
ITS DOCUMENTATION, OR ANY DERIVATIVES THEREOF, EVEN IF HZB HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. HZB SPECIFICALLY DISCLAIMS ANY WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NON-INFRINGEMENT.
THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, AND HZB HAS NO OBLIGATION TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# CA Lab (LabVIEW + EPICS)

<img src="https://www.helmholtz-berlin.de/media/media/angebote/it/experimentsteuerung/ca-lab/channelaccesspluslabview-hb-logo.jpg"
alt="CA Lab Logo"
style="float: left; margin-right: 10px;" />
## Overview

What is CA Lab?<br/>
**It is a**<br/>- user-friendly,<br/>- lightweight and<br/>- high performance<br/>interface between LabVIEW™ and EPICS.<br/>
**This interface uses**<br/>- proven EPICS BASE libraries (V7),<br/>- a CA Lab interface library<br/>- and polymorphic VIs<br/>
to access EPICS variables.

**Creating, reading and writing EPICS variables** is very simple now. Also, **user events** for EPICS variables can be implemented easily.
EPICS time stamp, status, severity, and optional PV fields (properties) are bound into a resulting data cluster. You avoid inconsistent data sets.
It's easy to create an executable of your VI.

**CA Lab works with Windows® and Linux.**<br/>
This interface requires only LabVIEW™.

To use this interface, it's <span style="text-decoration: underline">not</span> necessary to create any LabVIEW™ project nor to use external services. CA Lab can be used directly.

CA Lab is **open source** and works with all LabVIEW™ versions from 7.0 up to the current version (32bit/64bit).
It has been tested under Windows 7®, Windows 10® (Build 18363.836), and Ubuntu®20.04.

<img src="https://www.helmholtz-berlin.de/media/media/angebote/it/experimentsteuerung/ca-lab/calabinterface.png"
alt="schema of CA Lab interface"><br/>^schema of CA Lab interface^

Any VI can use caLabGet.vi to read or caLabPut.vi to write EPICS variables.
Use caLabEvent.vi to create user events for any EPICS variables.
Call CaLabInfo.vi to get context information of the CA Lab library.
In Windows®, you can use CaLabSoftIOC.vi to create new EPICS variables and start them. In Linux, you can use the native soft IOC to do that. It comes with the CA Lab package.

These CA Lab VIs call the interface library 'caLab', which uses EPICS base libraries 'ca' and 'Com' to provide Channel Access functions.

CA Lab library builds an internal PV cache and monitors PVs to improve the read and write access and reduce network traffic. Optional, you can disable caching.

<a href="https://www.helmholtz-berlin.de/zentrum/locations/it/software/exsteuer/calab/index_en.html">🔗more info and examples</a>
92 changes: 92 additions & 0 deletions ReadMeFirst.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
######################################################################
### CA Lab ReadMe for Windows� OS
######################################################################

----------------------------------------------------------------------
--- 1. General information
----------------------------------------------------------------------

In some cases it's necessary to restart computer because environment
variables have been changed by setup.
Please read chapter 3.1 if there are any warnings for environment variables.

Please check whether the specific user has full access to folder and files
of CA Lab before first run. You find the CA Lab folder in user.lib of
your LabVIEW� installation.

At first run of any caLab-VI some warnings will appear because there is a
new context. Please save changes therewith warnings won't appear again.
A better way is described in chapter 2 (mass compiling VIs).

Errors will occur if CA Lab has not been installed to standard path of LabVIEW�.
The reason is the wrong path for installed libraries.
Read chapter 3.2 to solve the problem with needed libraries for several VIs.

If setup created a start menu shortcut for CA Lab then it will appear as a
sub-entry of National Instruments. This sub-entry contains "CA Lab project"
which directs to installed VIs.

----------------------------------------------------------------------
--- 2. First using of CA Lab
----------------------------------------------------------------------

Mass compiling VIs
1. Select Tools->Advanced->Mass Compile
2. Choose CA Lab directory in your\Path\to\LabVIEW\user.lib\caLab
and click the "Select" button
3. Click the "Mass Compile" button
4. Finish with "Done" button

Start your first test, by choosing "startDemo" from Start:
Programs->National Instruments->caLab->"start Demo"
This will do following:
1. Start a demo IOC Shell with prepared test variables
2. Write random values to those variables
3. Monitors those variables
4. Shows currently used EPICS context

----------------------------------------------------------------------
--- 3. Solved problems
----------------------------------------------------------------------

--- 3.1 Environment variables for CA Lab

Environment variables need to be set for EPICS applications.
Please read this document:
http://www.aps.anl.gov/epics/base/R3-14/1-docs/CAref.html
Setup tries to configure "CATOOLS".
Setup will not overwrite existing variables.
If any variable exists a warning will appear. In this case you should check
CATOOLS consists a path to library folder of ca Lab. This should contain
ca.dll, caLab.dll and com.dll.
e.g. "C:\Program Files\National Instruments\LabVIEW 2012\user.lib\caLab\lib".
It's also necessary to extend the environment variable PATH with %CATOOLS%.



--- 3.2 Problems to execute VIs

All provided VIs depend on correct set absolute path to "caLab.dll", "ca.dll"
and "com.dll". This libraries are in subfolder "lib". You can navigate from
Start->Programs->National Instruments->caLab->"CA Lab project" to file "path.txt"
to get the right path.
This file contains the needed path for "CaLabGet.vi", "CaLabPut.vi", ...

--- 3.3 Problems to create an executable with the Application Builder

If you have problems to create a working executable with the Application Builder
change target folder from user.lib to another target (sometimes only root works).
Following libraries and services are needed by CA Lab: caLab.dll, caLabIoc.dll, ca.dll, Com.dll,
caRepeater.exe, msvcp100.dll (windows\system32), msvcr100.dll (windows\system32),
vcruntime140.dll (windows\system32), msvcp140.dll (windows\system32).
Environment variable PATH needs to be set to this files.
If you have problems with dependencies you should install CA Lab at target computer.

--- 3.4 Problems after installing new CA Lab version

If you upgrade existing VIs with CA Lab please exchange:
caLabGetxx.vi -> caLabGet.vi
caLabPutxx.vi -> caLabPut.vi
and click right on greyed out CA Lab VIs and use "Relink to SubVI"
to update type of Polymorphic VI.
Watch out! LabVIEW� may result in a misalignment of connectors!!
98 changes: 98 additions & 0 deletions buildCaLabAtUbuntu.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
#################################################
## How to build and install CA Lab at Ubuntu ##
#################################################

## This manual has been updated on 27/Feb/2018

## Testsystem
# Ubuntu 16.04 (64 bit)
# LabVIEW 2017 (32 or 64 bit) installed in /usr/local/natinst/

## Install EPICS Base
######################
sudo apt-get install g++
sudo mkdir /usr/local/epics
sudo chown owner:group /usr/local/epics/
cd ~/Downloads
wget https://epics.anl.gov/download/base/baseR3.14.12.7.tar.gz
tar -C /usr/local/epics/ -zxvf baseR3.14.12.7.tar.gz
cd /usr/local/epics/base-3.14.12.7/
wget https://epics.anl.gov/base/R3-14/12-docs/fix-1747091.patch
patch -p0 < ./fix-1747091.patch

# If you use LabVIEW 64 bit
sudo apt-get install libreadline6 libreadline6-dev
cd /usr/local/epics/base-3.14.12.7/
export EPICS_HOST_ARCH=linux-x86_64
make > make.log 2>&1

# If you use LabVIEW 32 bit
sudo apt-get install libc6-dev-i386
sudo apt-get install g++-multilib
nano /usr/local/epics/base-3.14.12.7/configure/os/CONFIG_SITE.Common.linux-x86 and comment out the line where it sets COMMANDLINE_LIBRARY = READLINE
cd /usr/local/epics/base-3.14.12.7/
export EPICS_HOST_ARCH=linux-x86
make > make.log 2>&1

## Install CA Lab
##################
sudo mkdir /usr/local/calab
sudo chown owner:group /usr/local/calab
cd ~/Downloads
wget http://www.helmholtz-berlin.de/media/media/angebote/it/software/experimentsteuerung/ca-lab/caLab_1608.zip
unzip caLab_1608.zip -d /usr/local/calab/
cd /usr/local/calab/

# If you use LabVIEW 64 bit
g++ -fPIC -std=c++0x -I/usr/local/epics/base-3.14.12.7/include -I/usr/local/epics/base-3.14.12.7/include/os/Linux -I/usr/local/natinst/LabVIEW-2017-64/cintools -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"caLab.d" -MT"caLab.d" -o "caLab.o" "/usr/local/calab/src/calab.cpp"
g++ -fPIC -L/usr/local/natinst/LabVIEW-2015-64/cintools -shared -o "libcalab.so" ./caLab.o

# If you use LabVIEW 32 bit
g++ -m32 -std=c++0x -I/usr/local/epics/base-3.14.12.7/include -I/usr/local/epics/base-3.14.12.7/include/os/Linux -I/usr/local/natinst/LabVIEW-2017/cintools -O0 -g3 -Wall -c -fmessage-length=0 -MMD -MP -MF"caLab.d" -MT"caLab.d" -o "caLab.o" "/usr/local/calab/src/calab.cpp"
g++ -m32 -L/usr/local/natinst/LabVIEW-2015/cintools -shared -o "libcalab.so" ./caLab.o

## CONFIG SYSTEM
#################
cd /etc/ld.so.conf.d

# If you use LabVIEW 64 bit
sudo nano epics.conf => /usr/local/epics/base-3.14.12.7/lib/linux-x86_64/
sudo nano calab.conf => /usr/local/natinst/LabVIEW-2017-64/cintools/
=> /usr/local/calab/

# If you use LabVIEW 32 bit
sudo nano epics.conf => /usr/local/epics/base-3.14.12.7/lib/linux-x86/
sudo nano calab.conf => /usr/local/natinst/LabVIEW-2017/cintools/
=> /usr/local/calab/

sudo ldconfig
restart computer

## LAST ADAPTATIONS
####################
set enviroment variables EPICS_CA_ADDR_LIST and EPICS_CA_AUTO_ADDR_LIST
optional set enviroment variables CALAB_NODBG and CALAB_POLLING
start Soft IOC shell: /usr/local/epics/base-3.14.12.7/bin/linux-x86_64/softIoc -D /usr/local/epics/base-3.14.12.7/dbd/softIoc.dbd -d /usr/local/calab/demo/db/demo.db
start labVIEW
open '/usr/local/calab/VIs/Private/CaLabGet_Main.vi'
set VI properties (Strg+I) "Category Protection" to "Unlocked"
edit 'Library name or path' of 'Call Library Function Nodes' (double click on it) => change entry to '/usr/local/calab/libcalab.so'
optinal set VI properties (Strg+I) "Category Protection" to "Locked"
repeat these steps with
'/usr/local/calab/VIs/Private/CaLabGet_Main_Initialized.vi'
'/usr/local/calab/VIs/Private/CaLabPut_Main.vi'
'/usr/local/calab/VIs/Private/CaLabPut_Main_Initialized.vi'
'/usr/local/calab/VIs/CaLabEvent_PV.vi'
'/usr/local/calab/VIs/CaLabEvent_PV-1D.vi'
'/usr/local/calab/VIs/CaLabDisconnect_PV.vi'
'/usr/local/calab/VIs/CaLabDisconnect-1D_PV.vi'
'/usr/local/calab/VIs/CaLabInit.vi'
all demo VIs (except SoftIoc*.vi) should be able to run


## Start Demo Soft IOC
#######################
/usr/local/epics/base-3.14.12.7/bin/linux-x86_64/softIoc -D /usr/local/epics/base-3.14.12.7/dbd/softIoc.dbd -d /usr/local/calab/demo/db/demo.db


Enjoy CA Lab!
Loading

0 comments on commit a103b99

Please sign in to comment.