- Posts: 27
- Thank you received: 1
Use of SigValue fails in class
1 week 22 hours ago #130
by jds
Use of SigValue fails in class was created by jds
I've got a strange issue when compiling the following:
I was extending the basesensor with the high and low limit detection following the ne43 standard to detect faulty measurements.
At first I tried the code out in a normal PLC because the develop cycle is a lot faster than going back and forth to the class editor.
The code goes as follows:
So far so good and I get the range I selected and calculate the limits (-2.5,-1.25,103.1 and 110%). All working fine.
Than I compare it with the AI.sigvalue to compare against the given input current.
This is where it goes wrong. In the PLC everything works as expected, but when doing the same in a class, the compiler gives me errors:
The first mark is probably because I already use an GetAi and the lib is defined already in the class. The second one gives me a headache.
Is there a way to get the sigvalue in the C code instead of using the GetAp because I think it has probably something to do with Sigvalue is created at runtime?
The way I try to read the sigvalue now:
I was extending the basesensor with the high and low limit detection following the ne43 standard to detect faulty measurements.
At first I tried the code out in a normal PLC because the develop cycle is a lot faster than going back and forth to the class editor.
The code goes as follows:
So far so good and I get the range I selected and calculate the limits (-2.5,-1.25,103.1 and 110%). All working fine.
Than I compare it with the AI.sigvalue to compare against the given input current.
This is where it goes wrong. In the PLC everything works as expected, but when doing the same in a class, the compiler gives me errors:
The first mark is probably because I already use an GetAi and the lib is defined already in the class. The second one gives me a headache.
Is there a way to get the sigvalue in the C code instead of using the GetAp because I think it has probably something to do with Sigvalue is created at runtime?
The way I try to read the sigvalue now:
Please Log in or Create an account to join the conversation.
1 week 12 hours ago #132
by claes
Replied by claes on topic Use of SigValue fails in class
Hi jds,
I suspect this is because you are using a GetData and a GetAp on the same Ai signal. You could solve this by setting SigValue on OA5 in the DataArithm and fetch it from there instead of from the GetAp.
/Claes
I suspect this is because you are using a GetData and a GetAp on the same Ai signal. You could solve this by setting SigValue on OA5 in the DataArithm and fetch it from there instead of from the GetAp.
/Claes
Please Log in or Create an account to join the conversation.
1 week 10 hours ago #136
by jds
Replied by jds on topic Use of SigValue fails in class
Tested it with Da1->SigValue and no more errors. Since I'm not a real C programmer it's searching for the right syntax, but I'm getting there
.
Code examples are always the best sources for me to learn.
Any reason why sensor error checking was never implemented? I've now created a class where the input signal is checked against the boundaries + an extra optional input (have to get the disable menu going) to get the status from the hardware error. Could be a nice complement to the base class
Code examples are always the best sources for me to learn.
Any reason why sensor error checking was never implemented? I've now created a class where the input signal is checked against the boundaries + an extra optional input (have to get the disable menu going) to get the status from the hardware error. Could be a nice complement to the base class
Please Log in or Create an account to join the conversation.
Time to create page: 0.377 seconds