VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Initialization on the host side

Hi, inside of the RT driver VIs there are cases with "initialize", "start" etc. Is there something similar on the host side? Regards, Swen
0 Kudos
Message 1 of 9
(6,624 Views)

Hi Swen,

 

What do you mean with 'on the host side'?

No matter where the engine runs (windows or RT) the driver VI is the same, which means in either case the Init and Start case is executed.

 

Tom

0 Kudos
Message 2 of 9
(6,621 Views)

 

There are no corresponding states in the initialization VIs.  The initialization VIs runs on the execution host and can be used to configure the engine VI which runs on the execution target.  Initialization VI runs one time, when the custom device is first added to the system definition.  Main runs every time the operator click on the custom device in the system explorer.  The states inside the driver VI specify when the state executes with respect to the rest of the NIVS Engine. 
Take the Inline Hardware Interface template for example.
The inline hardware interface template is similar to state machine architecture. Some developers will recognize it as an action-engine. See NI Discussion Forums » LabVIEW » Community Nugget 4/08/2007 Action Engines for a discussion on action engines. The Primary Control Loop (PCL) specifies the case to execute. An uninitialized Feedback Node is used for iterative data transfer. There are five cases defined by the Operation enumerated control.
  1. Initialize
  2. Start
  3. Read Data from Hardware
  4. Write Data to Hardware
  5. Close
This custom device runs in-line with the PCL, which calls each case at a specific time with respect to the other components in the NI VeriStand engine. The PCL will not proceed until the custom device case has completed.
Initialize
The Initialize case executes before the PCL starts. In this case, you can read the device configuration information from properties using the reference to the device. Initialize data and buffers used internally in the device. The framework compiles the list of Data References for the custom device Inputs and Outputs in advance using Custom Device API » Driver Functions » Get Custom Device Channel List and Custom Device API.lvlib » Templates » RT Driver VIs » Inline » Inline Driver Utilities » Channel Data References » Get Channel Data Reference.vi.  Since the PCL hasn’t started yet, you can't read or write channel values in the Initialize case.
Start
The Start case executes after Initialization and before the PCL starts running. There’s no difference between what code you can place in the Initialize and Start states.  Since the PCL hasn’t started yet, you can't read or write channel values in the Start case.
Read Data from HW
The Read Data from HW case executes at the beginning of the PCL, before other components (such as Stimulus, Faults, Alarms, Procedures, et cetera) execute.  The template contains a Flat Sequence frame named Read Hardware Channels. You can replace the code inside the frame with the API calls necessary to obtain data from a hardware API.  Do not call Get or Set Channel Value by Data Reference outside the inline driver VI. Doing so could cause system instability or errors.
Write Data to HW
The Write Data to HW case executes at the end of the PCL, after the other components (such as Stimulus, Faults, Alarms, Procedures, et cetera) have executed.  The case contains a Flat Sequence frame named Write Input Data to Hardware Channels. You can replace the code inside the frame with the API calls necessary to send data to a hardware device.
Close
The Close case executes after the PCL has finished executing. It's good practice to close references and release resources in this state. Since the PCL has terminated, you cannot read or write channel values in this case.
Steve K

 

0 Kudos
Message 3 of 9
(6,617 Views)
Hi Tom, I mean that when I deploy my configuration and devices to my RT target from my windows box the driver VIs are executed on the RT machine only. But what if I want to do some configurations on the windows host during the init phase, too? Like copy some files, setting up hardware that isn't connected to the RT but to the windows machine. Cheers, Swen
0 Kudos
Message 4 of 9
(6,615 Views)
Steve, That's what I asked for. So there is actually no way to run initialization code during the deployment process?
0 Kudos
Message 5 of 9
(6,612 Views)

Hey Swen,

 

there is no concept of a synchronized service between launching the custom device (CD) and the host system.

Once all items are deployed and ready to go, the deploy dialog will report that the deployment has been successful and the workspace is ready to go.

 

However, what we do have though is so called 'Action VIs' in System Explorer (SE). Each node withint your custom device may have those action VIs registered.

In your specific case I can think of two possible action VIs that might help you out here:

  • Action VI on Compilation (AVC)
  • Action VI on Download (AVD)

The  AVC is ONLY executed when the system definition file  (SDF) is compiled. Whether a SDF is compiled or not depends on what is currently running/available on the engine. Let's assume you run an SDF for the first time, the SDF will be compiled at this point. After some time you decide to stop the engine (undeploy) and then some time after you decide to run it again. In this case, the compilation will not happen since the SDF has not changed. Only if you open the SDF in SE, make a change and save it, the compilation is triggered on the next deployment.

 

The AVD is executed EVERY time the SDF is downloaded. This does not apply if you just disconnect and reconnect (since the SDF is already downloaded) though.

 

Let me know if one of those two might be of interest for you.

 

Tom

Message 6 of 9
(6,610 Views)
Hi Tom, I think the AVD could be interesting. That would be the one tagged as inside the custom device definition? Are there any events fired by VeriStand that could be used inside a running service to get informed about the actul systems state? Cheers, Swen
0 Kudos
Message 7 of 9
(6,583 Views)

The Action VI on Download occurs during deployment, so at this time VeriStand shouldn't be publishing any state events. What type of system information are you looking to obtain?

Jarrod S.
National Instruments
0 Kudos
Message 8 of 9
(6,574 Views)

Jarrod,

if I would configure one or more services to be started by VeriStand I would like to know about the systems current state inside of these services Is it idle/deploying/running etc. So again, are there any API calls or events with which I can get informations about VeriStands current state?

 

0 Kudos
Message 9 of 9
(6,547 Views)