VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

IronPython functions to create Stimulis Profile and Real-time Sequences

Solved!
Go to solution

Hello all,

I need a way to create Stimulus Profile and Real-Time Sequences with IronPython..

 

I have gone through NIVeriStand.py file but in this file I can find only basic functions like get Single channel value, run Stimulus Profile, etc... where as I don't find any functions like create New real-time sequence, create New Stimulus Profile, channel referencing, loops, comments etc... I don't find all the functions that are available in Real-time sequence API and Stimulus profile API in NIVeriStand.py

 

So if any 1 as any idea like how to import all the functions of Real-time sequence API and Stimulus profile  API into NIVeriStand.py file please let me know..

 

Regards,

Narra                                                 

 

 

0 Kudos
Message 1 of 6
(3,921 Views)
Solution
Accepted by topic author narra

Hi Narra,

 

I assume you know that already, but just for reference: These functions seem not to be supported in the VeriStand Python Interface.

 

For a list of supported functions see

https://github.com/NIVeriStandAdd-Ons/cPython-Interface-for-NI-VeriStand/blob/master/Docs/cPython%20...

 

So maybe you could use use .NET API directly from Python. A discussion and some links can be found here:

https://forums.ni.com/t5/NI-VeriStand/Ni-VeriStand-Automation-from-Python-C-C/td-p/3329504

 

Regards

Stefan

0 Kudos
Message 2 of 6
(3,849 Views)

Hi Stefan,

Thank you for your answer. I have another question ?

 

I am trying to run my stimulus profile through IronPython script but I am not able to do so can any one tell me where I am lagging ? Here below is my code:

 

import NIVeriStand

import clr

clr.AddReference("NationalInstruments.VeriStand, Version=2017.0.0.0, Culture=neutral, PublicKeyToken=a6d690c380daa308")

clr.AddReference("NationalInstruments.VeriStand.ClientAPI, Version=2017.0.0.0, Culture=neutral, PublicKeyToken=a6d690c380daa308"

 

import NationalInstruments.VeriStand.ClientAPI

from NationalInstruments.VeriStand.ClientAPI import Factory

 

Method1: directly from API

factory = NationalInstruments.VeriStand.ClientAPI.Factory()

stimulus = factory.GetIStimulus()

stimulus.RunStimulusProfile(r"C:\Users\Public\Documents\National Instruments\NI VeriStand 2017\Projects\Digital\digital.nivsstimprof", r"C:\Users\Public\Documents\National Instruments\NI VeriStand 2017\Projects\Digital\logs", 60000,1,1)

 

Method two from NIVeriStand.py

stimulus = NIVeriStand.Stimulus()

stimulus.RunStimulusProfile(r"C:\Users\Public\Documents\National Instruments\NI VeriStand 2017\Projects\Digital\digital.nivsstimprof", r"C:\Users\Public\Documents\National Instruments\NI VeriStand 2017\Projects\Digital\logs", 60000,1,1)

 

when I execute above code I am getting below error I am not sure how to get rid of it. Can any 1 help me on this ????

 

error:

NIVeriStand.NIVeriStandException: Consult NI VeriStand help for error code 0xfffb4d37 error message

0 Kudos
Message 3 of 6
(3,841 Views)

Hi narra,

 

you did get that error code from both calls, right? I did not see it yet and did not find it anywhere, neither in hex nor in dec.

 

Did you define a system definition file before?

 

See this forum post for a discussion and an example

https://forums.ni.com/t5/NI-VeriStand/Iron-Python/td-p/1290944

 

Stefan

 

0 Kudos
Message 4 of 6
(3,818 Views)

Hi Stefen,

Yes I have loaded System Definition File to the target. Here below is my actual code and output

 

import time

import os

import _winreg

import clr

 

 clr.AddReference("NationalInstruments.VeriStand, Version=2017.0.0.0, Culture=neutral, PublicKeyToken=a6d690c380daa308")

clr.AddReference("NationalInstruments.VeriStand.ClientAPI, Version=2017.0.0.0, Culture=neutral, PublicKeyToken=a6d690c380daa308")

clr.AddReference("NationalInstruments.VeriStand.RealTimeSequenceDefinitionApi, Version=2017.0.0.0, Culture=neutral, PublicKeyToken=a6d690c380daa308")

 

import NationalInstruments.VeriStand.ClientAPI

from NationalInstruments.VeriStand.ClientAPI import Factory

 

 factory = NationalInstruments.VeriStand.ClientAPI.Factory()

project = factory.GetIProject("localhost", r"C:\Users\Public\Documents\National Instruments\NI VeriStand 2017\Projects\Digital\Digital.nivsproj", "", "")

project.Visible = 1

project.Run(1)

 

stimulus = factory.GetIStimulus2("localhost")

error_object = stimulus.RunStimulusProfile(r"C:\Users\Public\Documents\National Instruments\NI VeriStand 2017\Projects\Digital\digital.nivsstimprof","",60000,1,1)

print error_object.Code

 

 

output:

4294659383

 

 

My project is running and System Definition File is loaded to the target. But Stimulus Profile is not running with the above function. Is there something to modify here ?

0 Kudos
Message 5 of 6
(3,812 Views)

Hello, I have encountered the same problem as you recently. May I ask if your problem has been resolved and how it was resolved

0 Kudos
Message 6 of 6
(1,407 Views)