-
Notifications
You must be signed in to change notification settings - Fork 36
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add units to models #180
base: master
Are you sure you want to change the base?
Add units to models #180
Conversation
ditto/models/position.py
Outdated
elevation = Float(help="""Decimal elevation (meters)""") | ||
# NOTE: We are not really using lat/long I believe, but mostly coordinates in various format | ||
# TODO: Build the conversion to parse to lat/long from given inputs... | ||
long = Float(help="""Decimal Longitude""", unit=M) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change long
to lng
(preferred) or lon
. long
is a Python builtin.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, you can spell it out fully (latitude
, longitude
etc).
Codecov Report
@@ Coverage Diff @@
## master #180 +/- ##
==========================================
+ Coverage 43.96% 44.13% +0.16%
==========================================
Files 74 75 +1
Lines 16473 16532 +59
==========================================
+ Hits 7243 7297 +54
- Misses 9230 9235 +5
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would strongly reccommend adding units of (decimal/percentage) for the attributes:
- v_max_pu
- v_min_pu
- min_power_factor
- power_factor
- per_unit
- vmin
- vmax
- center_tap_perct_1_N
- center_tap_perct_N_2
- center_tap_perct_1_2
- ppercentcurrent
- qpercentcurrent
- ppercentpower
- qpercentpower
- ppercentimpedance
- qpercentimpdance
- cutout_percent
- cutin_percent
- rise_limit
- fall_limit
- var_injection
- reserve
- discharge_rate
- charging_efficiency
- discharging_efficiency
This ensures that people don't put 100 when DiTTo is expecting 1.0.
Additionally I think that the attribute:
- noload_loss
should not have a unit of None
7c7e60f
to
f691839
Compare
@tarekelgindy, I rebased this PR and solved the conflicts. |
Codecov Report
@@ Coverage Diff @@
## master #180 +/- ##
==========================================
+ Coverage 43.98% 44.14% +0.16%
==========================================
Files 75 76 +1
Lines 17050 17109 +59
==========================================
+ Hits 7499 7553 +54
- Misses 9551 9556 +5
Continue to review full report at Codecov.
|
lat = Float(help="""Decimal Latitude""") | ||
elevation = Float(help="""Decimal elevation (meters)""") | ||
# NOTE: We are not really using lat/long I believe, but mostly coordinates in various format | ||
# TODO: Build the conversion to parse to lat/long from given inputs... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Re unit lat/long conversion, I've used pyproj in the past and it worked well. The only downside is that if one forgets to set preserve_units=True
during initialization things silently break when the input is not in metres.
f691839
to
faef7c9
Compare
8041f05
to
4c1d89d
Compare
4c1d89d
to
e3e9c78
Compare
First step to #84
constant.py
file with the unitsunit=...
to all model attributesAs you can see, some attributes are not that obvious. There are a few cases:
Scalar with dimension:
That's the easy case. For example
rated_power
==>unit=KVA
Dimensionless scalar:
Convention I used is to define
unit=None
. For examplename
orphase
...List of dimensionless scalars:
Convention I used is to define
unit=None
List of scalars with dimension:
Convention I used is to define the unit of the scalars. For example
impedance_matrix
is a list ofComplex
, andunit=OHM+"/"+M
List of DiTTo objects:
Convention I used is to define
unit=None
. For examplepositions
which is a list of position objects. The units of the position attributes are defined inposition.py
Attribute which dimension depends on another attribute's value:
That's the hard case. There are very few of those but I couldn't find a clean solution. For example, in
capacitor.py
, thelow
andhigh
attribute's dimension depends on the value ofmode
(can be Volts, Watts, amps... depending on the control mode).