View Javadoc

1   package org.catacomb.numeric.phys;
2   
3   
4   
5   
6   /*
7   
8    Calculation units for cells:
9   
10     ms            milliseconds
11     mV            millivolts
12     pA            picoamps
13     fC            femtocoulombs
14     pF            picofarads
15     nS            nanosiemens
16     GOhm          gigaohms
17     micron        micrometers
18     M             Molar
19     GOhm micron       for resistivity
20  
21  
22     eg  1 pA flowing onto a 1 pF capacitor raises the potential
23         by 1 mV per ms
24  
25         1 pA flowing through a resistance of 1 GOhm gives a potential drop
26         of 1mV
27  
28         1 mV across a conductance of 1 nS gives a current of 1 pA
29  
30         1 fC per ms is 1pC per second, or 1 pA
31  
32  
33     So, to get capacitance from area (micron^2) and C_mem in muF/cm^2
34     need x 10^6 for micro to pico and / 10^8 for cm to micron twice.
35     ie, 1.e-2;
36  
37     1/resistance in MOhm gives conductance in microS - need to multiply
38     conductances by 1000.
39  
40  
41     To convert from Ohm cm to GOhm micron, mply by 10-9 * 10^4 = 10^-5
42  
43  
44  
45  
46     ##### everything under the calc package is in these units #####
47     other catacomb packages can use whatever units they like,
48     but must call the appropriate conversion when exporting to
49     objects from calc.
50  
51  
52     The idea of this class is that components needn't know what
53     units to export in - they just call the appropriate converter,
54     saying what units thay have.
55  
56   */
57  
58  public final class Units {
59      public final static double from_ms(double x) {
60          return x;
61      }
62      public final static double from_nm(double x) {
63          return 1.e-3 * x;
64      }
65      public final static double from_micron(double x) {
66          return x;
67      }
68      public final static double from_micron2(double x) {
69          return x;
70      }
71      public final static double from_mV(double x) {
72          return x;
73      }
74      public final static double from_V(double x) {
75          return x * 1000.;
76      }
77      public final static double from_perV(double x) {
78          return x * 1e-3;
79      }
80      public final static double from_Ohmcm(double x) {
81          return 1e-5 * x;
82      }
83      public final static double from_microFpercm2(double x) {
84          return 1.e-2 *x;
85      }
86      public final static double from_pS(double x) {
87          return 1.e-3 * x;
88      }
89      public final static double from_nS(double x) {
90          return x;
91      }
92      public final static double from_microS(double x) {
93          return 1.e3 * x;
94      }
95      public final static double from_pA(double x) {
96          return x;
97      }
98      public final static double from_nA(double x) {
99          return 1.e3 * x;
100     }
101     public final static double from_A(double x) {
102         return 1.e-12 * x;
103     }
104     public final static double from_Celcius(double x) {
105         return 273 + x;
106     }
107     public final static double from_electrons(double x) {
108         return 1.e15 * Phys.electronCharge * x;
109     }
110     public final static double from_degrees(double x) {
111         return 2. * Math.PI * x / 360.;
112     }
113 }
114 
115 
116 
117