Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Apr 15 01:05
    keilw milestoned #197
  • Apr 15 01:05
    keilw demilestoned #197
  • Apr 15 01:05
    keilw closed #193
  • Apr 15 01:05
    keilw closed #86
  • Apr 15 01:04
    keilw milestoned #198
  • Apr 15 01:04
    keilw demilestoned #198
  • Apr 15 01:02

    keilw on master

    58: micro not recognised when u… (compare)

  • Apr 15 01:00

    keilw on 1.0.10

    (compare)

  • Apr 15 00:56

    keilw on master

    58: micro not recognised when u… (compare)

  • Apr 14 23:16

    keilw on master

    58: micro not recognised when u… (compare)

  • Mar 20 06:35
    thodorisbais closed #203
  • Mar 20 06:35
    thodorisbais commented #203
  • Mar 20 06:34

    thodorisbais on master

    remove Waffle Merge pull request #204 from Da… (compare)

  • Mar 20 06:34
    thodorisbais closed #204
  • Mar 20 03:39
    keilw edited #204
  • Mar 20 03:39
    Daniel-Dos review_requested #204
  • Mar 20 03:39
    Daniel-Dos review_requested #204
  • Mar 20 03:39
    Daniel-Dos opened #204
  • Mar 20 02:44
    thodorisbais labeled #203
  • Mar 20 02:44
    thodorisbais labeled #203
Erol
@FrEaKmAn
how can I get an non si units.. for example cubic feet?
Erol
@FrEaKmAn
I think I should use SimpleUnitFormat and add alias.. but the version in maven doesn't have this
will there also be a NonSIUnits class to hold some common nonsi units?
Werner Keil
@keilw
Yes, you can use Common Unit Systems in https://github.com/unitsofmeasurement/uom-systems (either the version for Java 6/7 or ME Embedded or "java8" for Java SE 8 and above). The latest Snapshot of UOM-SE or RI all contain UnitFormat.label (actually defined by the API of the same version already)
Erol
@FrEaKmAn
but the latest snapshot for uom-se is not available on maven?
Erol
@FrEaKmAn
or should I update my repository sources?
Werner Keil
@keilw
It is, please check https://oss.jfrog.org/oss-snapshot-local/tec/ or https://oss.jfrog.org/artifactory/oss-snapshot-local/javax/measure/, the snapshots are not on MavenCentral, but all project POMs are set to find them. If you have your own POM you might need to add those, see https://github.com/unitsofmeasurement/uom-demos/blob/master/pom.xml (under <repositories>) or pretty much every other POM using those snapshots.
Michael
@mk-fhnw

Hello everyone, I'd like to derive a new unit representation based on an existing one. However, it does not seem to work as expected. Could you please have a look at the following code snippet and guide me to the right directions? Thanks.

Unit<Energy> WATTHOUR = new TransformedUnit<Energy>("Wh", Units.JOULE, new RationalConverter(3600, 1));
ComparableQuantity<Power> power = Quantities.getQuantity(1000, MetricPrefix.MILLI(Units.WATT));
ComparableQuantity<Time> time = Quantities.getQuantity(15, Units.MINUTE);
ComparableQuantity<Energy> energy = power.multiply(time).asType(Energy.class);
System.out.println(energy); //Ouput 15000.00 J/s·min -> correct
System.out.println(energy.to(Units.JOULE)); //Output 900.00 J -> correct
System.out.println(energy.to(WATTHOUR)); //Output 0.25 m·N -> Expected: 0.25 Wh
System.out.println(energy.to(MetricPrefix.KILO(Units.JOULE))); //Output 0.90 m·N -> Wrong, expected something like 0.90 kJ or 0.90 kNm
System.out.println(energy.to(MetricPrefix.KILO(WATTHOUR))); //Output 0.00025 m·N -> Wrong, expected 0.00025 kWh

