Live data capturing AND recording from NI dynamometer in app

5 views (last 30 days)
Hi everyone,
as I'm embarking on quite a large project, and am new to this side of MATLAB, I wanna make sure I take the correct road from the get go.
The goal is to have a MATLAB app that displays a live plot of dynamometer force data (NI and connected directly to the pc), AND incrementaly storing that data in a global variable. As in, I want to plot the dyno data as it comes in, but also store it for later use.
Currently, I am stuck, as I can either live plot OR store it, but not both simultaneously.
That said, I have been looking into background v foregorund and 'readwrite' stuff, but I'm kind of lost there. Any pointers would be great!
Thanks.
  3 Comments
Dennis Premoli
Dennis Premoli on 5 Aug 2022
Edited: Dennis Premoli on 5 Aug 2022
Is there a maximum recording size, such that the variable could be pre-allocated?
No, the data gathered is frrom a machining process, therefore dependant on RPM, feed and the size of the material. All of these could change, drastically changing the time required for a full data capture. (We're talking even like 30 minutes runs).
What sampling rate are you hoping for, and what latency is acceptable for plotting?
Sample rate is unoptimised as of now adn we don't ahev a set target per se (but high in general). We are currently running at 25kHz but this could be turned down (relatively) if filesizes become stupid.
The live plotting doesn't need to be instantaneous or anything. A refresh every 0.5-1s seems reasonable?
Or are you using something like an NIDAQ chassis connected by way of USB ?
This^
Truth is, we know this is possible to a good degree of polish as a similar app has been produced and shown to us. Unfortunately we don't have access to its source code to just lift it and apply to ours :/
Walter Roberson
Walter Roberson on 6 Aug 2022
The space requirement would be... let's see... making some wild guesses...
I speculate that you will want a precision at least as high as 0.1 rpm, and that you might want to measure more than 6553 rpm, so I speculate that you might not be able to pack the readings into 2 bytes... but maybe you can
format long g
sample_rate = 25000;
number_of_dynamometers = 2; %?
samples_per_dynamometer = 3; %? X Y Z
bytes_per_sample = 4;
run_time = 30 * 60; %seconds
bytes_per_second = sample_rate * number_of_dynamometers * samples_per_dynamometer * bytes_per_sample
bytes_per_second =
600000
bytes_per_run = bytes_per_second * run_time
bytes_per_run =
1080000000
Gb_per_run = round(bytes_per_run / 2^30,1)
Gb_per_run =
1
... that would be quite do-able. You could pre-allocate for the largest expected run, or you could use https://www.mathworks.com/matlabcentral/fileexchange/8334-incremental-growth-of-an-array-revisited?s_tid=srchtitle

Sign in to comment.

Answers (0)

Categories

Find more on Startup and Shutdown in Help Center and File Exchange

Products


Release

R2022a

Community Treasure Hunt

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

Start Hunting!