Quantity

From FreeCAD Documentation
Revision as of 21:16, 10 December 2013 by Renatorivo (talk | contribs) (→‎Quantità: provvisoria)

Quantità

TRADUZIONE PROVVISORIA

La Quantità è una combinazione di un numero in virgola mobile e di una unità di misura.

In un sistema CAD o CAE ​​è molto importante mantenere la traccia dell'unità di misura di un valore. Quando si mescolano le unità o si calcolano i risultati in diverse unità di misura possono sorgere un sacco di problemi. Un famoso disastro, causato da un disguido sulle unità di misura, è il crash of the Mars Climate Orbiter. Anche in uno stesso Sistema di misura le unità sono disponibili in diversi formati, secondo il settore di utilizzo. Ad esempio, la velocità in km/h per le automobili, in m/s in robotica o in mm/minuto per la fresatura. Un sistema CAD deve conservare una traccia affidabile delle unità. Inoltre deve utilizzarle per eseguire i calcoli e deve verificare che per i parametri speciali sia adottata la giusta unità.

Per questo motivo è stata creata la sezione Quantità di FreeCAD. Essa include tutto il codice e gli oggetti che servono per trattare le unità, i calcoli delle unità, i dati inseriti dall'utente, la conversione tra i Sistemi di unità e fornire un corretto output delle unità e dei valori. In futuro, in FreeCAD, nessun parametro dovrebbe essere solo più un numero.

Nozioni di base

Tutte le unità fisiche possono essere espresse come combinazione delle sette Unità SI:



Un modo semplice per esprimere una Unità è quello di utilizzare un array di 7 interi, il numero delle unità di base, che definisce di quale unità si tratta. Le firme delle 7 unità di base sono:

  • LUNGHEZZA: [1,0,0,0,0,0,0]
  • MASSA: [0,1,0,0,0,0,0]
  • TEMPO: [0,0,1,0,0,0,0]
  • CORRENTE ELECTTRICA: [0,0,0,1,0,0,0]
  • TEMPERATURA TERMODINAMICA: [0,0,0,0,1,0,0]
  • QUANTITÀ DI SOSTANZA: [0,0,0,0,0,1,0]
  • INTENSITÀ LUMINOSA: [0,0,0,0,0,0,1]

Da queste 7 unità, siamo poi in grado di esprimere tutte le unità derivate definite nella Guida per l'utilizzo del Sistema Internazionale di Unità (SI) e di crearne di nuove, secondo le esigenze, come ad esempio:

  • MASS DENSITY: [-3,1,0,0,0,0,0]
  • AREA: [0,2,0,0,0,0,0]

Dato che l'angolo è fisicamente adimensionale, ma non è meno importante in un sistema CAD, si aggiunge una unità virtuale in più per Angle. Questo crea un vettore di 8 dati nella firma delle unità di FreeCAD.

Units calculator

Std_UnitsCalculator: il convertitore delle misure.

Script Python

Appendice

Unità supportate dal Parser

Anche se tutte le unità fisiche possono essere descritte con le sette unità SI, la maggior parte delle unità utilizzate nelle aree tecniche sono delle combinazioni di unità comuni (come Pa = N/m^2 Pascal ). Pertanto il parser delle unità di FreeCAD supporta molte combinazioni del SI e del sistema Imperiale. Queste unità sono definite nel file src/Base/QuantityParser.l e in futuro possono essere incrementate.


