I'm having lots of problems with ezunits, can't seem to get the units and their conversions right. One should calculate the volume of 2 tanks at 20°C which are filled with 6kg H_2 at 700bar relative pressure.
The total volume should be 0.103 m^3 and the volume for one tank should be 51.5 l.
That's what I get in Wxmaxima: https://ibb.co/6P91kYk
My code:
/* [ Created with wxMaxima version 20.06.6 ] */
/* [wxMaxima: input start ] */
kill(all); load(ezunits);
/* [wxMaxima: input end ] */
/* [wxMaxima: section start ]
Brennstoffzellenfahrzeug H_2, 2 Tanks, T=20°C, p_rel=700bar, m=6kg. Welches Volumen hat ein Tank?
[wxMaxima: section end ] */
/* [wxMaxima: input start ] */
T: 273.15`K+20`deg; p_rel: 700`bar; RR:8.314`J/(mol*K); m: 6`kg;
/* [wxMaxima: input end ] */
/* [wxMaxima: input start ] */
p: p_rel+1`bar;
/* [wxMaxima: input end ] */
/* [wxMaxima: input start ] */
p: p``N/m^2;
/* [wxMaxima: input end ] */
/* [wxMaxima: input start ] */
M_H_2:2*1.01`g/mol;
/* [wxMaxima: input end ] */
/* [wxMaxima: input start ] */
R: RR/M_H_2;
/* [wxMaxima: input end ] */
/* [wxMaxima: input start ] */
kill(V); dimensionally(solve(p*V=m*R*T,V)); V: rhs(%[1]);
/* [wxMaxima: input end ] */
/* [wxMaxima: input start ] */
V_tank: V/2;
/* [wxMaxima: input end ] */
/* Old versions of Maxima abort on loading files that end in a comment. */
"Created with wxMaxima 20.06.6"$
Some things I see that you can try.
(1)
bar
isn't a built-in unit. Try:declare_unit_conversion(1 ` bar = 101325 ` Pa)
(2) To convert 20 degrees Celsius, try:
T: 20 ` degC `` K
.(3) Here
m
appears as a variable, and also the unitm
. Rename the variablem
tom_tank
or something.(4) Units aren't automatically reduced to basic units. Try:
fundamental_units(V_tank);
and thenV_tank `` fundamental_units(V_tank);
Here's what I get after those changes: