C++ Logo

std-proposals

Advanced search

Re: [std-proposals] On the standardization of mp-units P3045R1

From: Sebastian Wittmeier <wittmeier_at_[hidden]>
Date: Tue, 18 Jun 2024 15:08:42 +0200
How would you suggest to solve distinguishing between a 3°C relative temperature increase and 3°C absolute temperature?   At the time of initialization of the variable with _deg_C (either always absolute or relative temperature or _deg_rel_C and _deg_abs_C)? Or at the time of usage?   -----Ursprüngliche Nachricht----- Von:Tiago Freire <tmiguelf_at_[hidden]> Gesendet:Di 18.06.2024 14:50 Betreff:RE: [std-proposals] On the standardization of mp-units P3045R1 An:std-proposals_at_[hidden]; CC:Sebastian Wittmeier <wittmeier_at_[hidden]>; When using “quantity” 1°C = 1°K, this is by design in mp-units (you cannot change this, it is intrinsic to the design). Only quantity_point converts 28°C to 301K.   From: Std-Proposals <std-proposals-bounces_at_[hidden]> On Behalf Of Sebastian Wittmeier via Std-Proposals Sent: Tuesday, June 18, 2024 14:43 To: std-proposals_at_[hidden] Cc: Sebastian Wittmeier <wittmeier_at_[hidden]> Subject: Re: [std-proposals] On the standardization of mp-units P3045R1   Hi Tiago, where does this difference of 11x come from? The temperature with 28°C vs. 301K?   -----Ursprüngliche Nachricht----- Von: Tiago Freire via Std-Proposals <std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]> > Gesendet: Di 18.06.2024 14:28 Betreff: [std-proposals] On the standardization of mp-units P3045R1 An: std-proposals_at_[hidden] <mailto:std-proposals_at_[hidden]> ; CC: Tiago Freire <tmiguelf_at_[hidden] <mailto:tmiguelf_at_[hidden]> >; Hi, I will be participating in St. Louis. And one of the papers that interested me was P3045R1, unfortunately I may or may not be on time to participate in this particular session.   There’s this question that I would like an answer too, and I wonder if there is anyone who will be attending St. Louis who would be willing to make this question on my behalf:       A lab worker puts in 40Kg of dry ice into a 1 cubic meter pressure tank rated for 10atm, they then vacuum the tank and seal it. As the CO2 warms up to room temperature (which at a specific date was 28°C) it evaporates, and eventually following the ideal gas law: PV=nRT   Is this setup dangerous?   Using mp-units (with the exact same design as the one being proposed for standardization) to solve this problem:   ``` quantity Volume = 1.0 * m*m*m; quantity Temperature = (28.0 * deg_C).in(K); quantity n_ = 0.04401 * kg / mol; quantity R_boltzman = 8.314 * N * m / (K * mol); quantity mass = 40.0 * kg; quantity Pressure = R_boltzman * Temperature * mass / n_ / Volume; std::cout << Pressure << std::endl; ```   We get the following result: `211581 N/m2` (=211.581kPa = 2,09 atm) But the correct answer is actually: 2275.629kPa = 22.5 atm (11 time s higher than what mp-units calculated)   How is this considered a design feature and not a bug? (note that other similar libraries don’t have this problem) And how do the authors think this design choice impacts on safety and user-friendliness?     Thanks.     --  Std-Proposals mailing list Std-Proposals_at_[hidden] <mailto:Std-Proposals_at_[hidden]> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

Received on 2024-06-18 13:08:49