Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.arch.embedded > #25054 > unrolled thread

Optimize pow() function

Started bypozz <pozzugno@gmail.com>
First post2016-09-22 15:36 +0200
Last post2016-09-26 22:44 -0500
Articles 20 on this page of 42 — 16 participants

Back to article view | Back to comp.arch.embedded


Contents

  Optimize pow() function pozz <pozzugno@gmail.com> - 2016-09-22 15:36 +0200
    Re: Optimize pow() function Don Y <blockedofcourse@foo.invalid> - 2016-09-22 07:17 -0700
      Re: Optimize pow() function pozz <pozzugno@gmail.com> - 2016-09-22 23:10 +0200
        Re: Optimize pow() function rickman <gnuarm@gmail.com> - 2016-09-22 17:31 -0400
          Re: Optimize pow() function lasselangwadtchristensen@gmail.com - 2016-09-22 14:44 -0700
          Re: Optimize pow() function pozz <pozzugno@gmail.com> - 2016-09-23 09:03 +0200
            Re: Optimize pow() function Paul Rubin <no.email@nospam.invalid> - 2016-09-23 00:17 -0700
            Re: Optimize pow() function Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2016-09-23 22:45 +0300
        Re: Optimize pow() function rickman <gnuarm@gmail.com> - 2016-09-22 17:44 -0400
          Re: Optimize pow() function pozz <pozzugno@gmail.com> - 2016-09-23 09:08 +0200
            Re: Optimize pow() function rickman <gnuarm@gmail.com> - 2016-09-24 01:54 -0400
        Re: Optimize pow() function Don Y <blockedofcourse@foo.invalid> - 2016-09-22 14:50 -0700
          Re: Optimize pow() function pozz <pozzugno@gmail.com> - 2016-09-23 09:23 +0200
            Re: Optimize pow() function Don Y <blockedofcourse@foo.invalid> - 2016-09-23 00:32 -0700
            Re: Optimize pow() function Evgeny Filatov <e.v.filatov@ieee.org> - 2016-09-23 12:56 +0300
              Re: Optimize pow() function Don Y <blockedofcourse@foo.invalid> - 2016-09-23 10:41 -0700
            Re: Optimize pow() function Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2016-09-23 21:07 +0200
            Re: Optimize pow() function Don Y <blockedofcourse@foo.invalid> - 2016-09-23 12:12 -0700
      Re: Optimize pow() function pozz <pozzugno@gmail.com> - 2016-09-22 23:12 +0200
        Re: Optimize pow() function Don Y <blockedofcourse@foo.invalid> - 2016-09-22 14:58 -0700
    Re: Optimize pow() function Tim Wescott <tim@seemywebsite.com> - 2016-09-22 10:01 -0500
      Re: Optimize pow() function Jack <jack4747@gmail.com> - 2016-09-22 08:08 -0700
        Re: Optimize pow() function Tim Wescott <seemywebsite@myfooter.really> - 2016-09-22 11:53 -0500
          Re: Optimize pow() function pippo2@disney.com (Jack) - 2016-09-22 21:12 +0200
            Re: Optimize pow() function lasselangwadtchristensen@gmail.com - 2016-09-22 13:12 -0700
            Re: Optimize pow() function Tim Wescott <seemywebsite@myfooter.really> - 2016-09-22 15:51 -0500
      Re: Optimize pow() function pozz <pozzugno@gmail.com> - 2016-09-22 23:15 +0200
        Re: Optimize pow() function Tim Wescott <seemywebsite@myfooter.really> - 2016-09-22 17:52 -0500
        Re: Optimize pow() function David Brown <david.brown@hesbynett.no> - 2016-09-23 09:32 +0200
      Re: Optimize pow() function David Brown <david.brown@hesbynett.no> - 2016-09-23 09:28 +0200
        Re: Optimize pow() function Paul Rubin <no.email@nospam.invalid> - 2016-09-23 00:47 -0700
          Re: Optimize pow() function David Brown <david.brown@hesbynett.no> - 2016-09-23 11:05 +0200
          Re: Optimize pow() function Tim Wescott <tim@seemywebsite.com> - 2016-09-23 11:44 -0500
    Re: Optimize pow() function Jack <jack4747@gmail.com> - 2016-09-22 23:15 -0700
      Re: Optimize pow() function Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2016-09-23 20:49 +0200
    Re: Optimize pow() function Richard Damon <Richard@Damon-Family.org> - 2016-09-25 06:50 -0400
      Re: Optimize pow() function Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2016-09-25 16:36 +0300
        Re: Optimize pow() function Chris <xxx.syseng.yyy@gfsys.co.uk> - 2016-09-26 17:30 +0000
          Re: Optimize pow() function Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2016-09-26 21:49 +0300
        Re: Optimize pow() function pozz <pozzugno@gmail.com> - 2016-09-26 23:30 +0200
          Re: Optimize pow() function Tauno Voipio <tauno.voipio@notused.fi.invalid> - 2016-09-27 18:58 +0300
    Re: Optimize pow() function Robert Wessel <robertwessel2@yahoo.com> - 2016-09-26 22:44 -0500

Page 1 of 3  [1] 2 3  Next page →


#25054 — Optimize pow() function

Frompozz <pozzugno@gmail.com>
Date2016-09-22 15:36 +0200
SubjectOptimize pow() function
Message-ID<ns0mo1$7j2$1@dont-email.me>
I have to convert voltage measure (Volt) into power (Watt).  As you 
know, the physics says I need to square the voltage measure.

I have to calibrate the mathematical law and I have two points:
0W -> 0V
<nominal power> -> <voltage at nominal power>

That could be enough, but we noticed a different relation between volt 
and watt at intermediate points. I, as the software engineer, have to 
try to compensate differences from the theory, without increasing 
complexity during calibration.

My idea is to calibrate the exponent: it is normally 2.00, but I can 
calibrate from 1.00 to 3.00.
In this way, the two old calibration points are the same as before.  So 
the exponent (the third calibration measure) can be changed at last.

The problem is pow() function with double arguments takes a lot of time 
to finish.  Do you suggest a mathematical method to reduce its complexity?


uint16_t power_nominal = 1500;   // In Watt
uint16_t volt_nominal;   // Volt measured at nominal power
signed uint8_t exp_corr = -100 to +100;
double exp = 2.00 + exp_corr;

uint16_t volt = adc_convert(...);  // Actual volt measure
double alpha = (double)power_nominal / pow((double)volt_nominal, exp);
uint32_t watt = alpha * pow((double)volt, exp);


alpha can be pre-calculated, because power_nominal, volt_nominal and exp 
are constant (after calibration). The last instruction is the problem.

[toc] | [next] | [standalone]


#25055

FromDon Y <blockedofcourse@foo.invalid>
Date2016-09-22 07:17 -0700
Message-ID<ns0p5g$ggu$1@dont-email.me>
In reply to#25054
On 9/22/2016 6:36 AM, pozz wrote:
> I have to convert voltage measure (Volt) into power (Watt).  As you know, the
> physics says I need to square the voltage measure.
>
> I have to calibrate the mathematical law and I have two points:
> 0W -> 0V
> <nominal power> -> <voltage at nominal power>
>
> That could be enough, but we noticed a different relation between volt and watt
> at intermediate points. I, as the software engineer, have to try to compensate
> differences from the theory, without increasing complexity during calibration.
>
> My idea is to calibrate the exponent: it is normally 2.00, but I can calibrate
> from 1.00 to 3.00.
> In this way, the two old calibration points are the same as before.  So the
> exponent (the third calibration measure) can be changed at last.
>
> The problem is pow() function with double arguments takes a lot of time to
> finish.  Do you suggest a mathematical method to reduce its complexity?
>
>
> uint16_t power_nominal = 1500;   // In Watt
> uint16_t volt_nominal;   // Volt measured at nominal power
> signed uint8_t exp_corr = -100 to +100;
> double exp = 2.00 + exp_corr;
>
> uint16_t volt = adc_convert(...);  // Actual volt measure
> double alpha = (double)power_nominal / pow((double)volt_nominal, exp);
> uint32_t watt = alpha * pow((double)volt, exp);
>
>
> alpha can be pre-calculated, because power_nominal, volt_nominal and exp are
> constant (after calibration). The last instruction is the problem.

No, the "problem" lies in your transducer/measurement error.
The definition of a "watt" (power) doesn't change just because your
observations of that APPARENT relationship (V ~ W) "has issues".

Perhaps your load's characteristics are changing as a function
of operating point.  Or, nonlinearities in your measurement system.
Or, ...

