-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathElectricCurrent.h
2262 lines (2059 loc) · 75.2 KB
/
ElectricCurrent.h
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
//
// Created by Ryan.Zurrin001 on 12/15/2021.
//
#ifndef PHYSICSFORMULA_ELECTRICCURRENT_H
#define PHYSICSFORMULA_ELECTRICCURRENT_H
#pragma once
/**
* @class ElectricCurrent
* @details driver class for solving complex physics problems
* @author Ryan Zurrin
* @dateBuilt 12/31/2020
* @lastEdit 12/31/2020
*/
#include "Constants.h"
#include <iostream>
//#include "Circuits.h"
static struct Resistivities
{
Resistivities() {}
const struct MetallicConductors {
const long double SILVER = 1.59e-8; //1.59e-8 conductor, OHm*m
const long double COPPER = 1.724e-8; //1.72e-8 conductor, OHm*m
const long double GOLD = 2.24e-8; //2.44e-8 conductor, OHm*m
const long double ALUMINUM = 2.65e-8; //conductor, OHm*m
const long double TUNGSTEN = 5.6e-8; //conductor, OHm*m
const long double IRON = 9.71e-8; //conductor, OHm*m
const long double MERCUARY = 9.84e-7; //conductor, OHm*m
const long double PLATINUM = 10.6e-8; //conductor, OHm*m
const long double STEEL = 20.0e-8; //conductor, OHm*m
const long double LEAD = 22.0e-8; //conductor, OHm*m
const long double MANGANIN = 44.0e-8; //conductor, OHm*m
const long double CONSTANTAN = 49.0e-8; //conductor, OHm*m
const long double NICHROME = 100.0e-8; //conductor, OHm*m
}metallicConductors;
const static struct IonicSolutions {
const long double L_MOLAR_CuSO4 = 3.9e-4; //OHm*m
const long double L_MOLAR_HCI = 1.7e-2; //OHm*m
const long double L_MOLAR_NaCl = 1.4e-4; //OHm*m
const long double H20 = 2.6e-5; //OHm*m
const long double BLOOD_HUMAN = 0.70; //OHm*m
const long double SEA_WATER = 0.22; //OHm*m
}ionicSolutions;
const static struct Semiconductors {
const long double GERMANIUM = 0.5; //OHm*m
const long double SILICON = 3.0e3; //OHm*m
const long double DIAMOND = 1.0e4; //OHm*m
} semiconductors;
const static struct Insulators {
const long double CERAMICS = 1e12; //OHm*m
const long double GLASS = 1e12; //OHm*m
const long double POLYETHYLENE = 1e16; //OHm*m
const long double POLYPROPYLENE = 1e16; //OHm*m
const long double RUBBER = 1e15; //OHm*m
const long double WOOD = 1e11; //OHm*m
const long double QUARTZ = 7.5e17; //OHm*m
}insulators;
const long double AIR = 2e16; //OHm*m
const long double VACUUM = 377.0; //OHm*m
const long double CARBON_PURE = 3.5 * pow(10, 5); //semiconductor, OHm*m
/// <summary>
/// The CARBON variable can be between 3.5 and 60 * 10^5 OHm*m. there is a
/// setCARBON method you can use to adjust its value. Its not checked so if you
/// put in a invalid number its on you, your calculation will be wrong. In the
/// argument only pass the first part, example 18.7. not 18.7*10^5. that gets added
/// automatically.
/// </summary>
long double CARBON = 10 * pow(10, 5); //semiconductor, OHm*m
/// <summary>
/// Sets the carbon variable.
/// </summary>
/// <param name="value">The value passed shoulong double be between 3.5 and 60.</param>
void setCARBON(long double value) { CARBON = value * pow(10, 5); }
const long double GERMANIUM_PURE = 600.0 * pow(10, -3); //semiconductor, OHm*m
/// <summary>
/// The GERMANIUM variable can be between 1 and 600 * 10^5 OHm*m. there is a
/// setGERMANIUM method you can use to adjust its value. Its not checked so if you
/// put in a invalid number its on you, your calculation will be wrong. In the
/// argument only pass the first part, example 18.7. not 18.7*10^-3. that gets added
/// automatically.
/// </summary>
long double GERMANIUM = 300 * pow(10, -3); //semiconductor, OHm*m
/// <summary>
/// Sets the GERMANIUM variable.
/// </summary>
/// <param name="value">The value passed shoulong double be between 1 and 600.</param>
void setGERMANIUM(long double value) { GERMANIUM = value * pow(10, -3); }
const long double SILICON_PURE = 2300; //2300semiconductor, OHm*m
/// <summary>
/// The SILICON variable can be between .1 and 2300 OHm*m. there is a
/// setSILICON method you can use to adjust its value. Its not checked so if you
/// put in a invalid number its on you, your calculation will be wrong.
/// </summary>
long double SILICON = .1; // .1 - 2300 semiconductor, OHm*m
/// <summary>
/// Sets the Silicon variable.
/// </summary>
/// <param name="value">The value passed shoulong double be between .1 and 2299.</param>
void setSILICON(long double value) { SILICON = value * pow(10, -3); }
const long double AMBER = 5.0 * pow(10, 14); // insulator, OHm*m
/// <summary>
/// The GLASS variable can be between 10^9 and 10^14 OHm*m. there is a
/// setGLASS method you can use to adjust its value. Its not checked so if you
/// put in a invalid number its on you, your calculation will be wrong.
/// </summary>
long double GLASS = pow(10,9); //semiconductor, OHm*m
/// <summary>
/// Sets the GLASS variable.
/// </summary>
/// <param name="value">The value passed shoulong double be between 10^9 - 10^14.</param>
void setGLASS(long double value) { GLASS = pow(10, value); }
/// <summary>
/// The WOOD variable can be between 10^8 and 10^11 OHm*m. there is a
/// setWOOD method you can use to adjust its value of the power. Its not checked so if you
/// put in a invalid number its on you, your calculation will be wrong.
/// </summary>
long double WOOD = pow(10, 9); // 10^X_ conductor, OHm*m
/// <summary>
/// Sets the GLASS variable.
/// </summary>
/// <param name="value">The value passed shoulong double be between 10^9 - 10^14.</param>
void setWOOD(long double X) { GLASS = pow(10, X); }
// create a map of the materials and their values for lookup
std::map<std::string, long double> materialMap = {
{"air", 2e16},
{"vacuum", 377.0},
{"aluminum", 2.65e-8},
{"copper", 1.72e-8},
{"gold", 2.44e-8},
{"iron", 9.71e-8},
{"lead", 22.0e-8},
{"manganin", 44.03-8},
{"constantan", 49.0e-8},
{"nichrome", 100.0e-8},
{"l_molar_cus04", 3.8e-4},
{"l_molar_hci", 1.7e-2},
{"l_molar_nacl", 1.4e-4},
{"h20", 2.6e-5},
{"blood_human", .70},
{"sea_water", .22},
{"germanium", .50},
{"silicon", 3.0e3},
{"diamond", 1.0e4},
{"ceramics", 1e12},
{"glass", 1e14},
{"polyethylene", 1e16},
{"polypropylene", 1e16},
{"rubber", 1e15},
{"wood", 1e9},
{"quartz", 7.5e17},
{"carbon", 10e5},
{"carbon_pure", 3.5e5},
{"germanium_pure", 600.0e-3},
{"silicon_pure", 2300.0},
{"amber", 5.0e14}
};
}resistivity;
static struct TemperatureCoefficientsOfResistivity
{
const long double SILVER = 3.8 * pow(10, -3); //3.8e-3 1/C
const long double COPPER = 3.9 * pow(10, -3); //3.9e-3 1/C
const long double GOLD = 3.4 * pow(10, -3); //3.4e-3 1/C
const long double ALUMINUM = 3.9 * pow(10, -3); //3.9e-3 1/C
const long double TUNGSTEN = 4.5 * pow(10, -3); //4.5e-3 1/C
const long double IRON = 5.0 * pow(10, -3); //5.0e-3 1/C
const long double PLATINUM = 3.93 * pow(10, -3); //3.93e-3 1/C
const long double LEAD = 3.9 * pow(10, -3); //3.9e-3 1/C
const long double MANGANIN = .000 * pow(10, -3); //.0000e-3 1/C
const long double CONSTANTAN = 0.002 * pow(10, -3); //.002e-3 1/C
const long double MERCURY = .89 * pow(10, -3); //.89e-3 1/C
const long double NICHROME = .4 * pow(10, -3); //.4e-3 1/C
const long double CARBON = -.5 * pow(10, -3); //-.5e-3 1/C
const long double GERMANIUM = -50 * pow(10, -3); //-50e-3 1/C
const long double SILICONE = -70 * pow(10, -3); //-70e-3 1/C
}tempCoefResistivity;
static struct AWGWireSizesByGauge
{
const long double AWG0000 = 11.6840e-3;// 11.6840mm diameter
// const struct AWG0000 {
// const long double d_inches = 0.460;
// const long double d_mm = 11.6840;
// const long double d_m = 0.0116840;
// const long double cross_section_mm = 107;
// const long double cross_section_m = 0.000107;
// const long double ohms_per_km = 0.16072;
// const long double max_amps_chassis = 380;
// }awg0000;
const long double AWG000 = 10.4038e-3;// 10.4038mm diameter
const long double AWG00 = 9.2659e-3;// 9.2659mm diameter
const long double AWG0 = 8.2525e-3;// 8.2525mm diameter
const long double AWG1 = 7.3482e-3;// 7.3482mm diameter
const long double AWG2 = 6.5430e-3;// 6.5430mm diameter
const long double AWG3 = 5.8268e-3;// 5.8268mm diameter
const long double AWG4 = 5.1892e-3;// 5.1892mm diameter
const long double AWG5 = 4.6203e-3;// 4.6203mm diameter
const long double AWG6 = 4.1148e-3;// 4.1148mm diameter
const long double AWG7 = 3.6652e-3;// 3.6652mm diameter
const long double AWG8 = 3.2639e-3;// 3.2639mm diameter
const long double AWG9 = 2.9058e-3;// 2.9058mm diameter
const long double AWG10 = 2.5883e-3;// 2.5883mm diameter
const long double AWG11 = 2.3038e-3;// 2.3038mm diameter
const long double AWG12 = 2.0523e-3;// 2.0523mm diameter
const long double AWG13 = 1.8288e-3;// 1.8288mm diameter
const long double AWG14 = 1.6281e-3;// 1.6281mm diameter
const long double AWG15 = 1.4503e-3;// 1.4503mm diameter
const long double AWG16 = 1.2903e-3;// 1.2903mm diameter
const long double AWG17 = 1.1506e-3;// 1.1506mm diameter
const long double AWG18 = 1.0236e-3;// 1.0236mm diameter
const long double AWG19 = 0.9119e-3;// 0.9119mm diameter
const long double AWG20 = 0.8128e-3;// 0.8128mm diameter
const long double AWG21 = 0.7239e-3;// 0.7239mm diameter
const long double AWG22 = 0.6400e-3;// 0.6452mm diameter
const long double AWG23 = 0.5740e-3;// 0.5740mm diameter
const long double AWG24 = 0.5105e-3;// 0.5105mm diameter
const long double AWG25 = 0.4547e-3;// 0.4547mm diameter
const long double AWG26 = 0.4039e-3;// 0.4050mm diameter
const long double AWG27 = 0.3607e-3;// 0.3580mm diameter
const long double AWG28 = 0.3200e-3;// 0.3200mm diameter
const long double AWG29 = 0.2870e-3;// 0.2860mm diameter
const long double AWG30 = 0.2540e-3;// 0.2550mm diameter
const long double AWG31 = 0.2261e-3;// 0.2270mm diameter
const long double AWG32 = 0.2032e-3;// 0.2020mm diameter
/**
* @brief Returns the diameter of the wire in meters for the given gauge.
* @warning For the 0000, 000, and 00 gauges, use a 1 in front of the zero's,
* e.g. 0000 = 10000, \n
* 000 = 1000, \n
* 00 = 100.
* @param gauge The gauge of the wire.
* @return The diameter of the wire in meters.
*/
[[nodiscard]] long double convertGauge2Diameter(int gauge) const
{
switch (gauge)
{
case 10000: return AWG0000;
case 1000: return AWG000;
case 100: return AWG00;
case 0: return AWG0;
case 1: return AWG1;
case 2: return AWG2;
case 3: return AWG3;
case 4: return AWG4;
case 5: return AWG5;
case 6: return AWG6;
case 7: return AWG7;
case 8: return AWG8;
case 9: return AWG9;
case 10: return AWG10;
case 11: return AWG11;
case 12: return AWG12;
case 13: return AWG13;
case 14: return AWG14;
case 15: return AWG15;
case 16: return AWG16;
case 17: return AWG17;
case 18: return AWG18;
case 19: return AWG19;
case 20: return AWG20;
case 21: return AWG21;
case 22: return AWG22;
case 23: return AWG23;
case 24: return AWG24;
case 25: return AWG25;
case 26: return AWG26;
case 27: return AWG27;
case 28: return AWG28;
case 29: return AWG29;
case 30: return AWG30;
case 31: return AWG31;
case 32: return AWG32;
default: return 0;
}
}
}AWG;
//static object counter for ElectricCurrent class
static int electricCurrent_objectCount = 0;
class ElectricCurrent
{
public:
ElectricCurrent()
{
countIncrease();
}
explicit ElectricCurrent(long double val)
{
countIncrease();
}
/**
* @brief copy constructor
*/
ElectricCurrent(const ElectricCurrent& t)
{
countIncrease();
}
/**
* #brief move constructor
*/
ElectricCurrent(ElectricCurrent&& t) noexcept
{
countIncrease();
}
/**
* @brief copy assignment operator
*/
ElectricCurrent& operator=(const ElectricCurrent& t)
{
if (this != &t)
{
countIncrease();
}
return *this;
}
static void show_objectCount() { std::cout
<< "\n electric current object count: " << electricCurrent_objectCount
<< std::endl; }
static int get_objectCount() { return electricCurrent_objectCount; }
/**
* @brief calculates the area of circle using the radius.
* @param r radius
* @param print print to console
* @return area(m^2)
*/
static long double circle_area_r(long double r, bool print = false);
/**
* @brief calculates the area of a sphere using the radius.
* @param r radius
* @param print print to console
* @return area(m^2)
*/
static long double sphere_area_r(long double r, bool print = false);
/**
* @brief calculates the area of a circle from the diameter
* @param d diameter
* @param print print to console
* @return area(m^2)
*/
static long double circle_area_d(long double d, bool print = false);
/**
* @brief calculates the area of a sphere from the diameter
* @param d diameter
* @param print print to console
* @return area(m^2)
*/
static long double sphere_area_d(long double d, bool print = false);
/**
* @brief calculates the area of a circle from the circumference
* @param c circumference
* @param print print to console
* @return area(m^2)
*/
static long double circle_area_c(long double c, bool print = false);
/**
* @brief calculates the area of a sphere from the circumference
* @param c circumference
* @param print print to console
* @return area(m^2)
*/
static long double sphere_area_c(long double c, bool print = false);
/**
* @brief calculates the area of a circle from the gauge
* @param gauge gauge
* @param print print to console
* @return area(m^2)
*/
static long double circle_area_gauge(int gauge, bool print = false);
/**
* @brief calculates the area of a square from the length of one side
* @param side length of one side
* @param print print to console
* @return area(m^2)
*/
static long double square_area(long double side, bool print = false);
/**
* @brief calculates the area of a rectangle from the length of one side
* and the width of the other side
* @param l length of one side
* @param w width of the other side
* @param print print to console
* @return area(m^2)
*/
static long double rectangle_area(long double l, long double w, bool print = false);
/**
* @brief calculates the electric current (I) defined as the rate at which charge
* (COULOMB) flows through a given time (t).
* @param Q charge (COULOMB)
* @param t time (s)
* @param print print to console
* @return the electric current SI unit of ampere (A)
*/
static long double electricCurrent(long double Q, long double t, bool print = true);
/**
* @brief calculates the time it takes charge COULOMB to flow through a current of I amperes
* @param Q charge (COULOMB)
* @param I current (A)
* @param print print to console
* @return time in seconds
*/
static long double timeItTakesChargeToFlow(long double Q, long double I, bool print = true);
/**
* @brief calculates the Electrics charge COULOMB
* @param I current (A)
* @param t time in seconds
* @param print print to console
* @return the charge in coulombs
*/
static long double electricCharge(long double I, long double t, bool print = true);
/**
* @brief calculates the current (I) using the number of free charges(n) per unit
* volume (Ax) where the charge per n is given by q and t is the unit time.
* I = (q * n * Ax) / t;
* @param q the charge
* @param n the number of free charges
* @param Ax the volume of segment Ax is the area * distance
* @param t the unit time the charge is moved over
* @param print print to console
* @return the current
*/
static long double current_qnAx_t(long double q,
long double n,
long double Ax,
long double t, bool print = true);
/**
* @brief calculates the current (I) using the number of free charges(n) per unit
* volume(A) each carrying a charge of q with a drift velocity of vd.
* @param n the number of free charges
* @param q the charge on each
* @param A the area
* @param vd the drift velocity
* @param print print to console
* @return the current
*/
static long double current_nqAvd(long double n,
long double q,
long double A,
long double vd, bool print = true);
/**
* @brief calculates the current from the voltage, diameter, resistivity_ldR
* and length of a wire.
* @param V the voltage
* @param d the diameter
* @param rho the resistivity_ldR
* @param L the length of the wire
* @param print print to console
* @return the current in amperes
*/
static long double current_VdRhoL(
long double V, long double d, long double rho, long double L, bool print = true);
/**
* @brief calculates the resistance of resistor with a resistivity_ldR of p and a
* length of l with a area of A(pir^2, in a circular resistor).
* @param p the resistivity_ldR
* @param l the length
* @param A the cross sectional area
* @param print print to console
* @return the resistance
*/
static long double resistanceUsingResistivity(long double p,
long double l,
long double A, bool print = true);
/**
* @brief calculate the resistance of a simple cylindrical resistor with wires
* connected to the ends, such as the carbon composition resistors that are
* used on electronic circuit boards. Imagine that the resistor is made by
* squirting material whose conductivity is σ into a cylindrical mold with
* length L and cross-sectional area A as shown in. Assume that this material
* satisfies Ohm's law.
* @param sigma the conductivity
* @param L the length
* @param A the cross sectional area
* @param print print to console
* @return the resistance
*/
static long double resistanceUsingConductivity(long double sigma,
long double L,
long double A, bool print = true);
/**
* @brief calculates the resistance of a piece of wire with a length of l,
* having a diameter of d and a resistivity_ldR of p, which depends on the
* material its made from. copper is a p = 1.72e-8 Ohms/m
* @param p the resistivity_ldR
* @param l the length
* @param d the diameter
* @param print print to console
* @return the resistance in Ohms
*/
static long double resistanceUsingResistivityWire(long double p,
long double l,
long double d, bool print = true);
/// <summary>
/// calculates the cross sectional areas the of a resistor.
/// </summary>
/// <param name="p">The resistivity_ldR.</param>
/// <param name="R">The Resistance.</param>
/// <param name="l">The length.</param>
/// <returns>area of resistor (m^2)</returns>
/**
* @brief calculates the cross sectional areas the of a resistor.
* @param p the resistivity_ldR
* @param R the Resistance
* @param l the length
* @param print print to console
* @return area of resistor (m^2)
*/
static long double areaOfResistor(long double p,
long double R,
long double l, bool print = true);
/**
* @brief calculates the length of a resistor.
* @param A the cross sectional area
* @param R The resistance
* @param p The resistivity_ldR
* @param print print to console
* @return the length of resistor (m)
*/
static long double lengthOfResistor(long double A,
long double R,
long double p, bool print = true);
/**
* @brief calculates the Lengths of filament.
* @param d the diameter
* @param R the resistance
* @param p the resistivity_ldR
* @param print print to console
* @return the length of filament (m)
*/
static long double lengthOfFilament(long double d,
long double R,
long double p, bool print = true);
/**
* @brief As part of a class project you are given m g of copper and asked
* to fabricate a wire with uniform cross-section. You use up m kg of the
* copper and make a wire with a resistance of R Ω. The resistivity_ldR
* of copper is p Ω · m and its density is pd kg/m^3
* calculates the Lengths of filament.
* @param m the mass
* @param R the resistance
* @param p the resistivity_ldR
* @param pd the density
* @param print print to console
* @return the length of filament (m)
*/
static long double lengthOfWireMade(
long double m, long double R,long double p, long double pd,
bool print = true);
/**
* @brief calculates the resistivity_ldR of a resistor.
* @param R The resistance
* @param A area
* @param l The length
* @param print print to console
* @return the resistivity_ldR
*/
static long double resistivityOfResistor(
long double R, long double A, long double l, bool print = true);
/**
* @brief Of what material is a wire made, if it is a length of (l)m long with a
* (d)m diameter and has a resistance of R ohms at 20.0∘C
* @param l The length
* @param d The diameter
* @param R The resistance
* @param print print to console
* @return Ohm m
*/
static long double resistivity_ldR(
long double l, long double d, long double R, bool print = true);
/**
* @brief A d m-diameter rod carries a I A current when the electric
* field in the rod is E V/m. Calculate the resistivity_ldR of the rod.
* @param d The diameter
* @param I The current
* @param E The electric field
* @param print print to console
* @return Ohm m
*/
static long double resistivity_dIE(
long double d, long double I, long double E, bool print = true);
/**
* @brief calculates the voltages drop across a resistor.
* @param I The current (Amperes)
* @param R The resistance
* @param print print to console
* @return The voltage
*/
static long double voltageDropAcrossResistor(
long double I, long double R, bool print = true);
/**
* @brief Calculates the drifts the velocity (V_d) of a common wire.
* @param q the charge
* @param diameter the diameter
* @param I the current (Amperes)
* @param p the density per kg/m^3
* @param mass the atomic mass
* @param print print to console
* @return drift velocity m/s
*/
static long double driftVelocity_commonWire(long double q,
long double diameter,
long double I,
long double p,
long double mass, bool print = true);
/**
* @brief Drifts the velocity common wire n.
* @param n The number of electrons per cubic meter (density of
* conduction electrons)
* @param q The charge
* @param diameter The diameter
* @param I The current
* @param print print to console
* @return drift velocity m/s
*/
static long double driftVelocity_commonWire_n(long double n,
long double q,
long double diameter,
long double I, bool print = true);
/**
* @brief Calculates the crosses sectional area
* @param p The resistivity_ldR
* @param l The length
* @param R The resistance
* @param print print to console
* @return cross sectional area (m^2)
*/
static long double crossSectionalArea(long double p,
long double l,
long double R, bool print = true);
/**
* @brief Calculates the change in resistances from the effects of a
* change in temperature.
* @param R0 The initial colong double resistance
* @param tCoR The temperature coefficients of resistivity_ldR.
* @param tempChange The change in the temperature.
* @param print print to console
* @return the new resistance in Ohms
*/
static long double resistanceChangeFromTemperature(
long double R0, long double tCoR, long double tempChange,
bool print = true);
/**
* @brief calculates the electrical power from current and volts
* @param I The current
* @param V The volts
* @param print print to console
* @return energy from electrical(W)
*/
static long double electricalPower_IV(
long double I, long double V, bool print = true);
/**
* @brief calculates the electrical power from current and resistance
* @param I The current.
* @param R The resistance.
* @param print print to console
* @return energy from electrical (W)
*/
static long double electricalPower_IR(
long double I, long double R, bool print = true);
/**
* @brief calculates the electrical power from volts and resistance
* @param V The volts
* @param R The resistance
* @param print print to console
* @return energy from electrical (W)
*/
static long double electricalPower_VR(
long double V, long double R, bool print = true);
/**
* @brief Some makes of along double cars have 6.00-V electrical systems.
* What is the hot resistance of a 30.0-W headlight in such a car?
* @param P The power.
* @param V The volts.
* @param print print to console
* @return resistance
*/
static long double resistance_PV(
long double P, long double V, bool print = true);
/**
* @brief Calculates the resistance from power and current.
* @param P The power.
* @param I The current.
* @param print print to console
* @return resistance
*/
static long double resistance_PI(
long double P, long double I, bool print = true);
/**
* @brief Calculates the resistance from voltage and current.
* @param V The volts.
* @param I The current.
* @param print print to console
* @return resistance
*/
static long double resistance_VI(
long double V, long double I, bool print = true);
/**
* @brief Calculate the voltage from power P and resistance R.
* @param P The power.
* @param R The resistance.
* @param print print to console
* @return voltage
*/
static long double voltage_PR(
long double P, long double R, bool print = true);
/**
* @brief Calculate the voltage from current I and resistance R.
* @param I The current.
* @param R The resistance.
* @param print print to console
* @return voltage
*/
static long double voltage_IR(
long double I, long double R, bool print = true);
/**
* @brief Calculate the voltage from current I and power P.
* @param I The current.
* @param P The power.
* @param print print to console
* @return voltage
*/
static long double voltage_IP(
long double I, long double P, bool print = true);
/**
* @brief calculates the current from rearranging the power equations
* @param P the power in watts
* @param R the resistance
* @param print print to console
* @return the current in amperes(I)
*/
static long double current_PR(
long double P, long double R, bool print = true);
/**
* @brief calculates the current from power and volts
* @param P the power in watts
* @param V the volts
* @param print print to console
* @return
*/
static long double current_PV(
long double P, long double V, bool print = true);
/**
* @brief calculates the current from volts and resistance
* @param V the volts
* @param R the resistance
* @param print print to console
* @return the current in amperes(I)
*/
static long double current_VR(
long double V, long double R, bool print = true);
/**
* @brief A charge of (COULOMB) C of charge passes through a pocket
* calculator’s solar cells in t seconds. What is the power output, given
* the calculator’s voltage output is a voltage of V.
* @param COULOMB The charge.
* @param t The time.
* @param V The voltage.
* @param print print to console
* @return the watts
*/
static long double powerOutputOverTime(
long double Q, long double t, long double V, bool print = true);
/**
* @brief Calculates the total electrons that pass through a charge.
* @param COULOMB The charge in coulombs.
* @param print print to console
* @return Ne, number of electrons
*/
static long double electronsThatPassThroughACharge(
long double Q, bool print = true);
/**
* @brief If a large cyclotron directs a beam of freeProtons nuclei onto a
* target with a beam current of I Amperes. Calculate How many nuclei per
* second this is.
* @param I The current.
* @param freeProtons The number of free protons.
* @param print print to console
* @return nuclei/second
*/
static long double nucleiPerSecond(
long double I, long double freeProtons, bool print = true);
/**
* @brief Calculates the ratio of the resistivity_ldR of wire1 to that of wire2,
* if they have the same resistance per unit length
* (as they might in household double wiring)
* @param p1 The the bigger resistivity_ldR.
* @param p2 The smaller resistivity_ldR.
* @param print print to console
* @return the ratio meaning the size of the smaller resistivity_ldR value will
* to by this value bigger
*/
static long double ratioOfDiametersInWires(
long double p1, long double p2, bool print = true);
/**
* @brief Calculates the current flows through a diameter of (d) rod with a
* resistivity_ldR of (p) that is a length of (l)m long, when (V) voltage is
* applied to it? (Such a rod may be used to make nuclear- particle
* detectors, for example.)
* @param V The applied voltage.
* @param p The resistivity_ldR.
* @param d The diameter.
* @param l The length.
* @param print print to console
* @return the Amperes
*/
static long double currentFlowThroughOfMaterial(
long double V, long double p, long double d, long double l,
bool print = true);
/**
* @brief A resistor made of Nichrome wire is used in an application where its
* resistance cannot change more than 1.00% from its value at 20.0∘C .
* Over what temperature range can it be used?
* @param tempCoEffOfResistivity The temperature coefficient of resistivity_ldR.
* @param maxChangePercent The maximum change percent.
* @param print print to console
* @return temperature
*/
static long double maximumTempchange(
long double tempCoEffOfResistivity, long double maxChangePercent,
bool print = true);
/**
* @brief With a 1200-W toaster, how much electrical energy is needed to make a
* slice of toast (cooking time = 1 minute)? At 9.0 cents/kW⋅h, how much does this cost?
* @param P The power inWatts.
* @param t The time in seconds.
* @param ratePerKwh The rate per KWH.
* @param print print to console
* @return total cost to use electricity
*/
static long double costOfElectricityUsed_kWh(
long double P, long double t, long double ratePerKwh,
bool print = true);
/**
* @brief An olong double light bulb draws only 50.0 W, rather than its original 60.0 W,
* due to evaporative thinning of its filament. By what factor is its
* diameter reduced, assuming uniform thinning along its length? Neglect
* any effects caused by temperature differences.
* @param Pi The starting wattage.
* @param Pf The final wattage.
* @param print print to console
* @return factor which diameter decreases
*/
static long double factorDiameterReduced(
long double Pi, long double Pf, bool print = true);
/**
* @brief Calculates the total time.
* @param COULOMB The charge.
* @param P The power.
* @param print print to console
* @return time
*/
static long double timeTotal(
long double Q, long double P, bool print = true);
/**
* @brief Calculates the total time.
* @param COULOMB The charge.
* @param I The current.
* @param V The volts.
* @param print print to console
* @return time
*/
static long double timeTotal(
long double Q, long double I, long double V, bool print = true);
/**
* @brief Calculates the total time.
* @param m1 The mass of tissue.
* @param c The specific heat of water(sub new substance value).
* @param Ti The initial temperature.
* @param Tf The temperature to raise to.
* @param m2 The mass of water to boil.
* @param Lv The latent heat of vaporization .
* @param I The current.
* @param V The volts.
* @param print print to console
* @return time
*/
static long double timeToRaiseTemperature(
long double m1, long double c, long double Ti, long double Tf,
long double m2, long double Lv, long double I, long double V,
bool print = true);
/**
* @brief Calculates the cost of heating a hot tub containing 1500 kg of water from
* 10.0∘C to 40.0∘C , assuming 75.0% efficiency to account for heat
* transfer to the surroundings? The cost of electricity is 9 cents/kW ⋅h .
* @param m The mass of the water.
* @param c The specific heat.
* @param Ti The initial temp.
* @param Tf The final temp.
* @param eff The eff.
* @param rate The rate.
* @param print print to console
* @return cost in cents
*/
static long double costToHeatHotTub(
long double m, long double c, long double Ti, long double Tf,
long double eff, long double rate, bool print = true);
/**
* @brief Calculates the RMS current.
* @param Ip The peek current.
* @param print print to console
* @return rms current
*/
static long double rmsCurrent(long double Ip, bool print = true);
/**
* @brief Calculates the peek current.
* @param Irms The rms current.
* @param print print to console
* @return peek current
*/
static long double peekCurrent(long double Irms, bool print = true);
/**
* @brief Calculates the peek current from the peek voltage Vp and the
* resistance R of the circuit.
* @param Vp The peek voltage.
* @param R The resistance.