0.1.0 • Published 9 years ago

capacitance.js v0.1.0

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

Table of Contents

Installation

$ npm install --save capacitance.js

Usage

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

API

capacitance(circuit, type)

circuit

Type: array

Description: Values of capacitors associated in your circuit.

Example: [1, 2, 3, 4]

type

Type: string

Description: Type of capacitors association in your circuit.

Options:

  • 'series' or 's': Capacitors in series.
  • 'parallel' or 'p': Capacitors in parallel.

Understand the Topic

Combinating capacitors is very common in many circuits, when we want to reach a capacitance level which only one capacitor is not enough.

Capacitors in Series

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)

Capacitors in Parallel

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

Development

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:

CommandDescription
compileRuns the Livescript compiler on the source.
testRuns Mocha in BDD mode.
buildRuns both compile and test commands.

Contributing

Contributions are very welcome! If you'd like to contribute, these guidelines may help you.

Motivation

I was studying capacitors association because of my Constant Current discipline and then decided to put the basics into practice.

License

capacitance.js is distributed under the MIT License, available in this repository. All contributions are assumed to be also licensed under the MIT License.