Ask yourself WHY the exponent needs to be changed.  I suggest you
don't have an accurate model of your load and its excitation.
Until you do, how will you know that this is the CORRECT means of
compensating your model to agree with your observations?

[toc] | [prev] | [next] | [standalone]


#25066

Frompozz <pozzugno@gmail.com>
Date2016-09-22 23:10 +0200
Message-ID<ns1hbm$c75$1@dont-email.me>
In reply to#25055
Il 22/09/2016 16:17, Don Y ha scritto:
 > On 9/22/2016 6:36 AM, pozz wrote:
 >> I have to convert voltage measure (Volt) into power (Watt).  As you
 >> know, the
 >> physics says I need to square the voltage measure.
 >>
 >> I have to calibrate the mathematical law and I have two points:
 >> 0W -> 0V
 >> <nominal power> -> <voltage at nominal power>
 >>
 >> That could be enough, but we noticed a different relation between volt
 >> and watt
 >> at intermediate points. I, as the software engineer, have to try to
 >> compensate
 >> differences from the theory, without increasing complexity during
 >> calibration.
 >>
 >> My idea is to calibrate the exponent: it is normally 2.00, but I can
 >> calibrate
 >> from 1.00 to 3.00.
 >> In this way, the two old calibration points are the same as before.
 >> So the
 >> exponent (the third calibration measure) can be changed at last.
 >>
 >> The problem is pow() function with double arguments takes a lot of
 >> time to
 >> finish.  Do you suggest a mathematical method to reduce its complexity?
 >>
 >>
 >> uint16_t power_nominal = 1500;   // In Watt
 >> uint16_t volt_nominal;   // Volt measured at nominal power
 >> signed uint8_t exp_corr = -100 to +100;
 >> double exp = 2.00 + exp_corr;
 >>
 >> uint16_t volt = adc_convert(...);  // Actual volt measure
 >> double alpha = (double)power_nominal / pow((double)volt_nominal, exp);
 >> uint32_t watt = alpha * pow((double)volt, exp);
 >>
 >>
 >> alpha can be pre-calculated, because power_nominal, volt_nominal and
 >> exp are
 >> constant (after calibration). The last instruction is the problem.
 >
 > No, the "problem" lies in your transducer/measurement error.
 > The definition of a "watt" (power) doesn't change just because your
 > observations of that APPARENT relationship (V ~ W) "has issues".
 >
 > Perhaps your load's characteristics are changing as a function
 > of operating point.  Or, nonlinearities in your measurement system.
 > Or, ...
 >
 > Ask yourself WHY the exponent needs to be changed.  I suggest you
 > don't have an accurate model of your load and its excitation.
 > Until you do, how will you know that this is the CORRECT means of
 > compensating your model to agree with your observations?


I know the problem is in the poor quality of the transducer, but I'm 
only in charge of the software and the hardware engineer can't fix it 
(often the software solves hardware issues).

So I need a more complex law. The quadratic law (one parameter) can be 
calibrated with a single measure (nominal value). The generic power law 
(exponent not exactly equals to 2, two parameters) needs two calibration 
measures and has a nice feature: it's very simple to calibrate in two steps.

The input section has an hardware calibration, a simple digital trimmer.
So the first step is to calculate the power from the measured voltage 
with the following formula:
   P = Pn / (Vn ^ 2) * (V ^ 2)
where Pn is the nominal power and Vn is the voltage needed at nominal 
power.  The user increase/decrease the trimmer pot until the correct 
power is displayed.

Second step. Change the power to another value (half of nominal power, 
for example). If the transducer works as in theory, the measured power 
is correct. Otherwise the user increase/decrease the exponent until the 
power displayed is correct. The power is calculated as:
   P = Pn / (Vn ^ exp) * (V ^ exp)

After the second step, we are sure the first calibration point is yet 
valid, because that formula is correct when V=Vn, even if exp isn't 2.


If I use the linear law P=AV^2+BV, I think the two calibration steps 
aren't indipendent: the operator should execute two measures, the system 
should save the two couples (P,V) and only after that calculate A and B 
coefficients.


It seems to me the exponentiation law is simpler during calibration.

[toc] | [prev] | [next] | [standalone]


#25069

Fromrickman <gnuarm@gmail.com>
Date2016-09-22 17:31 -0400
Message-ID<ns1ik8$gcl$1@dont-email.me>
In reply to#25066
On 9/22/2016 5:10 PM, pozz wrote:
> Il 22/09/2016 16:17, Don Y ha scritto:
>> On 9/22/2016 6:36 AM, pozz wrote:
>>> I have to convert voltage measure (Volt) into power (Watt).  As you
>>> know, the
>>> physics says I need to square the voltage measure.
>>>
>>> I have to calibrate the mathematical law and I have two points:
>>> 0W -> 0V
>>> <nominal power> -> <voltage at nominal power>
>>>
>>> That could be enough, but we noticed a different relation between volt
>>> and watt
>>> at intermediate points. I, as the software engineer, have to try to
>>> compensate
>>> differences from the theory, without increasing complexity during
>>> calibration.
>>>
>>> My idea is to calibrate the exponent: it is normally 2.00, but I can
>>> calibrate
>>> from 1.00 to 3.00.
>>> In this way, the two old calibration points are the same as before.
>>> So the
>>> exponent (the third calibration measure) can be changed at last.
>>>
>>> The problem is pow() function with double arguments takes a lot of
>>> time to
>>> finish.  Do you suggest a mathematical method to reduce its complexity?
>>>
>>>
>>> uint16_t power_nominal = 1500;   // In Watt
>>> uint16_t volt_nominal;   // Volt measured at nominal power
>>> signed uint8_t exp_corr = -100 to +100;
>>> double exp = 2.00 + exp_corr;
>>>
>>> uint16_t volt = adc_convert(...);  // Actual volt measure
>>> double alpha = (double)power_nominal / pow((double)volt_nominal, exp);
>>> uint32_t watt = alpha * pow((double)volt, exp);
>>>
>>>
>>> alpha can be pre-calculated, because power_nominal, volt_nominal and
>>> exp are
>>> constant (after calibration). The last instruction is the problem.
>>
>> No, the "problem" lies in your transducer/measurement error.
>> The definition of a "watt" (power) doesn't change just because your
>> observations of that APPARENT relationship (V ~ W) "has issues".
>>
>> Perhaps your load's characteristics are changing as a function
>> of operating point.  Or, nonlinearities in your measurement system.
>> Or, ...
>>
>> Ask yourself WHY the exponent needs to be changed.  I suggest you
>> don't have an accurate model of your load and its excitation.
>> Until you do, how will you know that this is the CORRECT means of
>> compensating your model to agree with your observations?
>
>
> I know the problem is in the poor quality of the transducer, but I'm
> only in charge of the software and the hardware engineer can't fix it
> (often the software solves hardware issues).
>
> So I need a more complex law. The quadratic law (one parameter) can be
> calibrated with a single measure (nominal value). The generic power law
> (exponent not exactly equals to 2, two parameters) needs two calibration
> measures and has a nice feature: it's very simple to calibrate in two
> steps.
>
> The input section has an hardware calibration, a simple digital trimmer.
> So the first step is to calculate the power from the measured voltage
> with the following formula:
>   P = Pn / (Vn ^ 2) * (V ^ 2)
> where Pn is the nominal power and Vn is the voltage needed at nominal
> power.  The user increase/decrease the trimmer pot until the correct
> power is displayed.
>
> Second step. Change the power to another value (half of nominal power,
> for example). If the transducer works as in theory, the measured power
> is correct. Otherwise the user increase/decrease the exponent until the
> power displayed is correct. The power is calculated as:
>   P = Pn / (Vn ^ exp) * (V ^ exp)
>
> After the second step, we are sure the first calibration point is yet
> valid, because that formula is correct when V=Vn, even if exp isn't 2.
>
>
> If I use the linear law P=AV^2+BV, I think the two calibration steps
> aren't indipendent: the operator should execute two measures, the system
> should save the two couples (P,V) and only after that calculate A and B
> coefficients.
>
>
> It seems to me the exponentiation law is simpler during calibration.

I don't know that complicating your power calculation is the right way 
to go.  Even if you do, why do you thing adjusting the exponent is the 
right compensation?  There are any number of other ways the values you 
are measuring could be out.

Can you measure the *actual* voltage the transducer is measuring?  How 
are you getting the power measurement to compare to your calculations? 
What is the device which is the load for this calculation?

Rather than fudging the calculation, maybe it is simpler to figure out 
how the measurement is out and correct that before you perform the power 
calculation.

-- 

