I love celsius! SOLVED

My circuit:

This is a signal converter from temperature (NTC) to voltage, used in an other CL project. It’s a test circuit only so the cap in parallel to the sensor is disconnected, also it would be counterproductively here because of the (for the other circuit) required short simulation time.

The NTC is represented by an ugly “workaround” using a current source, which in fact accepts a voltage (yes, very intuitive !) taken from a label.

The sensor itself is from EPCOS, R/T characteristics “8016”, having 10 k at 25 °C, see: http://www.epcos.com/inf/50/db/ntc_09/MiniSensors_B57861_S861.pdf + You have to add another underscore before and behind the "B57861" in the link to get the page, I can't do it in the forums because of the formatting issues, also in the following formula there is italic instead of "*" ...

I found a simple formula to convert from temperature (°C) to resistance: Res[kOhm]=32-0.035temp+28(EXP(-0.06*temp)-1)

Now I’d like to plot “Output” over temperature, or, as a workaround, Output over time when the temperature goes from 0 to 90 °C in say 200 microseconds (which is really pointless in reality but would exactly fit the simulation time of the other project, to see how the whole circuit works over time AND temperature).

The point would be to see the curve of “Output” over (linear) temperature.

Of course, I’d love to take both, temperature and resistance values from the plot …

The question would be what is the output at e.g. 65 °C ? And the resistance?

Is there a way to achieve this?

Regards, Sancho

by Sancho_P
October 29, 2012

BTW now I’m back at my basic issue with starting a simulation and loaded capacitors, and the “Skip initial”.

The “NTC” in this circuit holds at 10 k for 100 us, so it’s 10 k for the first 125 simulation steps.

Let’s connect the cap of 1 uF in parallel to the NTC. One (or at least I) would expect that - in the default settings (Skip: NO) - the cap starts empty, without any load. But nope, the transistor output isn’t at 5V, on the contrary.

Let’s “Skip” the “Initial” (Yes) and see the plot - surprise!

Again it’s not exactly what I’d expect (starting with 0.345 V at the Basis), but much closer. How come?

Now let’s go back to default “Skip Initial: No” and use 1pF, next 1nF - OK, may be (hmmm …).

Going to 100nF finally shows that the NTC has to discharge the cap. Why?

So we have always to change from the default to “Skip: Yes”, otherwise a beginner may be fooled by the plot?

What does it mean to “Skip Initial”, I thought only the first step is omitted? Documentation?

It seems there is something I did not really understand with simulation.

Too many questions, sorry!

Regards, Sancho

PS: Today it was the third time that I’ve had a small glitch in JavaScript, always the same, the box next to “Skip Initial:” did not react (open) any more and the “File” menu did open but behind the simulation - accordion. After clicking at “Build” everything was back to normal.

by Sancho_P
October 29, 2012

Hi Sancho!

About resistance vs. time.

You've probably already seen the original example but ...

For a variable resistance that can be swept over time:

or:

If you make the control parameter (V2 driving the 'resistance' net in these examples) a function of time using some expression with time as the independent variable, then you have your resistor that varies with time.

For resistance directly swept over time:

by signality
October 30, 2012

BTW,

If you need to put anything literally in a posting without the formatting being messed about with, see:

https://www.circuitlab.com/comments/syntax_overview/

by signality
October 30, 2012

You can also of course make the control parameter represent your temperature variable so you can do a DC Sweep showing resistance a s a function of temperature.

by signality
October 30, 2012

@signality:

1) Resistance versus time: I’ve seen the solutions you’ve proposed before, otherwise I’d not have found the solution used in my test circuit … :-))

Again: I still have problems to understand, better, to “swallow” these workarounds in perspective of a beginner, even a “hobby” electronics with practice. When I check the published circuits here I think I’m in a 2/3 majority (?). It may confuse more than help to use formulas and voltage sources at 0V. When I see a voltage source at 1kV and a load resistor of 1Ohm I’d immediately say “Don’t do that !!!” … (although sometimes I also have to deal with kA and MW).

