Comments (2)
Hello Dan,
Thanks for the nice words. I am very glad you enjoy this library!
Here follows the explanation for that message you see. I agree that it would be arguably good to avoid that condition, so I will patch it away soon.
Verbose answer follows:
The sine function has five parameters:
vo
, offset voltage in Voltva
, amplitude voltage, in Voltfreq
oscillation frequency in Hertztd
time delay, in secondstheta
oscillation damping constant in seconds
For all time functions, you may change the parameters at will in your code like, for example:
mysin.td = 1e-6
The change will be effective immediately.
As of now, you can even define a time function with a subset of the parameters and define the missing parameters subsequently, eg after you compute them.
For example, if you leave theta
undefined -- I'd venture to guess this is what is happening in your code -- when you try to evaluate the sine, it will complain some parameters are undefined and hence the time function should be impossible to evaluate. Only when it actually comes to evaluate it, the (pretty trivial) algorithm tries to provide a result anyway -- or otherwise it should stop the simulation -- and theta
undefined is interpreted as no damping, ie theta == 0
and the damping code is not executed (as damping with null theta
means divide by zero) and all is fine.
Providing a default value hard-coded in ahkab would make this error go away. I believe this to be a good idea, especially for theta
, which few people use. I will still think a bit about it before patching to make sure this doesn't bite back in unexpected ways.
I will also post here a drawing as time allows.
All the best,
GV
EDIT: clarifications, rewording.
from ahkab.
It should be fixed in 19eecc2
Now all commonly used parameters are compulsory and all seldom used parameters have a default value.
Noticed I realized I made a mistake whic got fixed too, the old theta
corresponds to, according to the usual conventions, 1/theta
. I have added the phase lag phi
too.
Here is the docstring from devices.sin
:
f(t) =
t < td:
vo + va*sin(pi*phi/180)
t >= td:
vo + va*exp(-(time - td)*theta)*sin(2*pi*freq*(t - td) + pi*phi/180)
*Parameters:*
vo: float
Offset
va: float
amplitude
freq: float
frequency in Hz
td: float, optional
time delay before beginning the sinusoidal time variation, in seconds.
Defaults to 0.
theta: float optional
damping factor in 1/s. Defaults to 0 (no damping).
phi: float, optional
Phase delay in degrees. Defaults to 0 (no phase delay).
Please feel free to reopen if you spot any problem.
I will likewise fix the other time functions.
from ahkab.
Related Issues (20)
- Issue with ankab HOT 5
- Tran example : 'op_solution' object has no attribute 'asmatrix' HOT 5
- voltage pulse source for a MOS inverter + questions HOT 4
- Zener Diode HOT 2
- Subcircuit call problem HOT 1
- RL circuit vs. LR circuit: different output HOT 5
- Plot circuit HOT 1
- Voltage-Controlled Switch Issue HOT 1
- Issue with a switch
- Compute on GPU using TensorFlow
- Verification RC cutoff frequency HOT 1
- error in AC and TRAN tutorial
- AttributeError: module 'pylab' has no attribute 'hold' HOT 3
- ImportError: No module named matplotlib.pyplot HOT 1
- Help : Finding current through a resistor
- Cant define diode HOT 1
- Help : Modeling a circuit with parallel components HOT 2
- Locale appears not set HOT 2
- How to use User definement device with non-linear property
- print_symbolic_results / print_symbolic_transfer_functions: sort key bug
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ahkab.