Hi everyone,
I want to create a log file in csv format. A time stamp and 18 analog values per line should be saved for this.
If I used the normal A1 .. A6 it works too. But I can't find the right function for ApCollect with up to 24 analog values.
I'm looking for the right approach to copy the individual ApCollect data (Ap [0], .., Ap [x]) to double or char variables in a DataArithm module.
For string variables I found the variant with the gdh_TranslateRtdbPointer and thought to myself that this should also work with the analog values. But it doesn't for me.
classdef Da1 Sv;
classdef Da2 Sv;
classdef Da3 ApCollect;
char *filename = (char *) gdh_TranslateRtdbPointer((unsigned long)Da1->ActualValue);
char *filepathnameValues = (char *) gdh_TranslateRtdbPointer((unsigned long)Da2->ActualValue);
/* float *act_IN_V_fl = (float *) gdh_TranslateRtdbPointer((unsigned long)Da3->Ap[0] ); */
double *act_IN_V_fl = (double *) gdh_TranslateRtdbPointer((unsigned long)Da3->Ap[0] );
char cmd[200];
char msgValues[200];
char msg[] = "'Datum_Uhrzeit;act_IN_V;act_IN_A;act_IN_S7_V;Sig_OUT_V;Sig_OUT_Min;Sig_OUT_Max'";
char filepath[] = "/home/pwrp/log/";
char filepathname[80];
char act_IN_V[10];
char act_IN_A[10];
char act_IN_S7_V[10];
char Sig_OUT_V[10];
char Sig_OUT_Min[10];
char Sig_OUT_Max[10];
snprintf( act_IN_V , sizeof( act_IN_V ) , "%.2f", act_IN_V_fl );
With the function snprintf the analog value is to be written into the variable 'act_IN_V'.
Thank's a lot
/Wolfgang