|
Components and Circuits For discussions about component types, alternatives and availability, circuit configurations and modifications etc. Discussions here should be of a general nature and not about specific sets. |
|
Thread Tools |
13th Feb 2006, 6:50 pm | #1 |
Moderator
Join Date: Jun 2003
Location: Oxford, UK
Posts: 27,970
|
Dropper calculator
I've been meaning to code Paul's dropper calculations in lowest common denominator C for ages, and actually did it in a spare hour this afternoon. I've deliberately left the code simple and easy to read. The program should compile using just about any C compiler and I've built versions for Linux (Slackware 9.1) and DOS (Borland C++ Builder 3).
Let me know your comments (don't ask for lots of fancy GUI stuff, that's the whole point ). Use at your own risk, and double check the results before risking your valve heaters. It is of course possible to use Paul's original spreadsheet under Linux if you have OpenOffice. Best regards, Paul See also this related thread. |
13th Feb 2006, 11:20 pm | #2 |
Pentode
Join Date: Oct 2005
Location: Gargnäs, north of Sweden
Posts: 105
|
Re: Dropper calculator
Hi Paul,
It all compiles fine on Slackware 10.2. With a little warning though : gcc dropper.c -Wall -o dropper -lm <ENTER> dropper.c: In function `getval': dropper.c:38: warning: float format, double arg (arg 3) Also I can get it to crash on Windows 2k if I enter something strange on the heater current prompt. Possibly I can get it to crash in some other ways also, just a little note I made I did not try to recompile it on Windows, I have no compiler installed on this particular PC. Some error-handling at the user input would fix this, but you have written you program just like I usually do. Make sure it works, then maybe later add some error-handling and refinements. In Linux it does not crash, you are meerly presented by negative voltages and power figures!! One more reason to go "penguin". Sorry, I did not mean to complain or anything, it's a useful program! I have looked at Paul's spreadsheet, and I also had thought an making a small C program. /Oskar |
14th Feb 2006, 1:04 am | #3 |
Moderator
Join Date: Jun 2003
Location: Oxford, UK
Posts: 27,970
|
Re: Dropper calculator
Yes Oskar, you will get different warnings on different systems. My Linux system warns about assigning a float to an integer. The Windows C++ compiler warns about something else (can't remember what it was now, but it wasn't important).
You are right that there's no error handling at all. The program just tries to find a floating point value from whatever you type in. I'd expect it to use '0.0' if there isn't a valid value there but it may access an invalid memory address or something. I may add some error checking in a future version if there's any interest. Best regards, Paul |
14th Feb 2006, 12:11 pm | #4 |
Moderator
Join Date: Jun 2003
Location: Oxford, UK
Posts: 27,970
|
Re: Dropper calculator
The program doesn't work reliably at present because of problems reading user input. I'll post an updated version here when I've fixed it.
Paul |
14th Feb 2006, 1:30 pm | #5 |
Moderator
Join Date: Jun 2003
Location: Oxford, UK
Posts: 27,970
|
Re: Dropper calculator
This version actually works! I've tested it and everything!
V0.3 fixes user input under DOS/Windows and fixes a coding error in the capacitive dropper calculations. Paul |
14th Feb 2006, 3:36 pm | #6 |
Pentode
Join Date: Oct 2005
Location: Gargnäs, north of Sweden
Posts: 105
|
Re: Dropper calculator
Looks like those changes you made should have done it. I will compile and test it later this evening maybe. On windows I compile my DOS programs with Delorie DJGPP.
/Oskar |