.DDS Files - Linear scaling and equation scaling

Post all DrDAQ questions here
Post Reply
Glovisol
Advanced User
Advanced User
Posts: 0
Joined: Sat May 11, 2013 10:03 am
Location: San Marzano Oliveto, Asti, Italy

.DDS Files - Linear scaling and equation scaling

Post by Glovisol »

PLEASE HELP!

1) I need to see the example of a .DDS file for linear scaling (e.g. using Method=1). This is of course possible within the Picolog's menu, but is would be most useful if it could be done by a separate file.

2) I also need to know if it is possible to write an exponential equation of the following kind into a .DDS scaling file and, if at all possible, to see an example.

aX^3 + bX^2 + cX + d, where X is the measured parameter (in volts) at one of the auxiliary inputs.

Again I note that the above is possible within the Picolog's menu.

Glovisol
Advanced User
Advanced User
Posts: 0
Joined: Sat May 11, 2013 10:03 am
Location: San Marzano Oliveto, Asti, Italy

Re: .DDS Files - Linear scaling and equation scaling

Post by Glovisol »

A way to do good precision resistance measurements with the DrDAQ follows.

The enclosed EXCEL file shows the result which could be obtained by placing a 100 KOhm resistor between the +5V output (pin 4) and input (pin 1) of an auxiliary input and then the resistor to be measured (or the variable resistance to be metered) between input (pin 1) and ground. Column Rx shows the values to be measured. Column Rt is the sum value of the 100 KOhm plus the resistor under test. Column Vx is voltage across resistor under test. Column Vclc is the calculated value which will minimise reading error in the DrDAQ. This error in percent is given in column Error %. Finally the value of the resistor or resistance under test is shown in column DISPLAY DrDAQ. This is the value Picolog will show and store as a fixed or as a variable input.

The cubic equation is: Vclc = (3E-15(Vx)^3) - (5E-10(Vx)^2) + 5E-05(Vx) and has been obtained by curve fitting, see Grafico 1 and then doing a small correction in the last term to minimise error.

The DrDAQ DISPLAY value is of course calculated with: R (Ohm) =Vclc * 1000/Ix

If the cubic equation can be written in a .DDS file, then the DrDAQ can measure resistance with a max. error of 0.7% as shown. This equation can of course be used by writing it directly into Picolog. Other resistance ranges can be implemented by changing the value of the 100 KOhm resistor and using this Excel file to obtain the new equation.
Ohmmeter2.xls
This file shows the entire process
(40 KiB) Downloaded 606 times

Glovisol
Advanced User
Advanced User
Posts: 0
Joined: Sat May 11, 2013 10:03 am
Location: San Marzano Oliveto, Asti, Italy

Re: .DDS Files - Linear scaling and equation scaling

Post by Glovisol »

A way to do good precision resistance measurements with the DrDAQ follows
As far as I could see it is not possible to write scaling equations in the .DDS file.

The proposed mehod can be implemented in theory by building a scaling table in the .DDS file taking the Vclc values from the Ohmeter 2.xls file, but unfortunately this method does not work in practice, because of the "pullup" resistor in the DrDAQ external input (pin 1) which provides "extra" current in parallel with the 100 kOhm resistor. To make it work we must place a simple isolation amplifier in front of the input, which will eliminate the extra current due to the pull-up. Ideally a twin operational amplifier could be used, accommodating two of the three external inputs. This would leave the third input bare for other applications.

I shall test this option and report in a future post.

Glovisol
Advanced User
Advanced User
Posts: 0
Joined: Sat May 11, 2013 10:03 am
Location: San Marzano Oliveto, Asti, Italy

Re: .DDS Files - Linear scaling and equation scaling

Post by Glovisol »

Buffer schematic
Buffer schematic
Ohmmeter3.xls
Cubic equation curve fitting & calculation
(44.5 KiB) Downloaded 650 times
Glovisol wrote:A way to do good precision resistance measurements with the DrDAQ follows
The previously described method works very well if an OP AMP buffer is used before the External input. The enclosed example shows the Ohm measurement done with Ext. 1 input.

First of all enclosed EXCEL file Ohmeter3 curve fits Ohms VS. Voltage and recovers cubic equation:

R [Ohm] = (1,431.8*X^3) + (3,589.6*X^2)+(20,074*X) (which is the inverted function of cubic equation shown in previous post)

or

