-
Couldn't load subscription status.
- Fork 87
Description
Hello, thank you very much for you work. I have an issue with a circuit that I try to simulate. While running the code I got this error messge :
File "C:\Python27\lib\site-packages\ahkab\switch.py", line 119, in init
self.dc_guess = self.model.get_dc_guess(self.device.is_on)
AttributeError: 'str' object has no attribute 'get_dc_guess'
Could you help me to solve the problem, it seem not to be a problem of my code.
This is the code I made that is not working so far :
import ahkab
import pylab as plt
import numpy as np
ownWall = ahkab.Circuit('First Try')
"""
models need to be defined before the devices that use them
"""
ownWall.add_model('ekv', 'nmos', dict(TYPE='n', VTO=.4, KP=10e-6))
ahkab.switch.vswitch_model('Switch', VT=5, VH=2, VON=None, VOFF=None, RON=None, ROFF=None)
ahkab.diode.diode_model('diode', IS=None, N=None, ISR=None, NR=None, RS=None, CJ0=None, M=None, VJ=None, FC=None, CP=None, TT=None, BV=None, IBV=None, KF=None, AF=None, FFE=None, TEMP=None, XTI=None, EG=None, TBV=None, TRS=None, TTT1=None, TTT2=None, TM1=None, TM2=None)
"""
This code will define the PWM driving the two mosfets
"""
v1 = 0
v2 = 5
alpha = 0.6
PER=10E-6
TR=10E-9
TD1 = 0
TD2 = TD1 + alphaPER
PW1 = alphaPER - 2TR
PW2 = (1 - alphaPER) - 2*TR
pwm1 = ahkab.time_functions.pulse(v1, v2, TD1, TR, PW1, TR, PER)
ownWall.add_vsource("VPWM1", "sn11", 'sn22', dc_value=10, ac_value=0, function = pwm1)
pwm2 = ahkab.time_functions.pulse(v1, v2, TD2, TR, PW2, TR, PER)
ownWall.add_vsource("VPWM2", "sn12", 'sn22', dc_value=10, ac_value=0, function = pwm2)
"""
This code define the power block of the ownWall without
input and output voltage and without PWM
"""
ownWall.add_capacitor('C1', 'n2', 'n1', value=440E-6)
ownWall.add_inductor('L', 'n2', 'n3', value=100E-6)
ownWall.add_resistor('Rl', 'n3', 'n4', value=0.1)
ahkab.switch.switch_device('n1', 'n4', 'sn11', 'sn21', 'Switch' )
ahkab.switch.switch_device('n5', 'n4', 'sn12', 'sn22', 'Switch' )
ownWall.add_diode('D1', 'n1', 'n4', 'diode')
ownWall.add_diode('D2', 'n4', 'n5', 'diode')
ownWall.add_capacitor('C2', 'n5', 'n1', value=440E-6)
Thank you for your help,
Romain.