User Documentation
Table Of Contents
- Table of contents
- 1 Introduction
- 2 Safety instructions
- 3 System overview
- 4 Operating behavior
- 5 Software installation
- 6 Configuration
- 7 Program development
- 8 Licensing
- 9 Device Administration (DevAdmin)
- 10 Software units
- 11 OPC UA Server
- 12 Node-RED
- 13 LongtermDiagnosticMonitor
- 14 Data recorder
- 15 Diagnostics
- 16 Maintenance
- 17 Technical data
- 18 Directives and standards
- 19 Appendix: Tutorial - creating an IEC project
- 20 Appendix: Addressing in the Ethernet (basics)
- 21 Appendix: Tutorial FoE
- 22 Appendix: Tutorial - call C function from IEC
- Index

Data recorder
System manual
2696790000/02/04.2020
91
static const char scProfileName[] = "TestDataRecAppP1";
static const char scVarNameTemp[] = "temperature";
static const char scVarNamePres[] = "pressure";
static const char scVarNameAct[] = "active";
/
*****************************************************************************
* static variables
*/
static int32_t sTemp;
static float sPres;
static int8_t sActive;
static DataRecApiProfileId sP1Id;
static DataRecApiVarId sTempId;
static DataRecApiVarId sPresId;
/
****************************************************************************/
void ModuleInit() {
DataRecApiInfo info;
DataRecApiTrigger trig;
DataRecApiResult rc;
char varPath[80];
LogApiAddId(traceid, "TestRec");
LogApiTrace(traceid, "TestDataRecApp initialized");
MemApiInit();
MemApiAddVar(scVarNameTemp, MemApiSInt32, &sTemp, sizeof sTemp);
MemApiAddVar(scVarNamePres, MemApiReal, &sPres, sizeof sPres);
MemApiAddVar(scVarNameAct, MemApiBool, &sActive, sizeof sActive);
sTemp = 0;
sPres = 0.0;
sActive = cFALSE;
strcpy(info.name, scProfileName);
info.size = 1000; /* space for 1000 samples */
info.maxVarCnt = 5; /* max. 5 variables per sample */
info.bufType = DataRecApiBufTypeContinuous; /* ring buffer type */
info.level = DataRecApiLevelApplRt; /* (unsupported yet) */
info.autoStart = 0; /* application start recording */
rc = DataRecApiCreateProfile(&info, &sP1Id);
ReturnIfNot(rc == DataRecApiResultOk && sP1Id != DataRecApiNoId);
snprintf(varPath, sizeof varPath, "APPL.MEM.%s", scVarNameTemp);
rc = DataRecApiAddVar(sP1Id, varPath, 0, &sTempId);
ReturnIfNot(rc == DataRecApiResultOk && sTempId != DataRecApiNoId);
snprintf(varPath, sizeof varPath, "APPL.MEM.%s", scVarNamePres);
rc = DataRecApiAddVar(sP1Id, varPath, 0, &sPresId);
ReturnIfNot(rc == DataRecApiResultOk && sPresId != DataRecApiNoId);
memset(&trig, 0, sizeof trig);
snprintf(varPath, sizeof varPath, "APPL.MEM.%s", scVarNameAct);
trig.startCond.op = DataRecApiTriggerOpPosSlope;
trig.startCond.val.valBOOL = cFALSE;
strncpy(trig.startCond.var, varPath, sizeof trig.startCond.var - 1);
trig.stopCond.op = DataRecApiTriggerOpNegSlope;
trig.stopCond.val.valBOOL = cTRUE;
strncpy(trig.stopCond.var, varPath, sizeof trig.stopCond.var - 1);
rc = DataRecApiSetTrigger(sP1Id, &trig);
ReturnIfNot(rc == DataRecApiResultOk);
}
/
****************************************************************************/
void ModuleExit() {
MemApiRemoveVar(scVarNameAct);
MemApiRemoveVar(scVarNamePres);