Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/escomma/ex23.hs

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


--------------------------------------------------------------------------------
import DC
import Circuit
import Print
import Time
import CPUTime

import Array

circuit :: ESim -> [Device]      
circuit z0 = (trf1 1 0 1 2 0 0.210 z0) ++
             (vsrc6 2 1 0 pwl v0 z0) ++
             (res1 3 1 0 1e15 z0) ++   
             (trf1 4 1 0 3 0 0.210 z0) ++
             (dio1 5 6 3 z0) ++    
             (res1 6 6 4 1.0 z0) ++   
             (res1 7 6 3 1.0e7 z0) ++ 
             (dio1 8 2 7 z0) ++    
             (res1 9 7 5 1.0 z0) ++    
             (res1 10 2 7 1.0e7 z0) ++    
             (dio1 11 3 8 z0) ++    
             (res1 12 5 8 1.0 z0) ++    
             (res1 13 3 8 1.0e7 z0) ++     
             (dio1 14 9 2 z0) ++    
             (res1 15 4 9 1.0 z0) ++    
             (res1 16 9 2 1.0e7 z0) ++ 
             (res1 17 4 5 1.0e20 z0) ++   
             (ind1 18 4 10 1.0e-3 z0) ++   
             (cap1 19 10 5 1.0e-6 z0) ++   
             (res1 20 10 5 100.0 z0)      
    
v0 = defaultVStep {vlim = 200, tlim = 50, steps = 10}
g0 = defaultGmin     
 
f = 20000.0
per = 1 / f
vp = 400.0            

pwl = [ (0.0, 0.0),
        (vp,  per*0.01),
        (vp,  per*0.39),
        (0.0, per*0.40), 
        (0.0, per*0.50),
        ((-1 * vp), per * 0.51),
        ((-1 * vp), per * 0.89),     
        (0.0, per * 0.90),
        (0.0, per) 
      ]
      
m = dcOP1 [] [] circuit
i0 = opvalue m                       
z = dcTran1 (per / 16) (1 * per) i0 i0  circuit   
tr_out = trPrint [0,1,2,3,4,5,6,7,9] z    
op_out = opPrint m   

          
            
main = do op_out
          tr_out 
          
          
          

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].