04-03-2018 09:12 AM - edited 04-03-2018 09:15 AM
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
Solved! Go to Solution.
04-17-2018 03:50 AM
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
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
04-19-2018 03:15 AM
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
04-23-2018 06:28 AM
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
04-23-2018 07:19 AM
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 ?
06-06-2023 06:48 AM
Hello, I have encountered the same problem as you recently. May I ask if your problem has been resolved and how it was resolved