131
|
1 ------------------------------------------------------------------------------
|
|
2 -- --
|
|
3 -- GNAT RUN-TIME COMPONENTS --
|
|
4 -- --
|
|
5 -- S Y S T E M . D I M . G E N E R I C _ M K S --
|
|
6 -- --
|
|
7 -- S p e c --
|
|
8 -- --
|
|
9 -- Copyright (C) 2011-2018, Free Software Foundation, Inc. --
|
|
10 -- --
|
|
11 -- GNAT is free software; you can redistribute it and/or modify it under --
|
|
12 -- terms of the GNU General Public License as published by the Free Soft- --
|
|
13 -- ware Foundation; either version 3, or (at your option) any later ver- --
|
|
14 -- sion. GNAT is distributed in the hope that it will be useful, but WITH- --
|
|
15 -- OUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY --
|
|
16 -- or FITNESS FOR A PARTICULAR PURPOSE. --
|
|
17 -- --
|
|
18 -- As a special exception under Section 7 of GPL version 3, you are granted --
|
|
19 -- additional permissions described in the GCC Runtime Library Exception, --
|
|
20 -- version 3.1, as published by the Free Software Foundation. --
|
|
21 -- --
|
|
22 -- You should have received a copy of the GNU General Public License and --
|
|
23 -- a copy of the GCC Runtime Library Exception along with this program; --
|
|
24 -- see the files COPYING3 and COPYING.RUNTIME respectively. If not, see --
|
|
25 -- <http://www.gnu.org/licenses/>. --
|
|
26 -- --
|
|
27 -- GNAT was originally developed by the GNAT team at New York University. --
|
|
28 -- Extensive contributions were provided by Ada Core Technologies Inc. --
|
|
29 -- --
|
|
30 ------------------------------------------------------------------------------
|
|
31
|
|
32 -- Defines the MKS dimension system which is the SI system of units
|
|
33
|
|
34 -- Some other prefixes of this system are defined in a child package (see
|
|
35 -- System.Dim.Generic_Mks.Generic_Other_Prefixes) in order to avoid too many
|
|
36 -- constant declarations in this package.
|
|
37
|
|
38 -- The dimension terminology is defined in System.Dim package
|
|
39
|
|
40 with Ada.Numerics;
|
|
41
|
|
42 generic
|
|
43 type Float_Type is digits <>;
|
|
44
|
|
45 package System.Dim.Generic_Mks is
|
|
46
|
|
47 e : constant := Ada.Numerics.e;
|
|
48 Pi : constant := Ada.Numerics.Pi;
|
|
49
|
|
50 -- Dimensioned type Mks_Type
|
|
51
|
|
52 type Mks_Type is new Float_Type
|
|
53 with
|
|
54 Dimension_System => (
|
|
55 (Unit_Name => Meter, Unit_Symbol => 'm', Dim_Symbol => 'L'),
|
|
56 (Unit_Name => Kilogram, Unit_Symbol => "kg", Dim_Symbol => 'M'),
|
|
57 (Unit_Name => Second, Unit_Symbol => 's', Dim_Symbol => 'T'),
|
|
58 (Unit_Name => Ampere, Unit_Symbol => 'A', Dim_Symbol => 'I'),
|
|
59 (Unit_Name => Kelvin, Unit_Symbol => 'K', Dim_Symbol => '@'),
|
|
60 (Unit_Name => Mole, Unit_Symbol => "mol", Dim_Symbol => 'N'),
|
|
61 (Unit_Name => Candela, Unit_Symbol => "cd", Dim_Symbol => 'J'));
|
|
62
|
|
63 -- SI Base dimensioned subtypes
|
|
64
|
|
65 subtype Length is Mks_Type
|
|
66 with
|
|
67 Dimension => (Symbol => 'm',
|
|
68 Meter => 1,
|
|
69 others => 0);
|
|
70
|
|
71 subtype Mass is Mks_Type
|
|
72 with
|
|
73 Dimension => (Symbol => "kg",
|
|
74 Kilogram => 1,
|
|
75 others => 0);
|
|
76
|
|
77 subtype Time is Mks_Type
|
|
78 with
|
|
79 Dimension => (Symbol => 's',
|
|
80 Second => 1,
|
|
81 others => 0);
|
|
82
|
|
83 subtype Electric_Current is Mks_Type
|
|
84 with
|
|
85 Dimension => (Symbol => 'A',
|
|
86 Ampere => 1,
|
|
87 others => 0);
|
|
88
|
|
89 subtype Thermodynamic_Temperature is Mks_Type
|
|
90 with
|
|
91 Dimension => (Symbol => 'K',
|
|
92 Kelvin => 1,
|
|
93 others => 0);
|
|
94
|
|
95 subtype Amount_Of_Substance is Mks_Type
|
|
96 with
|
|
97 Dimension => (Symbol => "mol",
|
|
98 Mole => 1,
|
|
99 others => 0);
|
|
100
|
|
101 subtype Luminous_Intensity is Mks_Type
|
|
102 with
|
|
103 Dimension => (Symbol => "cd",
|
|
104 Candela => 1,
|
|
105 others => 0);
|
|
106
|
|
107 -- Initialize SI Base unit values
|
|
108
|
|
109 -- Turn off the all the dimension warnings for these basic assignments
|
|
110 -- since otherwise we would get complaints about assigning dimensionless
|
|
111 -- values to dimensioned subtypes (we can't assign 1.0*m to m).
|
|
112
|
|
113 pragma Warnings (Off, "*assumed to be*");
|
|
114
|
|
115 m : constant Length := 1.0;
|
|
116 kg : constant Mass := 1.0;
|
|
117 s : constant Time := 1.0;
|
|
118 A : constant Electric_Current := 1.0;
|
|
119 K : constant Thermodynamic_Temperature := 1.0;
|
|
120 mol : constant Amount_Of_Substance := 1.0;
|
|
121 cd : constant Luminous_Intensity := 1.0;
|
|
122
|
|
123 pragma Warnings (On, "*assumed to be*");
|
|
124
|
|
125 -- SI Derived dimensioned subtypes
|
|
126
|
|
127 subtype Absorbed_Dose is Mks_Type
|
|
128 with
|
|
129 Dimension => (Symbol => "Gy",
|
|
130 Meter => 2,
|
|
131 Second => -2,
|
|
132 others => 0);
|
|
133
|
|
134 subtype Angle is Mks_Type
|
|
135 with
|
|
136 Dimension => (Symbol => "rad",
|
|
137 others => 0);
|
|
138
|
|
139 subtype Area is Mks_Type
|
|
140 with
|
|
141 Dimension => (
|
|
142 Meter => 2,
|
|
143 others => 0);
|
|
144
|
|
145 subtype Catalytic_Activity is Mks_Type
|
|
146 with
|
|
147 Dimension => (Symbol => "kat",
|
|
148 Second => -1,
|
|
149 Mole => 1,
|
|
150 others => 0);
|
|
151
|
|
152 subtype Celsius_Temperature is Mks_Type
|
|
153 with
|
|
154 Dimension => (Symbol => "°C",
|
|
155 Kelvin => 1,
|
|
156 others => 0);
|
|
157
|
|
158 subtype Electric_Capacitance is Mks_Type
|
|
159 with
|
|
160 Dimension => (Symbol => 'F',
|
|
161 Meter => -2,
|
|
162 Kilogram => -1,
|
|
163 Second => 4,
|
|
164 Ampere => 2,
|
|
165 others => 0);
|
|
166
|
|
167 subtype Electric_Charge is Mks_Type
|
|
168 with
|
|
169 Dimension => (Symbol => 'C',
|
|
170 Second => 1,
|
|
171 Ampere => 1,
|
|
172 others => 0);
|
|
173
|
|
174 subtype Electric_Conductance is Mks_Type
|
|
175 with
|
|
176 Dimension => (Symbol => 'S',
|
|
177 Meter => -2,
|
|
178 Kilogram => -1,
|
|
179 Second => 3,
|
|
180 Ampere => 2,
|
|
181 others => 0);
|
|
182
|
|
183 subtype Electric_Potential_Difference is Mks_Type
|
|
184 with
|
|
185 Dimension => (Symbol => 'V',
|
|
186 Meter => 2,
|
|
187 Kilogram => 1,
|
|
188 Second => -3,
|
|
189 Ampere => -1,
|
|
190 others => 0);
|
|
191
|
|
192 -- Note the type punning below. The Symbol is a single "ohm" character
|
|
193 -- encoded in UTF-8 (ce a9 in hexadecimal), but this file is not compiled
|
|
194 -- with -gnatW8, so we're treating the string literal as a two-character
|
|
195 -- String.
|
|
196
|
|
197 subtype Electric_Resistance is Mks_Type
|
|
198 with
|
|
199 Dimension => (Symbol => "Ω",
|
|
200 Meter => 2,
|
|
201 Kilogram => 1,
|
|
202 Second => -3,
|
|
203 Ampere => -2,
|
|
204 others => 0);
|
|
205
|
|
206 subtype Energy is Mks_Type
|
|
207 with
|
|
208 Dimension => (Symbol => 'J',
|
|
209 Meter => 2,
|
|
210 Kilogram => 1,
|
|
211 Second => -2,
|
|
212 others => 0);
|
|
213
|
|
214 subtype Equivalent_Dose is Mks_Type
|
|
215 with
|
|
216 Dimension => (Symbol => "Sv",
|
|
217 Meter => 2,
|
|
218 Second => -2,
|
|
219 others => 0);
|
|
220
|
|
221 subtype Force is Mks_Type
|
|
222 with
|
|
223 Dimension => (Symbol => 'N',
|
|
224 Meter => 1,
|
|
225 Kilogram => 1,
|
|
226 Second => -2,
|
|
227 others => 0);
|
|
228
|
|
229 subtype Frequency is Mks_Type
|
|
230 with
|
|
231 Dimension => (Symbol => "Hz",
|
|
232 Second => -1,
|
|
233 others => 0);
|
|
234
|
|
235 subtype Illuminance is Mks_Type
|
|
236 with
|
|
237 Dimension => (Symbol => "lx",
|
|
238 Meter => -2,
|
|
239 Candela => 1,
|
|
240 others => 0);
|
|
241
|
|
242 subtype Inductance is Mks_Type
|
|
243 with
|
|
244 Dimension => (Symbol => 'H',
|
|
245 Meter => 2,
|
|
246 Kilogram => 1,
|
|
247 Second => -2,
|
|
248 Ampere => -2,
|
|
249 others => 0);
|
|
250
|
|
251 subtype Luminous_Flux is Mks_Type
|
|
252 with
|
|
253 Dimension => (Symbol => "lm",
|
|
254 Candela => 1,
|
|
255 others => 0);
|
|
256
|
|
257 subtype Magnetic_Flux is Mks_Type
|
|
258 with
|
|
259 Dimension => (Symbol => "Wb",
|
|
260 Meter => 2,
|
|
261 Kilogram => 1,
|
|
262 Second => -2,
|
|
263 Ampere => -1,
|
|
264 others => 0);
|
|
265
|
|
266 subtype Magnetic_Flux_Density is Mks_Type
|
|
267 with
|
|
268 Dimension => (Symbol => 'T',
|
|
269 Kilogram => 1,
|
|
270 Second => -2,
|
|
271 Ampere => -1,
|
|
272 others => 0);
|
|
273
|
|
274 subtype Power is Mks_Type
|
|
275 with
|
|
276 Dimension => (Symbol => 'W',
|
|
277 Meter => 2,
|
|
278 Kilogram => 1,
|
|
279 Second => -3,
|
|
280 others => 0);
|
|
281
|
|
282 subtype Pressure is Mks_Type
|
|
283 with
|
|
284 Dimension => (Symbol => "Pa",
|
|
285 Meter => -1,
|
|
286 Kilogram => 1,
|
|
287 Second => -2,
|
|
288 others => 0);
|
|
289
|
|
290 subtype Radioactivity is Mks_Type
|
|
291 with
|
|
292 Dimension => (Symbol => "Bq",
|
|
293 Second => -1,
|
|
294 others => 0);
|
|
295
|
|
296 subtype Solid_Angle is Mks_Type
|
|
297 with
|
|
298 Dimension => (Symbol => "sr",
|
|
299 others => 0);
|
|
300
|
|
301 subtype Speed is Mks_Type
|
|
302 with
|
|
303 Dimension => (
|
|
304 Meter => 1,
|
|
305 Second => -1,
|
|
306 others => 0);
|
|
307
|
|
308 subtype Volume is Mks_Type
|
|
309 with
|
|
310 Dimension => (
|
|
311 Meter => 3,
|
|
312 others => 0);
|
|
313
|
|
314 -- Initialize derived dimension values
|
|
315
|
|
316 -- Turn off the all the dimension warnings for these basic assignments
|
|
317 -- since otherwise we would get complaints about assigning dimensionless
|
|
318 -- values to dimensioned subtypes.
|
|
319
|
|
320 pragma Warnings (Off, "*assumed to be*");
|
|
321
|
|
322 rad : constant Angle := 1.0;
|
|
323 sr : constant Solid_Angle := 1.0;
|
|
324 Hz : constant Frequency := 1.0;
|
|
325 N : constant Force := 1.0;
|
|
326 Pa : constant Pressure := 1.0;
|
|
327 J : constant Energy := 1.0;
|
|
328 W : constant Power := 1.0;
|
|
329 C : constant Electric_Charge := 1.0;
|
|
330 V : constant Electric_Potential_Difference := 1.0;
|
|
331 F : constant Electric_Capacitance := 1.0;
|
|
332 Ohm : constant Electric_Resistance := 1.0;
|
|
333 Si : constant Electric_Conductance := 1.0;
|
|
334 Wb : constant Magnetic_Flux := 1.0;
|
|
335 T : constant Magnetic_Flux_Density := 1.0;
|
|
336 H : constant Inductance := 1.0;
|
|
337 dC : constant Celsius_Temperature := 273.15;
|
|
338 lm : constant Luminous_Flux := 1.0;
|
|
339 lx : constant Illuminance := 1.0;
|
|
340 Bq : constant Radioactivity := 1.0;
|
|
341 Gy : constant Absorbed_Dose := 1.0;
|
|
342 Sv : constant Equivalent_Dose := 1.0;
|
|
343 kat : constant Catalytic_Activity := 1.0;
|
|
344
|
|
345 -- SI prefixes for Meter
|
|
346
|
|
347 um : constant Length := 1.0E-06; -- micro (u)
|
|
348 mm : constant Length := 1.0E-03; -- milli
|
|
349 cm : constant Length := 1.0E-02; -- centi
|
|
350 dm : constant Length := 1.0E-01; -- deci
|
|
351 dam : constant Length := 1.0E+01; -- deka
|
|
352 hm : constant Length := 1.0E+02; -- hecto
|
|
353 km : constant Length := 1.0E+03; -- kilo
|
|
354 Mem : constant Length := 1.0E+06; -- mega
|
|
355
|
|
356 -- SI prefixes for Kilogram
|
|
357
|
|
358 ug : constant Mass := 1.0E-09; -- micro (u)
|
|
359 mg : constant Mass := 1.0E-06; -- milli
|
|
360 cg : constant Mass := 1.0E-05; -- centi
|
|
361 dg : constant Mass := 1.0E-04; -- deci
|
|
362 g : constant Mass := 1.0E-03; -- gram
|
|
363 dag : constant Mass := 1.0E-02; -- deka
|
|
364 hg : constant Mass := 1.0E-01; -- hecto
|
|
365 Meg : constant Mass := 1.0E+03; -- mega
|
|
366
|
|
367 -- SI prefixes for Second
|
|
368
|
|
369 us : constant Time := 1.0E-06; -- micro (u)
|
|
370 ms : constant Time := 1.0E-03; -- milli
|
|
371 cs : constant Time := 1.0E-02; -- centi
|
|
372 ds : constant Time := 1.0E-01; -- deci
|
|
373 das : constant Time := 1.0E+01; -- deka
|
|
374 hs : constant Time := 1.0E+02; -- hecto
|
|
375 ks : constant Time := 1.0E+03; -- kilo
|
|
376 Mes : constant Time := 1.0E+06; -- mega
|
|
377
|
|
378 -- Other constants for Second
|
|
379
|
|
380 min : constant Time := 60.0 * s;
|
|
381 hour : constant Time := 60.0 * min;
|
|
382 day : constant Time := 24.0 * hour;
|
|
383 year : constant Time := 365.25 * day;
|
|
384
|
|
385 -- SI prefixes for Ampere
|
|
386
|
|
387 mA : constant Electric_Current := 1.0E-03; -- milli
|
|
388 cA : constant Electric_Current := 1.0E-02; -- centi
|
|
389 dA : constant Electric_Current := 1.0E-01; -- deci
|
|
390 daA : constant Electric_Current := 1.0E+01; -- deka
|
|
391 hA : constant Electric_Current := 1.0E+02; -- hecto
|
|
392 kA : constant Electric_Current := 1.0E+03; -- kilo
|
|
393 MeA : constant Electric_Current := 1.0E+06; -- mega
|
|
394
|
|
395 pragma Warnings (On, "*assumed to be*");
|
|
396 end System.Dim.Generic_Mks;
|