Rick C

[toc] | [prev] | [next] | [standalone]


#25070

Fromlasselangwadtchristensen@gmail.com
Date2016-09-22 14:44 -0700
Message-ID<ad202ba9-063d-4b4c-8ff4-f920447275fe@googlegroups.com>
In reply to#25069
Den torsdag den 22. september 2016 kl. 23.32.03 UTC+2 skrev rickman:
> On 9/22/2016 5:10 PM, pozz wrote:
> > Il 22/09/2016 16:17, Don Y ha scritto:
> >> On 9/22/2016 6:36 AM, pozz wrote:
> >>> I have to convert voltage measure (Volt) into power (Watt).  As you
> >>> know, the
> >>> physics says I need to square the voltage measure.
> >>>
> >>> I have to calibrate the mathematical law and I have two points:
> >>> 0W -> 0V
> >>> <nominal power> -> <voltage at nominal power>
> >>>
> >>> That could be enough, but we noticed a different relation between volt
> >>> and watt
> >>> at intermediate points. I, as the software engineer, have to try to
> >>> compensate
> >>> differences from the theory, without increasing complexity during
> >>> calibration.
> >>>
> >>> My idea is to calibrate the exponent: it is normally 2.00, but I can
> >>> calibrate
> >>> from 1.00 to 3.00.
> >>> In this way, the two old calibration points are the same as before.
> >>> So the
> >>> exponent (the third calibration measure) can be changed at last.
> >>>
> >>> The problem is pow() function with double arguments takes a lot of
> >>> time to
> >>> finish.  Do you suggest a mathematical method to reduce its complexity?
> >>>
> >>>
> >>> uint16_t power_nominal = 1500;   // In Watt
> >>> uint16_t volt_nominal;   // Volt measured at nominal power
> >>> signed uint8_t exp_corr = -100 to +100;
> >>> double exp = 2.00 + exp_corr;
> >>>
> >>> uint16_t volt = adc_convert(...);  // Actual volt measure
> >>> double alpha = (double)power_nominal / pow((double)volt_nominal, exp);
> >>> uint32_t watt = alpha * pow((double)volt, exp);
> >>>
> >>>
> >>> alpha can be pre-calculated, because power_nominal, volt_nominal and
> >>> exp are
> >>> constant (after calibration). The last instruction is the problem.
> >>
> >> No, the "problem" lies in your transducer/measurement error.
> >> The definition of a "watt" (power) doesn't change just because your
> >> observations of that APPARENT relationship (V ~ W) "has issues".
> >>
> >> Perhaps your load's characteristics are changing as a function
> >> of operating point.  Or, nonlinearities in your measurement system.
> >> Or, ...
> >>
> >> Ask yourself WHY the exponent needs to be changed.  I suggest you
> >> don't have an accurate model of your load and its excitation.
> >> Until you do, how will you know that this is the CORRECT means of
> >> compensating your model to agree with your observations?
> >
> >
> > I know the problem is in the poor quality of the transducer, but I'm
> > only in charge of the software and the hardware engineer can't fix it
> > (often the software solves hardware issues).
> >
> > So I need a more complex law. The quadratic law (one parameter) can be
> > calibrated with a single measure (nominal value). The generic power law
> > (exponent not exactly equals to 2, two parameters) needs two calibration
> > measures and has a nice feature: it's very simple to calibrate in two
> > steps.
> >
> > The input section has an hardware calibration, a simple digital trimmer.
> > So the first step is to calculate the power from the measured voltage
> > with the following formula:
> >   P = Pn / (Vn ^ 2) * (V ^ 2)
> > where Pn is the nominal power and Vn is the voltage needed at nominal
> > power.  The user increase/decrease the trimmer pot until the correct
> > power is displayed.
> >
> > Second step. Change the power to another value (half of nominal power,
> > for example). If the transducer works as in theory, the measured power
> > is correct. Otherwise the user increase/decrease the exponent until the
> > power displayed is correct. The power is calculated as:
> >   P = Pn / (Vn ^ exp) * (V ^ exp)
> >
> > After the second step, we are sure the first calibration point is yet
> > valid, because that formula is correct when V=Vn, even if exp isn't 2.
> >
> >
> > If I use the linear law P=AV^2+BV, I think the two calibration steps
> > aren't indipendent: the operator should execute two measures, the system
> > should save the two couples (P,V) and only after that calculate A and B
> > coefficients.
> >
> >
> > It seems to me the exponentiation law is simpler during calibration.
> 
> I don't know that complicating your power calculation is the right way 
> to go.  Even if you do, why do you thing adjusting the exponent is the 
> right compensation?  There are any number of other ways the values you 
> are measuring could be out.
> 
> Can you measure the *actual* voltage the transducer is measuring?  How 
> are you getting the power measurement to compare to your calculations? 
> What is the device which is the load for this calculation?
> 
> Rather than fudging the calculation, maybe it is simpler to figure out 
> how the measurement is out and correct that before you perform the power 
> calculation.
> 

yeh, the voltage measurement being out is going to have a different impact 
than a changing load resistance 

[toc] | [prev] | [next] | [standalone]


#25076

Frompozz <pozzugno@gmail.com>
Date2016-09-23 09:03 +0200
Message-ID<ns2k48$3e0$1@dont-email.me>
In reply to#25069
Il 22/09/2016 23:31, rickman ha scritto:
> On 9/22/2016 5:10 PM, pozz wrote:
>> Il 22/09/2016 16:17, Don Y ha scritto:
>>> On 9/22/2016 6:36 AM, pozz wrote:
>>>> I have to convert voltage measure (Volt) into power (Watt).  As you
>>>> know, the
>>>> physics says I need to square the voltage measure.
>>>>
>>>> I have to calibrate the mathematical law and I have two points:
>>>> 0W -> 0V
>>>> <nominal power> -> <voltage at nominal power>
>>>>
>>>> That could be enough, but we noticed a different relation between volt
>>>> and watt
>>>> at intermediate points. I, as the software engineer, have to try to
>>>> compensate
>>>> differences from the theory, without increasing complexity during
>>>> calibration.
>>>>
>>>> My idea is to calibrate the exponent: it is normally 2.00, but I can
>>>> calibrate
>>>> from 1.00 to 3.00.
>>>> In this way, the two old calibration points are the same as before.
>>>> So the
>>>> exponent (the third calibration measure) can be changed at last.
>>>>
>>>> The problem is pow() function with double arguments takes a lot of
>>>> time to
>>>> finish.  Do you suggest a mathematical method to reduce its complexity?
>>>>
>>>>
>>>> uint16_t power_nominal = 1500;   // In Watt
>>>> uint16_t volt_nominal;   // Volt measured at nominal power
>>>> signed uint8_t exp_corr = -100 to +100;
>>>> double exp = 2.00 + exp_corr;
>>>>
>>>> uint16_t volt = adc_convert(...);  // Actual volt measure
>>>> double alpha = (double)power_nominal / pow((double)volt_nominal, exp);
>>>> uint32_t watt = alpha * pow((double)volt, exp);
>>>>
>>>>
>>>> alpha can be pre-calculated, because power_nominal, volt_nominal and
>>>> exp are
>>>> constant (after calibration). The last instruction is the problem.
>>>
>>> No, the "problem" lies in your transducer/measurement error.
>>> The definition of a "watt" (power) doesn't change just because your
>>> observations of that APPARENT relationship (V ~ W) "has issues".
>>>
>>> Perhaps your load's characteristics are changing as a function
>>> of operating point.  Or, nonlinearities in your measurement system.
>>> Or, ...
>>>
>>> Ask yourself WHY the exponent needs to be changed.  I suggest you
>>> don't have an accurate model of your load and its excitation.
>>> Until you do, how will you know that this is the CORRECT means of
>>> compensating your model to agree with your observations?
>>
>>
>> I know the problem is in the poor quality of the transducer, but I'm
>> only in charge of the software and the hardware engineer can't fix it
>> (often the software solves hardware issues).
>>
>> So I need a more complex law. The quadratic law (one parameter) can be
>> calibrated with a single measure (nominal value). The generic power law
>> (exponent not exactly equals to 2, two parameters) needs two calibration
>> measures and has a nice feature: it's very simple to calibrate in two
>> steps.
>>
>> The input section has an hardware calibration, a simple digital trimmer.
>> So the first step is to calculate the power from the measured voltage
>> with the following formula:
>>   P = Pn / (Vn ^ 2) * (V ^ 2)
>> where Pn is the nominal power and Vn is the voltage needed at nominal
>> power.  The user increase/decrease the trimmer pot until the correct
>> power is displayed.
>>
>> Second step. Change the power to another value (half of nominal power,
>> for example). If the transducer works as in theory, the measured power
>> is correct. Otherwise the user increase/decrease the exponent until the
>> power displayed is correct. The power is calculated as:
>>   P = Pn / (Vn ^ exp) * (V ^ exp)
>>
>> After the second step, we are sure the first calibration point is yet
>> valid, because that formula is correct when V=Vn, even if exp isn't 2.
>>
>>
>> If I use the linear law P=AV^2+BV, I think the two calibration steps
>> aren't indipendent: the operator should execute two measures, the system
>> should save the two couples (P,V) and only after that calculate A and B
>> coefficients.
>>
>>
>> It seems to me the exponentiation law is simpler during calibration.
>
> I don't know that complicating your power calculation is the right way
> to go.  Even if you do, why do you thing adjusting the exponent is the
> right compensation?  There are any number of other ways the values you
> are measuring could be out.

