Online Forums
Technical support is provided through Support Forums below. Anybody can view them; you need to Register/Login to our site (see links in upper right corner) in order to Post questions. You do not have to be a licensed user of our product.
Please read Rules for forum posts before reporting your issue or asking a question. OPC Labs team is actively monitoring the forums, and replies as soon as possible. Various technical information can also be found in our Knowledge Base. For your convenience, we have also assembled a Frequently Asked Questions page.
Do not use the Contact page for technical issues.
Reading an array of floating point numbers?
I would expect the server to react the way I described, i.e. provide the array with the same number of element as it has bytes, except that each element will be a float instead. I think this is also the way that is compliant with the OPC specification. A specific server, however, may behave differently, that is outside of our control.
Please Log in or Create an account to join the conversation.
Please Log in or Create an account to join the conversation.
You could specify VarType.Array | VarType.R4 as the requested data type, but that would mean to return *each* member of the array as R4 - clearly, not what you want.
Best regards
Please Log in or Create an account to join the conversation.
Yes, in fact I am using the BitConverter.ToSingle() method to perform the conversion.
I posted this question to inquire if there was a way to call the SubscribeItem() method with a VarType argument that combines ARRAY and R4 so that my code wouldn't need to do the conversion.
But, since you so kindly informed me that there isn't, I will leave my code as is.
Please Log in or Create an account to join the conversation.
Provided that you have four bytes that represent a Single in the same way as .NET does (IEEE 754 format I believe), you can use BitConverter.ToSingle ( msdn.microsoft.com/en-us/library/system.bitconverter.tosingle(v=vs.110).aspx ) to achieve what you want, quite easily.
Best regards
Please Log in or Create an account to join the conversation.
Is there a way to configure the system so it knows to return an array of a specific data type other than BYTE? For example, instead of needing to convert the 4 bytes into a Single, is there a way to tell the system to give me an array of 512 singles?
Please Log in or Create an account to join the conversation.