Mercurial > forge
comparison extra/ocs/src/Mshichmanhodgesmosfet.cc @ 12674:3ce60a1159f8 octave-forge
fix bug in documentation
author | cdf |
---|---|
date | Mon, 17 Aug 2015 16:51:00 +0000 |
parents | 8c85ee67be16 |
children | a8f02c1adca6 |
comparison
equal
deleted
inserted
replaced
12673:88676c510f30 | 12674:3ce60a1159f8 |
---|---|
122 double vd = extvar(2); // V-drain | 122 double vd = extvar(2); // V-drain |
123 double vb = extvar(3); // V-bulk | 123 double vb = extvar(3); // V-bulk |
124 double T = extvar(4); // Temperature | 124 double T = extvar(4); // Temperature |
125 | 125 |
126 double k = mu0*Cox*pow((T + Tshift)/300.0,-3.0/2.0)*W/L; | 126 double k = mu0*Cox*pow((T + Tshift)/300.0,-3.0/2.0)*W/L; |
127 double dkdT = mu0*Cox*W*(-3.0/2)*pow((T + Tshift)/300.0,-5.0/2.0 )*(1.0/300.0)/L; | 127 double dkdT = mu0*Cox*W*(-3.0/2)*xpow((T + Tshift)/300.0,-5.0/2.0 )*(1.0/300.0)/L; |
128 | 128 |
129 double vgs = vg - vs; | 129 double vgs = vg - vs; |
130 double vds = vd - vs; | 130 double vds = vd - vs; |
131 | 131 |
132 if (vgs < Vth) | 132 if (vgs < Vth) |
136 *ids = vds*(*gd); | 136 *ids = vds*(*gd); |
137 *didT = 0; | 137 *didT = 0; |
138 } | 138 } |
139 else if ( ( (vgs-Vth)>= vds ) && (vds>=0)) | 139 else if ( ( (vgs-Vth)>= vds ) && (vds>=0)) |
140 { | 140 { |
141 *ids = k*((vgs-Vth)*vds - pow(vds,2)/2 ) + vds/rd; | 141 *ids = k*((vgs-Vth)*vds - xpow(vds,2)/2 ) + vds/rd; |
142 *gm = k*vds; | 142 *gm = k*vds; |
143 *gd = k*(vgs-Vth-vds) + (1/rd); | 143 *gd = k*(vgs-Vth-vds) + (1/rd); |
144 *didT = dkdT*((vgs-Vth)*vds-(pow(vds,2))/2); | 144 *didT = dkdT*((vgs-Vth)*vds-(xpow(vds,2))/2); |
145 } | 145 } |
146 else if (((vgs-Vth)>=(vds))&&(vds<0)) | 146 else if (((vgs-Vth)>=(vds))&&(vds<0)) |
147 { | 147 { |
148 *gm = 0; | 148 *gm = 0; |
149 *gd = 1/rd; | 149 *gd = 1/rd; |
150 *ids = vds*(*gd); | 150 *ids = vds*(*gd); |
151 *didT= 0; | 151 *didT= 0; |
152 } | 152 } |
153 else // (i.e. if 0 <= vgs-vth <= vds) | 153 else // (i.e. if 0 <= vgs-vth <= vds) |
154 { | 154 { |
155 *ids = (k/2)*pow((vgs-Vth),2) + vds/rd; | 155 *ids = (k/2)*xpow((vgs-Vth),2) + vds/rd; |
156 *gm = k*(vgs-Vth); | 156 *gm = k*(vgs-Vth); |
157 *gd = 1/rd; | 157 *gd = 1/rd; |
158 *didT= (dkdT/(2))*pow((vgs-Vth),2); | 158 *didT= (dkdT/(2))*xpow((vgs-Vth),2); |
159 } | 159 } |
160 | 160 |
161 *P = -(*ids)*vds; | 161 *P = -(*ids)*vds; |
162 *dPdT = -(*didT)*vds; | 162 *dPdT = -(*didT)*vds; |
163 *dPdvgs = -(*gm)*vds; | 163 *dPdvgs = -(*gm)*vds; |
175 double vs = extvar(1); // V-source | 175 double vs = extvar(1); // V-source |
176 double vd = extvar(2); // V-drain | 176 double vd = extvar(2); // V-drain |
177 double vb = extvar(3); // V-bulk | 177 double vb = extvar(3); // V-bulk |
178 double T = extvar(4); // Temperature | 178 double T = extvar(4); // Temperature |
179 | 179 |
180 double k = - mu0*Cox*pow((T + Tshift)/300.0,-3.0/2.0)*W/L; | 180 double k = - mu0*Cox*xpow((T + Tshift)/300.0,-3.0/2.0)*W/L; |
181 double dkdT = - mu0*Cox*W*(-3.0/2.0)*pow((T + Tshift)/300.0,-5.0/2.0 )*(1.0/300.0)/L; | 181 double dkdT = - mu0*Cox*W*(-3.0/2.0)*xpow((T + Tshift)/300.0,-5.0/2.0 )*(1.0/300.0)/L; |
182 | 182 |
183 double vgs = vg - vs; | 183 double vgs = vg - vs; |
184 double vds = vd - vs; | 184 double vds = vd - vs; |
185 | 185 |
186 if (vgs > Vth) | 186 if (vgs > Vth) |
190 *ids = vds*(*gd); | 190 *ids = vds*(*gd); |
191 *didT = 0; | 191 *didT = 0; |
192 } | 192 } |
193 else if ( ( (vgs-Vth)<= vds ) && (vds<=0)) | 193 else if ( ( (vgs-Vth)<= vds ) && (vds<=0)) |
194 { | 194 { |
195 *ids = k*((vgs-Vth)*vds - pow(vds,2)/2 ) + vds/rd; | 195 *ids = k*((vgs-Vth)*vds - xpow(vds,2)/2 ) + vds/rd; |
196 *gm = k*vds; | 196 *gm = k*vds; |
197 *gd = k*(vgs-Vth-vds) + (1/rd); | 197 *gd = k*(vgs-Vth-vds) + (1/rd); |
198 *didT = dkdT*((vgs-Vth)*vds-(pow(vds,2))/2); | 198 *didT = dkdT*((vgs-Vth)*vds-(xpow(vds,2))/2); |
199 } | 199 } |
200 else if (((vgs-Vth)<=(vds))&&(vds>0)) | 200 else if (((vgs-Vth)<=(vds))&&(vds>0)) |
201 { | 201 { |
202 *gm = 0; | 202 *gm = 0; |
203 *gd = 1/rd; | 203 *gd = 1/rd; |
204 *ids = vds*(*gd); | 204 *ids = vds*(*gd); |
205 *didT= 0; | 205 *didT= 0; |
206 } | 206 } |
207 else // (i.e. if 0 <= vgs-vth <= vds) | 207 else // (i.e. if 0 <= vgs-vth <= vds) |
208 { | 208 { |
209 *ids = (k/2)*pow((vgs-Vth),2) + vds/rd; | 209 *ids = (k/2)*xpow((vgs-Vth),2) + vds/rd; |
210 *gm = k*(vgs-Vth); | 210 *gm = k*(vgs-Vth); |
211 *gd = 1/rd; | 211 *gd = 1/rd; |
212 *didT= (dkdT/(2))*pow((vgs-Vth),2); | 212 *didT= (dkdT/(2))*xpow((vgs-Vth),2); |
213 } | 213 } |
214 | 214 |
215 *P = -(*ids)*vds; | 215 *P = -(*ids)*vds; |
216 *dPdT = -(*didT)*vds; | 216 *dPdT = -(*didT)*vds; |
217 *dPdvgs = -(*gm)*vds; | 217 *dPdvgs = -(*gm)*vds; |
541 retval(2) = octave_value(c); | 541 retval(2) = octave_value(c); |
542 } | 542 } |
543 else | 543 else |
544 error("Mshichmanhodgesmosfet: unknown element type.\n"); | 544 error("Mshichmanhodgesmosfet: unknown element type.\n"); |
545 | 545 |
546 return retval; | |
547 } | 546 } |
548 | 547 |
548 return (retval); | |
549 } | 549 } |