I know exponentiation could be not the optimum compensation, but I don't 
need it.  The transducer is similar to the theoric model (square law), 
but it differs from it a little.  I need only a mathematical trick to 
change slightly the shape of the square curve... and keeping simple the 
calibration of this new shape.

I found changing exponent is good in my application, because I'm sure it 
is exact at three points (0, Pn/2, Pn) and good at other points.
I don't need high accuracy in the reading.


> Can you measure the *actual* voltage the transducer is measuring?

Yes.


> How
> are you getting the power measurement to compare to your calculations?

Power meter.


> What is the device which is the load for this calculation?

The load is an RF amplifier.


> Rather than fudging the calculation, maybe it is simpler to figure out
> how the measurement is out and correct that before you perform the power
> calculation.

The measure on the field is similar to the theory (square law). 
Unfortunately it isn't exactly a square law (don't ask why, I don't 
know), so I'm finding a mathematical trick to change *a little* the 
shape of the square law.

[toc] | [prev] | [next] | [standalone]


#25078

FromPaul Rubin <no.email@nospam.invalid>
Date2016-09-23 00:17 -0700
Message-ID<87twd79jbn.fsf@jester.gateway.pace.com>
In reply to#25076
pozz <pozzugno@gmail.com> writes:
> I found changing exponent is good in my application, because I'm sure
> it is exact at three points (0, Pn/2, Pn) and good at other points.

I'm real skeptical, and anyway the exponent should vary at most over a
small range, like 1.98 to 2.02, not 1 to 3.  In that small range you can
approximate as e=2 and make a small correction with a term or two of the
infinite series for exp.

[toc] | [prev] | [next] | [standalone]


#25101

FromTauno Voipio <tauno.voipio@notused.fi.invalid>
Date2016-09-23 22:45 +0300
Message-ID<ns40oc$vkm$1@dont-email.me>
In reply to#25076
On 23.9.16 10:03, pozz wrote:
> Il 22/09/2016 23:31, rickman ha scritto:
>> On 9/22/2016 5:10 PM, pozz wrote:
>>> Il 22/09/2016 16:17, Don Y ha scritto:
>>>> On 9/22/2016 6:36 AM, pozz wrote:
>
>> How
>> are you getting the power measurement to compare to your calculations?
>
> Power meter.
>
>
>> What is the device which is the load for this calculation?
>
> The load is an RF amplifier.


A RF power amplifier usually reacts non-linearly to changes
in main supply voltage (plate/clooector/drain feed). In AM
transmitters special measures are taken to create a linear
realtionship between modulating voltage and output amplitude,
which would be the square law you're after.

For measuring the RF output, nothing beats a RF directional
wattmeter.

Please note that if the load behaves non-linearly or changes
its impedance, the relation between supply voltage and output
power will also change, often in a non-predicatable way.

-- 

-TV

[toc] | [prev] | [next] | [standalone]


#25071

Fromrickman <gnuarm@gmail.com>
Date2016-09-22 17:44 -0400
Message-ID<ns1jc0$igt$1@dont-email.me>
In reply to#25066
On 9/22/2016 5:10 PM, pozz wrote:
> Il 22/09/2016 16:17, Don Y ha scritto:
>> On 9/22/2016 6:36 AM, pozz wrote:
>>> I have to convert voltage measure (Volt) into power (Watt).  As you
>>> know, the
>>> physics says I need to square the voltage measure.
>>>
>>> I have to calibrate the mathematical law and I have two points:
>>> 0W -> 0V
>>> <nominal power> -> <voltage at nominal power>
>>>
>>> That could be enough, but we noticed a different relation between volt
>>> and watt
>>> at intermediate points. I, as the software engineer, have to try to
>>> compensate
>>> differences from the theory, without increasing complexity during
>>> calibration.
>>>
>>> My idea is to calibrate the exponent: it is normally 2.00, but I can
>>> calibrate
>>> from 1.00 to 3.00.
>>> In this way, the two old calibration points are the same as before.
>>> So the
>>> exponent (the third calibration measure) can be changed at last.
>>>
>>> The problem is pow() function with double arguments takes a lot of
>>> time to
>>> finish.  Do you suggest a mathematical method to reduce its complexity?
>>>
>>>
>>> uint16_t power_nominal = 1500;   // In Watt
>>> uint16_t volt_nominal;   // Volt measured at nominal power
>>> signed uint8_t exp_corr = -100 to +100;
>>> double exp = 2.00 + exp_corr;
>>>
>>> uint16_t volt = adc_convert(...);  // Actual volt measure
>>> double alpha = (double)power_nominal / pow((double)volt_nominal, exp);
>>> uint32_t watt = alpha * pow((double)volt, exp);
>>>
>>>
>>> alpha can be pre-calculated, because power_nominal, volt_nominal and
>>> exp are
>>> constant (after calibration). The last instruction is the problem.
>>
>> No, the "problem" lies in your transducer/measurement error.
>> The definition of a "watt" (power) doesn't change just because your
>> observations of that APPARENT relationship (V ~ W) "has issues".
>>
>> Perhaps your load's characteristics are changing as a function
>> of operating point.  Or, nonlinearities in your measurement system.
>> Or, ...
>>
>> Ask yourself WHY the exponent needs to be changed.  I suggest you
>> don't have an accurate model of your load and its excitation.
>> Until you do, how will you know that this is the CORRECT means of
>> compensating your model to agree with your observations?
>
>
> I know the problem is in the poor quality of the transducer, but I'm
> only in charge of the software and the hardware engineer can't fix it
> (often the software solves hardware issues).
>
> So I need a more complex law. The quadratic law (one parameter) can be
> calibrated with a single measure (nominal value). The generic power law
> (exponent not exactly equals to 2, two parameters) needs two calibration
> measures and has a nice feature: it's very simple to calibrate in two
> steps.
>
> The input section has an hardware calibration, a simple digital trimmer.
> So the first step is to calculate the power from the measured voltage
> with the following formula:
>   P = Pn / (Vn ^ 2) * (V ^ 2)
> where Pn is the nominal power and Vn is the voltage needed at nominal
> power.  The user increase/decrease the trimmer pot until the correct
> power is displayed.
>
> Second step. Change the power to another value (half of nominal power,
> for example). If the transducer works as in theory, the measured power
> is correct. Otherwise the user increase/decrease the exponent until the
> power displayed is correct. The power is calculated as:
>   P = Pn / (Vn ^ exp) * (V ^ exp)
>
> After the second step, we are sure the first calibration point is yet
> valid, because that formula is correct when V=Vn, even if exp isn't 2.

I think your equation is not written in a clear way.  I think what you 
mean is this...

P = Pn * (V ^ exp) / (Vn ^ exp)

Now the equation makes sense to me.  But that still doesn't mean it will 
give close to correct values anywhere other than the calibration points.

Have you considered...

P = Pn * (V / Vn) ^ exp

Then there are an infinite set of other corrections you could use.  The 
question is which ones are more accurate?

Have you looked at a range of data to see what the correction curve 
needs to be?

-- 

Rick C

[toc] | [prev] | [next] | [standalone]


#25077