So I see, it is possible to dig a well using a pencil, thanks! ;-)

I’ve updated my test circuit and wrote some description “as a newbie” (this is a lot of work, sure you know that). CL’s (partially) understanding of units is great - and bad as well.

Please check / comment my new circuit:

2) Regarding your feature suggestion, take into account that this is a browser application running in JavaScript, there are limited resources. 4 years ago it would have been impossible to run something like CL in any browser …

3) The initial condition: I think this is a very useful hint.

If I got that right, the newbie - advice would be:

  • For “real” electronics in CL never use the voltage source DIRECTLY to supply your circuit in Time Domain simulation.

  • Always set up your own power supply unit to supply “labels” and use these labels to supply the electronic circuit , similar to what you would do with your breadboard.

But:

This would lead to another feature suggestion: We need a simple (!) bench top power supply, a configurable “device” in CL with start up ramp and internal resistance combined to one single icon.

Yeah, it would be better to fix basic problems (at least change the default “Skip” setting) anyway.

However, I’d also love to “Skip” the whole start up (say xxx steps) in the simulation …

Regards, Sancho

by Sancho_P
November 01, 2012

" ... It may confuse more than help to use formulas and voltage sources at 0V. ... "

I've added some notes to the examples to clarify the use of the 0V sources here.

You could equally well use resistors, I just thought 0V sources made the example clearer because it doesn't introduce any other resistances into the circuit around the behavioural resistance. In the circuits with the 1.5k resistor for comparison, with 0V sources, if you remove that resistor and probe V(vcc)/I(V1.nB) then that gives the same resistance value as the behavioural expression is generating.

"Regarding your feature suggestion, take into account that this is a browser application running in JavaScript, ..."

Sorry, which feature suggestion?

"3) ..."

If only it were that simple.

Sometimes it's fine to use a simple DC voltage (or even the unique to CL feature that a net label of +XV is understood to be a voltage source of X Volts) as the supply that is understood by the simulator to have been applied for an infinite time before the start of the sim.

Simple DC circuits with no dynamic behaviour (i.e. only one mathematical solution) are fine with that.

However, if you introduce things that have time dependency or more than one stable state (bistable flip flops, schmitt triggers, relaxation oscillators, etc.) then the simulator has a much harder time deciding on which of several equally possible stable initial states to start from, let alone which is the one you think is the obviously correct one.

The simulator doesn't know that in your head you may have made an implicit assumption that the supplies really did start from zero and so the initial conditions are obvious to you.

If you want any simulator to start from some initial conditions then you have to put stuff in the sim to tell it that.

Starting supplies from zero is only one way to do it.

There are lots of examples in CL showing that and other ways.

Some simulators are better than others. Some will give different answers because they make different assumptions about unspecified initial conditions. No simulator will get it right every time. You have to use your judgement to decide if the results of any sim are reasonable.

Running separate, sometimes simpler sims as sanity checks is usually necessary on all the but the most basic simulations.

BTW: don't get distracted by the use of 'labels'.

Apart from the feature - which I think may be unique to CL - that a net label of +XV is understood to be a voltage source of X Volts, labels are just a way of giving a piece of wire (a net) a name.

If you join two nodes (the wire ends of components) together by attaching the same label to each that is exactly equivalent to joining them with a wire.

A label also makes it easier to identify which net may be being probed in a plot.

Labels are a convenience that helps make schematics less cluttered and more human readable.

No more, no less.

See:

and:

"We need a simple (!) bench top power supply, a configurable “device” in CL with start up ramp and internal resistance combined to one single icon."

OK, it may be fine for hobbyists but a lot of CL users are students on electronics and electrical engineering courses.

All that sort of stuff is initially helpful to novices but ultimately it hides a lot of the underlying real electronics that you need to understand if you are going to be a successful electronics engineer (as opposed to winging it by seat of the pants and rule of thumb design).

And hobbyists sometimes do some very scary things ...

:o

"Yeah, it would be better to fix basic problems (at least change the default “Skip” setting) anyway.

