Bug 388074 - Add some units from the petroleum industry
Summary: Add some units from the petroleum industry
Alias: None
Product: frameworks-kunitconversion
Classification: Unclassified
Component: general (show other bugs)
Version: unspecified
Platform: Other Linux
: NOR wishlist
Target Milestone: ---
Assignee: John Layt
Keywords: junior-jobs
Depends on:
Reported: 2017-12-20 14:46 UTC by ishovkun
Modified: 2018-11-06 21:11 UTC (History)
4 users (show)

See Also:
Latest Commit:
Version Fixed In: 5.53


Note You need to log in before you can comment on or make changes to this bug.
Description ishovkun 2017-12-20 14:46:12 UTC
I wish krunner could convert some units from the petroleum industry.
1. oil barrels (unit of volume). X barrels = X*5.6146 cubic feet.
The standard acronym is bbl.

2. Darcy and milidarcy (unit of permeability).
X darcys = X*9.869233e-13 m^2.
The standard acronym is d and md (milidarcys are more common), but since this abbreviation is taken by days, Da and mDa are also fine.
Comment 1 João Netto 2018-11-01 19:29:33 UTC
I would like to work on this feature, it seems simple to implement.

I'm completely new to the community, could I get some help?
Comment 2 Kai Uwe Broulik 2018-11-01 19:36:03 UTC
Hi, João, you might want to check out our Getting Started guide [1], you can browse the relevant source code files in [2], they are split into categories like units of volume, temperature, power, etc.
Patches you can upload to [3], enjoy and welcome aboard! ;)

[1] https://community.kde.org/Get_Involved
[2] https://cgit.kde.org/kunitconversion.git/tree/src
[3] http://phabricator.kde.org/
Comment 3 Nate Graham 2018-11-01 19:53:18 UTC
Hi João!

As it happens, my very first patch was for this repo, and Kai helped me (Bug 379171)! I can help you.

First, set up your development environment per https://community.kde.org/Get_Involved/development#Set_up_your_development_environment (or https://community.kde.org/Guidelines_and_HOWTOs/Build_from_source if you are already somewhat familiar with source control and software development workflows). Check out https://cgit.kde.org/kunitconversion.git and try to compile it.

The proposed oil barrel unit would make sense to do in volume.cpp. For Darcies and Milidarcies, we don't have a permeability-related category, so perhaps you could create permeability.h and permeability.cpp, following the pattern of the other ones.

Don't hesitate to reach out if you get stuck or need a hand!
Comment 4 João Netto 2018-11-03 03:39:32 UTC
First of all, thanks for all the support. It really helped me feel more comfortable here.

Finally, I managed to get my development enviroment running, and could compile kunitconversion. Still, I have a question, can I run it apart of Krunner or do I have to compile the entire Krunner?

Thanks in advance
Comment 5 Nate Graham 2018-11-03 03:42:06 UTC
Since it's a shared library, all you have to do is install your compiled version and KRunner will pick it up after being killed and restarted. You have two options:
1. Install it to /usr and overwrite the system version of the kunitconversion shared library. If you do this, you'll probably want to reinstall the distro-provided version after you're done testing.
2. Install it to a different location and adjust some things to make KRunner preferentially find your custom-compiled version. If you opt to do this. Probably Kai can be of more assistance than I can.
Comment 6 João Netto 2018-11-03 04:31:31 UTC
I finally managed to compile and execute Krunner.

I'll start working on the feature.
Comment 7 João Netto 2018-11-04 19:41:25 UTC
I implemented the first part of the request on, added the OilBarrel unit.

The second part of the project brings some questions, the SI unit for permeability  is SquareMeters, which is a Area type of unit. I implemented pemearbility.h and pemearbility.cpp based on the patterns of the other files. I declared Darcy and Mili-Darcys as units (Since Da are already used by eletric voltage, I called it Darcy) and they can convert to each other.

My questions now are: 

Is there a way to establish a connection between Darcy and SquareMeters?

After I implemented permeability.cpp, I added it to CMakeLists.txt, but I can't test my changes, how can I link it to the rest of the library?
Comment 8 João Netto 2018-11-04 19:49:53 UTC
Sorry for the double post.
This is what I got so far:
Comment 9 Nate Graham 2018-11-06 21:11:45 UTC
Git commit b2419e57eeea5cd98b3bfb42c3032b421633bf39 by Nate Graham, on behalf of João Netto.
Committed on 06/11/2018 at 21:11.
Pushed by ngraham into branch 'master'.

Updated with petroleum industry units

Added a new volume unity Oil Barrels and a new permeability class that handles Darcy and MiliDarcys.
FIXED-IN: 5.53

Reviewers: ngraham, broulik, #frameworks

Reviewed By: ngraham

Subscribers: ngraham, kde-frameworks-devel

Tags: #frameworks

Differential Revision: https://phabricator.kde.org/D16684

M  +1    -0    README.md
M  +1    -0    src/CMakeLists.txt
M  +2    -0    src/converter.cpp
A  +63   -0    src/permeability.cpp     [License: LGPL (v2+)]
A  +36   -0    src/permeability_p.h     [License: LGPL (v2+)]
M  +13   -2    src/unit.h
M  +10   -0    src/volume.cpp