Frompozz <pozzugno@gmail.com>
Date2016-09-23 09:08 +0200
Message-ID<ns2kci$4oq$1@dont-email.me>
In reply to#25071
Il 22/09/2016 23:44, rickman ha scritto:
> On 9/22/2016 5:10 PM, pozz wrote:
>> Il 22/09/2016 16:17, Don Y ha scritto:
>>> On 9/22/2016 6:36 AM, pozz wrote:
>>>> I have to convert voltage measure (Volt) into power (Watt).  As you
>>>> know, the
>>>> physics says I need to square the voltage measure.
>>>>
>>>> I have to calibrate the mathematical law and I have two points:
>>>> 0W -> 0V
>>>> <nominal power> -> <voltage at nominal power>
>>>>
>>>> That could be enough, but we noticed a different relation between volt
>>>> and watt
>>>> at intermediate points. I, as the software engineer, have to try to
>>>> compensate
>>>> differences from the theory, without increasing complexity during
>>>> calibration.
>>>>
>>>> My idea is to calibrate the exponent: it is normally 2.00, but I can
>>>> calibrate
>>>> from 1.00 to 3.00.
>>>> In this way, the two old calibration points are the same as before.
>>>> So the
>>>> exponent (the third calibration measure) can be changed at last.
>>>>
>>>> The problem is pow() function with double arguments takes a lot of
>>>> time to
>>>> finish.  Do you suggest a mathematical method to reduce its complexity?
>>>>
>>>>
>>>> uint16_t power_nominal = 1500;   // In Watt
>>>> uint16_t volt_nominal;   // Volt measured at nominal power
>>>> signed uint8_t exp_corr = -100 to +100;
>>>> double exp = 2.00 + exp_corr;
>>>>
>>>> uint16_t volt = adc_convert(...);  // Actual volt measure
>>>> double alpha = (double)power_nominal / pow((double)volt_nominal, exp);
>>>> uint32_t watt = alpha * pow((double)volt, exp);
>>>>
>>>>
>>>> alpha can be pre-calculated, because power_nominal, volt_nominal and
>>>> exp are
>>>> constant (after calibration). The last instruction is the problem.
>>>
>>> No, the "problem" lies in your transducer/measurement error.
>>> The definition of a "watt" (power) doesn't change just because your
>>> observations of that APPARENT relationship (V ~ W) "has issues".
>>>
>>> Perhaps your load's characteristics are changing as a function
>>> of operating point.  Or, nonlinearities in your measurement system.
>>> Or, ...
>>>
>>> Ask yourself WHY the exponent needs to be changed.  I suggest you
>>> don't have an accurate model of your load and its excitation.
>>> Until you do, how will you know that this is the CORRECT means of
>>> compensating your model to agree with your observations?
>>
>>
>> I know the problem is in the poor quality of the transducer, but I'm
>> only in charge of the software and the hardware engineer can't fix it
>> (often the software solves hardware issues).
>>
>> So I need a more complex law. The quadratic law (one parameter) can be
>> calibrated with a single measure (nominal value). The generic power law
>> (exponent not exactly equals to 2, two parameters) needs two calibration
>> measures and has a nice feature: it's very simple to calibrate in two
>> steps.
>>
>> The input section has an hardware calibration, a simple digital trimmer.
>> So the first step is to calculate the power from the measured voltage
>> with the following formula:
>>   P = Pn / (Vn ^ 2) * (V ^ 2)
>> where Pn is the nominal power and Vn is the voltage needed at nominal
>> power.  The user increase/decrease the trimmer pot until the correct
>> power is displayed.
>>
>> Second step. Change the power to another value (half of nominal power,
>> for example). If the transducer works as in theory, the measured power
>> is correct. Otherwise the user increase/decrease the exponent until the
>> power displayed is correct. The power is calculated as:
>>   P = Pn / (Vn ^ exp) * (V ^ exp)
>>
>> After the second step, we are sure the first calibration point is yet
>> valid, because that formula is correct when V=Vn, even if exp isn't 2.
>
> I think your equation is not written in a clear way.  I think what you
> mean is this...
>
> P = Pn * (V ^ exp) / (Vn ^ exp)

IMHO, they are identical mathematical expressions.


> Now the equation makes sense to me.  But that still doesn't mean it will
> give close to correct values anywhere other than the calibration points.

Yes, I have tried and this mathematical law could be ok for my application.


> Have you considered...
>
> P = Pn * (V / Vn) ^ exp

Again IMHO, this is identical to the above expressions.


> Then there are an infinite set of other corrections you could use.  The
> question is which ones are more accurate?

I don't need to increase accuracy.  I only need a little compensation of 
the square law.  The calibration process of the mathematical model 
should be simple.


> Have you looked at a range of data to see what the correction curve
> needs to be?

Yes, and it is somewhat a square law.  In some cases, I need to change 
the shape of the square law a little.

[toc] | [prev] | [next] | [standalone]


#25102

Fromrickman <gnuarm@gmail.com>
Date2016-09-24 01:54 -0400
Message-ID<ns54en$mof$1@dont-email.me>
In reply to#25077
On 9/23/2016 3:08 AM, pozz wrote:
> Il 22/09/2016 23:44, rickman ha scritto:
>> On 9/22/2016 5:10 PM, pozz wrote:
>>> Il 22/09/2016 16:17, Don Y ha scritto:
>>>> On 9/22/2016 6:36 AM, pozz wrote:
>>>>> I have to convert voltage measure (Volt) into power (Watt).  As you
>>>>> know, the
>>>>> physics says I need to square the voltage measure.
>>>>>
>>>>> I have to calibrate the mathematical law and I have two points:
>>>>> 0W -> 0V
>>>>> <nominal power> -> <voltage at nominal power>
>>>>>
>>>>> That could be enough, but we noticed a different relation between volt
>>>>> and watt
>>>>> at intermediate points. I, as the software engineer, have to try to
>>>>> compensate
>>>>> differences from the theory, without increasing complexity during
>>>>> calibration.
>>>>>
>>>>> My idea is to calibrate the exponent: it is normally 2.00, but I can
>>>>> calibrate
>>>>> from 1.00 to 3.00.
>>>>> In this way, the two old calibration points are the same as before.
>>>>> So the
>>>>> exponent (the third calibration measure) can be changed at last.
>>>>>
>>>>> The problem is pow() function with double arguments takes a lot of
>>>>> time to
>>>>> finish.  Do you suggest a mathematical method to reduce its
>>>>> complexity?
>>>>>
>>>>>
>>>>> uint16_t power_nominal = 1500;   // In Watt
>>>>> uint16_t volt_nominal;   // Volt measured at nominal power
>>>>> signed uint8_t exp_corr = -100 to +100;
>>>>> double exp = 2.00 + exp_corr;
>>>>>
>>>>> uint16_t volt = adc_convert(...);  // Actual volt measure
>>>>> double alpha = (double)power_nominal / pow((double)volt_nominal, exp);
>>>>> uint32_t watt = alpha * pow((double)volt, exp);
>>>>>
>>>>>
>>>>> alpha can be pre-calculated, because power_nominal, volt_nominal and
>>>>> exp are
>>>>> constant (after calibration). The last instruction is the problem.
>>>>
>>>> No, the "problem" lies in your transducer/measurement error.
>>>> The definition of a "watt" (power) doesn't change just because your
>>>> observations of that APPARENT relationship (V ~ W) "has issues".
>>>>
>>>> Perhaps your load's characteristics are changing as a function
>>>> of operating point.  Or, nonlinearities in your measurement system.
>>>> Or, ...
>>>>
>>>> Ask yourself WHY the exponent needs to be changed.  I suggest you
>>>> don't have an accurate model of your load and its excitation.
>>>> Until you do, how will you know that this is the CORRECT means of
>>>> compensating your model to agree with your observations?
>>>
>>>
>>> I know the problem is in the poor quality of the transducer, but I'm
>>> only in charge of the software and the hardware engineer can't fix it
>>> (often the software solves hardware issues).
>>>
>>> So I need a more complex law. The quadratic law (one parameter) can be
>>> calibrated with a single measure (nominal value). The generic power law
>>> (exponent not exactly equals to 2, two parameters) needs two calibration
>>> measures and has a nice feature: it's very simple to calibrate in two
>>> steps.
>>>
>>> The input section has an hardware calibration, a simple digital trimmer.
>>> So the first step is to calculate the power from the measured voltage
>>> with the following formula:
>>>   P = Pn / (Vn ^ 2) * (V ^ 2)
>>> where Pn is the nominal power and Vn is the voltage needed at nominal
>>> power.  The user increase/decrease the trimmer pot until the correct
>>> power is displayed.
>>>
>>> Second step. Change the power to another value (half of nominal power,
>>> for example). If the transducer works as in theory, the measured power
>>> is correct. Otherwise the user increase/decrease the exponent until the
>>> power displayed is correct. The power is calculated as:
>>>   P = Pn / (Vn ^ exp) * (V ^ exp)
>>>
>>> After the second step, we are sure the first calibration point is yet
>>> valid, because that formula is correct when V=Vn, even if exp isn't 2.
>>
>> I think your equation is not written in a clear way.  I think what you
>> mean is this...
>>
>> P = Pn * (V ^ exp) / (Vn ^ exp)
>
> IMHO, they are identical mathematical expressions.

