01-02-2013 05:15 PM - edited 01-02-2013 05:17 PM
Hello everyone - I hope we all had a good holiday season. Now it's back to work.
Backgound:
So I want to finish developing a calibration progarm that someone started a while back to progammatically develop a lookup table (rather then just a scalar and offset) for a current measurement. There are 64 channels of current measurement so you can imagine the pain of having to calibrate them one at a time every so often. The original program was developed in Simulink and could be run as a model in VeriStand (although I haven't seen it run yet - so not sure how well it works). The idea behind it is to send a known current to the measurement device and compare the actual value to the expected value - then create a lookup table. This allows for greater accuracy across a larger range of currents since the accuracy of the measurement device is a percent of the input.
Question:
What I'd like to do either with a Simulink model or with LabVIEW (or maybe there is even sometrhing embedded in VeriStand than do this - although doubtful) is when the SDF is deployed I'd like to have a dialog box pop up and ask the user if he/she wants to calibrate the current sensors. If no - run the test; if yes - calibrate and then run the test. I have no idea if this is possible to do and have not found anything using the search engine on here.
Let me know if anyone knows how to do this or even an alternate solution to be able to do something like this. The only way I can think is to have two separate projects with separate SDF's that do one function or the other - which may be alright since it won't have to be done too often. It would be convenient for end users to be able to select and calibrate on their own though.
Thanks for the help in advance.
01-03-2013 09:04 AM
You might look into creating a service to run in your VeriStand project. Services are VIs you program and are almost entirely identical to Workspace Tools, but you can configure them to launch whenever the project connects to the targets. A service can show a dialog or run silent in the background. Also, there are some synchronization options you can configure to force the project to wait for your service to run before it continues.
To create a service, refer to the Workspace Tool template at: <LabVIEW>\examples\NI VeriStand\Workspace\Workspace Tool Example.vi.
Then use the Configure Service dialog to add your service to the project.
01-03-2013 10:02 AM
Thanks for the help - I think that this will probably be able to work. The questions I have now though are - how can I run a program on the target without deploying the SDF? Maybe I'm just not thinking about it correctly but it seems that unless you open up that FTP and send the project over you won't be able to run the model to do the calibration. The other thing I'm unsure of but haven't given it too much thought is once I run the calibration and create this lookup tables - where/how would I be able to save them so they are accessible by the channels that need them? I have not used external files in a VeriStand project on target so I'm a little unsure of how to get those files to the right place on the target and have the channels look at the right place to get the information.
Any other advice about this process would be helpful as well. This is a new step in VeriStand for me.
01-03-2013 10:26 AM
I also have problems when I run the Workspace Tool Example in my VeriStand project.
It opens up just fine, but when I close it VeriStand shows that it's not connected to the target, but the workspace screen is still up and everything functinos. The only way to fix this is to close the process in task manager and start over. Might just be something with my system though.
The other concern is that when running it the workspace pops up and the SDF is fully deployed and running. I don't know how you would prevent that from happening until the workspace tool is done doing its "thing."
Thanks again.
01-04-2013 05:41 PM
You're correct in thinking that you're not going to be able to run your model on the target without deploying the system definition. The service mentioned in the previous post will only run on your host computer, but within the service you could use the VeriStand .NET API to change aspects of the system definition before it is deployed.
As far as accessing the calibration results from your model, I think it would be easiest just to have the results available as outputs of the model/channels in VeriStand.
I'm a little confused about what you're seeing with Workspace Tool Example. The tool will only run on your Windows machine. The workspace also only runs on your Windows machine. Are you still seeing updates from your target? (indicating a connection with the target and that the system def is still deployed). When you say that the only way to "fix this" is to use Windows task manager to close things, do you mean that you are unable to close the workspace otherwise?
01-07-2013 10:43 AM
With the Workspace Tool Example - it would just like "lock" up and not let me close it properly. The other buttons in it would work, but it would never let me close it. I'm not too worried about it though becuase I don't need to get that specifically to work.
What I was thinking about doing with this calibration thing is to create an application that can be installed and carries with it an SDF file to run the calibration. So essetionally you just run that program it opens up a VS gateway, deploys the needed files on the RT target and runs the calibration then saves the calibration map to a folder of the SDF you want to use to run your test.
I'm sure this isn't too hard to do but I have never worked with the VS API blocks yet so I'm not sure what ones you would use to do some of things - probably won't take much to figure out though. The other thing is all of the information will be on the RT target so how to I get it back to the host computer with the test SDF? I'm assuming I'd have to do an FTP transfer of some sort, but again that's something I've never done before in LabVIEW. Any suggestions/resources would be nice to help me out. Or maybe there is again... a better way? I'm just tossing ideas out - brainstorming. I do have the LabVIEW code written that will iterate through channel values (once they are received from VS), take samples, and generate my map by using linear interpolation/extrapolation and saves it as a tab deliminited text file.
Thanks again for the help.
01-08-2013 04:01 PM
Hi Joe,
Here are a couple thoughts:
1) There are blocks in the VeriStand .NET API that will allow you to calibrate the channels in your system definition file (prior to deployment, I think, but you'd have to test that). This code is very incomplete but just to give you an idea of how the .NET stuff would be set up:
Documentation on these methods are here:
2) To use this calibration API, you would of course have to have the calibration data you generated. If this look-up table is already available on the target, you could easily FTP wherever you wanted in order to access it. This document talks about how to FTP things programmatically in LabVIEW: http://digital.ni.com/public.nsf/allkb/3D985C3C08C12D0B862574BB005A7684
3) One thing that's going to be tricky is still how to optionally run the calibration. One possibility that I can see here is to run a normal RT VI on the target (I think you said you already had one developed) to create the calibration table. After that you could deploy the system definition file. The problem with this is that running an RT VI on the target removes the VeriStand engine (which is just a start-up exe) from the target. Therefore, before you could deploy your system definition file, you would have to programmatically reinstall the VeriStand engine.
Sorry, I think I addressed this a little backwards but hopefully that gives you some more information to get going on.