Add decibel power units (dBW and multiples)
ClosedPublic

Authored by iasensio on Aug 11 2019, 8:24 PM.

Details

Summary

Add decibel power units (dBW and mulitples)

Decibel power units are widely used in the fields of signal trasnmission and radiofrequency.
This patch adds decibel units to the Power category (dBm, dbW, dBµW and dBk).

The decibel calculation might be also interesting to other categories such as voltage or pressure (acoustics)

Test Plan
  • Check the units of the power category on krunner
  • The reference unit: 1W = 0dBW = 30dBm = 60dBµW = -30dBk
  • The decibel is a logarithmic scale so multiplying on natural units implies addition in decibel units:

10W = 10dBW = 40dBm = 70dBµW = -20dBk

Diff Detail

Repository
R292 KUnitConversion
Branch
log_power_units
Lint
No Linters Available
Unit
No Unit Test Coverage
Build Status
Buildable 15013
Build 15031: arc lint + arc unit
iasensio created this revision.Aug 11 2019, 8:24 PM
Restricted Application added a project: Frameworks. · View Herald TranscriptAug 11 2019, 8:24 PM
Restricted Application added a subscriber: kde-frameworks-devel. · View Herald Transcript
iasensio requested review of this revision.Aug 11 2019, 8:24 PM
iasensio edited the test plan for this revision. (Show Details)Aug 11 2019, 8:29 PM
ngraham added inline comments.
src/unit.h
143

This will (hopefully) land in 5.62, so use that for the number

iasensio updated this revision to Diff 63588.Aug 11 2019, 9:42 PM
  • Set frameworks version

Works just fine, but by adding dBm as a common unit, it's now the first t hing that shows up when I convert watts:

Seems a little odd to me, not being an audio professional. Does it really make sense to display dBm when I convert 5 terawatts? :p

iasensio marked an inline comment as done.Aug 14 2019, 1:47 PM

Well, in my field of work (telephony, radar and radio signal transmission) it makes totally sense (altought Terawatts would be major words 😄). It is a non trivial conversion that we make quite frequently.

If the question is between dBm and dBW as a common unit, I would go for dBm with no doubt. In my experience dBm is widely more used that its counterpart dBW. Also, as a quick and dirty comparison, one can check the difference in length and quality of those two articles: https://en.wikipedia.org/wiki/DBm and https://en.wikipedia.org/wiki/Decibel_watt.

If it is wether decibel power units are common globally, I would say (knowing that I have a field bias) that at least as important as horsepower on a different field.
Of course, I will gently (and happily) accept your decision. Just wanted to provide some context.

ngraham accepted this revision.Aug 14 2019, 2:22 PM

Since there are only two common units in the list right now, adding a third doesn't seem like a disaster. :)

@broulik, what do you think?

This revision is now accepted and ready to land.Aug 14 2019, 2:22 PM

Friendly ping

broulik accepted this revision.Aug 27 2019, 1:53 PM
This revision was automatically updated to reflect the committed changes.