NI VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

adding xnet can channels using veristand api

Highlighted

 

I'm trying to develop code to populate a system definition file with CAN channels from a XNET database.  I can't seem to get this working.  I've attached the test VI that I've created to get started.  I'm able to successfully add the database to the system definition file, but things break down why I try add a message to the incoming Single-Point CAN channel.  The Frame shows up, and the Multiplexer shows up.  However, the multiplexer is not changing its name as I would like it to.  No signal specification information shows up.  Perhaps I'm missing a step, or something is not linking correctly?  I would like to automatically complete the steps used to Import Frames in to a CAN channel in Veristand.  Any help would be appreciated.  Thanks.

0 Kudos
Message 1 of 5
(4,207 Views)

Hi ShawnBR,

 

Are you getting any errors when “things break down” or are you just not seeing the changes you expect to in the SDF?

Jayme W.
Applications Engineer
National Instruments
0 Kudos
Message 2 of 5
(4,174 Views)

I'm not getting any errors, just having issues getting the program to actually populate the system defintion file with CAN messages.  I can add a CAN port, but I am having issue adding Incoming Single-Point frames from a DBC file that has been added as an XNET Database.  The messages are multiplexed, so I will need a multiplexer, and would like to add groups of messages under each frame that is associated with each identifier.  Therefore I would like to specify the Frame, Multiplexer, Mode, and Signals. 

 

I've attached a new example that is close to what I am trying to acheive.  There are three items I have questions about:

 

1) In the SingalBasedFrame contstructor, there is a input for a string array of SingalNames.  Is this necessary to populate this input because it seems that signals are not added unless the CreateSignalBasedSignal method is used?  What is this input used for?

 

2) When using the CreateMode method, the Multiplexer is created, the mode is created, and a signal is added.  How do I rename the Multiplexer?  Renaming did not work when using the RanameNode method when I added this as a separate step as in the previous example I attached. 

 

3) How do I add multiple singal names under the same Mode?

 

Thanks.

0 Kudos
Message 3 of 5
(4,153 Views)

Hi Shawn,

 

1) You are right the signals are not added unless the CreateSignalBasedSignal method is called, however the SingalBasedFrame contstructor still needs a string array of SingalNames so that it knows which signals can be added to the system definition file.

 

2) Technically the RanameNode method should works for renaming the Mode. Does it return a True value. It might be a bug in the API

 

3) You would need to add a for loop and call the CreateMode method for all your signals. You can use XNET API to programmatically extract Signal Names from your database:

xnet_API_signals.png

Sev K.
Applications Engineering Specialist | CLA
National Instruments
0 Kudos
Message 4 of 5
(4,125 Views)

Hello ShawnBR,

 

I know this is an old post, but I looked into the following:

 

2) When using the CreateMode method, the Multiplexer is created, the mode is created, and a signal is added.  How do I rename the Multiplexer?  Renaming did not work when using the [RenameNode] method when I added this as a separate step as in the previous example I attached. 

 

I also experienced the same thing. I was able to switch from the System Definition API to the System Storage API (which is much harder to use but gives you more control). I think this is required because the Multiplexer name isn't manually editable in NI VeriStand, so the RenameNode method doesn't work. The attached image shows how to rename the Multiplexer.

 

Rename Multiplexer.PNGAdd and Rename Multiplexer

 

 

I also looked into the follow up question.

 

3) How do I add multiple [signal] names under the same Mode?

 

Add Multiplexed Signals.PNGAdd Multiplexed Signals

 

 

Note: The RenameNode can be used to rename the Mode, as shown in the picture above.

 

Hope this helps someone!

Chad

0 Kudos
Message 5 of 5
(399 Views)