However, I’d also love to “Skip” the whole start up (say xxx steps) in the simulation …""

Some earlier feature requests along these lines:

https://www.circuitlab.com/forums/feature-requests/topic/x4g79k32/startup-option-in-time-domain-simulations-please/

https://www.circuitlab.com/forums/feature-requests/topic/7yyp49h5/feature-request-delayed-start-of-plot-time/

by signality
November 02, 2012

@signality: “… which feature suggestion?”

Right, you’ve made so many … but this was my mistake, I’ve seen your last 2 postings in one FR and also read the beginning, not realizing that it originally was from May:Questions about editing model parameters

Regarding “3) …” If it only were that simple:

I think it is that simple - for a newbie. There are a few basic rules to obey when dealing with electronics, the first is “never use unprotected mains” and the second is “never use an unprotected car battery” to supply your test circuit.

So this one is better, it’s not a “Don’t” but a “Do”: Power your circuit using a designated power supply.

And: Use other voltages whenever you know what you are doing.

Your “Starting supplies from zero is only one way to do it.” sounds strange to me, because zero is the only possible state to start with - if there is no start condition setting possible. I understand your defending simulators from a theoretical point, but instead of “guessing” what to do there must be a warning if any condition (before starting) isn’t clear to the solver.

a) I can not assume 21,33V when no one told me about, but zero is where voltage in “real” world starts from. However, the question how it goes up may be essential in some case, but this is not the problem’s nucleus with capacitors in CL.

b) If there is a possibility of random results there should be a warning, e.g. a basic BJT astable multivibrator. In fact, this is an interesting example as the components have identical characteristics in simulation. It should stuck, I’ll have to try.

“…because they make different assumptions”: Undocumented assumptions are a no go.

Yep, regarding (CL?) labels I have some difficulties because I come from a different world. In my world it is essential to distinguish between read and write as well as the time sequence when working with several (connected) objects. CL (or any simulator for electronics?) doesn’t seem to have issues with that, which confuses me a bit.

But basically I love labels. Right now there is only a small issue to find out where a certain label is used in the diagram and which I have defined already, but this is no problem in small circuits.

During writing these lines I realize that several of my concerns may result from the differences of “my world” and this kind of simulation.

“OK, it may be fine for hobbyists but a lot of CL users are students on electronics and electrical engineering courses.” - - - Really, and they have capacitors starting with full load??? OMG ;-)))

Back to your feature suggestions: I think I’ve seen all of them, all comprehensible, but I don’t know if they have seen / understood them.

As far as their “discussion” is a open loop the system’s future is doubtful.

Regards, Sancho

by Sancho_P
November 02, 2012

Hmmmm, both your points i) and ii) are similar but don’t meet my arguments :-(

I did not and I even could not set any start condition (in CL), thus there is only one point in time to start from, no doubt, this is zero. For us (mankind) everything has a beginning - and an end.

There is no “in between” for CL (right now), so it is easy, first point is zero.

For a capacitor, a simple passive component, there is no mystical load to simulate at time zero.

The one and only safe point in (simulation) time is zero, the next iteration may be “kinda unpredictable” - but then a good software should give you a warning. As it is veeeeery difficult to produce true randomness the result will not be randomly but predictable and probably worthless for what you’d expect.

To simulate a running system (device, industrial production, power plant, ...) having a power loss of say 113 ms and getting powered on again would be interesting but is not in the focus of CL (hope so).

OK, I’m with you at the valuable “primitives”, however, you need fully tested, optimized and precompiled function blocks otherwise you would have both, endless work and endless simulation time.

It may be difficult to find a good trade-off, but with JavaScript in the browser the route is still limited somehow.

Regards, Sancho

by Sancho_P
November 03, 2012

Post a Reply

Please sign in or create an account to comment.

Go Ad-Free. Activate your CircuitLab membership. No more ads. Save unlimited circuits. Run unlimited simulations.

About CircuitLab

CircuitLab is an in-browser schematic capture and circuit simulation software tool to help you rapidly design and analyze analog and digital electronics systems.