turn {DEV,MODEL}_SUBCKT into base class
[gnucap-felix.git] / include / constant.h
blob72f214c81d4381c1f9424e1b6b9c45dd15ec2bde
1 /*$Id: constant.h,v 2014/05/16 al $ -*- C++ -*-
2 * Copyright (C) 2001 Albert Davis
3 * Author: Albert Davis <aldavis@gnu.org>
5 * This file is part of "Gnucap", the Gnu Circuit Analysis Package
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 3, or (at your option)
10 * any later version.
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.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
20 * 02110-1301, USA.
21 *------------------------------------------------------------------
22 * defined constants for just about everything
24 //testing=trivial 2006.07.17
25 #ifndef CONSTANT_H
26 #define CONSTANT_H
27 #include "md.h"
28 /*--------------------------------------------------------------------------*/
29 /* The names are chosen according to Verilog-A spec. */
30 /* Commented out means they are defined in a standard header, usually <math>*/
31 /* or there is some discrepancy of the correct value */
33 /* standard mathematical constants */
34 //double const M_PI = 3.1415926535897932384626433832795028841972;
35 double const M_TWO_PI = M_PI * 2;
36 //double const M_PI_2 = M_PI / 2;
37 //double const M_PI_4 = M_PI / 4;
38 //double const M_1_PI = 1 / M_PI;
39 //double const M_2_PI = 2 / M_PI;
40 //double const M_2_SQRTPI = 2 / sqrt(M_PI);
42 //double const M_E = 2.7182818284590452354;
43 //double const M_LOG2E = 1.4426950408889634074; // log2(M_E)
44 //double const M_LOG10E = 0.43429448190325182765; // log10(M_E)
45 //double const M_LN2 = 0.69314718055994530942; // log(2)
46 //double const M_LN10 = 2.3025809299404568402; // log(10)
48 //double const M_SQRT2 = 1.4142135623730904880; // sqrt(2)
49 //double const M_SQRT1_2 = 1 / M_SQRT_2;
51 /* extra mathematical constants */
52 //double const DTOR = 0.0174532925199432957692369076848861271344;
53 //double const RTOD = 57.2957795130823208768;
54 double const DTOR = M_PI / 180;
55 double const RTOD = 180 / M_PI;
57 /* standard physical constants ref: http://physics.nist.gov */
58 double const P_Q = 1.6021918e-19; // charge of an electron, (spice)
59 //double const P_Q = 1.60217653e-19; // charge of an electron, (nist)
60 double const P_C = 2.99792458e8; // speed of light m/s
61 double const P_K = 1.3806226e-23; // Boltzmann's constant J/K (spice)
62 //double const P_K = 1.3806505e-23; // Boltzmann's constant J/K (nist)
63 double const P_H = 6.6260693e-34; // Planck's constant J-s
64 double const P_U0 = M_PI * 4.0e-7; // permeability of vaccuum H/m
65 double const P_EPS0 = 8.854214871e-12; // permittivity of air F/m(spice)
66 //double const P_EPS0 = 8.854187817e-12; // permittivity of vaccuum F/m(nist)
67 //double const P_EPS0 = 1/(P_U0*P_C*P_C);// permittivity of vaccuum F/m(nist)
68 double const P_CELSIUS0 = 273.15; // 0 Celsius
70 /* extra physical constants */
71 double const P_EPS_SI = 11.7*P_EPS0; // permittivity of silicon (1.0359e-10)
72 double const P_EPS_OX = 3.9*P_EPS0; // permittivity of oxide (3.45e-11)
73 double const P_K_Q = P_K/P_Q;
75 /* dimension conversions.
76 * Hopefully, all internal distances are in meters.
77 * (except for some Berkeley models)
78 * In some cases the user data is in other units
80 double const CM2M = 1e-2; /* centimeters to meters */
81 double const CM2M2 = 1e-4; /* ........... squared */
82 double const ICM2M = 1e2; /* inverse ........... */
83 double const ICM2M2 = 1e4; /* inverse ........... squared */
84 double const ICM2M3 = 1e6; /* inverse ........... cubed */
85 double const MICRON2METER = 1e-6; /* microns to meters */
87 //#ifdef HAS_NUMERIC_LIMITS
88 //double const MAXDBL = std::numeric_limits<double>::max();
89 //#else
90 //double const MAXDBL = DBL_MAX;
91 //#endif
92 //BUG// construction order bug? .. use #define
94 #define MAXDBL (DBL_MAX)
96 double const BIGBIG = (MAXDBL)*(.9247958); /* unlikely number */
97 //double const OVERDUE = -(MAXDBL)*(.9347958);/* unlikely number */
98 double const NEVER = (MAXDBL)*(.9447958); /* unlikely number */
99 double const NOT_INPUT = -(MAXDBL)*(.9547658); /* unlikely number */
100 double const NOT_VALID = -(MAXDBL)*(.9647958); /* unlikely number */
101 double const LINEAR = -(MAXDBL)*(.9747958); /* unlikely number */
103 double const LOGBIGBIG = log(BIGBIG);
105 double const VOLTMIN = 1.0e-50;
106 double const PWRMIN = 1.0e-100;
108 const char TOKENTERM[] = ",=()[]";
110 enum {FILE_OK=0, FILE_BAD=-1};
111 /*--------------------------------------------------------------------------*/
112 /*--------------------------------------------------------------------------*/
113 #endif
114 // vim:ts=8:sw=2:noet: