LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Control and Simulation Loop read in data from file

Hi,

I'm trying to read data from file in control and simulation loop. The file(can be formated into .txt or .mat) contains a list of voltage values and serve as my Vin to the multisim design. It seems that only the first voltage value is read in to the loop.

Is there a way to take my own simulation signal (instead of using the build in signal VIs) and feed it into the multisim design? 

Im using labview 2016  with CDsim installed properly.

0 Kudos
Message 1 of 2
(2,178 Views)

Hi franktang,

 

The Control Design and Simulation Loops are predominately written to work with single-point data - in practice, that equates to reading a data point, doing whatever mathematical operations necessary in the loop, and pushing a single data point out the other side of the loop.  Certain functions are configured to accept arrays (See Manual-Automatic Control.vi in the Example Finder), but it doesn't look like the MultiSim block you're using is configured to accept more than one data point for each iteration of the loop.  You will need to unpack the voltage signals in that text file, throw one in an isolated software buffer, and then feed the individual data points into the CD&Sim loop.

Code-wise, I'd suggest a producer/consumer architecture where your producer loop reads the voltage values in the file and puts one in a buffer.  The CD&Sim loop then becomes your 'consumer' loop, implementing the calculations you need to do on the simulated data.  If you're unfamiliar with that architecture, there's a solid White Paper here

Matt | NI Systems Engineering
0 Kudos
Message 2 of 2
(2,120 Views)