It is equivalent, but the way you wrote it the order of operations has 
to be implied by the standard rules.  I typically don't write a division 
that way because often the equation really intended is

A = B / (C * D) rather than A = (B / C) * D

which are *not* equivalent.  So

A = B * D / C is more clear, to me anyway.  Or supply the parentheses.


>> Now the equation makes sense to me.  But that still doesn't mean it will
>> give close to correct values anywhere other than the calibration points.
>
> Yes, I have tried and this mathematical law could be ok for my application.
>
>
>> Have you considered...
>>
>> P = Pn * (V / Vn) ^ exp
>
> Again IMHO, this is identical to the above expressions.

Yeah, I got wrapped around the axle on this thinking of logs.  A 
division before taking the log is equivalent to adding the logs of the 
two values.

Still, again, this is a more clear way to write what you are doing.  The 
value Vn is just a scale factor.  Why complicated it by taking the 
exponent and dividing after the exponent is taken of the value measured? 
  At least this is more clear to me.


>> Then there are an infinite set of other corrections you could use.  The
>> question is which ones are more accurate?
>
> I don't need to increase accuracy.  I only need a little compensation of
> the square law.  The calibration process of the mathematical model
> should be simple.

Isn't the "compensation" to get better accuracy?


>> Have you looked at a range of data to see what the correction curve
>> needs to be?
>
> Yes, and it is somewhat a square law.  In some cases, I need to change
> the shape of the square law a little.

"A little" is a poor way to describe this.  There are many ways to 
correct your data.  You have chosen one that you find hard to calculate 
quickly enough.  So why not consider others which can be evaluated more 
quickly?  Others have given you other approaches.  I suggest you 
consider them more carefully and not wed yourself to using a variable 
exponent.  You say it is easy for the user to calibrate, but really you 
are saying it is easy for *you* to write the calibration algorithm.  If 
you can do the calibration with two measurements with your variable 
exponent, you can do a calibration with an x^3 term with two 
measurements.  The user doesn't need to know what the software is doing 
with those measurements.

-- 

Rick C

[toc] | [prev] | [next] | [standalone]


#25072

FromDon Y <blockedofcourse@foo.invalid>
Date2016-09-22 14:50 -0700
Message-ID<ns1jmm$jk0$1@dont-email.me>
In reply to#25066
On 9/22/2016 2:10 PM, pozz wrote:

>  > No, the "problem" lies in your transducer/measurement error.
>  > The definition of a "watt" (power) doesn't change just because your
>  > observations of that APPARENT relationship (V ~ W) "has issues".
>  >
>  > Perhaps your load's characteristics are changing as a function
>  > of operating point.  Or, nonlinearities in your measurement system.
>  > Or, ...
>  >
>  > Ask yourself WHY the exponent needs to be changed.  I suggest you
>  > don't have an accurate model of your load and its excitation.
>  > Until you do, how will you know that this is the CORRECT means of
>  > compensating your model to agree with your observations?
>
> I know the problem is in the poor quality of the transducer, but I'm only in
> charge of the software and the hardware engineer can't fix it (often the
> software solves hardware issues).
>
> So I need a more complex law. The quadratic law (one parameter) can be
> calibrated with a single measure (nominal value). The generic power law
> (exponent not exactly equals to 2, two parameters) needs two calibration
> measures and has a nice feature: it's very simple to calibrate in two steps.

Backup.

You're calibrating because, presumably, you need *some* degree of accuracy.
How (formally) has that been specified?  Percent of reading?  Percent of
range?  etc.

This tells you how "good" your model of the load must represent the
ACTUAL load, as viewed from the standpoint of your *single* measurement
device.  So far, you appear to only be considering fitting a curve
to two points:
- 0V (= 0 power!)
- Vmax (= some particular power)

Yet, you seem to care about the values between 0 and Vmax.

How *much* do you care about them?  If you are only operating at the
0 & Vmax points on the curve, then you don't need to fit an equation;
just store:
    (0V, 0W)
and
    (Vmax, Pmax)

[Obviously, this is not the case!]

> The input section has an hardware calibration, a simple digital trimmer.
> So the first step is to calculate the power from the measured voltage with the
> following formula:
>    P = Pn / (Vn ^ 2) * (V ^ 2)
> where Pn is the nominal power and Vn is the voltage needed at nominal power.

But, you aren't *controlling* any of these things (?) rather, just
*sensing* them (i.e., someone tells you "this is a load of X" while
you examine a sensed parameter -- voltage -- to correlate with that
declaration).

> The user increase/decrease the trimmer pot until the correct power is displayed.

What is your *load*?  If purely resistive, does it have a temperature
coefficient?  (e.g., if you left it operating at Pmax, would you see
changes)

In operation, do you expect the load to be "static"?  Or, time varying?
Does the load's impedance change based on how *it* is driven?  etc.

> Second step. Change the power to another value (half of nominal power, for
> example). If the transducer works as in theory, the measured power is correct.
> Otherwise the user increase/decrease the exponent until the power displayed is
> correct. The power is calculated as:
>    P = Pn / (Vn ^ exp) * (V ^ exp)
>
> After the second step, we are sure the first calibration point is yet valid,
> because that formula is correct when V=Vn, even if exp isn't 2.
>
> If I use the linear law P=AV^2+BV, I think the two calibration steps aren't
> indipendent: the operator should execute two measures, the system should save
> the two couples (P,V) and only after that calculate A and B coefficients.
>
> It seems to me the exponentiation law is simpler during calibration.

Your concern should be that of how *accurate* the proposed calibration
will be, in the context of the specifications governing that accuracy.
Unless you know how your load behaves, how can you begin to analyze how
well your model (equation) will fit its observed behavior?

Someone (customer) will apply your device and complain that the accuracy
AT THEIR PARTICULAR OPERATING POINT sucks.  Regardless of how accurate it
is at "0" and "Pmax" (and P/2).

Understand the load, first.  This gives you an idea of what *style* of
model you should be using.  Then, design the calibration procedure to
exploit that model as appropriate.

E.g., if you have a linear relationship, you know you just need to address
offset and span.  Higher order models can require more tweaking ESPECIALLY
IF THE MODEL IS JUST AN APPROXIMATION to the actual behavior.  You need to know
where the errors are likely to lie -- both in the circuit's performance
AND the model's idea of how it "should" be behaving.

Lastly, do yourself (your company) a BIG favor and let the device calibrate
itself (esp at run-time, if possible) *or* have a jig that automates the
process at Final Test -- it will pay for itself overnight!

[E.g., connect device to harness/fixture; invoke magic incantation to
start calibration procedure; device TELLS fixture to apply LOAD1; device
measures V1; device tells fixture to apply LOAD2; device measures V2;
lather, rinse, repeat; device figures out coefficients to fit model
to observations as good as possible (using some criteria for "good")
and stores calibration parameters -- OR, sounds alarm indicating
calibration not possible (FAIL)]

[toc] | [prev] | [next] | [standalone]


#25080

Frompozz <pozzugno@gmail.com>
Date2016-09-23 09:23 +0200
Message-ID<ns2l98$789$1@dont-email.me>
In reply to#25072
Il 22/09/2016 23:50, Don Y ha scritto:
> On 9/22/2016 2:10 PM, pozz wrote:
>
>>  > No, the "problem" lies in your transducer/measurement error.
>>  > The definition of a "watt" (power) doesn't change just because your
>>  > observations of that APPARENT relationship (V ~ W) "has issues".
>>  >
>>  > Perhaps your load's characteristics are changing as a function
>>  > of operating point.  Or, nonlinearities in your measurement system.
>>  > Or, ...
>>  >
>>  > Ask yourself WHY the exponent needs to be changed.  I suggest you
>>  > don't have an accurate model of your load and its excitation.
>>  > Until you do, how will you know that this is the CORRECT means of
>>  > compensating your model to agree with your observations?
>>
>> I know the problem is in the poor quality of the transducer, but I'm
>> only in
>> charge of the software and the hardware engineer can't fix it (often the
>> software solves hardware issues).
>>
>> So I need a more complex law. The quadratic law (one parameter) can be
>> calibrated with a single measure (nominal value). The generic power law
>> (exponent not exactly equals to 2, two parameters) needs two calibration
>> measures and has a nice feature: it's very simple to calibrate in two
>> steps.
>
> Backup.
>
> You're calibrating because, presumably, you need *some* degree of accuracy.
> How (formally) has that been specified?  Percent of reading?  Percent of
> range?  etc.
>
> This tells you how "good" your model of the load must represent the
> ACTUAL load, as viewed from the standpoint of your *single* measurement
> device.  So far, you appear to only be considering fitting a curve
> to two points:
> - 0V (= 0 power!)
> - Vmax (= some particular power)
>
> Yet, you seem to care about the values between 0 and Vmax.
>
> How *much* do you care about them?  If you are only operating at the
> 0 & Vmax points on the curve, then you don't need to fit an equation;
> just store:
>    (0V, 0W)
> and
>    (Vmax, Pmax)
>
> [Obviously, this is not the case!]

