Giter Site home page Giter Site logo

Voltage controlled switch model about ahkab HOT 5 CLOSED

ahkab avatar ahkab commented on June 26, 2024
Voltage controlled switch model

from ahkab.

Comments (5)

ggventurini avatar ggventurini commented on June 26, 2024

Work started.

from ahkab.

itdaniher avatar itdaniher commented on June 26, 2024

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.

ggventurini avatar ggventurini commented on June 26, 2024

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.

ggventurini avatar ggventurini commented on June 26, 2024

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.


switch_0v_1vh_test

from ahkab.

ggventurini avatar ggventurini commented on June 26, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.