MadsKirkFoged / EngineeringUnits

Working with units made easy with automatic unit-check and converting between units
MIT License
41 stars 10 forks source link

New unit: Molar flow #25

Closed mschmitz2 closed 2 years ago

mschmitz2 commented 2 years ago

Molar flow (i.e. AmountOfSubstance/ Duration e.g. mol/s) is a unit that would be of interest for me.

Specifically, I ran into needing to compute MassFlow / MolarMass, which I then noticed I could not cast to anything appropriate.

Thanks for the amazing work!

MadsKirkFoged commented 2 years ago

It sounds like something that needs to be added! I'll have a look at it after the summer holidays :-)

mschmitz2 commented 2 years ago

No hurry. I took inspiration from your source code and defined a couple of units myself.

Example of unit in question, with minimal number of units (SI & mol/s): MolarFlowUnit.zip.

MadsKirkFoged commented 2 years ago

I have added the MolarFlow in the newest version . Can you test it out and see if it matches your expectations?

AmountOfSubstance Mole = new AmountOfSubstance(10, AmountOfSubstanceUnit.Mole);
Duration Time = new Duration(5, DurationUnit.Second);
MolarFlow MF = Mole / Time;
mschmitz2 commented 2 years ago

Works as expected for all my current uses. Can get rid of my implementation. Thanks.