Industry Automation and Control Forum
This forum is addressing industrial automation design & engineering, operations, asset performance, cyber security and digital transformation for Plants & Machines.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-08-15 08:47 AM
Hi all,
I'm a LabVIEW programmer and one of the elegant things you can do is use a variant data class to pass a cluster of objects of different data types. The beauty of this is it acts like Object Orientated Programming and allows you to pass any data with a message, so at the other end of the comms the data knows where to go, it's data type for conversion, and what to do with the data.
So for instance, I can pass a message that says 'Log Event Data' with a cluster of data that includes say a Boolean array, a numeric, and a string which all get thrown into the variant object. On the other end the message dictates what the main function is and the cluster information is used to 'unpack' the data which then gets fed into another function, in this case logging event data and uses the data to determine the file write.
I want to know if something similar can be designed in Machine Expert? I've seen some code whereby a new variable is created and seems to contain an arbitrary amount of attributes which seems similar to a cluster, so for example if the main variable (the cluster name in the LabVIEW environment) is called Log Data, the entire variable looks something like: Log Data (Status, Bool; Message, String; Count, INT;)
Obviously the above is wrong, I know that, but does the principle of creating such a variable exist and if so, what does the specific syntax look like?
Many thanks in advance,
Mitch.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-08-19 02:46 PM
If you use Machine Expert (not Machine Expert Basic, and not Machine Expert HVAC) the software support object orient programming. If you want to use different datattypes in one variable you could creat a structure.
Link copied. Please paste this link to share this article on your social media post.
Link copied. Please paste this link to share this article on your social media post.
Posted: 2024-08-22 02:12 AM
Hi @Bastian_Schmitz,
Could you provide clarification on what the variable structure/syntax would look like?
Cheers
Mitch
Link copied. Please paste this link to share this article on your social media post.
Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.