Yes, I already made those considerations and I already tested my 
mathemaical model (exponentiation) against the correct measures made by 
a professional instrument.  I found exponentiation (after calibration) 
is good for the accuracy I need in the application.


>> The input section has an hardware calibration, a simple digital trimmer.
>> So the first step is to calculate the power from the measured voltage
>> with the
>> following formula:
>>    P = Pn / (Vn ^ 2) * (V ^ 2)
>> where Pn is the nominal power and Vn is the voltage needed at nominal
>> power.
>
> But, you aren't *controlling* any of these things (?) rather, just
> *sensing* them (i.e., someone tells you "this is a load of X" while
> you examine a sensed parameter -- voltage -- to correlate with that
> declaration).

The operator enters nominal power Pn (depending on the machine under 
test). The voltage needed at nominal power Vn is fixed (somewhat at 80% 
of the ADC input range, 0-4.096V = 3276 points).
During first step calibration, the operator actually changes the trimmer 
position until the input voltage to the ADC is Vn (the ADC conversion 
value is 3276 points).


>> The user increase/decrease the trimmer pot until the correct power is
>> displayed.
>
> What is your *load*?  If purely resistive, does it have a temperature
> coefficient?  (e.g., if you left it operating at Pmax, would you see
> changes)
>
> In operation, do you expect the load to be "static"?  Or, time varying?
> Does the load's impedance change based on how *it* is driven?  etc.

I don't care the load.  I'm only working on the power transducer.  If 
the load changes (because of temperature, degradation, ...), the output 
signal of transducer will change accordingly and the power reading will 
change too.


>> Second step. Change the power to another value (half of nominal power,
>> for
>> example). If the transducer works as in theory, the measured power is
>> correct.
>> Otherwise the user increase/decrease the exponent until the power
>> displayed is
>> correct. The power is calculated as:
>>    P = Pn / (Vn ^ exp) * (V ^ exp)
>>
>> After the second step, we are sure the first calibration point is yet
>> valid,
>> because that formula is correct when V=Vn, even if exp isn't 2.
>>
>> If I use the linear law P=AV^2+BV, I think the two calibration steps
>> aren't
>> indipendent: the operator should execute two measures, the system
>> should save
>> the two couples (P,V) and only after that calculate A and B coefficients.
>>
>> It seems to me the exponentiation law is simpler during calibration.
>
> Your concern should be that of how *accurate* the proposed calibration
> will be, in the context of the specifications governing that accuracy.
> Unless you know how your load behaves, how can you begin to analyze how
> well your model (equation) will fit its observed behavior?
>
> Someone (customer) will apply your device and complain that the accuracy
> AT THEIR PARTICULAR OPERATING POINT sucks.  Regardless of how accurate it
> is at "0" and "Pmax" (and P/2).
>
> Understand the load, first.  This gives you an idea of what *style* of
> model you should be using.  Then, design the calibration procedure to
> exploit that model as appropriate.

I think I'm making a measurement device.  It is independent from the 
load.  I only have to calibrate my measurement device, that is my 
transducer.

A voltage meter designer doesn't need to know the load, he only needs to 
test the transducer at different voltage levels.

For my accuracy (that isn't so high), a small change in the square shape 
law is ok.  I thought about exponentiation, because it is simple to 
calibrate.


> E.g., if you have a linear relationship, you know you just need to address
> offset and span.  Higher order models can require more tweaking ESPECIALLY
> IF THE MODEL IS JUST AN APPROXIMATION to the actual behavior.  You need
> to know
> where the errors are likely to lie -- both in the circuit's performance
> AND the model's idea of how it "should" be behaving.
>
> Lastly, do yourself (your company) a BIG favor and let the device calibrate
> itself (esp at run-time, if possible) *or* have a jig that automates the
> process at Final Test -- it will pay for itself overnight!
>
> [E.g., connect device to harness/fixture; invoke magic incantation to
> start calibration procedure; device TELLS fixture to apply LOAD1; device
> measures V1; device tells fixture to apply LOAD2; device measures V2;
> lather, rinse, repeat; device figures out coefficients to fit model
> to observations as good as possible (using some criteria for "good")
> and stores calibration parameters -- OR, sounds alarm indicating
> calibration not possible (FAIL)]

I don't need a complex model with many parameters to calibrate.  I think
   P = AX^2+BX
could be ok too as
   P = AV^exp

[toc] | [prev] | [next] | [standalone]


#25082

FromDon Y <blockedofcourse@foo.invalid>
Date2016-09-23 00:32 -0700
Message-ID<ns2lq0$8qr$1@dont-email.me>
In reply to#25080
On 9/23/2016 12:23 AM, pozz wrote:
> I don't need a complex model with many parameters to calibrate.  I think
>    P = AX^2+BX
> could be ok too as
>    P = AV^exp

Then just implement it and you're done!

[toc] | [prev] | [next] | [standalone]


#25091

FromEvgeny Filatov <e.v.filatov@ieee.org>
Date2016-09-23 12:56 +0300
Message-ID<W_6Fz.693$9A6.240@fx41.iad>
In reply to#25080
On 23.09.2016 10:23, pozz wrote:
> Il 22/09/2016 23:50, Don Y ha scritto:
>> On 9/22/2016 2:10 PM, pozz wrote:
>>
>>>  > No, the "problem" lies in your transducer/measurement error.
>>>  > The definition of a "watt" (power) doesn't change just because your
>>>  > observations of that APPARENT relationship (V ~ W) "has issues".
>>>  >
>>>  > Perhaps your load's characteristics are changing as a function
>>>  > of operating point.  Or, nonlinearities in your measurement system.
>>>  > Or, ...
>>>  >
>>>  > Ask yourself WHY the exponent needs to be changed.  I suggest you
>>>  > don't have an accurate model of your load and its excitation.
>>>  > Until you do, how will you know that this is the CORRECT means of
>>>  > compensating your model to agree with your observations?
>>>
>>> I know the problem is in the poor quality of the transducer, but I'm
>>> only in
>>> charge of the software and the hardware engineer can't fix it (often the
>>> software solves hardware issues).
>>>
>>> So I need a more complex law. The quadratic law (one parameter) can be
>>> calibrated with a single measure (nominal value). The generic power law
>>> (exponent not exactly equals to 2, two parameters) needs two calibration
>>> measures and has a nice feature: it's very simple to calibrate in two
>>> steps.
>>
>> Backup.
>>
>> You're calibrating because, presumably, you need *some* degree of
>> accuracy.
>> How (formally) has that been specified?  Percent of reading?  Percent of
>> range?  etc.
>>
>> This tells you how "good" your model of the load must represent the
>> ACTUAL load, as viewed from the standpoint of your *single* measurement
>> device.  So far, you appear to only be considering fitting a curve
>> to two points:
>> - 0V (= 0 power!)
>> - Vmax (= some particular power)
>>
>> Yet, you seem to care about the values between 0 and Vmax.
>>
>> How *much* do you care about them?  If you are only operating at the
>> 0 & Vmax points on the curve, then you don't need to fit an equation;
>> just store:
>>    (0V, 0W)
>> and
>>    (Vmax, Pmax)
>>
>> [Obviously, this is not the case!]
>
> Yes, I already made those considerations and I already tested my
> mathemaical model (exponentiation) against the correct measures made by
> a professional instrument.  I found exponentiation (after calibration)
> is good for the accuracy I need in the application.
>
>
>>> The input section has an hardware calibration, a simple digital trimmer.
>>> So the first step is to calculate the power from the measured voltage
>>> with the
>>> following formula:
>>>    P = Pn / (Vn ^ 2) * (V ^ 2)
>>> where Pn is the nominal power and Vn is the voltage needed at nominal
>>> power.
>>
>> But, you aren't *controlling* any of these things (?) rather, just
>> *sensing* them (i.e., someone tells you "this is a load of X" while
>> you examine a sensed parameter -- voltage -- to correlate with that
>> declaration).
>
> The operator enters nominal power Pn (depending on the machine under
> test). The voltage needed at nominal power Vn is fixed (somewhat at 80%
> of the ADC input range, 0-4.096V = 3276 points).
> During first step calibration, the operator actually changes the trimmer
> position until the input voltage to the ADC is Vn (the ADC conversion
> value is 3276 points).
>
>
>>> The user increase/decrease the trimmer pot until the correct power is
>>> displayed.
>>
>> What is your *load*?  If purely resistive, does it have a temperature
>> coefficient?  (e.g., if you left it operating at Pmax, would you see
>> changes)
>>
>> In operation, do you expect the load to be "static"?  Or, time varying?
>> Does the load's impedance change based on how *it* is driven?  etc.
>
> I don't care the load.  I'm only working on the power transducer.  If
> the load changes (because of temperature, degradation, ...), the output
> signal of transducer will change accordingly and the power reading will
> change too.
>
>
>>> Second step. Change the power to another value (half of nominal power,
>>> for
>>> example). If the transducer works as in theory, the measured power is
>>> correct.
>>> Otherwise the user increase/decrease the exponent until the power
>>> displayed is
>>> correct. The power is calculated as:
>>>    P = Pn / (Vn ^ exp) * (V ^ exp)
>>>
>>> After the second step, we are sure the first calibration point is yet
>>> valid,
>>> because that formula is correct when V=Vn, even if exp isn't 2.
>>>
>>> If I use the linear law P=AV^2+BV, I think the two calibration steps
>>> aren't
>>> indipendent: the operator should execute two measures, the system
>>> should save
>>> the two couples (P,V) and only after that calculate A and B
>>> coefficients.
>>>
>>> It seems to me the exponentiation law is simpler during calibration.
>>
>> Your concern should be that of how *accurate* the proposed calibration
>> will be, in the context of the specifications governing that accuracy.
>> Unless you know how your load behaves, how can you begin to analyze how
>> well your model (equation) will fit its observed behavior?
>>
>> Someone (customer) will apply your device and complain that the accuracy
>> AT THEIR PARTICULAR OPERATING POINT sucks.  Regardless of how accurate it
>> is at "0" and "Pmax" (and P/2).
>>
>> Understand the load, first.  This gives you an idea of what *style* of
>> model you should be using.  Then, design the calibration procedure to
>> exploit that model as appropriate.
>
> I think I'm making a measurement device.  It is independent from the
> load.  I only have to calibrate my measurement device, that is my
> transducer.
>

