Random Ramblings on LabVIEW Design

Community Browser
Labels
cancel
Showing results for 
Search instead for 
Did you mean: 

Project Portability #2 Modbus Library Case Study

swatts
Active Participant

Morning Projecteers

I modified the Modbus toolkit (some version I got off NI.com a while back) and in my normal fashion wanted to control my dependencies. All I wanted to do was to move the modbus directory from vi.lib and embed it into my project hierarchy. I also need to be able to then move my entire project hierarchy about on the drive too.

Here's how it went......

 

The Modification

ModbusSlave.png

 

I had to modify Create Slave Instance (TCP).vi so that I could point it at a specific ethernet port. In this case I added an extra input so it was very obvious if I had the wrong library version on my machine (this is not a given and the implications are discussed in detail here)

 

All I wanted to do was move the \modbus directory from vi.lib and into my project directory so I can push it up to my repository.

 

Step 1 Move Directory from vi.lib

Step1.png

And we get warnings and errors, which is actually not a bad thing.

 

First it’s locked because it’s part of a RT deployment (multiple instances). I removed the called vi from the RT Project.

 

Step 2 Loading Project With Embedded Library

I closed LabVIEW and started again getting the following message.

Step2.png

As I was writing up this process I persisted pressing [Ignore] for longer than I usually would, after 15 minutes I got bored.

So I Killed LabVIEW.

 

Step 3 Tackle Slave Class On Its Own

Step3a.png

And after a bit of whirring it all loaded nicely

Step3b.png

When I opened up Initialize.vi none of the called classes where found, but after a bit of saving and loading all was good.

 

Step 4 Saving SubVIs.lvlib

Loaded up SubVIs.lvlib, this is called by both the Master and the Slave Classes.

Step4a.png

And a Save All saved 216 files, which was very encouraging. I loaded and saved both the Master and Slave Classes and all appeared to be good.

 

Step 5 Back In The Project

I reloaded my project

Step5a.png

and dealt with all the conflicts (not too many) and then went into the dependencies to clear those up.

 

Step 6 Cleaning House

As I've said before a tidy project is a happy project.

Step6a.png

These were essentially old test-stubs and examples so I had the bonus of deleting old unused code from the code-base (the best type of programming!)

This was now all working OK.

 

Step 7 Making It Portable

Although it was all working the project wasn't actually portable, if I moved it on disk it lost the SubVIs Directory and here I ran into a common faulting finding problem. I had a gut feeling for what was wrong, but had convinced myself that it shouldn't be a problem. I also wanted to bounce some ideas off someone else so started to skype-hassle Fabiola. She kindly started looking through the issue with me offering me use of the Delacor Library Duplicator and also showed me that I could open the lvlib file with notepad and check the files were relative and not absolute.

 

The directory structure on disk was still niggling me tho'

Here's how it was originally.

Step7a.png

I moved the subvis subdir into the slave subdir and deleted the master directory as it was not required. And now I can export it from my repo to anywhere and it will work. I've said this before but never actually done the hard graft to prove it.

 

LabVIEW likes subVIs to be below the caller in the hierarchy.

 

And that's what I'm talking about when I'm talking about project portability.

Lots of Love

Steve

 

Steve


Opportunity to learn from experienced developers / entrepeneurs (Fab,Joerg and Brian amongst them):
DSH Pragmatic Software Development Workshop


Random Ramblings Index
My Profile

Comments