[Ktechlab-devel] My ktechlab modifications

Alan Grimes agrimes at speakeasy.net
Thu Jul 2 16:10:05 UTC 2009


thomas at tgohome.com wrote:
> Hi... Again,
> 
> I have made some more tweaks... I've added capacitor over-rates, and I've
> also fixed many NPN transistor over-rate bugs. I added maximum power
> dissipation for transistors as well (however, I'd like someone else to
> review that I'm doing it correctly)

> One thing I added to capacitors (only fixed capacitors at the moment,
> maybe variable caps soon) was a polar setting, and a maximum working
> voltage setting. If the capacitor is polar, then it cannot tolerate more
> than 2.5 volts backward. (This might be a setting later, but at the moment
> it's fixed.) If working voltage is exceeded, or the capacitor is run in
> reverse (when it is polar) an over-rate warning is shown. I also added
> charge (coulombs), energy (joules) and volts to the tooltip for the
> capacitor.

You are obviously far more capable of working with the GUI and front end
than I am.

My own changes had been focused on refactoring the code such that it was
more reliable and more accurate.

Currently there are massive problems with most nonlinear components. =(

My most recent fix involved the Logic out, I think I did a half-way
decent job of modeling the internal impedance of the port.

One kinda cool thing ktechlab does now is with SR flip-flops, if you
connect the output of a SR to an external voltage source and you can
overpower the output impedance, you can force the part to change state!
=P This is because the SR flipflop is basically two NOR gates, the
output of one being one of the inputs of the other, so if you overpower
that output (probably destroying the part!), you can cause it to change
states. =P

The code works because the implementation of SR flipflop is currently
stateless, it uses nothing other than the states of its pins to
function. Because LogicOut is a subclass of LogicIn, the output pins
have all the functionality of input pins! Furthermore, I consolidated
all state information for the pin down to a single state variable. So
when you overpower the output, you can force it to change state which
then triggers the normal cascade of events... =P

It might also be useful to implement T-flip-flops at some point to
simplify some other code, such as my DAC demo.


-- 
New president: Here we go again...
Chemistry.com: A total rip-off.
Powers are not rights.





More information about the Ktechlab-devel mailing list