def launch_veristand(): NIVeriStand.LaunchNIVeriStand() print('wait for Veristand Launching') time.sleep(10) print('Wait end') workspace = NIVeriStand.Workspace2('localhost') return workspace
def mix_legacy_and_rtseq_run(): """Combines the legacy API with Python real-time sequences to run a deterministic test.""" # Ensures NI VeriStand is running. NIVeriStand.LaunchNIVeriStand() # Uses the ClientAPI interface to get a reference to Workspace2 workspace = NIVeriStand.Workspace2("localhost") engine_demo_path = os.path.join(os.path.expanduser("~"), 'Documents', 'National Instruments', 'VeriStand 2018', 'Examples', 'Stimulus Profile', 'Engine Demo', 'Engine Demo.nivssdf') # Deploys the system definition. workspace.ConnectToSystem(engine_demo_path, True, 60000) try: # Uses Python real-time sequences to run a test. run_py_as_rtseq(run_engine_demo) print("Test Success") except RunError as e: print("Test Failed: %d - %s" % (int(e.error.error_code), e.error.message)) finally: # You can now disconnect from the system, so the next test can run. workspace.DisconnectFromSystem('', True)
def mix_legacy_and_rtseq_run(): """Combines the legacy API with Python real-time sequences to run a deterministic test.""" # Ensures NI VeriStand is running. NIVeriStand.LaunchNIVeriStand() print('wait') time.sleep(10) print('Wait end') # Uses the ClientAPI interface to get a reference to Workspace2 workspace = NIVeriStand.Workspace2("localhost") engine_demo_path = "C:\\Users\\Public\\Documents\\" \ "National Instruments\\NI VeriStand 2018\\Examples\\Stimulus Profile\\Engine Demo\\Engine Demo.nivssdf" # Deploys the system definition. workspace.ConnectToSystem(engine_demo_path, True, 60000) try: # Uses Python real-time sequences to run a test. # run_py_as_rtseq(run_engine_demo) engine_demo_basic(BooleanValue(True), DoubleValue(2500)) print("Test Success") except RunError as e: print("Test Failed: %d - %s" % (int(e.error.error_code), e.error.message)) finally: # You can now disconnect from the system, so the next test can run. workspace.DisconnectFromSystem('', True)
def mix_legacy_and_rtseq_run(): """Combines the legacy API with Python real-time sequences to run a deterministic test.""" # Ensures NI VeriStand is running. NIVeriStand.LaunchNIVeriStand() # Wait 30 seconds for the gateway to start time.sleep(30) engine_demo_path = Path(r"C:\Users\Public\Documents\National Instruments\NI VeriStand 2020\Examples\Stimulus Profile\Engine Demo\Engine Demo.nivssdf") if not engine_demo_path.exists(): print("Error! System definition not found!") return # Uses the ClientAPI interface to get a reference to Workspace2 workspace = NIVeriStand.Workspace2("localhost") # engine_demo_path = os.path.join("c:/", "users", "public", "Documents", "National Instruments", "VeriStand 2020", "Examples", "Stimulus Profile", "Engine Demo", "Engine Demo.nivssdf") # Deploys the system definition. workspace.ConnectToSystem(str(engine_demo_path), True, 60000) try: # Uses Python real-time sequences to run a test. run_py_as_rtseq(run_engine_demo) print("Test Success") except RunError as e: print("Test Failed: %d - %s" % (int(e.error.error_code), e.error.message)) finally: # You can now disconnect from the system, so the next test can run. workspace.DisconnectFromSystem('', True)
def launch_veristand(): NIVeriStand.LaunchNIVeriStand() print('wait for Veristand Launching') time.sleep(15) print('Wait end')