NI VeriStand Add-Ons Documents

cancel
Showing results for 
Search instead for 
Did you mean: 

Example: Programmatic Creation of a System Definition File using C#

Example: Programmatic Creation of a System Definition File using C#

Overview

This project contains code to programically generate a system definition file.  In it I include links to references of all the classes I use. 

I have included adding the following items to the system definition:

* DAQ Card

* User Channel -- Mapped to AI0 of the DAQ Card

* FPGA Device

* XNET Database

* CAN Device -- Linked to the XNET Database

* Simulation Model -- Uses the model from the Sinewave Delay Example Project

* Connection of Model Inports/Outports/Parameters to User Channels


Instructions for Use

Download and unzip the project, then open Veristand_SystemDefinition_Creation.sln

Before you run the program, you need to add the XNET example database using the XNET Database editor.  The XNET example database is located here: C:\Users\Public\Documents\National Instruments\NI-XNET\Examples (Windows 7)

If you do not do this, then you will have errors when you open the system definition file in Veristand.

Software

To use these examples you must have the following software installed:

  • NI-XNET
  • NI-DAQmx
  • NI Veristand 2011
  • .NET Framework 3.5
  • To compile this project you need either Visual Studio with C# support enabled or Visual C# Express

Support and Contact

This add-on is provided as open-source software.  If it does not meet your exact specification, you are encouraged to modify the source code to meet your needs.  It is not officially supported by National Instruments.

National Instruments does not support this code or guarantee its quality in any way. THIS EXAMPLE PROGRAM IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND AND SUBJECT TO CERTAIN RESTRICTIONS AS MORE SPECIFICALLY SET FORTH IN NI.COM'S TERMS OF USE (http://ni.com/legal/termsofuse/unitedstates/us/).

Applications Engineer
National Instruments
Comments
Minesh
Member
Member
on

Matt,

This is good stuff! I am in need of an automated way of sucking in say a spreadsheet of System Definitions and pre-populating a System Definition File. Our customers provide us with an ICD of 1000s of IO and inputing this by hand is a ton of mouse clicks. I am very new to the .NET API, so your example has a wealth of knowledge. Can aliases be created the same way? And can they be used to map inputs to outputs via the API?

Would you say your example is a pretty good starting point for what I want to do?

Thanks

Minesh

Matt.M
NI Employee (retired)
on

Hi Minesh,

Sorry about taking so long to get back to you.  You can add large amounts of channel mappings using the Root.AddChannelMappings(string[] sources, string[] destinations), I have uploaded a new version of my project which uses this function on line 91.

Regards,

Matt M.

Applications Engineer
National Instruments
SmileBoB
Member
Member
on

Hi,

Just a question, is it possible to programmatically add a custome device to a system definition file through .NET API?

Best regards

SmileBoB
Member
Member
on

Hi,

Just a question, is it possible to programmatically add a custome device to a system definition file through .NET API?

Best regards

Matt.M
NI Employee (retired)
on

Hello,

Yes, you can add a custom device to your system definition.

Here is the class you can use to create a CustomDevice object: http://zone.ni.com/reference/en-XX/help/372846C-01/veristandsdapi/html/t_nationalinstruments_verista...

The custom device you want to add needs to be in C:\Users\Public\Public Documents\NI Veristand 2011\Custom Devices. The name and GUID you use to create the Custom Device object will have to match one of the custom devices in that folder.

Once you have created the custom device object, you can add it to the CustomDevices section: http://zone.ni.com/reference/en-XX/help/372846C-01/veristandsdapi/html/t_nationalinstruments_verista...

Use the GetCustomDevices method on the Target object to get the CustomDevices section of the target you want to add the custom device to: http://zone.ni.com/reference/en-XX/help/372846C-01/veristandsdapi/html/m_nationalinstruments_verista...

I have also uploaded a new version of my code that includes an example of adding the Embedded Data Logger custom device that comes with Veristand.

Regards,

Matt M.

Applications Engineer
National Instruments
Contributors