FORUM CTRLX AUTOMATION
ctrlX World Partner Apps for ctrlX AUTOMATION
Dear Community User! We are updating our platform to a new
system.
Read more: Important
information on the platform change.
09-19-2022 02:11 PM
A customer is currently working with arrays in the datalayer. In particular he tested ardouble, arint and arstring. He noticed two things:
1. ardouble rounds down the values, which are entered in the datalayer, so that no decimal places arrive in the C++ program (arint works, as far as I could judge, without problems). He looked at the buffer data (data.m_value.buffer.buffer) in the Variant object and could already see there that the double value is only entered rounded into the buffer:
In the upper image, the double values read byte by byte result in 1 and 2, although the values 1.1 and 2.2 were entered in the datalayer.
If the Variant object is created directly with double values, these are also stored correctly in the buffer:
A good way to check the conversion is to use an IEEE double converter: e.g. https://www.binaryconvert.com/result_double.html?decimal=049046049 and a calculator that can convert decimal values to hex values.
2. Arstring still adds quotes before and after the string. Also this behavior occurs only if the data comes from the datalayer:
Without datalayer:
With datalayer:
3. Furthermore he noticed that if a variable is registered (provider->registerNode) and written directly afterwards, the writeSync method returns DL_INVALID_ADDRESS. If you wait a bit after registering (e.g. with this_thread::sleep_for(100ms)), this error does not occur.
Our assumption is that the register method is executed asynchronously in the background and the write method is called before the datalayer has finished registering the node.
Can the registering of the node be executed synchronously to avoid this behavior and if so, how or what are the alternative ways to fix the problem?
Solved! Go to Solution.
09-20-2022 11:28 AM - edited 09-20-2022 02:53 PM
Hello redford,
thanks for reporting these issues.
std::this_thread::sleep_for(std::chrono::milliseconds(1000));
Best regards,
Nick