Modelling discrete components

I am looking for a way to write pieces of software to simulate the 'behaviour' of a resistor, a capacitor, an inductor, a diode etc. and need a common set of parameters to communicate between the modules. Each module would be one component. I wonder what would be the best information for the interface between modules - i.e. for each component to process and to output. I guess I'm looking for a common interface between diverse components.

I don't think a simple voltage and current model is workable as I need to account for the impedance of the supply. A simple resistor, if it is low enough value relative to the supply impedance, will modify the values passed to it so I cannot put, say, 3V across a resistor and expect it to remain 3V.

My first thought is that I need to account for charge. If the component is supplied 1) Potential across its terminals 2) Charge available 3) A time over which to calculate - say 1 microsecond

could it then 'reply' with the charge used (or, needed) in the time interval?

Second thought is for the component to be supplied 1) Potential across its terminals 2) A time over which to calculate

and it returns an instantaneous resistance. A capacitor, for example, would begin with zero and increase to infinity as it charges.

In either case I need to modify the source of the voltage according to its impedance and the circuit load. Please note that the intention is to model the components over 'real time' so a static analysis of an AC circuit isn't any good.

There must be a better way that I have described. I'm not even sure I can get this to work. Any suggestions?

-- TIA, James

Reply to
James Harris
Loading thread data ...

Have you looked at Spice ?

Graham

Reply to
Pooh Bear

My first thought was that you should model the supply too. Then resistors remain relatively simple resistors, at least as long as you don't exceed the power the device can handle. That seems like it would make your components much closer to the textbook models.

Reply to
Don Taylor
[...]

Before coming across Spice's real time 'Transient' analysis, I started writing a prog using energy as the medium of exchange. The stuff either got dissapated or pooled but the sums added up OK. Joules were handed around and each circuit element dismantled it back into appropriate volts and amps based on the component type and the stored state from the previous time increment. I remember it got horribly yukky but I'm not a programmer. john

Reply to
John Jardine.

It's been done. download the source for berkeley spice from sunsite.

a voltage current model should handle that...

It sounds like you have a lot of simultaneous equations to solve...

Bye. Jasen

Reply to
Jasen Betts

That sounds like the kind of thing I was thinking about. I guess I would need to deal in Volts and Charge rather than Energy if my understanding of capacitors is correct: if one is charged from a 12V supply then the supply is removed will the capacitor essentially provide its charge into a load at 12V - at least initially? In other words is the voltage at which the capacitor was charged important? I'm a bit confused about that (as you can probably tell).

Using the water analogy I think of charge as the quantity of water and voltage as its (average) height. Energy I understand as the product of the two so I guess I will need to handle either Joules _or_ Volts and Coulombs.

Reply to
groupstudy2001

snip

I'm not sure. I think simultaneous equations would be needed to derive a formula for how parts of the circuit vary with time (maybe I misunderstand, though) but I was thinking of what I now understand is called a discrete time simulation - don't you love buzzwords? I've found an article on this at

Reply to
groupstudy2001

That sounds like the kind of thing I was thinking about. I guess I would need to deal in Volts and Charge rather than Energy if my understanding of capacitors is correct: if one is charged from a 12V supply then the supply is removed will the capacitor essentially provide its charge into a load at 12V - at least initially? In other words is the voltage at which the capacitor was charged important? I'm a bit confused about that (as you can probably tell).

Using the water analogy I think of charge as the quantity of water and voltage as its (average) height. Energy I understand as the product of the two so I guess I will need to handle either Joules _or_ Volts and Coulombs.

Reply to
groupstudy2001

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.