Simple module to calculate electrical capacitance in series and parallel circuits.
$ npm install --save capacitance.js
const capacitance = require('capacitance.js');
capacitance([1, 2, 3], 'series');
//=> 0.5454545454545455
capacitance([1, 2, 3], 'parallel');
//=> 6
console.log([1, 2, 3], 'parallel') + 'F')
// 6F
Type: array
Description: Values of capacitors associated in your circuit.
Example: [1, 2, 3, 4]
Type: string
Description: Type of capacitors association in your circuit.
Options:
'series'
or's'
: Capacitors in series.'parallel'
or'p'
: Capacitors in parallel.
Combinating capacitors is very common in many circuits, when we want to reach a capacitance level which only one capacitor is not enough.
In an association of series capacitors, the equivalent capacitor is equal to the inverse of the sum of all the inverted capacitors which make up the association:
1 / Ceq = (1 / C1) + (1 / C2) + (1 / C3) + ... + (1 / Cn)
In an association of parallel capacitors, the equivalent capacitor is equal to the sum of all capacitors that make up the association:
Ceq = C1 + C2 + C3 + ... + Cn
All the tasks needed for development automation are defined in the
package.json
scripts property and can be run via:
npm run <command>
Here is a summary of all the commands:
Command | Description |
---|---|
compile |
Runs the Livescript compiler on the source. |
test |
Runs Mocha in BDD mode. |
build |
Runs both compile and test commands. |
Contributions are very welcome! If you'd like to contribute, these guidelines may help you.
I was studying capacitors association because of my Constant Current discipline and then decided to put the basics into practice.
capacitance.js is distributed under the MIT License, available in this repository. All contributions are assumed to be also licensed under the MIT License.