Simulate a real-time input to algorithm

조회 수: 4(최근 30일)
Alexandre Piccini
Alexandre Piccini 2018년 9월 5일
답변: Sanchita Ghosh 2020년 8월 26일
Hello guys,
Currently I'm working on a RT combustion analysis solution for our Formula Student prototype. By no means it is considerable to have the dyno set up only to test my code, so I need to do testing off-line, but as close as possible to the RT data I/O dynamics.
I came up with the idea of, using pressure (time-domain) data I already have from other DAQ sessions, have it as if a DAQ device is sending this signal I already have, so I can see the response of my code to it. Again, with a different phrasing:
Instead of the real situation (a NI board sending data continuously), I want the vector I already have feeding my code in real time - say, at a rate of 1000 samples (positions) per second. This way I could monitor the behaviour of my code.
What I don't know how to do is just that: simulate this continuous entry NOT coming from an actual device, but from data in my hard drive. I suppose this must be a simple thing, maybe with simulink (I'm not intending to use simulink for now - but could use it if it is the only way) I could do it - what's not making a lot of sense is how I manage to create a (sort of) "detached instance" of processing feeding my "code instance" with data.
Thank you all in advance


Sanchita Ghosh
Sanchita Ghosh 2020년 8월 26일
Hi Alexandre,
Assuming that you already have the NI output data stored along with the timing. You can use "timeseries" object as the input data for your calculation. Here the input argument of "timeseries" are the NI output data and corresponding timings(stored vector). The timing should be as per your NI board output rate. When you create a timeseries object, it will give you continuous entry as it is coming from actual device. You can get some help about "timeseries" by this link


Find more on Real-Time Simulation and Testing in Help Center and File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by