Greetings [note that by default replies go to the poster - not the list]:

In JSBSim we are addressing this in our own way (at the moment), 
programmatically using an
STL map (indexed by STL strings) to index conversion factors like this:


  convert["M"]["FT"] = 3.2808399;
  convert["FT"]["M"] = 1.0/convert["M"]["FT"];
  convert["M2"]["FT2"] = convert["M"]["FT"]*convert["M"]["FT"];
  convert["FT2"]["M2"] = 1.0/convert["M2"]["FT2"];
  convert["FT"]["IN"] = 12.0;
  convert["IN"]["FT"] = 1.0/convert["FT"]["IN"];
  convert["LBS"]["KG"] = 0.45359237;
  convert["KG"]["LBS"] = 1.0/convert["LBS"]["KG"];
  convert["SLUG*FT2"]["KG*M2"] = 1.35594;
  convert["KG*M2"]["SLUG*FT2"] = 1.0/convert["SLUG*FT2"]["KG*M2"];
  convert["RAD"]["DEG"] = 360.0/(2.0*3.1415926);
  convert["DEG"]["RAD"] = 1.0/convert["RAD"]["DEG"];
  convert["LBS/FT"]["N/M"] = 14.5939;
  convert["LBS/FT/SEC"]["N/M/SEC"] = 14.5939;
  convert["N/M"]["LBS/FT"] = 1.0/convert["LBS/FT"]["N/M"];
  convert["N/M/SEC"]["LBS/FT/SEC"] = 1.0/convert["LBS/FT/SEC"]["N/M/SEC"];

  convert["M"]["M"] = 1.00;
  convert["FT"]["FT"] = 1.00;
  convert["IN"]["IN"] = 1.00;
  convert["IN3"]["IN3"] = 1.00;
  convert["DEG"]["DEG"] = 1.00;
  convert["RAD"]["RAD"] = 1.00;
  convert["M2"]["M2"] = 1.00;
  convert["FT2"]["FT2"] = 1.00;
  convert["KG*M2"]["KG*M2"] = 1.00;
  convert["SLUG*FT2"]["SLUG*FT2"] = 1.00;
  convert["KG"]["KG"] = 1.00;
  convert["LBS"]["LBS"] = 1.00;
  convert["LBS/FT"]["LBS/FT"] = 1.00;
  convert["N/M"]["N/M"] = 1.00;
  convert["LBS/FT/SEC"]["LBS/FT/SEC"] = 1.00;
  convert["N/M/SEC"]["N/M/SEC"] = 1.00;
  convert["PSI"]["PSI"] = 1.00;
  convert["INHG"]["INHG"] = 1.00;
  convert["HP"]["HP"] = 1.00;

Since this is only done at initialization time, CPU usage is not so critical 
for us. I'd
be interested in hearing more about standard unit abbrev.s, though.

Jon Berndt

Reply via email to