Comments (5)
Work started.
from ahkab.
A few thoughts:
Would it be possible to build this primitive off of the resistor where the transconductance is time-dependent? A switch from 1e6 ohms to 1e-1 ohms will likely simulate better than inf to zero. It looks potentially doable to base some of this off of time-dependent sources. Not sure how D
would be modified to take into the near-infinite time-dependent change in resistance, though...
Would it be possible to do high-level analysis looking at each LTI section of a circuit with a time or voltage dependent switch? Perhaps full switch-mode simulation could be done by passing transient_analysis
a non-None
matrix for x0
, possibly even a different circ
? LTI systems tend to be easy to work with and manipulate, and you already have even fairly advanced symbolic analysis of such working great!
from ahkab.
Hi!
Yes, it would be possible to define a time variable resistor with R = R(t)
. Right now, that would need to be done with a non-linear device, which is a pity. The reason is the MNA matrix is built with the elem.R
values, which are not expected to change with time. One could define the time-variable resistor (which is linear) as non-linear and the simulator would call its i(...)
and g(...)
methods (g is the small signal conductance 1/r) passing the time. Time that can then be used to return (V(n1)-V(n2))/R(t)
and 1/R(t)
, where R(t)
is defined somewhere in the module.
That would be a possible implementation. I was planning to stick with something compatible with SPICE3, which would be a switch controlled by either a voltage or a current. (This is truly non-linear.)
EDIT: no reason not to do both anyway!
Regarding the symbolic simulations, I am afraid I do not totally understand what you mean, but for the extent I can understand it all sounds reasonable. LTI circuits we can solve easily and reliably.
Here are my thoughts abt supporting switches in symbolic analyses.
We need to split by symbolic analysis type and switch type.
Symbolic OP simulation of a voltage-controlled switch is troublesome. Say you have a switch with threshold VT
(symbol). The drive voltage is by the voltage partition V1*R1/(R1*R2)
(all symbols). Is the switch closed or open? That depends whether V1 * R1/(R1*R2) > VT
or not, which the simulator doesn't know. Open or closed switch changes network topology and therefore the expressions of the results. In this case linearization helps but requires telling the simulator the switch status, since the only linearization that we can do is in a definite state (open: linear model a resistor of value ROFF, or closed: linear model of value RON). I find this to be interesting anyway, one could get the status from a numeric OP simulation.
Symbolic OP simulation of a time-controlled switch is easier but probably of little interest, IMO. OP inherently means steady state, ie the switch must have one state, usually in this cases the status at time=0 is used as DC, again replacing the switch with a resistor, nothing ground-breaking, but it can be implemented and it would be consistent with numeric OP.
Symbolic AC is in the frequency domain and it works on the small-signal linearized circuit, modeling a time-dependent switch I believe is not possible. Modeling voltage-controlled switch could be done as in the case of symbolic OP.
Its place would be in a symbolic transient, which would be a great feature. I am afraid solutions can be computed analytically for a subset of the cases/elements and with simplified models. Still that'd be cool.
from ahkab.
There is a preliminary little-tested implementation of a voltage switch in branch switch, see commit dfee0e8 - latest at the time of writing.
It should closely resemble SPICE voltage controlled switch. I could not find any doc regarding how spice handles the switching point and I decided to model the region with tanh(x).
It may be buggy. I am pretty sure some bug has escaped me.
Some code is missing in symbolic.py (not supported) and netlist_parser.py (can't be parsed from a netlist, only works from a python script).
If you try it, please let me know how it goes.
from ahkab.
If you try it, please let me know how it goes.
Ahhh it still needs more work, sorry.
EDIT: Seems OK now.
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.