R [KOhm] = (1.4318*X^3) + (3.5896*X^2) + (20.074*X)

Where variable X is the voltage measured by Ext.1 at the output of the Buffer Op Amp, as shown in enclosed JPEG file.
Accuracy of Ohms reading is better than 1%.

The reading is done by opening Picolog and using then internal scaling feature, by writing the cubic equation in "equation scaling". Equation must be written with exponential terms .i.e. "X^3" as X*X*X and so on, as shown in the Jpeg file. Internal scaling can also be used by writing a table, copying the values for O-1000-5000-10000-15000-20000 and 25000 Ohms from the EXCEL Ohmeter3 file.

Unfortunately I tried to make and use a .DDS scaling file with the same table values, as described above, but it does not work. any suggestion?

Glovisol
Advanced User
Advanced User
Posts: 0
Joined: Sat May 11, 2013 10:03 am
Location: San Marzano Oliveto, Asti, Italy

Re: .DDS Files - Linear scaling and equation scaling - MORE

Post by Glovisol »

XY display of 0 to 25 KOhm measurement
XY display of 0 to 25 KOhm measurement
Actual screen of Picolog display showing measured Ohm in Ext.1 and input voltage in Ext.2
Actual screen of Picolog display showing measured Ohm in Ext.1 and input voltage in Ext.2
I am enclosing pictorials showing operation of resistance measurement method. These pictorials were obtained by replacing the resistor to be measured witha multi-turn pot.

In the next post I will show a much simplified interface (no ext. supplies) to obtain the same results.
Attachments
XY display of 0 to 10 KOhm measurement
XY display of 0 to 10 KOhm measurement

Glovisol
Advanced User
Advanced User
Posts: 0
Joined: Sat May 11, 2013 10:03 am
Location: San Marzano Oliveto, Asti, Italy

Re: .DDS Files - Linear scaling and equation scaling - SIMPL

Post by Glovisol »

Ohmmeter4.xls
This EXCEL file computes the DrDAQ equation & lists all Ohm values Vs. input voltage
(35 KiB) Downloaded 581 times
It is possible to do an even more accurate resistance measurement using the Ext. Input if it is possible to keep the resistance to be measured floating above ground. In this case the negative supply for the Op Amp is no longer necessary, because we make the Op Amp see a positive voltage even with zero Ohm. We can also eliminate the separate positive supply and feed the buffer with the +5V coming from Pin 4 of the Ext. input.

The circuit diagram is the DrDAQ Buffer Data (2) file. The cubic equation has been calculated with enclosed EXCEL file Ohmeter 4. The curve fitting equation is:

R [Ohm] = 1338*X^3 + 3434*X^2 + 20200*X - 3321.6

R [KOhm] = 1.338*X^3 + 3.434*X^2 + 20.2*X - 3.3216

This equation is valid from less than 1 KOhm to 50 KOhm, as shown in Ohmeter 4, yelding 1% error maximum. If the 3.3 KOhm metering resistor is made adjustable, it is possible to null out small errors due to DrDAQ voltage calibration. Other resistor ranges can be achieved by replacing the two metering resistors and recalculating with the Ohmeter 4 file.

As described in the previous post, the equation must be written in the scaling section of Picolog. Equivalent results by inserting a scaling table, taken from the values shown by Ohmeter 4, in the scaling section of Picolog. Unfortunately I have not been able to make the same table work in a .DDS file, but suspect this could be due to corrupted Picolog software or to other software installed in the PC (Windows XP) as I previously described in a previous post. I will do a clean-up and report in a future post.
Attachments
Simplified DrDAQ buffer for Ext. Input
Simplified DrDAQ buffer for Ext. Input

Glovisol
Advanced User
Advanced User
Posts: 0
Joined: Sat May 11, 2013 10:03 am
Location: San Marzano Oliveto, Asti, Italy

Re: .DDS Files - Linear scaling and equation scaling - PROBL

Post by Glovisol »

Referring to my previous posts, I was unable to use a .DDS file for scaling the Resistance measurement values: it simply did not work. For this research I have been using a table top with WXP/SP3. Eventually the system behavior was so erratic I again started suspecting something was wrong with the software. I therefore removed a lot of software (I shall not get in trouble naming which) removed Picolog and cleaned up and defragmented the system HD. After re-starting, I re-installed Picolog, wrote the .DDS file with scaling from 1KOhm to 30KOhm and the DrDAQ started working immediately. After some experimenting I found that the best way is to use a harmonic scale,in which any value is the double of the preceding one. XY graph, and .DDS scale is enclosed. Note that I changed the file from .DDS to .txt after doing the plot, in order to make the photo.
.DDS scaling worked eventually!!
.DDS scaling worked eventually!!
So the rules for .DDS scaling I picked up with this work are as follows.

