cafe-1.21.0

This commit is contained in:
2024-07-04 15:24:20 +02:00
parent 19d636477f
commit 45e08c4b20
10 changed files with 1113 additions and 236 deletions
+3 -1
View File
@@ -1,8 +1,10 @@
makefile-
scripts-
*~
*.bak
*.*-
RHEL7-x86_64
RHEL8-x86_6
RHEL8-x86_64
SL6-x86_64
windows-x64
felix-cache
+34 -4
View File
@@ -1,19 +1,49 @@
## --------------------------------------------------------------------------
## makefile
##
make: installs mocha mex file and associated shared object file locally
into $OBJ_DIR=${EPICS_HOST_ARCH}/$(MATLAB_VERSION)
make install: installs mocha mex file and associated shared object file
into INSTALL_PATH?=$(INSTALL_MOCHA_LIBDIR) where:
INSTALL_MOCHA_LIBDIR= $(CAFE_BASE)/mocha/$(MOCHA_VERSION)/lib/${EPICS_HOST_ARCH}/$(MATLAB_VERSION)
make clean:
rm $(OBJ_DIR)/*.o $(OBJ_DIR)/*.so $(OBJ_DIR)/*.$(MEXE)
## --------------------------------------------------------------------------
#RHEL8
module load gcc/10.4.0
module load matlab/<version>
#Before compiling, update version number in macchinettaSwitch.cpp
#Find the following line and change version/date
#plhs[0]=mxCreateString((char *) "mocha-1.20.1 : 7 May 2024");
make -f makefile_rel_1.20-gcc-10.4.0
# installs mex file locally
# RHEL8-x86_64/><version>
make -f makefile_rel_1.20-gcc-10.4.0 install
# installs mex file centrally to
/opt/gfa/cafe/mocha/mocha-1.20.1-gcc-10.4.0/lib/RHEL8-x86_64/<version>
#Create AIT module instance
cd /opt/psi/Cafe/cafe-matlab
mdkir 2023a-RHEL8-gcc-10.4.0-cafe-1.20.1
cd 2023a-RHEL8-gcc-10.4.0-cafe-1.20.1
mkdir libexec
cd libexec
cp /opt/gfa/cafe/mocha/mocha-1.20.1-gcc-10.4.0/lib/RHEL8-x86_64/2023a/* .
#Declare new module, e.g., <new_matlab_version>
cd /opt/psi/Cafe/modulefiles/cafe-matlab
cp 2024a <new_matlab_version>
#in new module,
module load matlab/<new_matlab_version>
cp .release-2024a .release-<new_matlab_version>
Binary file not shown.
Binary file not shown.
+1 -1
View File
@@ -501,7 +501,7 @@ void macchinettaFunction(int nlhs, mxArray *plhs[], int nrhs, const mxArray *prh
break;
case MOCHA_VERSION:
plhs[0]=mxCreateString((char *) "mocha-1.19.2 : 28 September 2023");
plhs[0]=mxCreateString((char *) "mocha-1.20.1 : 7 May 2024");
break;
case SHOW:
-104
View File
@@ -1,104 +0,0 @@
#
# Jan Chrin
# Version: July 2019 - Qt5
#
# makefile to build mocha mex file
# printenv | grep MATLAB to reveal your MATLAB Directory
#
#
# local executables are built in ./${EPICS_HOST_ARCH}/$(MVER)
# where the MATLAB version is grepped from $(MATLAB)
MATLAB_ROOT=${MATLAB}
MATLAB_VERSION=$(notdir $(MATLAB_ROOT))
##### CHANGE AS APPROPRIATE #################
#Mocha Version to install
MOCHA_VERSION=mocha-1.16.1-gcc-7.3.0
#CAFE version to link to
CAFE_VERSION=cafe-1.16.1-gcc-7.3.0
EPICS_BASE=${EPICS}/base-7.0.6
#CAFE project base
CAFE_BASE=/opt/gfa/cafe
CAFE_MOCHA_BASE=${CAFE_BASE}/mocha
CAFE_CPP_BASE=$(CAFE_BASE)/cpp/$(CAFE_VERSION)
BOOST_BASE=${CAFE_BASE}/boost/boost_1_61_0/include
CAFE_OBJS_DIR = $(CAFE_BASE)/cpp/$(CAFE_VERSION)/lib/$(EPICS_HOST_ARCH)/libcafe.a
#if qt5 has libQt5Core.so link
#QT5_DIR= /opt/psi/Cafe/cafe-matlab/${MATLAB_VERSION}/libexec
QT5_DIR= ${MATLAB_ROOT}/bin/glnxa64
INSTALL_MOCHA_LIBDIR= $(CAFE_MOCHA_BASE)/$(MOCHA_VERSION)/lib/$(EPICS_HOST_ARCH)/$(MATLAB_VERSION)
#############################################
#First deteremine if we are on a 32/64 bit machine
#as mex file extensions are named differently
pattern64=x86_64
pattern32=i386
PWD=$(shell pwd)
#hardware platform
HW=$(shell uname -i)
ifeq ($(pattern64),$(findstring $(pattern64), $(HW)))
MEXE=mexa64
MATLAB_LIB = $(MATLAB_ROOT)/bin/glnxa64
else
ifeq ($(pattern32),$(findstring $(pattern32), $(HW)))
MEXE=mexglx
MATLAB_LIB = $(MATLAB_ROOT)/bin/glnxa86
endif
endif
INSTALL_PATH?=$(INSTALL_MOCHA_LIBDIR)
OBJ_DIR= ${EPICS_HOST_ARCH}/$(MATLAB_VERSION)
INCLUDEPATH_MOCHA += -I$(MATLAB_ROOT)/extern/include \
-I$(CAFE_CPP_BASE)/include -I./ \
-I$(EPICS_BASE)/include -I$(EPICS_BASE)/include/os/Linux \
-I$(EPICS_BASE)/include/compiler/gcc
INCLUDEPATH_MACHINETTA += $(INCLUDEPATH_MOCHA) -I$(BOOST_BASE) -I$(BOOST_BASE)/boost
# linkage to qt5 required if cafe built with Qt5
#-lboost_system -lboost_thread-mt
LIBS += -ldl -lca -lCom -lmx -lmex -lmat -lQt5Core -lQt5Xml
#LIBS += -lmx -lmex -lmat
$(OBJ_DIR)/mocha.$(MEXE): mocha.cpp $(OBJ_DIR)/macchinettaSwitch.o
mex CXXFLAGS='$(CXXFLAGS) -v -largeArrayDims -ansi -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++1z' \
'LDFLAGS=-L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} -Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} -L${QT5_DIR} -Wl,-rpath,${QT5_DIR} -L$(MATLAB_LIB) -Wl,-rpath,$(MATLAB_LIB) $(LIBS)' \
mocha.cpp $(OBJ_DIR)/macchinettaSwitch.o $(CAFE_OBJS_DIR) \
-outdir $(OBJ_DIR) -output mocha.$(MEXE) \
$(INCLUDEPATH_MOCHA)
$(OBJ_DIR)/macchinettaSwitch.o: macchinettaSwitch.cpp macchinettaHelper.h \
macchinetta.h containerMochaccino.h
mex CXXFLAGS='-v -largeArrayDims -ansi -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++1z' \
-c macchinettaSwitch.cpp $(INCLUDEPATH_MACHINETTA) 'LDFLAGS=-L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} -Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} -L$(MATLAB_LIB) -Wl,-rpath,$(MATLAB_LIB) $(LIBS)' -outdir $(OBJ_DIR)
install: $(OBJ_DIR)/mocha.$(MEXE)
mkdir -p $(INSTALL_PATH)
mex CXXFLAGS='-v -largeArrayDims -ansi -fexceptions -fPIC -fno-omit-frame-pointer -pthread -std=c++1z' \
mocha.cpp $(OBJ_DIR)/macchinettaSwitch.o $(CAFE_OBJS_DIR) -outdir $(INSTALL_PATH) -output mocha.$(MEXE) $(INCLUDEPATH_MOCHA) \
'LDFLAGS=-L$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} -Wl,-rpath,$(EPICS_BASE)/lib/${EPICS_HOST_ARCH} -L$(MATLAB_LIB) -Wl,-rpath,$(MATLAB_LIB) $(LIBS)'
cp example.m $(INSTALL_PATH)
cp scripts/monitorAction.m $(INSTALL_PATH)
cp scripts/pvtable.m $(INSTALL_PATH)
cp scripts/test.xml $(INSTALL_PATH)
install_lib: $(OBJ_DIR)/libmacchinetta.so
mkdir -p $(INSTALL_PATH)
cp $(OBJ_DIR)/libmacchinetta.so $(INSTALL_PATH)
clean:
rm -f $(OBJ_DIR)/*.o $(OBJ_DIR)/*.so $(OBJ_DIR)/*.$(MEXE)
print-% : ; @echo $* = $($*)
+6 -6
View File
@@ -4,7 +4,7 @@
# This default is ONLY activated
# (1) in the absence of the relevant input argument, and
# (2) if matlab is not already pre-loaded on your system
MATLAB_DEFAULT=2016b
MATLAB_DEFAULT=2020a
# cafe-matlab.sh script to enable use of the mocha mex-file
# The script executes the command: module load cafe-matlab/<matlab-version>
@@ -15,15 +15,15 @@ MATLAB_DEFAULT=2016b
# Usage: cafe-matlab.sh -v <matlab version> -d <default matlab version> -s <true/false>
# where the input key value pairs are **optional**
# Examples of usage:
# (1) Use mocha with MATLAB version 2016b but do not start matlab [-s false is default]
# cafe-matlab.sh -v 2016b
# (2) Use mocha with MATLAB version 2016b and start matlab
# cafe-matlab.sh -v 2016b -s true
# (1) Use mocha with MATLAB version 2017b but do not start matlab [-s false is default]
# cafe-matlab.sh -v 2017b
# (2) Use mocha with MATLAB version 2020a and start matlab
# cafe-matlab.sh -v 2020a -s true
# (3) Use mocha with MATLAB version given by MATLAB_DEFAULT in script
# cafe-matlab.sh -v default -s true
# cafe-matlab.sh --usedefault [equivalent -v default -s false]
# (4) Use mocha with preloaded matlab (else if none, then that given by -d option else MATLAB_DEFAULT )
# cafe-matlab.sh -d 2016b
# cafe-matlab.sh -d 2020a
# cafe-matlab.sh --preloaded [equivalent to -v preloaded -s false]
-118
View File
@@ -1,118 +0,0 @@
function value = caget(channel,cached)
% caget('channel') returns current value and additional infos
% of given EPICS channel.
% caget('channel',1) returns last value and additional infos
% of given EPICS channel.
%
% channel can be a channel name or a handle as returned from mcaopen
%
% return value elements:
% val: value (scalar, vector or string)
% sevr: severity as a number
% sevr_str: severity as a string
% stat: status as a number
% stat_str: status as a string
% time: timestamp as a date vector
% units: units string
persistent severity_str
persistent status_str
persistent zerotime
persistent units
if ischar(channel)
pv = mocha('open',channel);
if mocha('isConnected', channel) == false
mocha('openNowAndWait', 0.5)
end
if mocha('isConnected', channel) == false
error('EPICS channel %s not found', channel);
end
elseif isnumeric(channel)
pv = channel;
else
error ('first argument must be channel name or handle');
end
if isvector(pv)
pv=pv(1); % truncate
end
chInfo=mocha ('getChannelInfo',pv);
%dt='native'
%if (chInfo.dataType=='DBR_ENUM')
% dt='int8'
%end
if nargin > 1 && cached
pvStruct = mocha('getPVCache',pv);
else
pvStruct = mocha('getPV', pv);
end
pvCtrl = mocha('getCtrlCache',pv);
%pvCtrl
% initialize severity and status enums
if isempty(severity_str)
severity_str = {'NO_ALARM';'MINOR';'MAJOR';'INVALID'};
status_str = {'NO_ALARM';'READ';'WRITE';'HIHI';'HIGH';'LOLO';'LOW';'STATE';'COS';'COMM';'TIMEOUT';'HWLIMIT';'CALC';'SCAN';'LINK';'SOFT';'BAD_SUB';'UDF';'DISABLE';'SIMM';'READ_ACCESS';'WRITE_ACCESS'};
end
value.val = pvStruct.val;
units = pvCtrl.units;
%string = pvCtrl.enumStrings;
if (pvCtrl.noEnumStrings>0)
%if size(string) > 1
%disp(size(string))
value.val_str = value.val;
value.val = mocha('getCache',pv,'int8');
end
%if ~isempty(units{1})
%value.units = units{1};
%end
value.units=units;
value.sevr = pvStruct.alarmSeverity;
indx=max(pvStruct.alarmSeverity, 0);
value.sevr_str = severity_str{indx+1};
value.stat = pvStruct.alarmStatus;
indx=max(pvStruct.alarmStatus, 0);
value.stat_str = status_str{ indx+1};
timestamp = mocha('getTimestamp',pv);
if (numel(timestamp) == 2)
% old mca version
% do not use mcatime here because 1. it is slow, 2. is returns UTC
% calculating zerotime only once is faster and takes localtime into account
% When daylight saving time begins or ends, restart the program!
if isempty(zerotime)
[status,timezone]=system('date +%z'); % get localtime offset
timeoffs=str2double(timezone);
houroffs=floor(timeoffs/100);
minoffs=(timeoffs-100*houroffs);
zerotime = datenum('1-Jan-1990') + (minoffs/60 + houroffs)/24;
end
time=timestamp(1)+timestamp(2)/1000000000;
if time
time = zerotime+time/24/3600;
end
value.time = datevec(time);
else
% new mca version
timestamp(6)=timestamp(6)+timestamp(7)/1000000000;
value.time = timestamp(1:6);
end
-1
View File
@@ -1 +0,0 @@
../example.m
+1068
View File
File diff suppressed because it is too large Load Diff
+1 -1
View File
@@ -8,4 +8,4 @@ function mcaunlock;
% loosing channel access connections.
%mca(0);
mocha('mexUnlock');
disp('mca mex-file is now UNLOCKED');
%disp('mca mex-file is now UNLOCKED');