CallumSamuels Posted May 5, 2022 Share Posted May 5, 2022 Hi all, I apologize now I am a complete beginner with this software and data acquisition in general. I have exported two sets of mass flow rate data using an export set (10seconds worth) which is great; however, what I want to do now is use the data and find the average of each set of mass flow rates and store it so I can plot them against each other - the intention is to then incrementally increase the mass flow rate to build a plot of the relationship between the two sets of data and use linear regression to get a discharge coefficient. My plan (perhaps others have a better idea): 1. use a button to begin a sequence that triggers the export set to record for 10s. 2. use another button that begins a sequence to read the data in the export set and calculate an average for each mass flow rate sets 3. average value is then plotted on graph 4. increase the mass flow rate at the wall and repeat procedures 1-3. 5. when I have values for a range of mass flow rates, use a sequence and linear regression to determine the discharge coefficient, d_c (mfr_1 = d_c mfr_2) 6. discharge coefficient then saved as global variable to be used going forward. Does this sound like right workflow and simplest way to do thing? I am not very good at programming/code heavy stuff so hoping someone can help. At the moment I am stuck at step 2. Thank you all for your time Callum Quote Link to comment Share on other sites More sharing options...
CallumSamuels Posted May 5, 2022 Author Share Posted May 5, 2022 The first thing I am trying to do is read the values from my export set file and save them in an array variable that I can then use in pages I have tried using File.Open and File.ReadDelim to access the column but its too code-y for me 😢 Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted May 5, 2022 Share Posted May 5, 2022 Personally, if you were doing the linearly, I wouldn't do it that way. I'd still create export sets, but I'd calculate the means on that data at the same time and stick it into a Test channel with some Persist. The only reason you'd want to go about reading back the data is if you were going to do the tests at random times along with taking other data for other purposes. Quote Link to comment Share on other sites More sharing options...
CallumSamuels Posted May 5, 2022 Author Share Posted May 5, 2022 Thank you for the reply. I am still a little confused. When you say to calculate the means on that data at the same time how would you go about this? Would that be in the expression in the export set or as a sequence file after? I am sorry I am really new to this. I want to click a button which takes say 5s seconds of readings, averages them and saves the mean value as maybe a global variable? that I can use to plot on a graph. I want to do this 5 times with i guess 5 seprate buttons to produce a graph. Quote Link to comment Share on other sites More sharing options...
AzeoTech Posted May 5, 2022 Share Posted May 5, 2022 Just do this: 1) create a new channel to hold the mean. Let's say you call it "MyMean", though really you should pick a better name. It should be Device Type "Test" with I/O type "D to A". The rest doesn't really matter for now 2) I'm going to assume you are always taking data, but that you want to click a button that takes the mean of the last 5 seconds of data. To do that, select the Quick Sequence action for the button and put in script like this, where "myReading" is the name of your main channel. MyMean = mean(MyReading[systime(), systime() - 5]) Click this button whenever, and it will add a new mean to the list, moving the old ones back. By default it will hold 3600 means, but you can change that with the History of the MyMean channel. 3) now you can just plot MyMean vs Time on a graph. Or if you prefer, MyMean vs Point(MyMean) and then set the bottom axis to "Lin" instead of Date/Time. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.