Git Product home page Git Product logo

Comments (4)

ra3xdh avatar ra3xdh commented on May 24, 2024

@cvgaviao , It is not a bug. There are indeed missing parameters. Current controlled switches require definition of controlling source and modelcard (.MODEL). Look the switch definition example at the Ngspice manual:

w1 40 0 vm3 wswitch1 off
.model wswitch1 csw it =1m ih = 0.2m ron =1 roff =10k

from qucs_s.

ra3xdh avatar ra3xdh commented on May 24, 2024

Also SPICE notation should be used for SPICE-only devices. For example SPICE doesn't support measurement units (like Ohm) and has a different prefix system (Meg instead of M)

from qucs_s.

tvrusso avatar tvrusso commented on May 24, 2024

(Edited: Sorry, I was typing my response at the same time as ra3xdh was typing his, and didn't see his before submitting mine)

Several things here:

  1. You are not specifying any voltage source whose current should control the switch. Both ngspice and Xyce require that.
    1a. Qucs-s doesn't seem to make it obvious that this is required, and should probably have a slot in its device parameters that clearly indicates that it should have a current probe name specified.
  2. You are specifying all of the parameters of the device as instance parameters in the W1 device. Neither ngspice nor Xyce support that for the W device (at least for the version of ngspice I have installed). The various parameters are supposed to go in a .model and the name of that model given for the W device.
  3. Xyce's switch devices are not the same as ngspice's, and take different model parameters. For example, there is no It and Ih parameter for Xyce's devices, and the current-controlled switch has instead ION and IOFF parameters to denote what current values should turn the switch on or off. This is described in the Xyce reference guide section 2.3.21.

So instead of putting all of your parameters into the W device's dialog box (W, W_Line_2, etc.), put them into a ".MODEL Section" element with the contents ".model myswitch csw (It=0.01 Ih=0 RON=100Ohm ROFF=10MEGOhm)" and then change your W device specification in Qucs-s to have a first line that contains the name of a voltage source whose current should be used to determine the switch state, and a second line with "myswitch" on it. (You could stuff 'em both on the same line, I suppose). Qucs-s will then generate a legal ngspice line for the switch.

If you want to run it in Xyce, you'll need to modify the switch model card to be of type "iswitch" and use a set of legal parameters for Xyce's switch (which will be different than ngspice's).

from qucs_s.

tvrusso avatar tvrusso commented on May 24, 2024

Also SPICE notation should be used for SPICE-only devices. For example SPICE doesn't support measurement units (like Ohm)

Actually, standard SPICE3F5 ignores everything after a number that it doesn't recognize as a multiplier. So specifying a resistor as "1MEGOhm", "1MEGFarad", "1MEGHenry" or "1MEGBogus" are all the same as specifying it as "1MEG". Xyce also follows this rule. I assume, since ngspice is based on SPICE3F5, that it probably also follows this behavior.

It is still safer just to leave off units, so they can't be misinterpreted. For example, if you specify a huge capacitor as a "1Farad" cap, it'll actually be interpreted by SPICE as a 1e-15 because it'll see the "f" and think "femto."

This same issue is why Xyce doesn't support "a" as an "atto" multiplier --- many legacy netlists and model cards have units of Amp specified in current sources and device parameters on the assumption that SPICE would just ignore it, and so we can't let "a" mean "1e-18" or all of those old netlists will be unrunnable.

The 1M vs. 1MEG thing is really important, though --- because SPICE netlist parsing is case-insensitive, "1M" and "1m" both mean 1e-3.

from qucs_s.

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.