06-06-2017 09:40 AM
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.
06-07-2017 09:32 AM
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