Plan 9 from Bell Labs’s /usr/web/sources/contrib/fernan/escomma/ex21.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
v0 = defaultVStep {vlim = 200, steps = 20} 
circuit :: ESim -> [Device]      
circuit z0 = (trf1 1 0 1 2 0 0.149 z0) ++
             (vsrc4 2 1 0 650.0 f v0 z0) ++
             (res1 3 1 0 1e15 z0) ++
             (trf1 4 1 0 3 0 0.149 z0) ++
             (dio1 5 4 3 z0) ++
             (dio1 6 4 2 z0) ++
             --(cap1 7 4 0 (2 * (2200.0e-6)) z0) ++
             --(res1 7 4 3 1e8 z0) ++
             --(res1 8 4 2 1e8 z0) ++
             (res1 7 5 0 1.2 z0) ++
             (vsrc1 8 4 5 0.0 z0) ++
             (cap1 9 4 0 (220 * (1.0e-6)) z0)       

m = dcOP1 [] [] circuit
op_out = opPrint m
i0 = opvalue m                       

f = 20000.0
per = 1 / f
  
z = dcTran1 (per / 16) (2 * per) i0 i0  circuit   
tr_out = trPrint [0,1,2,3,4,7,8] z

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].