coilwraps 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ef67fa026278f31214d41aabd3476fc5f8c1b6c3d942c671220e096aeb3260ad
4
- data.tar.gz: f7b5df76c4fde6fb743ed98e7b6c78725ed4fd27b9faf8c00829a127ec7d7281
3
+ metadata.gz: bae3a728f601865ee43eed20032180f7f0b11fbc7ad8cfa8ef98823d3b98e7cd
4
+ data.tar.gz: eec6766a44090444e3fb7aff34d7da9a9472e4fb7a2cf4823b71720c514e04fa
5
5
  SHA512:
6
- metadata.gz: d22b9e73c804411e25b4ba3561028a88f6cc5b094bffe5b91465e2d87d1e38510dd4c3fc164d3ea890bea75a6c55c358a56b5b2b7952665bc0815b329ecfb1e8
7
- data.tar.gz: 924584067e88e424591c3fa22fbbb475fe144402818e1b3e9e66ef0543bcdaf53c1d503881caf3af4e29bac190ab67b91f6cae699bd65291e7f90968cdb0dd4e
6
+ metadata.gz: e60622c1b71dec41e7cb26e7ef918a610af82649771c62c425e23b8a1af88c12ed04cc9e707777de8c96d27b063498702204a6d25aa67fe3366c397f8c5425c4
7
+ data.tar.gz: 11a7b27e862697f8a3e153cf922bab3222e0e34f32b54375678653a3eda7ea73efba43e6a182d25e65c35fafcbb686aade2303819a0609c04d2d704f58ddada3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- coilwraps (0.1.0)
4
+ coilwraps (0.1.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -2,4 +2,4 @@
2
2
 
3
3
  require 'coilwraps'
4
4
 
5
- Coilwraps.run!
5
+ Coilwraps::Presenter.run
@@ -1,39 +1,6 @@
1
1
  require 'coilwraps/version'
2
+ require 'coilwraps/presenter'
3
+ require 'coilwraps/calculator'
2
4
 
3
- module Coilwraps extend self
4
- class Error < StandardError; end
5
-
6
- def run!
7
- puts <<-FOO
8
- This tool will help you determine the number of wraps needed to reach a desired ohm rating for a microcoil made from A-1 Kanthal resistance wire.
9
- Things you will need to know are as follows:
10
- - the wire gauge (AWG) you are using, 20-34 Guages supported,
11
- - the diameter (in millimeters) of the jig you are wrapping the coil around.
12
- FOO
13
-
14
- puts 'what is the desired resistance in ohms?'
15
- resistance = gets.chomp.to_f
16
-
17
- puts 'what is the wire guage (AWG)?'
18
- wire = gets.chomp.to_i
19
-
20
- # area calculation inspired by http://www.rapidtables.com/calc/wire/awg-to-mm.htm
21
- area = 0.012668 * 92**((36-wire)/19.5)
22
-
23
- puts 'what is the jig diameter in millimeters?'
24
- diameter = gets.chomp.to_f
25
-
26
- radius = diameter / 2
27
- circumference = radius * 2 * Math::PI
28
-
29
- # resistivity of kanthal A-1 is .00145 ohms*mm^2/mm
30
- resistivity = 0.00145
31
-
32
- coil_length = (resistance * area) / resistivity
33
- wraps = coil_length / circumference
34
-
35
- wraps = wraps.round
36
-
37
- puts "The number of wraps needed is #{wraps}, however remember to always measure your builds with a multimeter or ohmmeter. Vape safe."
38
- end
5
+ module Coilwraps
39
6
  end
@@ -0,0 +1,24 @@
1
+ module Coilwraps
2
+ class Calculator
3
+ RESISTIVITY = {
4
+ # resistivity of kanthal A-1 is .00145 ohms*mm^2/mm
5
+ kanthal_a1: 0.00145
6
+ }
7
+
8
+ def self.run(resistance:, wire_guage:, jig_diameter:, wire_type:)
9
+ # area calculation inspired by http://www.rapidtables.com/calc/wire/awg-to-mm.htm
10
+ area = 0.012668 * 92**((36-wire_guage)/19.5)
11
+
12
+ radius = jig_diameter / 2
13
+
14
+ circumference = radius * 2 * Math::PI
15
+
16
+ resistivity = RESISTIVITY[wire_type]
17
+
18
+ coil_length = (resistance * area) / resistivity
19
+ wraps = coil_length / circumference
20
+
21
+ wraps.round
22
+ end
23
+ end
24
+ end
@@ -0,0 +1,31 @@
1
+ module Coilwraps
2
+ # Provides the main entry point to run coilwraps
3
+ class Presenter
4
+ def self.run
5
+ puts <<-FOO
6
+ This tool will help you determine the number of wraps needed to reach a desired ohm rating for a microcoil made from A-1 Kanthal resistance wire.
7
+ Things you will need to know are as follows:
8
+ - the wire gauge (AWG) you are using, 20-34 Guages supported,
9
+ - the diameter (in millimeters) of the jig you are wrapping the coil around.
10
+ FOO
11
+
12
+ puts 'what is the desired resistance in ohms?'
13
+ resistance = gets.chomp.to_f
14
+
15
+ puts 'what is the wire guage (AWG)?'
16
+ wire_guage = gets.chomp.to_i
17
+
18
+ puts 'what is the jig diameter in millimeters?'
19
+ jig_diameter = gets.chomp.to_f
20
+
21
+ wraps = Coilwraps::Calculator.run(
22
+ resistance: resistance,
23
+ wire_guage: wire_guage,
24
+ jig_diameter: jig_diameter,
25
+ wire_type: :kanthal_a1
26
+ )
27
+
28
+ puts "The number of wraps needed is #{wraps}, however remember to always measure your builds with a multimeter or ohmmeter. Vape safe."
29
+ end
30
+ end
31
+ end
@@ -1,3 +1,3 @@
1
1
  module Coilwraps
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: coilwraps
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Charles Peach
@@ -33,6 +33,8 @@ files:
33
33
  - bin/setup
34
34
  - coilwraps.gemspec
35
35
  - lib/coilwraps.rb
36
+ - lib/coilwraps/calculator.rb
37
+ - lib/coilwraps/presenter.rb
36
38
  - lib/coilwraps/version.rb
37
39
  homepage: https://github.com/charlespeach/coil-wraps
38
40
  licenses: