Apr-22-2018, 04:27 AM
i implemented this small project in C a few years ago.
given any 2 of these 4 values (amps, volts, watts, ohms) it calculates the other 2 and displays all 4. here is some output from the C version:
the year in the Copyright is goofed up. it should be 2009 (as timestamped on the file).
given any 2 of these 4 values (amps, volts, watts, ohms) it calculates the other 2 and displays all 4. here is some output from the C version:
Output:lt1/forums /home/forums 1> electric 2a 90w
amps: 2.00000000 ohms: 22.5000000 volts: 45.0000000 watts: 90.0000000
lt1/forums /home/forums 2> electric 3a 120v
amps: 3.00000000 ohms: 40.0000000 volts: 120.000000 watts: 360.000000
lt1/forums /home/forums 3> electric 2.5a 230v
amps: 2.50000000 ohms: 92.0000000 volts: 230.000000 watts: 575.000000
lt1/forums /home/forums 4> electric 25w 230v
amps: 0.10869565 ohms: 2116.00000 volts: 230.000000 watts: 25.0000000
lt1/forums /home/forums 5> file $(which electric)
/usr/local/bin/electric: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.15, BuildID[sha1]=78d20baf48c9ba2b784ffe7067d49e4fc3c91bda, not stripped
lt1/forums /home/forums 6> ls -l $(which electric)
-rwxr-xr-x 1 root root 12977 Dec 1 2012 /usr/local/bin/electric
lt1/forums /home/forums 7>
the old C source code is here: http://ipal.net/free/electric.cthe year in the Copyright is goofed up. it should be 2009 (as timestamped on the file).