11 Commits
1.4.0 ... 2.0.3

6 changed files with 49 additions and 60 deletions

View File

@@ -2,12 +2,12 @@
record(waveform,"$(P)DAQ-${Name}-DataAct"){
info(asyn:FIFO, "1000")
field(DESC, "Data")
field(PINI, "1")
field(DTYP, "asynFloat64ArrayIn")
field(INP, "@asyn(${PORT},$(ADDR=0),$(TIMEOUT=1000))plugin.daq.${Name}.data")
field(FTVL, "DOUBLE")
field(NELM, "${NELM}")
field(SCAN, "I/O Intr")
field(FLNK, "${FLNK=''}")
field(TSE, "0")
}

View File

@@ -2,11 +2,13 @@ include /ioc/tools/driver.makefile
MODULE = ecmc_plugin_daq
BUILDCLASSES = Linux
ARCH_FILTER = deb10%
# "Transfer" module name to plugin
USR_CFLAGS +=-DECMC_PLUGIN_MODULE_NAME=${MODULE}
# Run 7.0.6 for now
EXCLUDE_VERSIONS+=3 7.0.5 7.0.6
BUILDCLASSES = Linux
ARCH_FILTER = deb10% deb12%
EXCLUDE_VERSIONS+=3 7.0.5 7.0.6 7.0.7 7.0.9
IGNORE_MODULES += asynMotor
IGNORE_MODULES += motorBase
@@ -15,8 +17,26 @@ USR_CXXFLAGS += -std=c++17
OPT_CXXFLAGS_YES = -O3
# dependencies
ECmasterECMC_VERSION = v1.1.0
ecmc_VERSION = 9.5.0
ecmc_VERSION = 10.0
# ethercat
# debian 12
EC_MASTER_VER = 1.6.3
EC_BASE_PATH = /ioc/NeedfulThings/EtherCAT/4epics/${EC_MASTER_VER}/
USR_CXXFLAGS_deb12-x86_64 += -I${EC_BASE_PATH}${T_A}/include/
USR_CXXFLAGS_deb12-x86_64 += -L${EC_BASE_PATH}${T_A}/lib/
LIB_SYS_LIBS += ethercat
USR_LDFLAGS_deb12-x86_64 += -Wl,-rpath=${EC_BASE_PATH}${T_A}/lib/
USR_LDFLAGS_deb12-x86_64 += -L ${EC_BASE_PATH}${T_A}/lib/
# debian 10
# note: EC_MASTER LIB does not depend on epics version hence use the 7.0.8 build..
USR_LDFLAGS_deb10-x86_64 += -lethercat
EC_MASTER_LIB = /ioc/NeedfulThings/EtherCAT/4epics/v1.1.0/R7.0.8/
USR_LDFLAGS_deb10-x86_64 += -Wl,-rpath=${EC_MASTER_LIB}lib/${T_A}
USR_LDFLAGS_deb10-x86_64 += -L ${EC_MASTER_LIB}lib/${T_A}
USR_CXXFLAGS_deb10-x86_64 += -I${EC_MASTER_LIB}/include/
BASE_DIR = .
SRC_DIR = $(BASE_DIR)/src

View File

