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
94
void ModuleInit() {
/*
* create variables to be recorded
*/
MemApiInit();
MemApiAddVar(scVarNameTemp, MemApiSInt32, &sTemp, sizeof sTemp);
MemApiAddVar(scVarNamePres, MemApiReal, &sPres, sizeof sPres);
}
/
****************************************************************************/
void ModuleExit() {
ExitRecording();
MemApiRemoveVar(scVarNamePres);
MemApiRemoveVar(scVarNameTemp);
MemApiExit();
}
/
****************************************************************************/
void ModuleStart() {
/*
* now all variables are available such that profiles can be restored and
* variables can be added to profiles
*/
InitRecording();
sTemp = 0;
sPres = 0.0;
StartRecording();
}
/
****************************************************************************/
void ModuleStop() {
StopRecording();
}
Implementation of the persistence in 10 second intervals (with additional ter-
mination assessment per second):
/* libk2ctrl exports for advanced applications */
extern int CreateTask(const char *name, void (*fctAddr)(void *), void *param,
int prior, int stackSize);
extern int ResumeTask(int hdl);
/
*****************************************************************************
* static variables
*/
static int sTaskHdl;
static int sRun, sStarted, sTerminated;
/
****************************************************************************/
void LowPriorTask(void *arg) {
enum { cSaveStatePeriodSecs = 10 };
int cnt = cSaveStatePeriodSecs;
DataRecApiResult rc;
while (sRun) {
sleep(1/*secs*/);
if (--cnt == 0) {
rc = DataRecApiSaveState(sP1Id);
cnt = cSaveStatePeriodSecs;
}
}
sTerminated = 1;
}