Ejemplo n.º 1
0
 def __init__(self, name, target=None, gatewayIPAddress=None):
     if ((target is None) and (gatewayIPAddress is None)):
         self.imodel = Factory().GetIModel(name)
     elif (target is None):
         self.imodel = Factory().GetIModel(gatewayIPAddress, "", name)
     elif (gatewayIPAddress is None):
         self.imodel = Factory().GetIModel("", target, name)
     else:
         self.imodel = Factory().GetIModel(gatewayIPAddress, target, name)
Ejemplo n.º 2
0
 def __init__(self, name, target=None, gatewayIPAddress=None):
     if ((target is None) and (gatewayIPAddress is None)):
         self.ialarm = Factory().GetIAlarm(name)
     elif (target is None):
         self.ialarm = Factory().GetIAlarm("", name, gatewayIPAddress)
     elif (gatewayIPAddress is None):
         self.ialarm = Factory().GetIAlarm(target, name, "")
     else:
         self.ialarm = Factory().GetIAlarm(target, name, gatewayIPAddress)
Ejemplo n.º 3
0
def WaitForNIVeriStandReady(address="localhost", secondsTimeout=120):
    import time

    start = time.time()
    while True:
        try:
            Factory().GetIWorkspace2(address)
            break
        except Exception:
            time.sleep(0.5)
            now = time.time()
            if (now - start) > secondsTimeout:
                raise NIVeriStandException(-307663,
                                           "Could not connect to gateway.")
Ejemplo n.º 4
0
 def __init__(self, gateway_ip_address=None):
     super(self.__class__, self).__init__()
     if (gateway_ip_address is None):
         self.modmgr = Factory().GetIModelManager2("")
     else:
         self.modmgr = Factory().GetIModelManager2(gateway_ip_address)
Ejemplo n.º 5
0
 def __init__(self):
     self.modmgr = Factory().GetIModelManager()
Ejemplo n.º 6
0
 def __init__(self, gateway_ip_address=None):
     if (gateway_ip_address is None):
         self.iamgr = Factory().GetIAlarmManager2("")
     else:
         self.iamgr = Factory().GetIAlarmManager2(gateway_ip_address)
Ejemplo n.º 7
0
 def __init__(self):
     self.iamgr = Factory().GetIAlarmManager()
def _get_factory():
    global factory
    if not factory:
        factory = Factory()
    return factory
Ejemplo n.º 9
0
 def __init__(self):
     self.iwks = Factory().GetIWorkspace()
Ejemplo n.º 10
0
 def __init__(self, gatewayIPAddress=None):
     if (gatewayIPAddress is None):
         self.player = Factory().GetIMacroPlayer("")
     else:
         self.player = Factory().GetIMacroPlayer(gatewayIPAddress)
Ejemplo n.º 11
0
 def __init__(self):
     self.record = Factory().GetIMacroRecorder()
Ejemplo n.º 12
0
 def __init__(self, gatewayIPAddress=None):
     if (gatewayIPAddress is None):
         self.istim = Factory().GetIStimulus2("")
     else:
         self.istim = Factory().GetIStimulus2(gatewayIPAddress)
import clr
import sys
import System

'''Run C:\\Users\\Public\\Documents\\National Instruments\\NI VeriStand 2017\\Examples\\Stimulus Profile\\Engine Demo\\Engine Demo.nivsproj'''

sys.path.append("c:\\Program Files (x86)\\National Instruments\\VeriStand 2017\\nivs.lib\\Reference Assemblies")
clr.AddReference("NationalInstruments.VeriStand.ClientAPI")
clr.AddReference("NationalInstruments.VeriStand.RealTimeSequenceDefinitionApi")

from NationalInstruments.VeriStand.StimulusProfileDefinitionApi import StimulusProfile
from NationalInstruments.VeriStand.ClientAPI import Factory

#Instance of Class Factory provides access to the NI VeriStand system 
fac = Factory()
print(fac)

