-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathSpringDesigner.scad
2082 lines (1952 loc) · 85.4 KB
/
SpringDesigner.scad
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&& SpringFactory: SpringDesigner.scad
Copyright (c) 2022, Jeff Hessenflow
All rights reserved.
https://github.com/jshessen/SpringFactory
Parametric OpenSCAD file in support of the "Spring Factory 1.2"
https://www.thingiverse.com/thing:5171637
Vincent Baillet
https://www.thingiverse.com/vbaillet/designs
&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
/*&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
&& GNU GPLv3
&&
This program is free software: you can redistribute it and/or modify it under
the terms of the GNU General Public License as published by the Free Software
Foundation, either version 3 of the License, or (at your option) any later
version.
This program is distributed in the hope that it will be useful, but WITHOUT
ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
You should have received a copy of the GNU General Public License along with
this program. If not, see <https://www.gnu.org/licenses/>.
&&
&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&*/
// GHOUL -- https://github.com/jshessen/GHOUL
include <external/ghoul/lib.scad>;
/*?????????????????????????????????????????????????????????????????
??
/*???????????????????????????????????????????????????????
?? Section: Customizer
??
Description:
The Customizer feature provides a graphic user interface for editing model parameters.
??
???????????????????????????????????????????????????????*/
/* [Global] */
// Display Verbose Output?
$VERBOSE=1; // [0:No,1:Level=1,2:Level=2,3:Developer]
// Select your unit of measure:
METRIC=1; // [1:Metric,0:Imperial]
/* [Spring Dimensions] */
// Common Wire Diameters (ASTM A228)
//common_d=A228_common_wire_diameter;
//echo(str("[",pipe_list_builder(STANDARD_PIPE_LIST),"]"));
// (d) Wire Diameter:
d_wire=0; //[0:.001:25]
// (Do|De|Do) Outer Diameter of Spring:
D_outer=0; //[0:.001:25]
//L1/L2/L3/L4 = F1/F2/F3/F4
// (L|L0|Lf|L_free) Free length (no load):
L_free=0; //[0:.001:25]
// (Na|N_active) Number of Active Coils
N_active=0; //[0:.001:25]
/*
?????????????????????????????????????????????????????????????????*/
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Section: Defined/Derived Variables
*/
/* [Hidden] */
d = d_wire;
Do = D_outer;
L0 = L_free;
Na = N_active;
background=[250,210];
background_color=[192,192,192];
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
/*/////////////////////////////////////////////////////////////////
// Section: Modules
*/
/*///////////////////////////////////////////////////////
// Module: connector()
//
Description:
Creates a "Connector" object
Parameter(s):
l (undef) = The "length" distance on the X-axis
b1 (undef) = The "width" of the "bottom" of the profile on Y-axis
b2 (undef) = The "width" of the "top" of the profile on Y-axis
h (undef) = The "height" distance on the Z-axis
border (undef) = Boolean used to create a right trapezoid
*/
/* Example: Make sample object
// connector(connector_length,width_bottom,width_top,height,connections=3);
// translate([40,0,0]) connector(0,width_bottom,width_top,
///////////////////////////////////////////////////////*/
spring_characteristics();
module spring_characteristics(){
//Metric
d = 0.965; //mm
Do = 12.700; //mm
L0 = 25.400; //mm
Na = 4.000;
/* https://www.efunda.com/designstandards/springs/calc_comp_designer.cfm
Rates & Loads
Spring Rate (or Spring constant), k : 1.329 N/mm
True Maximum Load, True Fmax : 27.985 N
Maximum Load Considering Solid Height, Solid Height Fmax : 24.776 N
Safe Travel
Potential True Maximum Travel w/ Longer Free Length, True Travelmax : 21.060 mm
Maximum Travel Considering Solid Height, Solid Height Travelmax : 18.645 mm
Minimum Loaded Height : 6.755 mm*/
spring_dimensions(d,Do,L0,Na);
}
module spring_dimensions(d,Do,L0,Na){
form="B";
ends=spring_ends[search(form,spring_ends)[0]][1];
D=D(Do,d);
Di=Di(Do,d);
Ne=Ne(Closed=true,Ground=false);
Nt=Nt(Na,Ne,Form=form);
Ls=Ls(d,Nt,Form=form);
C=C(D,d);
p=p(L0,d,Na);
a=a(p,D);
prefix=pad("",5,"-");
tab="\t";
dimensions=str(
"Pysical Dimensions","\n",
prefix,get_description("d",symbols),":",tab,tab, d, " mm", "\n", // 0.965 mm
prefix,prefix,get_description("Do",symbols),":",tab,tab, Do, " mm", "\n", // 12.700 mm
prefix,prefix,get_description("Di",symbols),":",tab,tab, Di, " mm", "\n", // 10.770 mm
prefix,prefix,get_description("D",symbols),":",tab,tab, D, " mm", "\n", // 11.735 mm
prefix,prefix,get_description("L",symbols),":",tab, L0, " mm", "\n", // 25.400 mm
prefix,prefix,get_description("Ls",symbols),":",tab, Ls, " mm", "\n", // 6.755 mm
prefix,get_description("Na",symbols),":",tab,tab, Na, "\n", // 4.000
prefix,get_description("Ne",symbols),":",tab,tab, Ne, "\n", // 2.000
prefix,get_description("Nt",symbols),":",tab,tab, Nt, "\n", // 6
prefix,"Type of Ends:",tab,tab,tab, ends, "\n", // Closed|Squared
prefix,get_description("C",symbols),":",tab,tab,tab, C, "\n", // 12.161
prefix,get_description("p",symbols),":",tab,tab,tab, p, " mm", "\n", // 5.626 mm
prefix,get_description("a",symbols),":",tab,tab, a, " rad","\n", // 8.68 Radians
"Material Type","\n",
prefix,"Music Wire ASTM A228");
echo(dimensions);
echo( (-1)?"negative":false);
E = 0;
G = 0;
//Kc=Kb/Ks = (2*C*(4*C +2))/((4*C-3)*(2*C+1));
//Na = (Gd)/((8C^3k)(1+0.5/C^2))
//Na = Gd^4y_max/(8D^3Fmax)
//(Lo)cr=2.63*D/greek(a)
// greek(a) = 2.63*D/Lo
// greek(a) = end-condition constant
// ycr = critical deflection
// ys = Fmax/k*
// L0=Ls+ys
// D=C*d
//Over a rod
// D=drod+d+allow
//In a hole
// D=dhole-d-allow
// Free
// As Wound Ssy=A/d^m
// Set Removed Ssy=0.65*A/d^m
//fom=-(relative cost)(Ypi^2*d%2*Nt*D)/4
// (Kd) = Shear stress correction factor
// (Sut) = Minimum tensile strength of material (Wire Strength)
// (A) = A kpsi/Mpa
// (m) = Exponent
A=0;
m=1;
//Caution: Use Ap in ksi with d in inches, and Ap in MPa with d in mm.
//https://www.drtempleman.com/spring-resources/spring-design-formulas
// (Sut) = Tensile Strength
Sut=A/pow(d,m);
// (Ssy) = Torsional yeild strength (Wire Shear Strength)
// 0.35 Sut <= Sy <= 0.52Sut
// Ssy = Tall = .45Sut (cold-drawn carbon steel) - music wire After set 60-70
// Ssy = Tall = .50Sut (hardend and tempered carbon and low-alloy steel) 65-75
// Ssy = Tall = .35Sut (austenitic stainless steel and nonferrous alloys) - austenitic stainless nonferrous alloys 55-65
Ssy=0.50*Sut;
// (F) = Static Load corresponding to the yield strength
//F=(PI*pow(d,3)*Ssy)/8*Kd*D;
// (k) = Spring Rate/Constant (stiffness)
k = spring_rate(d,G,C,Na);
}
/*
Compression spring
Total turns 7
Active turns 5
Wire diameter 1 mm
∗Free length 12.7 ± 0.4 mm
∗Solid length 7 mm max.
∗Outside coil diameter 7.6 mm max.
∗Inside coil diameter 5 mm
Rate 7850 N/m
∗Load at 9 mm 31 ± 4.5 N
Solid stress 881 N/mm2
∗Ends Closed and ground
Wound Right-hand or left-hand
∗Material S202
∗Protective treatment Cadmium-plate
Weights & Measures
Weight of one spring, M : 0.0028 Lbs
Weight per one thousand springs, M : 2.8063 Lbs
Length of wire required to make one spring, Lwire : 8.7085 Inches
Stress Factors
Material shear modulus, G : 11,492,970.929 psi
Maximum shear stress possible, tmax : 150,870.000
Wahl correction factor, W : 1.118
Possible Loads
0.557 lbF @ 0.927 Loaded Height yes
2.230 lbF @ 0.706 Loaded Height yes
Max Load For This Spring: 5.574 lbF
*/
/*
Stress Factor: 1 --> No Conversion Required
Force: 2.5 Newton --> 2.5 Newton No Conversion Required
Spring Index: 2 --> No Conversion Required
Diameter of spring wire: 1 Meter --> 1 Meter No Conversion Required
Substituting Input Values in Formula
𝜏 = k*(8*F*C)/(pi*d^2) --> 1*(8*2.5*2)/(pi*1^2)
Evaluating ... ...
𝜏 = 12.7323954473516
FINAL ANSWER
12.7323954473516 Pascal <-- Shear Stress
(Calculation completed in 00.016 seconds)
*/
module compression_spring_designer(Fo,Lo, Fi,Li){
/*
Springs --> Leaf Springs
--> Helical Springs
--> Compression Spring aka Open Coil Spring
--> Tension Spring aka Closed Coil Spring (Extension)
--> Torsion Spring
--> Spiral Spring
What is a Compression Spring?
Compression springs are helically coiled wires wound one on top of the other to absorb shock or maintain a force between two surfaces.
Therefore containing or releasing energy when a load is applied.
*/
/*Limit the design solution space by setting some practical limits
Preferred range for spring index
4 <= C <=12
Preferred range for number of active coils
3 <= Na <=15
Lx <= 1
L0<= 4
L0_cr Buckling Criteria
ns >= 1.20 Factor of Safety
figure of merit
75% of the force deflection curve
between F=0 and F=Fs
Fmax<= 7/8*Fs
Fractional Overrun to closure as curly
Fs=(1+curly)Fmax
Fs=(1+curly)(7/8)*Fs
curly = 1/7 = 0.143 curly >= 0.15
y=F/k
d
D
C
Od
Na
Ls
Lo
(Lo)cr
(ns) = Ssy/Ts
fom
*/
// If there are no constraints on spring diameter
// Fo = Force at Length Lo
// Fi = Force at Length Li
//Peter R.N. Childs, in Mechanical Design Engineering Handbook, 2014
// 1. Select a material and identify its shear modulus of elasticity G and an estimate of the design stress.
// 2. Calculate a value for the wire diameter based on the spring material properties and assuming approximate values for C and Kw. Typical estimates for C and Kw of 7 and 1.2, respectively, are generally suitable.
// d=sqrt((8*Kw*Fo*C)/(PI*τmax));
// 3. Select a standard wire diameter.
// 4. Determine the maximum number of active coils possible for the spring. The rationale here is that the solid length must be less than the operating length. The relationship between the solid length and the number of coils is a function of the end treatment. For squared and ground ends,
// Ls=d*(Na+2);
// Substituting Ls = Lo
// Nmax = (Lo/d)-2;
// 5. The designer can now select any number of active coils less than the maximum calculated value. Choosing a small value will result in larger clearances between adjacent coils and will use less wire per spring but will entail higher stresses for a given load. One approach is to try progressively fewer coils until the maximum permissible design stress is approached.
// 6. Calculate the Spring Index using
// C=pow((G*d)/(8*K*Na),1/3);
// 7. The mean diameter can now be calculated from the definition of the Spring Index, D = Cd.
// 8. Calculate the Wahl factor, Kw.
// 9. Determine the expected stress due to the operating force and compare with the design stress.
// 10. Calculate the solid length, the force on the spring at the solid length, and the shear stress in the spring at the solid length. Compare this value with the allowable shear stress and see whether it is safe.
// 11. Check whether the spring is likely to buckle.
// 12. Specify the spring dimensions.
// The design procedure requires access to tables of data for material properties and wire diameters.
// Fo = Force at Length Lo
// Fi = Force at Length Li
// Odmax = Max Outer Diameter
// 1. Select a material and identify its shear modulus of elasticity G.
// 2. Identify the operating force, Fo, operating length, Lo, the installed force, Fi, and the installed length, Li.
// 3. Determine the spring rate, k = (Fo − Fi)/(Li − Lo).
// 4. Calculate the free length, L0 = Li + (Fi/k).
// 5. Specify an initial estimate for the mean diameter.
// 6. Specify an initial design stress. An estimate for the initial design stress can be made using Table 15.5 and Figure 15.12.
// 7. Calculate a trial wire diameter, d, by rearranging Eqn (15.6) or Eqn (15.9) and assuming a value for Kd or Kw, which is unknown at this stage. Kw = 1.2 is generally a suitable estimate at this stage.
// 8. Based on the value determined in (7), select a standard wire diameter from a wire manufacturer's catalog or using Table 15.4 as a guide.
// 9. Calculate the Spring Index, C, and the Wahl factor, Kw.
// 10. Determine the expected stress due to the operating force and compare with the design stress using Eqn (15.6) or Eqn (15.9).
// 11. Determine the number of active coils required to give the desired deflection characteristics for the spring, Na = Gd/(8kC3).
// 12. Calculate the solid length, the force on the spring at the solid length, and the shear stress in the spring at the solid length. Compare this value with the allowable shear stress and see whether it is safe. If the value for the shear stress is too high, alter the design parameters set above, such as the wire diameter or material, and reanalyze the results.
// 13. Check whether the spring is likely to buckle.
// 14. Specify the spring dimensions.
}
create_background(background, background_color);
module create_background(background, c, a) {
translate([0,0,-0.5]) color(c=c/255, alpha=a) square(background);
}
/*///////////////////////////////////////////////////////
// Module: mirror_copy()
//
Description:
A custom mirror module that retains the original
object in addition to the mirrored one.
https://en.wikibooks.org/wiki/OpenSCAD_User_Manual/Tips_and_Tricks#Create_a_mirrored_object_while_retaining_the_original
//
///////////////////////////////////////////////////////*/
module mirror_copy(v = [1, 0, 0]) {
children();
mirror(v) children();
}
/*///////////////////////////////////////////////////////
// Module: line_up()
//
Description:
Translates the "child" objects along the [x, y, z] plane
Parameter(s):
v ([x,y,z] = [0,0,0])
v[0] = X-axis
v[1] = Y-axis
v[2] = Z-axis
//
///////////////////////////////////////////////////////*/
module line_up(v) {
x=(!is_undef(v[0])) ? v[0] : 0;
y=(!is_undef(v[1])) ? v[1] : 0;
z=(!is_undef(v[2])) ? v[2] : 0;
for (i = [0 : 1 : $children-1])
translate([x*i, y*i, z*i ]) children(i);
}
/*
/////////////////////////////////////////////////////////////////*/
/*#################################################################
## Section: Functions - Springs
*/
/*#######################################################
## Function: inside_diameter()
##
Description:
Inside Diameter (Di) is defined as the width of the inside of a coil spring's diameter measured from the center of the helix.
Parameter(s):
(Do,d | Do=,d=)
Do = Outer Diameter of Spring Coil is defined as the outside diameter of the spring coil winding.
d = Diameter of spring wire is the diameter length of helical spring wire
(D=,d=)
D = Mean Coil Diameter is defined as the average of the outer and inner coil diameters.
d = Diameter of spring wire is the diameter length of helical spring wire
Formula(s):
Di = Do-2*D;
Di = D-d;
##
#######################################################*/
function inside_diameter(Do,d, D) = (
let(Di=(!is_undef(D) && !is_undef(d)) ? D-d : Do-2*d)
(!$VERBOSE)
? Di
: let(reference = str("Di"))
let(formula = (!is_undef(D) && !is_undef(d)) ? str("D-d") : str("Do-2*d"))
let(equation = (!is_undef(D) && !is_undef(d)) ? str(D,"-",d) : str(Do,"-",2,"*",d))
echo(verbose(reference,formula,equation,Di))
Di
);
function Di(Do,d, D) = inside_diameter(Do,d, D);
/*#######################################################
## Function: outside_diameter()
##
Description:
Outer Diameter (Do) of Spring Coil is the width of the spring measured from outside the coil.
Parameter(s):
(Di,d | Di=,d=)
Di = Inside Diameter is defined as the width of the inside of a coil spring's diameter measured from the center of the helix
d = Diameter of spring wire is the diameter length of helical spring wire
(D=,d=)
D = Mean Coil Diameter is defined as the average of the outer and inner coil diameters.
d = Diameter of spring wire is the diameter length of helical spring wire
Formula(s):
Di = Do+2*D;
Di = D+d;
##
#######################################################*/
function outside_diameter(Di,d, D) = (
let(Do=(!is_undef(D) && !is_undef(d)) ? D+d : Di+2*d)
(!$VERBOSE)
? Do
: let(reference = str("Do"))
let(formula = (!is_undef(D) && !is_undef(d)) ? str("D+d") : str("Di+2*d"))
let(equation = (!is_undef(D) && !is_undef(d)) ? str(D,"+",d) : str(Di,"+",2,"*",d))
echo(verbose(reference,formula,equation,Do))
Do
);
function Do(Di,d, D) = outside_diameter(Di,d, D);
/*#######################################################
## Function: diameter()
##
Description:
Diameter of spring wire (d) is the diameter length of helical spring wire
Parameter(s):
(Do,Di|Do=,Di=)
Do = Outer Diameter of Spring Coil is defined as the outside diameter of the spring coil winding
Di = Inside Diameter is defined as the width of the inside of a coil spring's diameter measured from the center of the helix
Formula(s):
d = (Do-Di)/2;
##
#######################################################*/
function diameter(Do,Di) = (
let(d=(Do-Di)/2)
(!$VERBOSE)
? d
: let(reference = "d")
let(formula = str("(Do-Di)/2"))
let(equation = str("(",Do,"-",Di,")","/",2))
echo(verbose(reference,formula,equation,d))
d
);
function d(Do,Di) = diameter(Do,Di);
/*#######################################################
## Function: mean_diameter()
##
Description:
Mean Coil Diameter (D) is defined as the average of the outer and inner coil diameters.
In spring design, the Mean Coil Diameter is used more for calculating the rate and ultimate stress in the spring rather than for fit.
Parameter(s):
(Do,d|Do=,d=)
Do = Outer Diameter of Spring Coil is defined as the outside diameter of the spring coil winding
d = Diameter of spring wire is the diameter length of helical spring wire
(Di=,d=)
Di = Inside Diameter is defined as the width of the inside of a coil spring's diameter measured from the center of the helix
d = Diameter of spring wire is the diameter length of helical spring wire
(Do=,Di=)
Do = Outer Diameter of Spring Coil is defined as the outside diameter of the spring coil winding
Di = Inside Diameter is defined as the width of the inside of a coil spring's diameter measured from the center of the helix
(d=,C=)
d = Diameter of spring wire is the diameter length of helical spring wire
C = Spring Index is defined as the ratio of Mean Coil Diameter of the spring to the diameter of the spring wire
Formula(s):
D = Do-d;
D = Di+d;
D = C/d;
D = (Do+Di)/2;
##
#######################################################*/
function mean_diameter(Do,d, Di, C) = (
let(D=
(!is_undef(Do) && !is_undef(Di)) ? (Do+Di)/2 :
(!is_undef(C) && !is_undef(d)) ? C/d :
(!is_undef(Di) && !is_undef(d)) ? Di+d :
Do-d)
(!$VERBOSE)
? D
: let(reference = "D")
let(formula =
(!is_undef(Do) && !is_undef(Di)) ? str("(Do+Di)/2") :
(!is_undef(C) && !is_undef(d)) ? str("C/d") :
(!is_undef(Di) && !is_undef(d)) ? str("Di+d")
: str("Do-d"))
let(equation =
(!is_undef(Do) && !is_undef(Di)) ? str("(",Do,"+",Di,")","/",2) :
(!is_undef(C) && !is_undef(d)) ? str(C,"/",d) :
(!is_undef(Di) && !is_undef(d)) ? str(Di,"+",d)
: str(Do,"-",d))
echo(verbose(reference,formula,equation,D))
D
);
function D(Do,d, Di, C) = mean_diameter(Do,d, Di, C);
/*#######################################################
## Function: mean_radius()
##
Description:
Mean Coil Radius (R) is defined as the Mean Coil Diameter divided by 2
Parameter(s):
(D|D=)
D = Mean Coil Diameter is defined as the average of the outer and inner coil diameters
Formula(s):
R = D/2;
##
#######################################################*/
function mean_radius(D) = (
let(R=D/2)
(!$VERBOSE)
? R
: let(reference = "R")
let(formula = str("D/2"))
let(equation = str(D,"/",2))
echo(verbose(reference,formula,equation,R))
R
);
function R(D) = mean_radius(D);
/*#######################################################
## Function: radius()
##
Description:
Radius of spring wire (r) is the radius length of helical spring wire
Parameter(s):
(d|d=)
d = Diameter of spring wire is the diameter length of helical spring wirefrom the center of the helix
Formula(s):
r = d/2;
##
#######################################################*/
function radius(d) = (
let(r=d/2)
(!$VERBOSE)
? r
: let(reference = "r")
let(formula = str("d/2"))
let(equation = str(d,"/",2))
echo(verbose(reference,formula,equation,r))
r
);
function r(d) = radius(d);
/*#######################################################
## Function: spring_index()
##
Description:
C = Spring Index (C) is defined as the ratio of Mean Coil Diameter of the spring to the diameter of the spring wire
When designing a rectangular wire helical spring, it is preferable to set the Spring Index within the range of 4 to 12.
Be careful as a decrease in the Spring Index leads to an increase in the local stress.
Parameter(s):
(D,d|D=,d=)
D = Mean Coil Diameter is defined as the average of the outer and inner coil diameters
d = Diameter of spring wire is the diameter length of helical spring wire
Formula(s):
C = D/d;
##
#######################################################*/
function spring_index(D,d) = (
let(C=D/d)
(!$VERBOSE)
? C
: let(reference = "C")
let(formula = str("D/d"))
let(equation = str(D,"/",d))
echo(verbose(reference,formula,equation,C))
C
);
function C(D,d) = spring_index(D,d);
/*#######################################################
## Function: end_coils()
##
Description:
Ne = Number of end/inert coils
Parameter(s):
(Form|Form=)
Form = ISO-2162-2-1993 Form Type (A-F)
(Open|Closed)
Open = Boolean
Closed = Boolean
Ground = Boolean
##
#######################################################*/
function end_coils(Form, Open,Closed, Ground) = (
let(Open=(!is_undef(Closed))? !Closed :
(!is_undef(Open)) ? Open : undef)
let(Ground=(!is_undef(Ground)) ? Ground : undef)
let(Form=(!is_undef(Form)) ? Form :
(Open && !Ground) ? "A" :
(!Open && !Ground) ? "B" :
(Open && Ground) ? "C" :
(!Open && Ground) ? "D" : undef)
let(Ne=(Form == "A") ? 0 :
(Form == "C") ? 1
: 2)
(!$VERBOSE)
? Ne
: let(reference = "Ne")
let(formula = str("#"))
let(equation = str(Ne))
echo(verbose(reference,formula,equation,Ne))
Ne
);
function Ne(Form, Open,Closed, Ground) = end_coils(Form, Open,Closed, Ground);
/*#######################################################
## Function: total_coils()
##
Description:
Nt = Number of Total Coils
Parameter(s):
(Na,Ne|Na=,Ne=)
Na = Number of Active Coils
Ne = Number of End Coils
(Na=,Form=)
Form = ISO-2162-2-1993 Form Type (A-F)
(Open=|Closed=,Ground=)
Open = Boolean
Closed = Boolean
Ground = Boolean
Formula(s):
Nt = Na+Ne;
##
#######################################################*/
function total_coils(Na,Ne, Form, Open,Closed, Ground) = (
let(Open=(!is_undef(Closed))? !Closed :
(!is_undef(Open)) ? Open : undef)
let(Ground=(!is_undef(Ground)) ? Ground : undef)
let(Form=(!is_undef(Form)) ? Form :
(Open && !Ground) ? "A" :
(!Open && !Ground) ? "B" :
(Open && Ground) ? "C" :
(!Open && Ground) ? "D" : undef)
let(Ne=(!is_undef(Ne)) ? Ne : Ne(Form=Form))
let(Nt=Na+Ne)
(!$VERBOSE)
? Nt
: let(reference = "Nt")
let(formula = str("Na+Ne"))
let(equation = str(Na,"+",Ne))
echo(verbose(reference,formula,equation,Nt))
Nt
);
function Nt(Na,Ne, Form, Open,Closed, Ground) = total_coils(Na,Ne, Form, Open,Closed, Ground);
/*#######################################################
## Function: pitch()
##
Description:
pitch = Distance between coils
Parameter(s):
(L0,d,Na,Form|L0=,d=,Na=,Form=)
L0 = Free Length (no load)
d = Diameter of spring wire is the diameter length of helical spring wire
Na = Number of Active Coils
Form = ISO-2162-2-1993 Form Type (A-F)
(L0=,d=,Na=,Form=,Open=|Closed=,Ground=)
L0 = Free Length (no load)
d = Diameter of spring wire is the diameter length of helical spring wire
Na = Number of Active Coils
Open = Boolean
Closed = Boolean
Ground = Boolean
Formula(s):
p = (L0-d)/Na;
p = (L0-3*d)/Na;
p = L0/(Na+1);
p = (L0-2*d)/Na;
##
#######################################################*/
function pitch(L0,d,Na, Form, Open,Closed, Ground) = (
let(Open=(!is_undef(Closed))? !Closed :
(!is_undef(Open)) ? Open : undef)
let(Ground=(!is_undef(Ground)) ? Ground : undef)
let(Form=(!is_undef(Form)) ? Form :
(Open && !Ground) ? "A" :
(!Open && !Ground) ? "B" :
(Open && Ground) ? "C" :
(!Open && Ground) ? "D" : undef)
let(p =(!is_undef(Ne)) ? Ne :
(Form == "A") ? (L0-d)/Na :
(Form == "B") ? (L0-3*d)/Na :
(Form == "C") ? L0/(Na+1)
:(L0-2*d)/Na)
(!$VERBOSE)
? p
: let(reference = "p")
let(arguments=[
((!is_undef(Form)) ? str("Form : ",Form) : ""),
((!is_undef(Open)) ? str("Open : ",Open) : ""),
((!is_undef(Ground))? str("Ground : ",Ground) : "")
])
let(formula =
(Form == "A") ? str("(L0-d)/Na") :
(Form == "B") ? str("(L0-3*d)/Na") :
(Form == "C") ? str("L0/(Na+1)")
: str("(L0-2*d)/Na)"))
let(equation =
(Form == "A") ? str("(",L0,"-",d,")/",Na) :
(Form == "B") ? str("(",L0,"-",3,"*",d,")/",Na) :
(Form == "C") ? str("",L0,"/(",Na,"+",1,")")
: str("(",L0,"-",2,"*",d,")/",Na,")"))
echo(verbose(reference,formula,equation,p))
p
);
function p(L0,d,Na, Form, Open,Closed, Ground) = pitch(L0,d,Na, Form, Open,Closed, Ground);
/*#######################################################
## Function: rise_angle()
##
Description:
Angular Deflection
Parameter(s):
(p,D|p=,D=)
p = Pitch
D = Mean Coil Diameter is defined as the average of the outer and inner coil diameters.
Formula(s):
a = atan(p/(PI*D);
##
#######################################################*/
function rise_angle(p,D) = (
let(a=atan(p/(PI*D)))
(!$VERBOSE)
? a
: let(reference = "a")
let(pi=get_symbol("PI",symbols))
let(formula = str("atan(p/(",pi,"*D)"))
let(equation = str("atan(",p,"/","(",pi,"*",D,")"))
echo(verbose(reference,formula,equation,a))
a
);
function a(p,D) = rise_angle(p,D);
/*#######################################################
## Function: free_length()
##
Description:
L0 = Free Length (no load)
Parameter(s):
(p,d,Na,Form|p=,d=,Na=,Form=)
p = Distance between coils
d = Diameter of spring wire is the diameter length of helical spring wire
Na = Number of Active Coils
Form = ISO-2162-2-1993 Form Type (A-F)
(p=,d=,Na=,Form=,Open=|Closed=,Ground=)
p = Distance between coils
d = Diameter of spring wire is the diameter length of helical spring wire
Na = Number of Active Coils
Open = Boolean
Closed = Boolean
Ground = Boolean
Formula(s):
##
#######################################################*/
function free_length(p,d,Na, Form, Open,Closed, Ground) = (
let(Open=(!is_undef(Closed))? !Closed :
(!is_undef(Open)) ? Open : undef)
let(Ground=(!is_undef(Ground)) ? Ground : undef)
let(Form=(!is_undef(Form)) ? Form :
(Open && !Ground) ? "A" :
(!Open && !Ground) ? "B" :
(Open && Ground) ? "C" :
(!Open && Ground) ? "D" : undef)
let(L0=(!is_undef(Ne)) ? Ne :
(Form == "A") ? p*Na+d :
(Form == "B") ? p*Na+3*d :
(Form == "C") ? P*(Na+1)
: P*Na+2*d)
(!$VERBOSE)
? L0
: let(reference = "L0")
let(arguments=[
((!is_undef(Form)) ? str("Form : ",Form) : "" ),
((!is_undef(Open)) ? str("Open : ",Open) : "" ),
((!is_undef(Ground))? str("Ground : ",Ground) : "" )
])
let(formula =
(Form == "A") ? str("p*Na+d") :
(Form == "B") ? str("p*Na+3*d") :
(Form == "C") ? str("p*(Na+1)")
: str("p*Na+2*d"))
let(equation =
(Form == "A") ? str(p,"*",Na,"+",d) :
(Form == "B") ? str(p,"*",Na,"+",3,"*",d) :
(Form == "C") ? str(p,"*(",Na,"+",d,")")
: str(p,"*",Na,"+",2,"*",d))
echo(verbose(reference,formula,equation,L0))
L0
);
function L0(p,d,Na, Form, Open,Closed, Ground) = free_length(p,d,Na, Form, Open,Closed, Ground);
/*#######################################################
## Function: solid_length()
##
Description:
Ls = Solid Length Length
Parameter(s):
(d=,Nt=,Form=,Open=|Closed=,Ground=)
d = Diameter of spring wire is the diameter length of helical spring wire
Nt = Number of Total Coils
Form = ISO-2162-2-1993 Form Type (A-F)
Open = Boolean
Closed = Boolean
Ground = Boolean
Formula(s):
Ls = d*Nt;
Ls = d*(Nt+1);
##
#######################################################*/
function solid_length(d,Nt, Form, Open,Closed, Ground) = (
let(Open=(!is_undef(Closed))? !Closed :
(!is_undef(Open)) ? Open : undef)
let(Ground=(!is_undef(Ground)) ? Ground :
(!is_undef(Form) && (Form == "C" || Form == "D")) ? 1 : 0)
let(Ls=(Ground) ? d*Nt : d*(Nt+1))
(!$VERBOSE)
? Ls
: let(reference = "Ls")
let(arguments=[
((!is_undef(Form)) ? str("Form : ",Form) : "" ),
((!is_undef(Open)) ? str("Open : ",Open) : "" ),
((!is_undef(Ground))? str("Ground : ",Ground) : "" )
])
let(formula = (Ground) ? str("d*Nt") : str("d*(Nt+1)"))
let(equation = (Ground) ? str(d,"*",Nt) : str(d,"*(",Nt,"+",1,")"))
echo(verbose(reference,formula,equation,Ls))
Ls
);
function Ls(d,Nt, Form, Open,Closed, Ground) = solid_length(d,Nt, Form, Open,Closed, Ground);
/*#######################################################
## Function: direct_shear_factor()
##
Description:
Kd = Factor to account for Direct Shear Stress
It is commonly recommended that Kd be used for modeling a spring under static loading only.
Parameter(s):
(C|C=)
C = Spring Index is defined as the ratio of Mean Coil Diameter of the spring to the diameter of the spring wire
(D=,d=)
d = Diameter of spring wire is the diameter length of helical spring wire
D = Mean Coil Diameter is defined as the average of the outer and inner coil diameters
Formula(s):
Kd=(2*C+1)/(2*C);
Kd=(C+0.5)/C;
Kd=1+(1/(2*C));
Kd=1+((0.5)/C);
Kd=1+(0.5*d/D);
Kd=1+(d/2*D);
##
#######################################################*/
function direct_shear_factor(C, D,d) = (
let(Kd=(!is_undef(D) && !is_undef(d)) ? 1+(d/2*D) : 1+(1/(2*C)))
(!$VERBOSE)
? Kd
: let(reference = "Kd")
let(formula =
(!is_undef(D) && !is_undef(d)) ? str("1+(d/2*D)")
: str("1+(1/(2*C)"))
let(equation =
(!is_undef(D) && !is_undef(d)) ? str(1,"+","(",d,"/",2,"*",D,")")
: str(1,"+","(",1,"/","(",2,"*",C,")"))
echo(verbose(reference,formula,equation,Kd))
Kd
);
function Kd(C, D,d) = direct_shear_factor(C, D,d);
/*#######################################################
## Function: stress_factor()
##
Description:
K = Stress Factor
In order to take into account the effect of direct shear (Kd) and change in coil curvature (Kc) a stress factor is defined K=Kd*Kc.
It is commonly recommended that K be used for modeling fatigue.
Parameter(s):
(C|C=)
C = Spring Index is defined as the ratio of Mean Coil Diameter of the spring to the diameter of the spring wire
Formula(s):
*Recommended - Include shifted origin concept
Kw = Wahl[1929] = ((4*C-1)/(4*C-4)) + (0.615/C);
Honegger[1930] = (C/(C-1)) + (0.615/C);
*Kb = Bergstraesser[1933] = (C + 0.5)/(C-0.75);
Sopwith[1942] = (C + 0.2)/(C-1);
Not-Recommended - Does not include the shifted origin concept (high deviation)
Rover[1913] = (C/(C-1)) + (1/(4*C));
Wood[1934] = (C/(C-1)) + (1/(2*C));
##
#######################################################*/
//Recommended
function wahl_factor(C) = (
let(Kw=((4*C-1)/(4*C-4))+(0.615)/C)
(!$VERBOSE)
? Kw
: let(reference = "Kw")
let(formula = str("((4*C -1)/(4*C-4)) + (0.615)/C)"))
let(equation = str("(","(",4,"*",C,"-",1,")","/","(",4,"*",C,"-",4,")",")","+","(",0.615,")","/",C))
echo(verbose(reference,formula,equation,Kw))
Kw
);
function Kw(C) = wahl_factor(C);
function bergstraesser_factor(C) = (
let(Kb=(C+0.5)/(C-0.75))
(!$VERBOSE)
? Kb
: let(reference = "Kb")
let(formula = str("(C+0.5)/(C-0.75)"))
let(equation = str("(",C,"+",0.5,")","/","(",C,"-",0.75,")"))
echo(verbose(reference,formula,equation,Kb))
Kb
);
function Kb(C) = bergstraesser_factor(C);
//Acceptable
function sopwith_factor(C) = (C+0.2)/(C-1);
function honegger_factor(C) = (C/(C-1))+(0.615/C);
//Not-Recommended
function rover_factor(C) = (C/(C-1))+(1/(4*C));
function wood_factor(C) = (C/(C-1))+(1/(2*C));
//function stress_factor(C) = Kw(C);
function stress_factor(C) = Kb(C);
function K(C) = stress_factor(C);
/*#######################################################
## Function: spring_rate()
##
Description:
k = Spring Rate/Constant (stiffness)
Spring rate, also known as spring constant, is the constant amount of force or spring rate of force it takes an extension or compression spring to travel one unit (inch or millimeter).
It is a constant value which helps you calculate how much load you will need with a specific distance traveled and it will also help you calculate how much travel you will achieve with a certain load.
Parameter(s):
(d,G,C,Na|d=,G=,C=,Na=)
d = Diameter of spring wire is the diameter length of helical spring wire
G = Shear Modulus of Elasticity in Shear or Torsion
C = Spring Index is defined as the ratio of Mean Coil Diameter of the spring to the diameter of the spring wire
Na = Number of Active Coils
(d=,G=,D=,Na=)
d = Diameter of spring wire is the diameter length of helical spring wire
D = Mean Coil Diameter is defined as the average of the outer and inner coil diameters
Na = Number of Active Coils
(F=,x=)
F = Force is any interaction that, when unopposed, will change the motion of an object.
x = Distance/Deflection of Spring (Hooke’s Law)
Formula(s):
k=(d*G)/(8*pow(C,3)*Na);
k=(G*pow(d,4))/(8*pow(D,3)*Na);
k=F/x;
##
#######################################################*/
function spring_rate(d,G,C,Na, D, F,x) = (
let(k=
(!is_undef(F) && !is_undef(x)) ? F/x :
(!is_undef(D)) ? (G*pow(d,4))/(8*pow(D,3)*Na)
: (d*G)/(8*pow(C,3)*Na))
(!$VERBOSE)
? k
: let(reference = "k")
let(formula =
(!is_undef(F) && !is_undef(x)) ? str("F/x") :
(!is_undef(D)) ? str("(G*d^4))/(8*D^3)*Na)")