Werner Keil
@keilw
Hi, thanks for raising this. I made your example available under "Energy Demos" https://github.com/unitsofmeasurement/uom-demos/tree/master/domain/energy-se/src/main/java/tec/uom/demo/energy/se since it's a good example for calculations related to energy. The small demo unit system shows, how you have to provide formatting hints via SimpleUnitFormat.label(). At the moment (this was always the case also when we had a similar implementation in JScience 4/JSR 275) multiples of new units like "kWh" also need a label. We're working on improvements to solve this, so the known prefixes can be used as such. Hope that helps you formatting your output in the desired manner?
Michael
@mk-fhnw
Hi, thank you for bringing this to my attention. I have also seen the other example (DemoUnitSystem). However, the lib located on maven (uom-se-0.8-RC1) does not contain a SimpleUnitFormat class yet. I will wait for the next realse which hopefully solves the problem. Thanks again for the great work!
Werner Keil
@keilw
If you can wait till Public Draft (0.8), sure, we expect to submit that before the end of Q4, but just like uom-demos are continuously built against the latest versions of all artifacts, you may find them in SNAPSHOT repos like http://oss.jfrog.org/artifactory/libs-snapshot. E.g. http://oss.jfrog.org/libs-snapshot/tec/ for both RI and SE port.
Erol
@FrEaKmAn
hi @keilw is there anything in uom equivalent to jscience VolumetricFlowRate?
Erol
@FrEaKmAn
never mind, found it
Erol
@FrEaKmAn
yes
I have a question about some units.. it seems that bar and psi are missing? what the options to add this units into core?
PSI would be for either US or Imperial, I don't recall it's there yet, so please feel free to file an enhancement request in https://github.com/unitsofmeasurement/uom-systems/issues
The room for those general topics would be https://gitter.im/unitsofmeasurement btw. but no worries posting something here or in "RI" ;-)
Erol
@FrEaKmAn
sorry
Werner Keil
@keilw
No problem
Btw. if you prefer you may also open a PR for uom-systems and other repositories instead of a GitHub issue. Except for API, RI and TCK it's open to all interested users and developers. Only some parts are for JCP/EG members.
Zack Juhasz
@zjuhasz
Submitted pull request unitsofmeasurement/uom-se#130
Chris Hennick
@Pr0methean
hi all, I'm trying to get PR #172 ready to reopen, but I'm getting some weird test failures nowhere near what I'm touching
I had to narrow a few types elsewhere, mainly from Unit<> to AbstractUnit<> and Quantity<> to ComparableQuantity<>
Werner Keil
@keilw
So was that the only reason for changing from Unit<> to AbstractUnit<> ?
Rahul Vaidya
@rvaidya
hello, i'm looking at this library and i'm having trouble figuring out what i need to use
i saw this response to a similar question: @keilw
Thanks for your interest. Yes, uom-se is recommended for Java SE 8 and above (while the RI will of course also work on those environments, but without Lambdas, etc.)
The "common" Unit System module is available for Java8: https://github.com/unitsofmeasurement/uom-systems/tree/master/common-java8 It contains mainly non SI units like US Customary or Imperial or non-metric prefixes like Crore, Lakh,... SI units also exists both for the RI and Java SE 8: https://github.com/unitsofmeasurement/si-units/tree/master/units-java8
trying to figure out what to use for Java 8 SE - but some libraries seem to have the same stuff (NonSI exists in si-units and uom-systems) and some seem to just have stubs
daniil-timofeev
@daniil-timofeev
Hello guys. Do you plan to support Valhalla project improvements in this library?
Werner Keil
@keilw
Some day whenever Valhalla is ready. Like a few other improvements (e.g. the JEP for automatically deriving a concrete type via instanceof, don't recall the number but it would be very useful)
However, you probably won't see this here. We already proposed a new Unit JSR (2.0 the number is mainly due to the significant upgrade of the SI System after approx. 50 years) which should get a number some weeks from now. And https://github.com/unitsofmeasurement/indriya is the proposed new unified RI and successor to this project.
You can use it with JSR 363 (we'll release Indriya 1.0 in early 2018 as soon as a new JSR is approved) now and this way it'll seamlessly allow upgrading to the new API in early 2019 before the new SI standard comes into effect.
And who knows maybe Java 19.3 or so might even bring Valhalla, then Indriya will use it
daniil-timofeev
@daniil-timofeev
trying to use indrya API from scala
Quantities.getQuantity() will not work at scala, because Double, Float and Int in scala extends AnyVal, and does not implement `java.lang.Number'
and DoubleQuantity class is inaccessible
daniil-timofeev
@daniil-timofeev
so, compilation will fall with the following error class DoubleQuantity in package quantity cannot be accessed in package tech.units.indriya.quantity
does DoubleQuantity is private in module settings?
Werner Keil
@keilw
Does Scala require it to be public? All these are not supposed to be public because they are implementation details for NumberQuantity.
Note, there is a chatroom for https://gitter.im/unitsofmeasurement/indriya
@zjuhasz have you already tried Indriya in Kotlin?
Werner Keil
@keilw
If you want we'd be happy to create a Scala space in https://github.com/unitsofmeasurement/uom-spaces
Zack Juhasz
@zjuhasz
Not yet, we're planning on switching over Physikal to Indriya in a couple months most likely. But in Kotlin Double, Float, Int, do inherit from Number so it should work the same as in Java. I don't think I understand the question from @daniil-timofeev though
daniil-timofeev
@daniil-timofeev
@keilw Scala Number is other class than java Number. So i can't use methods from Quantities from Scala
daniil-timofeev
@daniil-timofeev
@keilw Why Quantity<Q extends Quantity<Q>>. Can i read something somewhere about this encoding?
Werner Keil
@keilw
Encoding? That is Java Generics. Making it typesafe. And since the company providing commercial Scala support was once called Typesafe I trust Scala should be able to handle typse safety in Java in a similar way as Kotlin does. Kotlin seems to be closer to Java in some respect, but it should be possible to provide a similar binding.
Zack Juhasz
@zjuhasz
@daniil-timofeev it allows you to say you want a quantity of a certain type. Like Quantity<Temperature> or Quantity<Pressure>. If you're using UoM for the first time I would start out trying it in Java or Kotlin first where it is all idiomatic and tested before trying it in Scala. The JSR 363 spec describes it pretty well in detail, not sure if there is one for JSR 385 yet. Here is the JSR 363 one http://download.oracle.com/otndocs/jcp/units-1_0-final-eval-spec/
Werner Keil
@keilw
The Spec for JSR 385 is not final yet, but you find a RO copy of the working draft here: https://docs.google.com/document/d/12KhosAFriGCczBs6gwtJJDfg_QlANT92_lhxUWO2gCY/edit?usp=sharing