Nope. In general case the load will influence the measurement, unless 
it's specifically provided for by the hardware. What I mean is the 
relationship doesn't have to be linear.

What I would suggest you to do -- get your hardware schematics, then use 
it to produce a model of how does the measurement work (involving the 
load). In that model you would have perhaps two unknown variables (like 
real and imaginary parts of complex impedance of the load), so then you 
would know exactly how many measurements do you need to make, and how to 
calculate the power.

HTH,

Gene

[toc] | [prev] | [next] | [standalone]


#25096

FromDon Y <blockedofcourse@foo.invalid>
Date2016-09-23 10:41 -0700
Message-ID<ns3pfv$2ne$1@dont-email.me>
In reply to#25091
On 9/23/2016 2:56 AM, Evgeny Filatov wrote:
> Nope. In general case the load will influence the measurement, unless it's
> specifically provided for by the hardware. What I mean is the relationship
> doesn't have to be linear.
>
> What I would suggest you to do -- get your hardware schematics, then use it to
> produce a model of how does the measurement work (involving the load). In that
> model you would have perhaps two unknown variables (like real and imaginary
> parts of complex impedance of the load), so then you would know exactly how
> many measurements do you need to make, and how to calculate the power.

You are also likely to have aspects of the measurement system that
contribute to errors/nonlinearities in the measurement.  I.e.,
assuming "0 = 0" inherently assumes you can measure "0"!

[toc] | [prev] | [next] | [standalone]


#25099

FromHans-Bernhard Bröker <HBBroeker@t-online.de>
Date2016-09-23 21:07 +0200
Message-ID<e4lcstFr8dqU1@mid.dfncis.de>
In reply to#25080
Am 23.09.2016 um 09:23 schrieb pozz:
> I thought about exponentiation, because it is simple to calibrate.

Simple to calibrate it may seem -- but then, so is almost every curve 
you can compute at all, with only 3 measurements and 3 parameters to 
determine from them.

But if all you're really after is a "small correction of the square 
law", why lock yourself so thoroughly on the idea that tweaking the 
exponent should be that small correction, rather than, say, a small 
shift of the zero point, or a bit of a cubic correction term?

Let's face it: of all the functions in the usual collection of standard 
math library functions (as in: the Standard C <math.h>), pow() is 
_by_far_ the least simple.  You really don't want to use that beast 
unless your machine has (for a task as hinted here) huge large amounts 
of FPU cycles you really cannot find more practical use for.

[toc] | [prev] | [next] | [standalone]


#25100

FromDon Y <blockedofcourse@foo.invalid>
Date2016-09-23 12:12 -0700
Message-ID<ns3uri$oql$1@dont-email.me>
In reply to#25080
On 9/23/2016 12:23 AM, pozz wrote:
>> What is your *load*?  If purely resistive, does it have a temperature
>> coefficient?  (e.g., if you left it operating at Pmax, would you see
>> changes)
>>
>> In operation, do you expect the load to be "static"?  Or, time varying?
>> Does the load's impedance change based on how *it* is driven?  etc.
>
> I don't care the load.  I'm only working on the power transducer.  If the load
> changes (because of temperature, degradation, ...), the output signal of
> transducer will change accordingly and the power reading will change too.

(sigh)  You really don't understand the problem you're trying to solve.

I have a voltmeter, here, good to 5-1/2 digits.  It was calibrated 4 minutes
ago to an NBS traceable reference.  It's sitting in a temperature controlled
housing.  yada-yada-yada-yada.

It is presently displaying 1.92341 volts.  To what "power" does that
correspond?

[pull black curtain to hide my actions...]

Now, it's displaying 1.84421 volts.  What power level does THIS represent?
Is it MORE or LESS than the power above??  (think carefully before
answering).

How does your "professional instrument" (acting as your authoritative
reference) measure the power in the load?  Why do you trust *it* -- yet
KNOW that your measurements are incorrect?  What does *it* know that
you don't?  What is it *doing* that you aren't?

[toc] | [prev] | [next] | [standalone]


#25067

Frompozz <pozzugno@gmail.com>
Date2016-09-22 23:12 +0200
Message-ID<ns1hgb$c75$2@dont-email.me>
In reply to#25055
Il 22/09/2016 16:17, Don Y ha scritto:> [...]
 > Until you do, how will you know that this is the CORRECT means of
 > compensating your model to agree with your observations?

I don't need the CORRECT means, but only a sufficiently good means of 
compensanting a not ideal system.

[toc] | [prev] | [next] | [standalone]


#25073

FromDon Y <blockedofcourse@foo.invalid>
Date2016-09-22 14:58 -0700
Message-ID<ns1k5i$ktl$1@dont-email.me>
In reply to#25067
On 9/22/2016 2:12 PM, pozz wrote:
> Il 22/09/2016 16:17, Don Y ha scritto:> [...]
>  > Until you do, how will you know that this is the CORRECT means of
>  > compensating your model to agree with your observations?
>
> I don't need the CORRECT means, but only a sufficiently good means of
> compensanting a not ideal system.

But you don't know what that "system" looks like!  Until you do, you
can't come up with a model that you can authoritatively will represent
its behavior at all operating points.

Here's a simple model:
     P(i) = x(i)
Associate a value of x with a given value of P.  Repeat for as many
values of P as you want to track, accurately.

The question to then ask is how can I accurately ESTIMATE the actual
value of P based on my current observed value of x?  If you happen to
have a tuple that associates a P value with that particular x value,
then you are in luck!

ASSUMING THE CALIBRATION DOESN'T DRIFT/ALTER with time, temperature,
"wear and tear", etc.

Otherwise, you'll have to interpolate by walking the curve defined
by the model BETWEEN the two closest calibration points to your current
operating point.  (you're hoping an exponential is the right shape)

How can you decide that you have "a sufficiently good means of
compensanting [sic]" if you don't really know how the load behaves
in the real world?

[toc] | [prev] | [next] | [standalone]


Page 1 of 3  [1] 2 3  Next page →

Back to top | Article view | comp.arch.embedded


csiph-web