#Interface to perform basic workspace operations
facWork = fac.GetIWorkspace2('localhost')
print(facWork)

#Create StimulusProfile object and execute profile asynchronously. 
stimProfile = StimulusProfile("c:\\Users\\Public\\Documents\\National Instruments\\NI VeriStand 2017\\Examples\\Stimulus Profile\\Engine Demo\\Stimulus Profiles\\Basic Engine Demo\\Engine Demo Basics.nivsstimprof")
stimProfile.ExecuteAsync('localhost','000')

#define in out parameters
chan = System.String("Targets/Controller/Simulation Models/Models/Engine Demo/Outports/RPM")
out = System.Double(0)

error, out = facWork.GetSingleChannelValue(chan, out)
print("")
from niveristand.library import wait

#Import the next elements to be able to create a logging specification
import clr
clr.AddReference("NationalInstruments.VeriStand.ClientAPI")
from NationalInstruments.VeriStand.ClientAPI import Factory
from NationalInstruments.VeriStand.ClientAPI import Logging
from NationalInstruments.VeriStand.ClientAPI.Logging import *

from System import Array

####################
###Setup logging ###

#Open Data Logging Manager Reference. We use localhost because logging takes place in the local computer
Data_Logging_Manager_Ref = Factory().GetIDataLogging("localhost")

#New TDMS Log File. First input is path to logging file. Second input is fileConflictOperation. 0 means create a new file with unique name
TDMSLogFile_Ref = TdmsLogFile(r"C:\Users\chericks\Documents\VeriStand Projects\Engine Demo\Logs\myLog.tdms",0)

#Add TDMS Group and one channel. Repeat for as many groups and channels.
Group_ref = TdmsChannelGroup("myGroup")
Channel_ref = TdmsChannel("myChannel","Aliases/ActualRPM")
#Add channel to group
Group_ref.AddChannel(Channel_ref)

#Add group to TDMS file
TDMSLogFile_Ref.AddChannelGroup(Group_ref)

#New Data Logging Specification (TDMS)
Logging_Specification_Ref = DataLoggingSpecification(TDMSLogFile_Ref)
Ejemplo n.º 15
0
 def __init__(self, gatewayIPAddress=None):
     if (gatewayIPAddress is None):
         self.isfiu = Factory().GetIChannelFault("")
     else:
         self.isfiu = Factory().GetIChannelFault(gatewayIPAddress)
Ejemplo n.º 16
0
 def __init__(self, gatewayIPAddress=None):
     if (gatewayIPAddress is None):
         self.iwks = Factory().GetIWorkspace2("")
     else:
         self.iwks = Factory().GetIWorkspace2(gatewayIPAddress)
Ejemplo n.º 17
0
 def __init__(self):
     self.istim = Factory().GetIStimulus()
from System import Array

#Import command line library
import os

#Import elements to be able to deploy the project and connect to the workspace
from NationalInstruments.VeriStand.ClientAPI import DeployOptions

#Launch NI VeriStand and open project
projectpath = r"C:\Users\chericks\Documents\VeriStand Projects\Engine Demo\Engine Demo.nivsprj"
os.startfile(projectpath)

wait(30)

#Open Workspace Reference. We use localhost because logging takes place in the local computer
Workspace_Ref = Factory().GetIWorkspace2("localhost")

#New DeployOptions Reference
DeployOptions_Ref = DeployOptions()
DeployOptions_Ref.DeploySystemDefinition = True
DeployOptions_Ref.Timeout = 60000
DeployOptions_Ref.CalibrationFilePath = r"C:\Users\chericks\Documents\VeriStand Projects\Engine Demo\Engine Demo.nivscf"
DeployOptions_Ref.FilteredTargets = ""

#Connect to System
systemDefinitionFilePath = r"C:\Users\chericks\Documents\VeriStand Projects\Engine Demo\Engine Demo.nivssdf"
Workspace_Ref.ConnectToSystem(systemDefinitionFilePath, DeployOptions_Ref)

####################
###Setup logging ###