MCPcopy Create free account
hub / github.com/SLiCAP/SLiCAP_python / getSv_inoise

Method getSv_inoise

SLiCAP/SLiCAPngspice.py:268–302  ·  view source on GitHub ↗
(self, ID, VD, VS, VB, fmin, fmax, numDec)

Source from the content-addressed store, hash-verified

266 self.errors['cbd'] = ((self.params['cbd']-self.params['cdb'])/(self.params['cbd']+self.params['cdb']))
267
268 def getSv_inoise(self, ID, VD, VS, VB, fmin, fmax, numDec):
269 self.params = {}
270 self.step = None
271 self.getOPid(ID, VD, VS, VB, sqrt(fmin*fmax))
272 VGS = self.params['v(vgs)']
273 if self.dev[0].lower() == 'p':
274 VGS = -VGS
275 IDS = self.params['i(ids)']
276 print("Ids target :", ID)
277 print("Ids realized:", IDS, "\n")
278 print("Vgs realized:", VGS, "\n")
279 txt = "MOS_noise\n"
280 txt += '%s\n\n'%(self.lib)
281 txt += '.param L = %s\n'%(self.L)
282 txt += '.param W = %s\n'%(self.W)
283 txt += '.param M = %s\n'%(self.M)
284 txt += '.param VG = %s\n'%(VGS + VS)
285 txt += '.param VD = %s\n'%(VD)
286 txt += '.param VS = %s\n'%(VS)
287 txt += '.param VB = %s\n'%(VB)
288 txt += '%s d g s b %s W={W} L={L} M={M}\n\n'%(self.refDes, self.dev)
289 txt += 'V1 dd 0 dc {VD}\n'
290 txt += 'V2 g 0 dc {VG} ac 1\n'
291 txt += 'V3 s 0 dc {VS}\n'
292 txt += 'V4 b 0 dc {VB}\n'
293 txt += 'L1 d dd 1G\n'
294 txt += '.end'
295 with open('MOS_noise.cir', 'w') as f:
296 f.write(txt)
297 simCmd = 'noise V(d) V2 dec %s %s %s'%( str(numDec), str(fmin), str(fmax))
298 namesDict = {'inoise': 'inoise_spectrum'}
299 output = ngspice2traces('MOS_noise', simCmd, namesDict, stepCmd=None, traceType='onoise', squaredNoise=True)
300 remove('MOS_noise.cir')
301 remove('MOS_noise.csv')
302 return output
303
304def _run_ngspice(args, stdout_path=None, timeout=None):
305 """Run ngspice as a direct child process so it can be reliably terminated.

Callers

nothing calls this directly

Calls 3

getOPidMethod · 0.95
ngspice2tracesFunction · 0.85
writeMethod · 0.80

Tested by

no test coverage detected