VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

ironPython script error

I wrote a very simple ironPython script but got the following error 0xFFFB4E32 (can't find the node).

I just couldn't figure out why. I ever had similar script running fine.

 

===== error =====

Deploying C:\Documents and Settings\All Users\Documents\National Instruments\NI
VeriStand 2010\Projects\Serial Communication\testProject\testProject.nivssdf

start serial communication...

Unexpected Exception Consult NI VeriStand help for error code 0xfffb4e32 error m
essage

 

===== here is the script i wrote =====

import sys
import time
import NIVeriStand
from NIVeriStand import NIVeriStandException

APPDATADIR = r"C:\Documents and Settings\All Users\Documents\National Instruments\NI VeriStand 2010"
VSTANDCONFIGDIR = APPDATADIR + '\\Projects\\Serial Communication\\testProject\\'
LOGGINGDIR = r"C:\DeleteFolder"

def sleep():
    time.sleep(1)
    
# Load workspace
wks = NIVeriStand.Workspace()

try:
    print ""
    CONFIGFILE = VSTANDCONFIGDIR + r"testProject.nivssdf"
    print "Deploying %s \n" % CONFIGFILE
    wks.RunWorkspaceFile(CONFIGFILE,1,1,60000,"","")

    print "start serial communication...\n"
    wks.SetSingleChannelValue("Targets/Controller/Custom Devices/GSE Interface/Connect", True)

    sleep(2)
        
    print "stop serial communication...\n"
    wks.SetSingleChannelValue("Targets/Controller/Custom Devices/GSE Interface/Connect", False)

    print ""
    raw_input("\n\nPress the enter key to exit.")

except NIVeriStandException, e:
    TEST_COMMENT = "Unexpected Exception " + e.message()
    print TEST_COMMENT
except:
    print sys.exc_info()
    
finally:
    wks.StopWorkspaceFile("")

 

 

===== VS custom device sdf screenshot =====

attached "CD channel.png"

0 Kudos
Message 1 of 11
(7,278 Views)

By the way, the python script is running on local computer, but VeriStand project is running on RT chassis.

I'm wondering if the python script can access the channels of VeriStand running on RT chassis?

Is there any particular thing I should know?

 

Thanks.

0 Kudos
Message 2 of 11
(7,269 Views)

Hi MileP,

 

I don't really see anything wrong with your script...  It looks like it should work.  The APIs are designed to communicate with the NIVS Gateway process on your host machine, which then communcates to the deployed RT system.  So you should be able to use the API to access channels on your RT system.

 

The one thing I did notice was that you are using a deprecated version of the NIVS Workspace API. The version you are using was made for NIVS 2009, and is only included for backwards compatibility.  With NIVS 2010 you should be using the Workspace2 interface.  I have attached an example Python script that shows how to use Workspace2.  Also, if you need more information on the different interfaces, check out the API documentation here:  NI VeriStand™ Execution API Documentation

 

Regards,

Devin

0 Kudos
Message 3 of 11
(7,243 Views)

Thank you, Devin.

 

I don't see too much difference between WorkSpace and WorkSpace2 for my case. I tried to use WorkSpace2 methods ConnectToSystem() and DisconnectFromSystem(), and SetSingleChannelValue(), but got the same error.

0 Kudos
Message 4 of 11
(7,238 Views)

Hi MileP,

 

It definitely seems strange, and I'm not sure what your problem could be.  Without your system definition and custom device (and hardware?) though, I can't test it out myself to see if I can reproduce.  Some things you could check:

 

  1. Can you successfully run the script I posted with the "Example" system definition which ships with NIVS?
  2. If you perform the same steps as your script manually (ie. setting channel values with controls mapped on the workspace) do you get any errors from VeriStand?
  3. If you modify your script to set values of different channels (such as User Channels) instead of your custom device Connect channel, do you still get an error?
0 Kudos
Message 5 of 11
(7,227 Views)

Hi Devin,

 

I tried what you suggested:

 

1) The script you provided with the Example system definition file coming with NIVS works. I think that's for local computer instead of RT-Target.

2) Performed my script manually, got the same error. The system definition file was deployed successfully.

3) Set values to User Channels, got the same error.

 

Do I need special settings to the network? Currently the RT-Target and Local host computer are in the same LAN.

Does single quote and double quota matter when accessing the channels? I tried both, the result is same.

 

I could send you the system definition file and CD module, but you may need the same HW chassis setting, do you?

0 Kudos
Message 6 of 11
(7,223 Views)

HI MileP,

 

1) You could change the Example to be targeted to your RT target, and run your script again.  This would tell us whether there is some communication problem to an RT target, or whether it's something specific to your system definition.

 

2) So without running a Python script at all, you still saw an error?  When did this happen?  How did it appear?  Did NI VeriStand poop up a message?  The error message in your original post was the error output of your Python script (from using the APIs), but I didn't see a mention of any other errors from VeriStand.

 

3) Very strange.  Based on your script output, it looks like the error is getting thrown the first time you try to set a channel value.  Which shouldn't be a problem with User Channels.   Maybe you could start removing things from your System Definition (such as your custom device) until the error goes away.  Or start with a blank system definition and gradually add things back in.

 

The communication usually should work without issue on most machines, but it's possible that a firewall may be blocking communication.  Try opening up these ports:

2040, 2050: Engine communication
56432, 56431: UDP communication (These are the default ports. The user could change them in Tools»Options)

 

I'm not an expert in Python syntax, but from documents I've looked at online, it seems both single and double quotes are valid for strings.  Regardless, I tried both in the example script, and they both worked find, so I don't think that's the issue.

 

Does your custom device require some connected hardware to function properly?  You could post the system definition and CD, but I'm not sure whether I'll be able to run it.

0 Kudos
Message 7 of 11
(7,215 Views)

Hi Devin,

 

1) I changed the Example to be our RT-Target and the script ran properly. I also added my Custom Device to the example sdf file and modified the script to set value to CD channel. It also worked fine.

 

2) Immediately after the error 0xFFFB4E32 from the script, a window pops up in VS (see attached file).

 

3) I tried to remove everything else from System Definition File and left one user channel only, still got the error.

I will try to create a new System Definition File and gradually add things back asap, and give you feedback.

 

The local computer has no any firewall and windows firewall is off, so I assume the ports are open.

 

I'm running the CD for loopback test, so no UUT is needed.

 

Thanks!

 

0 Kudos
Message 8 of 11
(7,206 Views)

Hi Devin,

 

I created a new VS project and used RT-Target as the controller. Without adding anything else but my CD to the sdf, the python script worked fine when accessing the CD channels.

I got the sdf file from another identical chassis, but couldn't understand why the script didn't work even if I removed everything else but CD from that sdf file.

Maybe there is a glitch or something in that sdf file.

 

 

0 Kudos
Message 9 of 11
(7,193 Views)

Hi MileP,

 

I'm not sure what could have happened there, but I'm glad you were able to figure it out.  You might consider sending the bad system definition file into support to see if they can look into it further and file a bug report to R&D if necessary.

 

Regards,

Devin

0 Kudos
Message 10 of 11
(7,187 Views)