NI VeriStand Add-Ons Discussions

cancel
Showing results for 
Search instead for 
Did you mean: 

Update custom device IO without deleting it.

Hello.

I have made several custom devices into veristand and I have linked them. Now I have realised that I need a new output on a custom device. I already have updated it but the new output doesn't appear on the system explorer custom device. If I delete it and I import it again the new output appears but the problem is that due to I have deleted the custom device all the mappings made to this custom device have been deleted and I need to make them again.

I have tried to store the mappings and it works but the variables used in procedures cannot be stored and I have lost all the logics.

So anyone knows how to update a custom device WITHOUT deleting it?

Thanks in advance.

Miguel.

0 Kudos
Message 1 of 4
(4,551 Views)

Hi Miguel,

You would need to write you own mutation code to convert your custom device between versions. You can accomplish this by using an "ActionVIOnLoad" which checks the custom device version and acts accordingly (ex. adds a channel).

To correctly use this, you will need to use the follwing:

  1. Update the value for <Version> in the custom device XML
  2. Create a new VI based off of "ActionVIOnLoad Template.vit". You can find this VI in the Custom Deivce API.lvlib underneath Templates\Action VI
  3. Add the <ActionVIOnLoad> tag to you main page in your custom device XML.

For an example of how to use this to add mutation code to your custom device, you can check out the code for the Engine Simulation Custom Device.

Message 2 of 4
(3,185 Views)

Hi Devin.

Thanks for your quick support. I have tried your solution but I cannot implement it (I have also checked the example). I upload my custom device to this community to see if you can implement if for me. It's a problem I have to solve soon and I cannot analize in detail so please help me if you can.

https://consigna.tecnalia.com/3029

Pass: Veristand

Thanks in advance.

Miguel

0 Kudos
Message 3 of 4
(3,185 Views)

Hi Miguel,

In the Engine Simulation Custom Device, open the project and look at the following VI:
Engine Simulation Custom Device.lvlib\System Explorer\Actions\Main On Load Action VI.vi

If you look at the code for this VI, you see that when the custom device is loaded, it checks the version of the custom device stored in the system definition.  If it is less than the current version of the custom device, it performs some actions (in this case, it adds a section  to the custom device and three channels).  After that, it updates the "Version" tag of the custom device to the current version (so the update will not happen again next time you load your system definition file).

You will need to implement something similar in your own custom device.

mutation.png

If you look at the XML for the engine simulation custom device, you will also see where this VI is referenced in the XML.  Under the main page section in the XML is the following, which tells NI VeriStand to call the above code when the custom device is loaded:

<ActionVIOnLoad>

    <Type>To Common Doc Dir</Type>

    <Path>Custom Devices\Engine Simulation\Engine Simulation Configuration.llb\Main On Load Action VI.vi</Path>

</ActionVIOnLoad>

I hope that helps.

Regards,

Devin

0 Kudos
Message 4 of 4
(3,185 Views)