VeriStand

cancel
Showing results for 
Search instead for 
Did you mean: 

load custom text file

Hello,

I'm a relatively new Veristand user and would like to load a custom test sequence using the Workspace tools and pass the contents to a real-time sequence. I believe I have all the functionality sorted on the real-time sequence however I have not been able to figure out how to load a text file from the workspace using a filepath control.

 

So far I have looked at the CSV playback option using the Stimuls profile editor but I dont belive this will suit my needs (I would like to perform pass/fail checks before proceeding to the next setpoint). 

 

I have created a model from a VI that can read a command to load the contents of my custom file but without the filepath control it requires a user input to define the filepath and would not be suitable as it we will need to run automated sequences that run 3/4 days. 

 

Can anyone suggest a possible method of opening a text file from the workspace?

Cheers,
Dave

 

 

0 Kudos
Message 1 of 5
(3,876 Views)

Hello,

 

I am Ed from National Instruments Applications Engineering. I have been forwarded your query with regards to loading custom files for VeriStand control.

 

So, I do indeed see your issue which is that the file path control does not exist in the workspace palette, however you can create custom controls and thereby achieve this if needed such that the user can select files. I have included a white paper below which walks through this process:

 

https://knowledge.ni.com/KnowledgeArticleDetails?id=kA03q000000x4QfCAI&l=en-US

 

However I believe based on some of your description, the document I have additionally linked below may be more towards your application needs:

 

https://www.ni.com/docs/en-US/bundle/veristand/page/tutorial-stimulus-update-model-parameter.html

 

Please keep me apprised as to whether the above is indeed what you are looking for.

 

Best regards,

 

Ed

0 Kudos
Message 2 of 5
(3,828 Views)

 Hi Ed,

Thanks for the reply. In the end I implemented something similar to what you suggested.

As file paths can be constants in a model, I created a model that reads from a text file with a fixed path. I used a custom workspace control to load create a filepath string of the desired test script to load, saved it to the text file where the model can read the filepath. Bit of a workaround but works well.


Cheers!

0 Kudos
Message 3 of 5
(3,798 Views)

Sounds like you got to a suitable solution, but wanted to add my two cents as well.  Keep in mind that models typically should be deterministic (no network comm, file I/O, etc.) and should typically only contain mathematical functions.  Accessing a file from a model may work, but could lead to issues down the road since it does not handle initialization and shutdown as gracefully as other techniques.  Since mathematical models typically inherently handle initialization and don't need a shutdown case, this is a non-issue.  However, since models cannot respond to Deploy and Undeploy events of the VeriStand engine, you don't really have a foolproof way of ensuring your file references are closed on undeploy, which could leave the file in a bad state or cause a memory leak.

 

If your test sequence can be stored in CSV format, where column 0 represents time and columns 1-N represent the channel values, you can load those CSV files as if they were an RT sequence directly.  Check out the tutorial here: http://www.ni.com/tutorial/14020/en/.  The advantage here is that VeriStand handles appropriate initialization and shutdown for you.

 

To make this more configurable, you could use the Stimulus Profile API to programmatically control which file is deployed, and have it launch your VeriStand Workspace as well.

Cody A.
0 Kudos
Message 4 of 5
(3,794 Views)

I looked at the CSV replay function but it doesn't seem suitable for my application. Changes to setpoints are not only time based but are dependent on other events such as temperature requirements, user inputs, and the need to perform intermediate functions (such as warmup and cooldown events) that I dont think can be implemented with the CSV file playback.

 

0 Kudos
Message 5 of 5
(3,783 Views)