"nm"      yylval = Quantity(1.0e-6    ,Unit(1));      return UNIT; // nanometro
"ym"      yylval = Quantity(1.0e-3    ,Unit(1));      return UNIT; // micrometro
"mm"      yylval = Quantity(1.0       ,Unit(1));      return UNIT; // millimetro
"cm"      yylval = Quantity(10.0      ,Unit(1));      return UNIT; // centimetro
"dm"      yylval = Quantity(100.0     ,Unit(1));      return UNIT; // decimetro
"m"       yylval = Quantity(1.0e3     ,Unit(1));      return UNIT; // metro
"km"      yylval = Quantity(1.0e6     ,Unit(1));      return UNIT; // kilometro
"l"       yylval = Quantity(1000000.0 ,Unit(3));      return UNIT; // Litro      dm^3
"yg"      yylval = Quantity(1.0e-9    ,Unit(0,1));    return UNIT; // milligrammo
"mg"      yylval = Quantity(1.0e-6    ,Unit(0,1));    return UNIT; // milligrammo
"g"       yylval = Quantity(1.0e-3    ,Unit(0,1));    return UNIT; // grammo
"kg"      yylval = Quantity(1.0       ,Unit(0,1));    return UNIT; // kilogrammo
"t"       yylval = Quantity(1000.0    ,Unit(0,1));    return UNIT; // ton
"s"       yylval = Quantity(1.0       ,Unit(0,0,1));  return UNIT; // secondo                          (internal standard time)
"min"     yylval = Quantity(60.0      ,Unit(0,0,1));  return UNIT; // minuto
"h"       yylval = Quantity(3600.0    ,Unit(0,0,1));  return UNIT; // ora  
"A"       yylval = Quantity(1.0       ,Unit(0,0,0,1));    return UNIT; // Ampere          (internal standard electric current)
"mA"      yylval = Quantity(0.001     ,Unit(0,0,0,1));    return UNIT; // milli Ampere         
"kA"      yylval = Quantity(1000.0    ,Unit(0,0,0,1));    return UNIT; // kilo Ampere         
"MA"      yylval = Quantity(1.0e6     ,Unit(0,0,0,1));    return UNIT; // Mega Ampere         
"K"       yylval = Quantity(1.0       ,Unit(0,0,0,0,1));  return UNIT; // Kelvin (internal standard thermodynamic temperature)
"mK"      yylval = Quantity(0.001     ,Unit(0,0,0,0,1));  return UNIT; // Kelvin         
"yK"      yylval = Quantity(0.000001  ,Unit(0,0,0,0,1));  return UNIT; // Kelvin         
"mol"     yylval = Quantity(1.0       ,Unit(0,0,0,0,0,1));    return UNIT; // Mole     (internal standard amount of substance)        
"cd"      yylval = Quantity(1.0       ,Unit(0,0,0,0,0,0,1));  return UNIT; // Candela   (internal standard luminous intensity)        
"deg"     yylval = Quantity(1.0           ,Unit(0,0,0,0,0,0,0,1));    return UNIT; // degree         (internal standard angle)
"rad"     yylval = Quantity(180/M_PI      ,Unit(0,0,0,0,0,0,0,1));    return UNIT; // radian         
"gon"     yylval = Quantity(360.0/400.0   ,Unit(0,0,0,0,0,0,0,1));    return UNIT; // gon         
"in"      yylval = Quantity(25.4      ,Unit(1));      return UNIT; // inch
"\""      yylval = Quantity(25.4      ,Unit(1));      return UNIT; // inch
"fo"      yylval = Quantity(304.8     ,Unit(1));      return UNIT; // foot
"'"       yylval = Quantity(304.8     ,Unit(1));      return UNIT; // foot
"th"      yylval = Quantity(0.0254    ,Unit(1));      return UNIT; // thou
"yr"      yylval = Quantity(914.4     ,Unit(1));      return UNIT; // yard


"lb"      yylval = Quantity(0.45359237     ,Unit(0,1));   return UNIT; // pound
"oz"      yylval = Quantity(0.45359237     ,Unit(0,1));   return UNIT; // ounce
"st"      yylval = Quantity(6.35029318     ,Unit(0,1));   return UNIT; // Stone
"cwt"     yylval = Quantity(50.80234544    ,Unit(0,1));   return UNIT; // hundredweights
Altre lingue: