News:

  • May 05, 2026, 05:27:32 PM

Login with username, password and session length

Author Topic: Math & String Print for logarithmic scaling in exponential form  (Read 9434 times)

Dmelnyk

  • Newbie
  • *
  • Posts: 6
I am looking to do 0-10vdc logarithmic scaling.
Output signal (measuring signal) 0 … +10 V
Measuring range 0.774 V (5×10-10 mbar)
… +10 V (1000 mbar)
Relationship voltage-pressure logarithmic, 0.75 V/decade
(→ Appendix A)
p = 10(U - 7.75) / 0.75 + c
where U        p            c

     [V]     [Torr]       -0.125


I have the PLC program as:

Math:
Result:            D0
Epression:  WX0-7.75

Math:
Result:            D1
Expression: (D0/0.75)-0.125

Math:
Result:            D2
Expression: 10**D1

STRPRINT
Print to:          SS0
Print Script: FmtReal(D2,2,2,exp)


From what I can tell this should be correct to display in exponential form. If "U" is 7.00 then after the math and STRPRINT I should see ( 7.5x10-2Torr). 

Any help would be appreciated.  Thanks




franji1

  • Bit Weenie
  • Host Moderator
  • Hero Member
  • *****
  • Posts: 3806
    • Host Engineering
Re: Math & String Print for logarithmic scaling in exponential form
« Reply #1 on: July 01, 2013, 02:36:40 PM »
WX0 is not in volts, it is usually 12 bit or 16 bit integer, with ranges of 0-4095 or 0-65535.  I would use SCALE WX0 from 0.0 to 10.0 to R0 (use the decimal point), then use R0 in place of D0, and R1 for D1, R2, for D2, etc.  D0 is just 32 bit signed integer, so you won't get any fractional values like you do with R (REAL or IEEE 32 bit floating point).
« Last Edit: July 01, 2013, 02:43:08 PM by franji1 »