Mizan Posted June 9, 2015 Share Posted June 9, 2015 I am using DAQFactory with a LabJack to log the temperature. The temperature signal feeds into the LabJack via a voltage divider also to calculate the temperature from the resistance I have to perform a quadratic equation. I have got all this to work but I am trying to make it simpler for others to use so I set up a page with popup's so the can define the voltage divider settings (R1 and R2) as well as the coefficients of the quadratic equation but I when I define R1 = 10 for example, anyhting that refers to it just updates the value at the time R1 was defined. Is there anyway/anywhere I can define my constants which can be changed when the user decides? I've tried using 'test' devices with D to A outputs and I've tried creating V Channels but these only seem to work when the value is being updated periodically in time. I Just want to put R1 = 0 and leave it and change it later if I need. Thanks Link to comment Share on other sites More sharing options...
AzeoTech Posted June 9, 2015 Share Posted June 9, 2015 A Test D/A is probably the way to go. Set the Persist to 1 so it keeps the value after restart, and make sure the Timing is 0 (it should force that with D/A). Set the History to 1 too so you don't get any history. You can then do: R1 = 3 and it will put that value in the channel. And you can access it simply with: R1 Link to comment Share on other sites More sharing options...
SteveMyres Posted June 9, 2015 Share Posted June 9, 2015 Don't know the details of your app, but why not use a global variable? Link to comment Share on other sites More sharing options...
Mizan Posted June 10, 2015 Author Share Posted June 10, 2015 Hi, Thanks for your help but my problem still persists. Essentially what have done is set a conversion on the channel I am measuring the equation is just numbers and value i.e. VoltageToResis = equation*value This conversion is applied to the channel TemperatureResistance so this displays the resistance of the probe. I then on the event tab of the TemperatureResistance channel did Temperature.AddValue(equation*R0) and in the Temperature channel it does update to the correct temperature but the issue I'm having is once I define this, the timestamp for the recorded data uses the time assigned to R0. I have tried both R0 and R0[0]. Thanks again for your help Link to comment Share on other sites More sharing options...
AzeoTech Posted June 10, 2015 Share Posted June 10, 2015 Steve, I recommended a test channel so the value would persist between restarts. Mizan, I think I need to see your document. You probably have a typo or an error in your syntax. Link to comment Share on other sites More sharing options...
Mizan Posted June 11, 2015 Author Share Posted June 11, 2015 TechGuy, What do you mean by 'between restarts'. I've tried making a new file with one input channel with LabJackUD as its device and then I added two test channels, one called output which would display the modifed data and the other channel called constant. In the event tab of the input channel I wrote output.AddValue(input[0]*constant[0]) but I still have the problem where the timestamp for output is stuck on the timestamp for my constant Steve, how do I define and redefine global variables? Link to comment Share on other sites More sharing options...
AzeoTech Posted June 11, 2015 Share Posted June 11, 2015 I mean between when you quit DAQFactory and you start it up again. Global variables will reinitialize to their defaults (if any). You can fix the timestamp issue by using insertTime(): output.addValue(insertTime(input[0]*constant[0], input.time[0], 0)) Link to comment Share on other sites More sharing options...
Mizan Posted June 12, 2015 Author Share Posted June 12, 2015 I mean between when you quit DAQFactory and you start it up again. Global variables will reinitialize to their defaults (if any). You can fix the timestamp issue by using insertTime(): output.addValue(insertTime(input[0]*constant[0], input.time[0], 0)) The insertTime(): function worked. Thanks for the help Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.