KiCad PCB EDA Suite
Loading...
Searching...
No Matches
units_scales.h
Go to the documentation of this file.
1/*
2 * This program source code file is part of KiCad, a free EDA CAD application.
3 *
4 * Copyright (C) 2011-2014 Jean-Pierre Charras
5 * Copyright (C) 2004-2022 KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 *
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License along
18 * with this program. If not, see <http://www.gnu.org/licenses/>.
19 */
20
25// Inside calculations, units are always meter, Hz, Ohm and Radian
26// These units are not very easy to handle, so we use conversion constants
27
28#ifndef UNITS_SCALES_H
29#define UNITS_SCALES_H
30
31#define UNIT_KM 1e3 // km to meter
32#define UNIT_M 1 // m to meter
33#define UNIT_CM 1e-2 // cm to meter
34#define UNIT_MM 1e-3 // mm to meter
35#define UNIT_MICRON 1e-6 // um to meter
36#define UNIT_INCH (1e-2*2.54) // inch to meter
37#define UNIT_MIL (1e-5*2.54) // mil (or thou) to meter
38#define UNIT_FEET 0.3048 // feet to meter
39#define UNIT_OZSQFT (34.40*UNIT_MICRON) // 1 oz/ft^2 is 34.30 microns nominal, 30.90 minimum
40
41#define UNIT_GHZ 1e9
42#define UNIT_MHZ 1e6
43#define UNIT_KHZ 1e3
44
45#define UNIT_DEGREE (M_PI/180.0) // degree to radian
46#define UNIT_RADIAN 1.0 // Radian to radian
47
48#define UNIT_OHM 1.0 // Ohm to Ohm
49#define UNIT_KOHM 1e3 // KOhm to Ohm
50
51#define UNIT_OHM_PER_METER 1.0 // Ohm per meter to Ohm per meter
52#define UNIT_OHM_PER_KILOMETER 1e-3 // Ohm per kilometer to Ohm per meter
53#define UNIT_OHM_PER_FEET 3.28084 // Ohm per feet to Ohm per meter
54#define UNIT_OHM_PER_1000FEET 3.28084e-3 // Ohm per 1000feet to Ohm per meter
55
56#define UNIT_KILOVOLT 1e-3 // Kilovolt to Volt
57#define UNIT_VOLT 1.0 // Volt to Volt
58#define UNIT_MILLIVOLT 1e+3 // Millivolt to Volt
59
60#define UNIT_MEGAWATT 1e-6 // Kilowatt to Watt
61#define UNIT_KILOWATT 1e-3 // Kilowatt to Watt
62#define UNIT_WATT 1.0 // Watt to Watt
63#define UNIT_MILLIWATT 1e+3 // Milliwatt to Watt
64
65#define UNIT_METER_PER_SECOND 1.0 // meter per second to meter per second
66#define UNIT_KILOMETER_PER_HOUR ( 1 / 3.6 ) // km/h to m/s
67#define UNIT_FEET_PER_SECOND 0.3048 // ft/s to m/s
68#define UNIT_MILES_PER_HOUR 1609.34 // mi/h to m/s
69
70#define UNIT_SECOND 1.0 // second to second
71#define UNIT_MSECOND 1e-3 // millisecond to second
72#define UNIT_USECOND 1e-6 // microsecond to second
73#define UNIT_NSECOND 1e-9 // nanosecond to second
74#define UNIT_PSECOND 1e-12 // picosecond to second
75
76#endif // UNITS_SCALES_H