Bug in DataFWrite

More
1 month 2 weeks ago #11 by parth
Bug in DataFWrite was created by parth
Hello Everyone, 

I have found a bug in the DataFWrite object. This DataFWrite object writes all the attributes and their value of an object into a file.
But seems like there is a bug where it is writing some garbage value for Actual Value in the file.
I have attached some images to show this bug more clearly
You can see that it writes some garbage value for the file Actual Value. And the Actual Value is 300 shown in the graph.
Can somebody please help me solve this bug?

Thanks.
Attachments:

Please Log in or Create an account to join the conversation.

More
1 month 2 weeks ago #13 by claes
Replied by claes on topic Bug in DataFWrite
Hi parth,

The actual value of signal object are gathered in specific area objects to ensure thread safety and optimize the IO handling. The ActualValue attribute contains a pointer to a specific offset in an area object, and handling of pointer attributes is not implemented in DataFWrite and DataFRead.

/Claes
The following user(s) said Thank You: parth

Please Log in or Create an account to join the conversation.

More
1 month 2 weeks ago #17 by parth
Replied by parth on topic Bug in DataFWrite
Hi claes,

Thank you for the reply.
Is there any way I can write Actual Value in a file using DataFWrite class or any other class?

Thanks

Please Log in or Create an account to join the conversation.

More
1 month 1 week ago #22 by claes
Replied by claes on topic Bug in DataFWrite
Hi parti,

One way is to use a CArithm. Connect a GetAv the A1 input of the CArithm and insert some code like this

if (d1) {
FILE *fp;

fp = fopen(”/tmp/av.txt”, ”w”);
fprintf(fp, ”Actual value: %5.2f\n”, A1);
fclose(fp);
}

Read with code below and connect the OA1 output to a CStoAv

if (d1) {
pwr_tFloat32 val;
FILE *fp;
fopen("/tmp/av.txt", "r");
fscanf(fp, "%f", &val);
fclose(fp);
OA1 = val;
}

You might have to include stdio.h in $pwrp_inc/ra_plc_user.h with
#include <stdio.h>

/Claes
The following user(s) said Thank You: Automate, parth

Please Log in or Create an account to join the conversation.

Time to create page: 0.406 seconds
Powered by Kunena Forum