Jump to content

Cluster Version control Design question


Recommended Posts

Hi All,

I have an application where I store the data in a cluster. Suppose this is my ver. 1 of the application and the cluster consists of 3 I32. and I ship this application to the customer.

 

Now for the ver 2 I want to store a string to the cluster so I updated my cluster to 3 I32 and 1 String. But this ver 2 should also be able to read ver 1. just like MS Word 2007 is able to read .doc files

 

In my design, I am stroing the version number and data(as variant) in a cluster and convert that cluster to variant and do a 'variant to flattened string' before saving it to a file.

 

I am attaching my desing protoype here so you get a better idea of what I am talking about and suggest me if you think it can be done in a better way.

 

 

Thanks,

Ritesh 

ClusterVersionControl_Design.vi

Link to post
Share on other sites

Ah, the "versioning data for preservation or communication with older clients" problem. You are not the only one to encounter this. 11 months ago, I released a draft of my solution to this problem. The library is complete and ready to use, although there are features that aren't there yet. I hope a new version is available within the next month or so.

https://decibel.ni.com/content/docs/DOC-24015

You may not like my solution -- it relies on classes instead of clusters for various reasons. But the patterns of usage that I establish there are based on lots of research into the data serialization mechanisms of other programming languages/libraries and various file formats. But the short answer is that this approach allows the reading and writing of older formats for arbitrary data.

 

Other libraries:

MGI: http://mooregoodideas.com/robustxml/

 

 

OpenG also has a very robust solution but I cannot find where to download it -- my Google skills have completely failed this morning. Someone else may post a link to it.

Link to post
Share on other sites

Just to be clear - there are already good existing solutions. You should probably just use them.

  1. The OpenG variant config VIs which AQ mentioned are great. You should see them in the list of packages after you install VIPM.
  2. The MGI VIs he linked to are also good. I haven't tried the XML variety, but the INI ones work basically the same as the OpenG VIs, with the main functional difference being that they reset everything in the file each time, where the OpenG VIs can work on existing files and only change parts of them. Both of them basically work by name - if something doesn't already exist in the saved file, they will use the default value for it.
  3. Besides AQ's experiment, LVOOP already has this magically - it keeps the change history for each class, so you can flatten a class of version X and then unflatten it when the version is X+4 and it should know automatically how to do the conversion. I'm assuming the main reason AQ didn't suggest this is that it has some issues like resetting the history if you rename the class or being completely opaque.

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Similar Content

    • By jhoehner
      Hello All,
      First time LAVA poster here with my first question. Why do some LabVIEW programmers insist on wiring the error cluster to the bottom of their VI as opposed to the sides as shown in most NI documentation. Is there any benefit to it? Is it 100% a preference thing? Is there a way to make LabVIEW connect error wires like this automatically?
      I've only seen it in advanced LabVIEW code from experienced programmers and some parts of the Actor Framework.
      Your insight and experience is appreciated! 

    • By the_mitten
      The introduction of parallel, read-only access for DVRs in LabVIEW 2017 adds a great deal of flexibility to using DVRs to monitor values in parallel executions of code. Fo\The downside of this, of course, is the necessity of using the In Place Element (IPE) throughout your code simply to read the value. Having IPEs throughout your code just to read a value both takes up block diagram real estate and also takes more clicks than desirable to insert.
      Similarly, though less frequently, there are times when you only need to update the value within a DVR without actually performing any logic inside of the IPE.  This situation is less frequent, at least for me, as I am usually using arrays or classes with DVRs such that I actually need to modify the existing data rather than simply replacing it.
      A more preferable solution to the above situations would be to have Read/Get and Write/Set VIs for the DVRs to simplify the process of working with them. This way, and IPE on the block diagram would only be needed when you were actually modifying the existing data within the DVR, rather than simply overwriting or returning the current value.
      Thanks to the power of malleable VIs and the type specialization structure that is now officially released in LabVIEW 2018, a better solution is now available. I’ve created two malleable VIs, Read  DVR Value (Parallel) and Write DVR Value that allow you to perform a write and a parallel read on any DVR data type.
       Now, you can use a single VI that you can insert via Quick Drop to read or to write DVR values.  
      Download the attached ZIP file to access the two malleable VIs and example code, and please let me know your thoughts in the comments!
       


      DVR Read and Write VIs 1.0.0.zip
    • By takanoha
      Hi 
      I have a simple program which has only 2 buttons for the user interface. When the user clicks OK I want the program to get into the event structure case called "OK Button". Once it is inside there is a loop which continuously waits for 1 second until "Stop Button" is called from the user. 
      But because once the user presses the "OK Button" the program gets into the event and therefore I can not call the "Stop Button". 
      Is there a way to call the "Stop Button" even if the program is inside the event ?
       
      Thanks

      event_out.vi
    • By Fred chen
      Hi
       
      When I call the DLL, there is a structure:
      struct Signal { uint32 nStartBit; uint32 nLen; double nFactor; double nOffset; double nMin; double nMax; double nValue; uint64 nRawValue; bool is_signed; char unit[11]; char strName[66]; char strComment[201]; };  
       
      There is another  Message structure to the above Signal:
       
      struct Message { uint32 nSignalCount; uint32 nID; uint8 nExtend; uint32 nSize; Signal vSignals[513]; char strName[66]; char strComment[201]; }  
        The point is  Signal vSignals[513];
       
      I've tried to solve it like this,but the program will crash.
       
      How to create struct Message ,any good suggestions?  Thanks a lot.
       

      message.vi
    • By Taylorh140
      After working on the set cluster element by name xnode, it made me realize i could use the same concept to convert a variant array to a cluster. The technique is actually pretty simple, the xnode generates a case structure for each element in a cluster in cluster order, wherein a bundle by name is used to set the value and an unbundle by name is used to get the type, a variant to data is used to convert the data. This has some benefits over some methods, you are not limited to 255 elements, although that is not usually the case some of us are paranoid that clusterosaurus giganticous will be larger than expected. It also has a draw back  that is that when converting from a variant array all the elements must have unique, non-blank names, and this is usually the case. 

      I think this technique (though very brute-force) might be useful for some other things let me know what you guys think.

      VariantArrayToCluster.zip
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.