unitsofmeasurement / uom-systems

Units of Measurement Systems
http://www.uom.systems
Other
36 stars 17 forks source link

Unit with range restriction #115

Closed frank-montyne closed 6 years ago

frank-montyne commented 7 years ago

I would like to implement the power factor unit (The power factor of an AC electrical power system is defined as the ratio of the real power flowing to the load to the apparent power in the circuit,[1][2] and is a dimensionless number in the closed interval of −1 to 1). Could some explain how to create a unit with a range restriction? Thanks, Frank

keilw commented 7 years ago

Is there some link or site describing this unit? Somewhat closer than life in Texas at the moment, a concrete demo of how to use Range is https://github.com/unitsofmeasurement/uom-demos/blob/master/console/systems/common-java8/src/main/java/tec/uom/demo/se/systems/common/ThePerfectStorm.java defining storm/Hurricane categories (where each category also has an upper and lower boundary)

frank-montyne commented 7 years ago

I hope you don't live in Texas for the moment:) Thanks for the link. A description of the power factor unit can be found here [https://en.wikipedia.org/wiki/Power_factor]

Thanks, frank

keilw commented 7 years ago

No, JSR 363 Co Spec Lead @leomrlima does, but hopefully Austin is a little more up in the state, so it may not see its central river flooded in the same way Houston and other cities are facing I hope.

keilw commented 7 years ago

Sounds like the kind of stuff my late dad who was an electrical engineer would have been the best expert to ask ;-| So far there's only an energy demo, but being relatively specific, I imagine this could be more a case for https://github.com/unitsofmeasurement/uom-domain than general unit systems.

frank-montyne commented 7 years ago

I agree, we are active in the IoT sector more specifically targeting energy consumption/production in the B2B sector. We are using the UoM service to define the datatype for the different sensors we capture data for. If you want to know more have a look at byNubian Is this a domain other people are already working on? Otherwise we would definitely be interested to cooperate.

Thanks, Frank

frank-montyne commented 7 years ago

One last question is there already a dimensionless boolean unit available?

keilw commented 7 years ago

A bit like https://github.com/openxc/openxc-android/blob/master/library/src/main/java/com/openxc/units/Boolean.java in OpenXC? No, but in some cases it may be more subject to using enums. Similar to Percent it is usually not feasible to convert to or from such units ("Off/s" or "Yes/m" seems unusual, maybe when you do voting? ;-) but we can offer it. Not sure, which unit system though.

frank-montyne commented 7 years ago

Yes, that's what I mean.

keilw commented 7 years ago

Not sure where it would fit, but like Percent it may even work well in a future RI. Could you propose something like that for https://github.com/unitsofmeasurement/indriya/issues? It is the next Gen RI for an upcoming new JSR (update to 363 under a new number) It works against the 1.0 API right now, so while it is still in "Stealth Mode" it works, we just won't do snapshots for it until a new JSR starts.

frank-montyne commented 7 years ago

Ok I'll do that

keilw commented 7 years ago

Thanks, if there's no immediate pressure, please do so. Btw, should you be willing and interested to join the JCP, we're more than happy to accept help and constructive input for new features. Depending on the level of involvement, one could join as Associate Member (and be mentioned as "Contributor", see Red Hat for https://jcp.org/en/jsr/detail?id=363) or if a strategic interest exists by your company, you could also represent it in the JCP. That allows joining an EG of a new/updated JSR.

keilw commented 6 years ago

@frank-montyne Please note, JSR 385 has been created. If you want to propose something for Indriya (the new RI) do so at any time, ideally before Public Review (should be in Q4/18 as of now) And if you would like to join either the EG or as contributor, you can nominate yourself: https://jcp.org/en/jsr/egnom?id=385

keilw commented 6 years ago

This is covered by the Range in the RIs, therefore no action needed here AFAIK.