@@ -82,7 +82,7 @@ ${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddDataItem.cmd, "PARAM=ec0.s7.ti
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddDataItem.cmd, "PARAM=ec0.s7.timestamp01, FORMAT=1"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQAddDataItem.cmd, "PARAM=ec0.s7.mm.analogInputArray01"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQFinalizeArray.cmd "NAME=${NAME}"
${SCRIPTEXEC} ${ecmc_plugin_daq_DIR}ecmcDAQFinalizeArray.cmd "NAME=${NAME},DATA_FLNK=''"
#- To check result use camon -t c6025a:DAQ-ToEdwin-DataAct

View File

@@ -11,8 +11,9 @@
#-###############################################################################
#-
#- Arguments
#- NAME : Name of DAQ array
#-
#- NAME : Name of DAQ array
#- DATA_FLNK : Forward link from data array (optional, default to '')
#-
#-################################################################################
#- Connect to sources in order to know NELM.. Data sources must be known before added with the scripts..
@@ -24,7 +25,7 @@ ecmcIf("${DAQ_NELM=-1}<0")
${IF_TRUE}ecmcExit : Failed read DAQ array NELM
ecmcEndIf()
dbLoadRecords(ecmcPluginDAQ.template,"P=${ECMC_PREFIX},Name=${NAME},NELM=${DAQ_NELM},PORT=ECMC.PLUGIN.DAQ.${NAME}")
dbLoadRecords(ecmcPluginDAQ.template,"P=${ECMC_PREFIX},Name=${NAME},NELM=${DAQ_NELM},PORT=ECMC.PLUGIN.DAQ.${NAME},FLNK=${DATA_FLNK=''}")
epicsEnvUnset(DAQ_NELM)
epicsEnvUnset(ECMC_DAQ_CURR_CH)
epicsEnvUnset(ECMC_DAQ_CURR_ITM)

View File

@@ -32,11 +32,11 @@ static char* lastConfStr = NULL;
static int alreadyLoaded = 0;
/** Optional.
* Will be called once after successfull load into ecmc.
* Will be called once after successful load into ecmc.
* Return value other than 0 will be considered error.
* configStr can be used for configuration parameters.
**/
int daqConstruct(char *configStr)
static int daqConstruct(char *configStr)
{
if(alreadyLoaded) {
printf("Error: Plugin ecmc_plugin_daq already loaded and can only be loaded once.");
@@ -51,7 +51,7 @@ int daqConstruct(char *configStr)
/** Optional function.
* Will be called once at unload.
**/
void daqDestruct(void)
static void daqDestruct(void)
{
// Segfaults here during destruction?! need to check..
//deleteAllDAQs();
@@ -61,19 +61,19 @@ void daqDestruct(void)
}
/** Optional function.
* Will be called each realtime cycle if definded
* ecmcError: Error code of ecmc. Makes it posible for
* Will be called each realtime cycle if defined
* ecmcError: Error code of ecmc. Makes it possible for
* this plugin to react on ecmc errors
* Return value other than 0 will be considered to be an error code in ecmc.
**/
int daqRealtime(int ecmcError)
static int daqRealtime(int ecmcError)
{
lastEcmcError = ecmcError;
return executeDAQs();
}
int daqEnterRT(){
static int daqEnterRT(){
return validateDAQs(); //linkDataToDAQs();
}
@@ -81,31 +81,16 @@ int daqEnterRT(){
* Will be called once just before leaving realtime mode
* Return value other than 0 will be considered error.
**/
int daqExitRT(void){
static int daqExitRT(void){
return 0;
}
// // Plc function for clear of buffers
// double daq_clear(double index) {
// return (double)clearDAQ((int)index);
// }
// Plc function for enable
//double daq_enable(double index, double enable) {
// return 0; //(double)enableDAQ((int)index, (int)enable);
//}
// // Plc function for trigg new measurement (will clear buffers)
// double daq_trigg(double index) {
// return (double)triggDAQ((int)index);
// }
// Register data for plugin so ecmc know what to use
struct ecmcPluginData pluginDataDef = {
static struct ecmcPluginData pluginDataDef = {
// Allways use ECMC_PLUG_VERSION_MAGIC
.ifVersion = ECMC_PLUG_VERSION_MAGIC,
// Name
.name = "ecmcPlugin_DAQ",
.name = "ecmc_plugin_daq",
// Description
.desc = "DAQ plugin for use with ecmc.",
// Option description
@@ -124,28 +109,6 @@ struct ecmcPluginData pluginDataDef = {
.realtimeExitFnc = daqExitRT,
// PLC funcs
.funcs[0] = {0},
// { /*----fft_clear----*/
// // Function name (this is the name you use in ecmc plc-code)
// .funcName = "daq_enable",
// // Function description
// .funcDesc = "daq_enable(index,enable) : Enable/disaable daq[index].",
// /**
// * 12 different prototypes allowed (only doubles since reg in plc).
// * Only funcArg${argCount} func shall be assigned the rest set to NULL.
// **/
// .funcArg0 = NULL,
// .funcArg1 = NULL,
// .funcArg2 = daq_enable,
// .funcArg3 = NULL,
// .funcArg4 = NULL,
// .funcArg5 = NULL,
// .funcArg6 = NULL,
// .funcArg7 = NULL,
// .funcArg8 = NULL,
// .funcArg9 = NULL,
// .funcArg10 = NULL,
// .funcGenericObj = NULL,
// },
.consts[0] = {0}, // last element set all to zero..
};

View File

@@ -10,10 +10,15 @@
#-###############################################################################
#-
#- Arguments
#- PLUGIN_ID : Id of plugin to load (mandatory)
#- PLUGIN_ID : Id of plugin to load (optional)
#-
#################################################################################
#- Load plugin:
epicsEnvSet(ECMC_PLUGIN_FILNAME,"$(ecmc_plugin_daq_DIR)lib/${EPICS_HOST_ARCH=linux-x86_64}/libecmc_plugin_daq.so")
${SCRIPTEXEC} ${ecmccfg_DIR}loadPlugin.cmd, "PLUGIN_ID=${PLUGIN_ID}, FILE='${ECMC_PLUGIN_FILNAME}' , CONFIG='NOT USED',REPORT=1"
ecmcIf("${PLUGIN_ID=-1}=-1")
${IF_TRUE}${SCRIPTEXEC} ${ecmccfg_DIR}loadPlugin.cmd, "FILE='${ECMC_PLUGIN_FILNAME}' , CONFIG='NOT USED',REPORT=1"
#else
${IF_FALSE}${SCRIPTEXEC} ${ecmccfg_DIR}loadPlugin.cmd, "PLUGIN_ID=${PLUGIN_ID}, FILE='${ECMC_PLUGIN_FILNAME}' , CONFIG='NOT USED',REPORT=1"
ecmcEndIf()