Closed magni-mar closed 10 months ago
You can't directly divide mp_units::quantity
by std::chrono::seconds
. Those are different libraries and the division of such variables will not produce power (in fact it is an invalid operation by default).
In order to make it work you have to convert std::chrono::seconds
to a proper quantity type in mp-units. I notice you are still on the V1 of the library but here is the solution in the V2: https://godbolt.org/z/5qTsfq7MY. Similar stuff can be easily achieved in the previous versions as well.
I missed the type that covers seconds in mp units.
When trying to calculate energy from multiplying power and time, as in: energy = power * time.
I get the following error:
for the following code:
How can I multiply power with time without accessing the raw numbers?