1) Carefully check for errors in the file. Generally speaking a mis-spelled entry or a wrong number cause Picolog to crash. This is easy, because with most errors Picolog will not even turn the DrDAQ on.
2) Pay attention at how the scaling list is made. Number too big in the "Scaled" sometimes make trouble. For instance the Picolog display would go up to 30,000, but not to 40,000. It was simple to change from Ohm to KOhm and use decimal places to solve this. If one value spacing does not work, try another.
3) Every time you wish to make a modification to the .DDS file, you MUST "start new settings" in Picolog, then shut it down, then modify the .DDS file, then open Picolog and finally open the scaled channel you are working with.
4) IF IT DOES NOT WORK OR GETS CRAZY, MOST LIKELY YOU HAVE SOME ROT IN THE HD AND/OR PICOLOG IS CORRUPTED AND YOU MUST DO YOUR CLEANING HOMEWORK.
5) The XY display is invaluable to check if you are scaling according to the intended physical values and/or if a value in the scaling is wrong.

Patience is the name of the game.

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: .DDS Files - Linear scaling and equation scaling - PROBL

Post by Martyn »

Glovisol wrote:2) Pay attention at how the scaling list is made. Number too big in the "Scaled" sometimes make trouble. For instance the Picolog display would go up to 30,000, but not to 40,000. It was simple to change from Ohm to KOhm and use decimal places to solve this. If one value spacing does not work, try another.
32767 is likely to be the limit, a signed 16 bit integer
4) IF IT DOES NOT WORK OR GETS CRAZY, MOST LIKELY YOU HAVE SOME ROT IN THE HD AND/OR PICOLOG IS CORRUPTED AND YOU MUST DO YOUR CLEANING HOMEWORK.
Sounds very unusual, but always worth keeping systems clean
Martyn
Technical Support Manager

Glovisol
Advanced User
Advanced User
Posts: 0
Joined: Sat May 11, 2013 10:03 am
Location: San Marzano Oliveto, Asti, Italy

Re: .DDS Files - Linear scaling and equation scaling

Post by Glovisol »

Dear Martyin,

Thanks for your information. But how you write a .DDS file with linear scaling? I need to see an example for use of
Method 1, Gain and Offset. Is it is possible to enter an equation as well?


Glovisol

Martyn
Site Admin
Site Admin
Posts: 4491
Joined: Fri Jun 10, 2011 8:15 am
Location: St. Neots

Re: .DDS Files - Linear scaling and equation scaling

Post by Martyn »

As an example you would need a .dds file with the following format

For a lookup table with just two pairs, the file would look like this:

Code: Select all

Notes=LM35CZ Temperature sensor
Type=Table
Units=°C
-0.02 -20 
0.1 100 
For an equation, the file would look like this:

Code: Select all

Notes=Temperature in Fahrenheit from LM35CZ
Type=Equation
Units=°F
32 + x *0.005555
Martyn
Technical Support Manager

Glovisol
Advanced User
Advanced User
Posts: 0
Joined: Sat May 11, 2013 10:03 am
Location: San Marzano Oliveto, Asti, Italy

Re: .DDS Files - Linear scaling and equation scaling

Post by Glovisol »

Dear Martyn,

Many thanks for your examples. However I have been unable to make them work as .DDS files. Even using the Autodetect Resistor, they are not recognized as valid files and no change in name/unit etc. appears when you open Picolog.

Perhaps your examples are too concise and I miss essential additions to complete them. What I need is COMPLETE exmaples, that I could copy and use, just to get started.

Thanks in advance for your help.

glovisol

Glovisol
Advanced User
Advanced User
Posts: 0
Joined: Sat May 11, 2013 10:03 am
Location: San Marzano Oliveto, Asti, Italy

Re: .DDS Files - Linear scaling and equation scaling

Post by Glovisol »

.DDS Files for LINEAR/EQUATION SCALING

I note we are all still in the dark about the possible application of linear and/or equation scaling in .DDS files. Even the discovery it is not yet possible to use DrDAQ in this mode would be of advantage.

Post Reply