KiCad PCB EDA Suite
Loading...
Searching...
No Matches
iec60664.cpp
Go to the documentation of this file.
1/*
2 * This program source code file is part of KICAD, a free EDA CAD application.
3 *
4 * Copyright (C) 2023 Kicad Developers, see AUTHORS.txt for contributors.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version 3
9 * of the License, or (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program. If not, see <http://www.gnu.org/licenses/>.
18 */
19
20
21// Based on IEC60664-1 : 2020-05
22#include "iec60664.h"
23#include <iostream>
24
25double IEC60664::GetMinGrooveWidth( const POLLUTION_DEGREE aPD, const double aDistIso )
26{
27 if( aDistIso <= 0 )
28 return -1;
29
30 // Based on IEC60664-1 : 2020-05 ยง6.8
31 if( abs( aDistIso ) < 3 )
32 return aDistIso / 3;
33
34 switch( aPD )
35 {
36 case POLLUTION_DEGREE::PD1: return 0.25;
37 case POLLUTION_DEGREE::PD2: return 1.0;
38 case POLLUTION_DEGREE::PD3: return 1.5;
39 default: return -1;
40 }
41}
42
43double IEC60664::GetClearanceAltitudeCorrectionFactor( const double aAltitude )
44{
45 // Based on IEC60664-1 : 2020-05 Table A.2
46
47 if( aAltitude <= 2000 )
48 return 1.0;
49 if( aAltitude <= 3000 )
50 return 1.14;
51 if( aAltitude <= 4000 )
52 return 1.29;
53 if( aAltitude <= 5000 )
54 return 1.48;
55 if( aAltitude <= 6000 )
56 return 1.70;
57 if( aAltitude <= 7000 )
58 return 1.95;
59 if( aAltitude <= 8000 )
60 return 2.25;
61 if( aAltitude <= 9000 )
62 return 2.62;
63 if( aAltitude <= 10000 )
64 return 3.02;
65 if( aAltitude <= 15000 )
66 return 6.67;
67 if( aAltitude <= 20000 )
68 return 14.5;
69 return -1;
70}
71
72double IEC60664::GetClearanceForRMSVoltage( const double aVRMS, const FIELD aField )
73{
74 // Based on IEC60664-1 : 2020-05 Table A.1
75
76 switch( aField )
77 {
79 if( aVRMS <= 0.028 )
80 return 0.001;
81 if( aVRMS <= 0.053 )
82 return 0.002;
83 if( aVRMS <= 0.078 )
84 return 0.003;
85 if( aVRMS <= 0.102 )
86 return 0.004;
87 if( aVRMS <= 0.124 )
88 return 0.005;
89 if( aVRMS <= 0.152 )
90 return 0.00625;
91 if( aVRMS <= 0.191 )
92 return 0.008;
93 if( aVRMS <= 0.23 )
94 return 0.010;
95 if( aVRMS <= 0.25 )
96 return 0.012;
97 if( aVRMS <= 0.26 )
98 return 0.015;
99 if( aVRMS <= 0.28 )
100 return 0.020;
101 if( aVRMS <= 0.31 )
102 return 0.025;
103 if( aVRMS <= 0.33 )
104 return 0.030;
105 if( aVRMS <= 0.37 )
106 return 0.040;
107 if( aVRMS <= 0.37 )
108 return 0.040;
109 if( aVRMS <= 0.40 )
110 return 0.050;
111 if( aVRMS <= 0.42 )
112 return 0.0625;
113 if( aVRMS <= 0.46 )
114 return 0.080;
115 if( aVRMS <= 0.50 )
116 return 0.10;
117 if( aVRMS <= 0.52 )
118 return 0.12;
119 if( aVRMS <= 0.57 )
120 return 0.15;
121 if( aVRMS <= 0.62 )
122 return 0.20;
123 if( aVRMS <= 0.67 )
124 return 0.25;
125 if( aVRMS <= 0.71 )
126 return 0.30;
127 if( aVRMS <= 0.78 )
128 return 0.40;
129 if( aVRMS <= 0.84 )
130 return 0.50;
131 if( aVRMS <= 0.90 )
132 return 0.60;
133 if( aVRMS <= 0.98 )
134 return 0.80;
135 if( aVRMS <= 1.06 )
136 return 1.0;
137 if( aVRMS <= 1.20 )
138 return 1.2;
139 if( aVRMS <= 1.39 )
140 return 1.5;
141 if( aVRMS <= 1.68 )
142 return 2.0;
143 if( aVRMS <= 1.96 )
144 return 2.5;
145 if( aVRMS <= 2.21 )
146 return 3.0;
147 if( aVRMS <= 2.68 )
148 return 4.0;
149 if( aVRMS <= 3.11 )
150 return 5.0;
151 if( aVRMS <= 3.51 )
152 return 6.0;
153 if( aVRMS <= 4.26 )
154 return 8.0;
155 if( aVRMS <= 4.95 )
156 return 10;
157 if( aVRMS <= 5.78 )
158 return 12.0;
159 if( aVRMS <= 7.0 )
160 return 15.0;
161 if( aVRMS <= 8.98 )
162 return 20.0;
163 if( aVRMS <= 10.8 )
164 return 25.0;
165 if( aVRMS <= 12.7 )
166 return 30.0;
167 if( aVRMS <= 16.2 )
168 return 40.0;
169 if( aVRMS <= 19.6 )
170 return 50.0;
171 if( aVRMS <= 22.8 )
172 return 60.0;
173 if( aVRMS <= 29.2 )
174 return 80.0;
175 if( aVRMS <= 35.4 )
176 return 80.0;
177
178 break;
179
181 if( aVRMS <= 0.028 )
182 return 0.001;
183 if( aVRMS <= 0.053 )
184 return 0.002;
185 if( aVRMS <= 0.078 )
186 return 0.003;
187 if( aVRMS <= 0.102 )
188 return 0.004;
189 if( aVRMS <= 0.124 )
190 return 0.005;
191 if( aVRMS <= 0.152 )
192 return 0.00625;
193 if( aVRMS <= 0.191 )
194 return 0.008;
195 if( aVRMS <= 0.23 )
196 return 0.010;
197 if( aVRMS <= 0.25 )
198 return 0.012;
199 if( aVRMS <= 0.26 )
200 return 0.015;
201 if( aVRMS <= 0.28 )
202 return 0.020;
203 if( aVRMS <= 0.31 )
204 return 0.025;
205 if( aVRMS <= 0.33 )
206 return 0.030;
207 if( aVRMS <= 0.37 )
208 return 0.040;
209 if( aVRMS <= 0.37 )
210 return 0.040;
211 if( aVRMS <= 0.40 )
212 return 0.050;
213 if( aVRMS <= 0.42 )
214 return 0.0625;
215 if( aVRMS <= 0.50 )
216 return 0.080;
217 if( aVRMS <= 0.57 )
218 return 0.10;
219 if( aVRMS <= 0.64 )
220 return 0.12;
221 if( aVRMS <= 0.74 )
222 return 0.15;
223 if( aVRMS <= 0.89 )
224 return 0.20;
225 if( aVRMS <= 1.03 )
226 return 0.25;
227 if( aVRMS <= 1.15 )
228 return 0.30;
229 if( aVRMS <= 1.38 )
230 return 0.40;
231 if( aVRMS <= 1.59 )
232 return 0.50;
233 if( aVRMS <= 1.79 )
234 return 0.60;
235 if( aVRMS <= 2.15 )
236 return 0.80;
237 if( aVRMS <= 2.47 )
238 return 1.0;
239 if( aVRMS <= 2.89 )
240 return 1.2;
241 if( aVRMS <= 3.50 )
242 return 1.5;
243 if( aVRMS <= 4.48 )
244 return 2.0;
245 if( aVRMS <= 5.41 )
246 return 2.5;
247 if( aVRMS <= 6.32 )
248 return 3.0;
249 if( aVRMS <= 8.06 )
250 return 4.0;
251 if( aVRMS <= 9.76 )
252 return 5.0;
253 if( aVRMS <= 11.5 )
254 return 6.0;
255 if( aVRMS <= 14.6 )
256 return 8.0;
257 if( aVRMS <= 17.7 )
258 return 10;
259 if( aVRMS <= 20.9 )
260 return 12.0;
261 if( aVRMS <= 25.7 )
262 return 15.0;
263 if( aVRMS <= 33.5 )
264 return 20.0;
265 if( aVRMS <= 41.2 )
266 return 25.0;
267 if( aVRMS <= 48.8 )
268 return 30.0;
269 if( aVRMS <= 63.6 )
270 return 40.0;
271 if( aVRMS <= 78.5 )
272 return 50.0;
273 if( aVRMS <= 92.6 )
274 return 60.0;
275 if( aVRMS <= 120.9 )
276 return 80.0;
277 if( aVRMS <= 148.5 )
278 return 80.0;
279
280 break;
281
282 default:
283 break;
284 }
285
286 return -1; // Out of range
287}
288
289
291 const POLLUTION_DEGREE aPD,
292 const FIELD aField )
293{
294 // Based on IEC60664-1 : 2020-05 Table F.2
295
296 switch( aField )
297 {
299 if( aPD <= POLLUTION_DEGREE::PD1 )
300 {
301 if( aVoltage <= 0.33 )
302 return 0.01;
303 if( aVoltage <= 0.40 )
304 return 0.02;
305 if( aVoltage <= 0.50 )
306 return 0.04;
307 if( aVoltage <= 0.60 )
308 return 0.06;
309 if( aVoltage <= 0.80 )
310 return 0.10;
311 if( aVoltage <= 1.0 )
312 return 0.15;
313 }
314 if( aPD <= POLLUTION_DEGREE::PD2 )
315 {
316 if( aVoltage <= 1.0 )
317 return 0.2;
318 if( aVoltage <= 1.2 )
319 return 0.25;
320 if( aVoltage <= 1.5 )
321 return 0.5;
322 }
323 if( aPD <= POLLUTION_DEGREE::PD3 )
324 {
325 if( aVoltage <= 1.5 )
326 return 0.8;
327 if( aVoltage <= 2.0 )
328 return 1.0;
329 if( aVoltage <= 2.5 )
330 return 1.5;
331 }
332 if( ( aPD >= POLLUTION_DEGREE::PD4 ) && ( aVoltage <= 2.5 ) )
333 return 1.6;
334 if( aVoltage <= 3.0 )
335 return 2.0;
336 if( aVoltage <= 4.0 )
337 return 3.0;
338 if( aVoltage <= 5.0 )
339 return 4.0;
340 if( aVoltage <= 6.0 )
341 return 5.5;
342 if( aVoltage <= 8.0 )
343 return 8.0;
344 if( aVoltage <= 10 )
345 return 11;
346 if( aVoltage <= 12 )
347 return 14;
348 if( aVoltage <= 15 )
349 return 18;
350 if( aVoltage <= 20 )
351 return 25;
352 if( aVoltage <= 25 )
353 return 33;
354 if( aVoltage <= 30 )
355 return 40;
356 if( aVoltage <= 40 )
357 return 60;
358 if( aVoltage <= 50 )
359 return 75;
360 if( aVoltage <= 60 )
361 return 90;
362 if( aVoltage <= 80 )
363 return 130;
364 if( aVoltage <= 100 )
365 return 170;
366
367 break;
368
370 if( aPD <= POLLUTION_DEGREE::PD1 )
371 {
372 if( aVoltage <= 0.33 )
373 return 0.01;
374 if( aVoltage <= 0.40 )
375 return 0.02;
376 if( aVoltage <= 0.50 )
377 return 0.04;
378 if( aVoltage <= 0.60 )
379 return 0.06;
380 if( aVoltage <= 0.80 )
381 return 0.10;
382 if( aVoltage <= 1.0 )
383 return 0.15;
384 if( aVoltage <= 1.2 )
385 return 0.2;
386 }
387 if( aPD <= POLLUTION_DEGREE::PD2 )
388 {
389 if( aVoltage <= 1.2 )
390 return 0.2;
391 if( aVoltage <= 1.5 )
392 return 0.3;
393 if( aVoltage <= 2.0 )
394 return 0.45;
395 if( aVoltage <= 2.5 )
396 return 0.60;
397 if( aVoltage <= 3.0 )
398 return 0.80;
399 }
400 if( aPD <= POLLUTION_DEGREE::PD3 )
401 {
402 if( aVoltage <= 3.0 )
403 return 0.80;
404 if( aVoltage <= 4.0 )
405 return 1.2;
406 if( aVoltage <= 5.0 )
407 return 1.5;
408 }
409 if( ( aPD >= POLLUTION_DEGREE::PD4 ) && ( aVoltage <= 5.0 ) )
410 return 1.6;
411 if( aVoltage <= 6.0 )
412 return 2.0;
413 if( aVoltage <= 8.0 )
414 return 3.0;
415 if( aVoltage <= 10 )
416 return 3.5;
417 if( aVoltage <= 12 )
418 return 4.5;
419 if( aVoltage <= 15 )
420 return 5.5;
421 if( aVoltage <= 20 )
422 return 8.0;
423 if( aVoltage <= 25 )
424 return 10;
425 if( aVoltage <= 30 )
426 return 12.5;
427 if( aVoltage <= 40 )
428 return 17;
429 if( aVoltage <= 50 )
430 return 22;
431 if( aVoltage <= 60 )
432 return 27;
433 if( aVoltage <= 80 )
434 return 35;
435 if( aVoltage <= 100 )
436 return 45;
437
438 break;
439
440 default:
441 break;
442 }
443
444 return -1; // Out of range
445}
446
447double IEC60664::GetClearanceToWithstandPeaks( const double aVoltage, const FIELD aField )
448{
449 // Based on IEC60664-1 : 2020-05 Table F.8
450
451 switch( aField )
452 {
454 if( aVoltage <= 0.04 )
455 return 0.001;
456 if( aVoltage <= 0.06 )
457 return 0.002;
458 if( aVoltage <= 0.1 )
459 return 0.003;
460 if( aVoltage <= 0.12 )
461 return 0.004;
462 if( aVoltage <= 0.15 )
463 return 0.005;
464 if( aVoltage <= 0.20 )
465 return 0.006;
466 if( aVoltage <= 0.25 )
467 return 0.008;
468 if( aVoltage <= 0.33 )
469 return 0.01;
470 if( aVoltage <= 0.4 )
471 return 0.02;
472 if( aVoltage <= 0.5 )
473 return 0.04;
474 if( aVoltage <= 0.6 )
475 return 0.06;
476 if( aVoltage <= 0.8 )
477 return 0.13;
478 if( aVoltage <= 1.0 )
479 return 0.26;
480 if( aVoltage <= 1.2 )
481 return 0.42;
482 if( aVoltage <= 1.5 )
483 return 0.76;
484 if( aVoltage <= 2.0 )
485 return 1.27;
486 if( aVoltage <= 2.5 )
487 return 1.8;
488 if( aVoltage <= 3.0 )
489 return 2.4;
490 if( aVoltage <= 4.0 )
491 return 3.8;
492 if( aVoltage <= 5.0 )
493 return 5.7;
494 if( aVoltage <= 6.0 )
495 return 7.9;
496 if( aVoltage <= 8.0 )
497 return 11.0;
498 if( aVoltage <= 10 )
499 return 15.2;
500 if( aVoltage <= 12 )
501 return 19;
502 if( aVoltage <= 15 )
503 return 25;
504 if( aVoltage <= 20 )
505 return 34;
506 if( aVoltage <= 25 )
507 return 44;
508 if( aVoltage <= 30 )
509 return 55;
510 if( aVoltage <= 40 )
511 return 77;
512 if( aVoltage <= 50 )
513 return 100;
514
515 break;
516
518 if( aVoltage <= 0.04 )
519 return 0.001;
520 if( aVoltage <= 0.06 )
521 return 0.002;
522 if( aVoltage <= 0.1 )
523 return 0.003;
524 if( aVoltage <= 0.12 )
525 return 0.004;
526 if( aVoltage <= 0.15 )
527 return 0.005;
528 if( aVoltage <= 0.20 )
529 return 0.006;
530 if( aVoltage <= 0.25 )
531 return 0.008;
532 if( aVoltage <= 0.33 )
533 return 0.01;
534 if( aVoltage <= 0.33 )
535 return 0.01;
536 if( aVoltage <= 0.4 )
537 return 0.02;
538 if( aVoltage <= 0.5 )
539 return 0.04;
540 if( aVoltage <= 0.6 )
541 return 0.06;
542 if( aVoltage <= 0.8 )
543 return 0.1;
544 if( aVoltage <= 1.0 )
545 return 0.15;
546 if( aVoltage <= 1.2 )
547 return 0.2;
548 if( aVoltage <= 1.5 )
549 return 0.3;
550 if( aVoltage <= 2.0 )
551 return 0.45;
552 if( aVoltage <= 2.5 )
553 return 0.6;
554 if( aVoltage <= 3.0 )
555 return 0.8;
556 if( aVoltage <= 4.0 )
557 return 1.2;
558 if( aVoltage <= 5.0 )
559 return 1.5;
560 if( aVoltage <= 6.0 )
561 return 2;
562 if( aVoltage <= 8.0 )
563 return 3;
564 if( aVoltage <= 10 )
565 return 3.5;
566 if( aVoltage <= 12 )
567 return 4.5;
568 if( aVoltage <= 15 )
569 return 5.5;
570 if( aVoltage <= 20 )
571 return 8;
572 if( aVoltage <= 25 )
573 return 10;
574 if( aVoltage <= 30 )
575 return 12.5;
576 if( aVoltage <= 40 )
577 return 17;
578 if( aVoltage <= 50 )
579 return 22;
580 if( aVoltage <= 60 )
581 return 27;
582 if( aVoltage <= 80 )
583 return 35;
584 if( aVoltage <= 100 )
585 return 45;
586
587 break;
588
589 default:
590 break;
591 }
592 return -1;
593}
594
596{
597 // Based on IEC60664-1 : 2020-05 Table F.1
598 double voltage = m_ratedVoltage;
599
600 switch( m_overvoltageCat )
601 {
603 if( voltage <= 50 )
604 return 330;
605 if( voltage <= 100 )
606 return 500;
607 if( voltage <= 150 )
608 return 800;
609 if( voltage <= 300 )
610 return 1500;
611 if( voltage <= 600 )
612 return 2500;
613 if( voltage <= 1000 )
614 return 4000;
615 if( voltage <= 1250 )
616 return 4000;
617 if( voltage <= 1500 )
618 return 6000;
619
620 break;
621
623 if( voltage <= 50 )
624 return 500;
625 if( voltage <= 100 )
626 return 800;
627 if( voltage <= 150 )
628 return 1500;
629 if( voltage <= 300 )
630 return 2500;
631 if( voltage <= 600 )
632 return 4000;
633 if( voltage <= 1000 )
634 return 6000;
635 if( voltage <= 1250 )
636 return 6000;
637 if( voltage <= 1500 )
638 return 8000;
639
640 break;
641
643 if( voltage <= 50 )
644 return 800;
645 if( voltage <= 100 )
646 return 1500;
647 if( voltage <= 150 )
648 return 2500;
649 if( voltage <= 300 )
650 return 4000;
651 if( voltage <= 600 )
652 return 6000;
653 if( voltage <= 1000 )
654 return 8000;
655 if( voltage <= 1250 )
656 return 8000;
657 if( voltage <= 1500 )
658 return 10000;
659
660 break;
661
663 if( voltage <= 50 )
664 return 1500;
665 if( voltage <= 100 )
666 return 2500;
667 if( voltage <= 150 )
668 return 4000;
669 if( voltage <= 300 )
670 return 6000;
671 if( voltage <= 600 )
672 return 8000;
673 if( voltage <= 1000 )
674 return 12000;
675 if( voltage <= 1250 )
676 return 12000;
677 if( voltage <= 1500 )
678 return 15000;
679
680 break;
681
682 default:
683 break;
684 }
685
686 return -1; // Out of range
687}
688
689
691{
692 if( aCTI >= 600 )
694 if( aCTI >= 400 )
696 if( aCTI >= 175 )
698 if( aCTI >= 100 )
701}
702
703
704double IEC60664::GetBasicCreepageDistance( const double aVoltage, const POLLUTION_DEGREE aPD,
705 const MATERIAL_GROUP aMG )
706{
707 // Based on IEC60664-1 : 2020-05 Table F.5
708
709 bool IsPCBmaterial = m_pcbMaterial;
710
711 if( aVoltage > 1000 )
712 IsPCBmaterial = false;
713 if( aPD >= POLLUTION_DEGREE::PD3 )
714 IsPCBmaterial = false;
716 IsPCBmaterial = false;
717
718 if( IsPCBmaterial )
719 {
720 if( aPD == POLLUTION_DEGREE::PD1 )
721 {
722 if( aVoltage <= 50 )
723 return 0.025;
724 if( aVoltage <= 63 )
725 return 0.040;
726 if( aVoltage <= 80 )
727 return 0.063;
728 if( aVoltage <= 100 )
729 return 0.100;
730 if( aVoltage <= 125 )
731 return 0.160;
732 if( aVoltage <= 160 )
733 return 0.250;
734 if( aVoltage <= 200 )
735 return 0.400;
736 if( aVoltage <= 250 )
737 return 0.560;
738 if( aVoltage <= 320 )
739 return 0.75;
740 if( aVoltage <= 400 )
741 return 1.0;
742 if( aVoltage <= 500 )
743 return 1.3;
744 if( aVoltage <= 630 )
745 return 1.8;
746 if( aVoltage <= 800 )
747 return 2.4;
748 if( aVoltage <= 1000 )
749 return 3.2;
750 }
751 if( aPD == POLLUTION_DEGREE::PD2 )
752 {
753 if( aVoltage <= 50 )
754 return 0.040;
755 if( aVoltage <= 63 )
756 return 0.063;
757 if( aVoltage <= 80 )
758 return 0.100;
759 if( aVoltage <= 100 )
760 return 0.160;
761 if( aVoltage <= 125 )
762 return 0.250;
763 if( aVoltage <= 160 )
764 return 0.400;
765 if( aVoltage <= 200 )
766 return 0.630;
767 if( aVoltage <= 250 )
768 return 1.000;
769 if( aVoltage <= 320 )
770 return 1.60;
771 if( aVoltage <= 400 )
772 return 2.0;
773 if( aVoltage <= 500 )
774 return 2.5;
775 if( aVoltage <= 630 )
776 return 3.2;
777 if( aVoltage <= 800 )
778 return 4.0;
779 if( aVoltage <= 1000 )
780 return 5.0;
781 }
782 }
783 if( aPD == POLLUTION_DEGREE::PD1 )
784 {
785 if( aVoltage <= 10 )
786 return 0.080;
787 if( aVoltage <= 12.5 )
788 return 0.090;
789 if( aVoltage <= 16 )
790 return 0.100;
791 if( aVoltage <= 20 )
792 return 0.110;
793 if( aVoltage <= 25 )
794 return 0.125;
795 if( aVoltage <= 32 )
796 return 0.14;
797 if( aVoltage <= 40 )
798 return 0.16;
799 if( aVoltage <= 50 )
800 return 0.18;
801 if( aVoltage <= 63 )
802 return 0.20;
803 if( aVoltage <= 80 )
804 return 0.22;
805 if( aVoltage <= 100 )
806 return 0.25;
807 if( aVoltage <= 125 )
808 return 0.28;
809 if( aVoltage <= 160 )
810 return 0.32;
811 if( aVoltage <= 200 )
812 return 0.42;
813 if( aVoltage <= 250 )
814 return 0.56;
815 if( aVoltage <= 320 )
816 return 0.75;
817 if( aVoltage <= 400 )
818 return 1.0;
819 if( aVoltage <= 500 )
820 return 1.3;
821 if( aVoltage <= 630 )
822 return 1.8;
823 if( aVoltage <= 800 )
824 return 2.4;
825 if( aVoltage <= 1000 )
826 return 3.2;
827 if( aVoltage <= 1250 )
828 return 4.2;
829 if( aVoltage <= 1600 )
830 return 5.6;
831 if( aVoltage <= 2000 )
832 return 7.5;
833 if( aVoltage <= 2500 )
834 return 10.0;
835 if( aVoltage <= 3200 )
836 return 12.5;
837 if( aVoltage <= 4000 )
838 return 16.0;
839 if( aVoltage <= 5000 )
840 return 20.0;
841 if( aVoltage <= 6300 )
842 return 25.0;
843 if( aVoltage <= 8000 )
844 return 32.0;
845 if( aVoltage <= 10000 )
846 return 40.0;
847 if( aVoltage <= 12500 )
848 return 50.0;
849 if( aVoltage <= 16000 )
850 return 63.0;
851 if( aVoltage <= 20000 )
852 return 80.0;
853 if( aVoltage <= 25000 )
854 return 100.0;
855 if( aVoltage <= 32000 )
856 return 125.0;
857 if( aVoltage <= 40000 )
858 return 160.0;
859 if( aVoltage <= 50000 )
860 return 200.0;
861 if( aVoltage <= 63000 )
862 return 250;
863 }
864 if( aPD == POLLUTION_DEGREE::PD2 && aMG == MATERIAL_GROUP::MG_I )
865 {
866 if( aVoltage <= 10 )
867 return 0.400;
868 if( aVoltage <= 12.5 )
869 return 0.420;
870 if( aVoltage <= 16 )
871 return 0.450;
872 if( aVoltage <= 20 )
873 return 0.480;
874 if( aVoltage <= 25 )
875 return 0.500;
876 if( aVoltage <= 32 )
877 return 0.53;
878 if( aVoltage <= 40 )
879 return 0.56;
880 if( aVoltage <= 50 )
881 return 0.60;
882 if( aVoltage <= 63 )
883 return 0.63;
884 if( aVoltage <= 80 )
885 return 0.67;
886 if( aVoltage <= 100 )
887 return 0.71;
888 if( aVoltage <= 125 )
889 return 0.75;
890 if( aVoltage <= 160 )
891 return 0.80;
892 if( aVoltage <= 200 )
893 return 1.00;
894 if( aVoltage <= 250 )
895 return 1.25;
896 if( aVoltage <= 320 )
897 return 1.60;
898 if( aVoltage <= 400 )
899 return 2.0;
900 if( aVoltage <= 500 )
901 return 2.5;
902 if( aVoltage <= 630 )
903 return 3.2;
904 if( aVoltage <= 800 )
905 return 4.0;
906 if( aVoltage <= 1000 )
907 return 5.0;
908 if( aVoltage <= 1250 )
909 return 6.3;
910 if( aVoltage <= 1600 )
911 return 8.0;
912 if( aVoltage <= 2000 )
913 return 10.0;
914 if( aVoltage <= 2500 )
915 return 12.5;
916 if( aVoltage <= 3200 )
917 return 16.0;
918 if( aVoltage <= 4000 )
919 return 20.0;
920 if( aVoltage <= 5000 )
921 return 25.0;
922 if( aVoltage <= 6300 )
923 return 32.0;
924 if( aVoltage <= 8000 )
925 return 40.0;
926 if( aVoltage <= 10000 )
927 return 50.0;
928 if( aVoltage <= 12500 )
929 return 63.0;
930 if( aVoltage <= 16000 )
931 return 80.0;
932 if( aVoltage <= 20000 )
933 return 100.0;
934 if( aVoltage <= 25000 )
935 return 125.0;
936 if( aVoltage <= 32000 )
937 return 160.0;
938 if( aVoltage <= 40000 )
939 return 200.0;
940 if( aVoltage <= 50000 )
941 return 250.0;
942 if( aVoltage <= 63000 )
943 return 320.0;
944 }
945 if( aPD == POLLUTION_DEGREE::PD2 && aMG == MATERIAL_GROUP::MG_II )
946 {
947 if( aVoltage <= 10 )
948 return 0.400;
949 if( aVoltage <= 12.5 )
950 return 0.420;
951 if( aVoltage <= 16 )
952 return 0.450;
953 if( aVoltage <= 20 )
954 return 0.480;
955 if( aVoltage <= 25 )
956 return 0.500;
957 if( aVoltage <= 32 )
958 return 0.53;
959 if( aVoltage <= 40 )
960 return 0.80;
961 if( aVoltage <= 50 )
962 return 0.85;
963 if( aVoltage <= 63 )
964 return 0.90;
965 if( aVoltage <= 80 )
966 return 0.95;
967 if( aVoltage <= 100 )
968 return 1.00;
969 if( aVoltage <= 125 )
970 return 1.05;
971 if( aVoltage <= 160 )
972 return 1.10;
973 if( aVoltage <= 200 )
974 return 1.40;
975 if( aVoltage <= 250 )
976 return 1.80;
977 if( aVoltage <= 320 )
978 return 2.20;
979 if( aVoltage <= 400 )
980 return 2.8;
981 if( aVoltage <= 500 )
982 return 3.6;
983 if( aVoltage <= 630 )
984 return 4.5;
985 if( aVoltage <= 800 )
986 return 5.6;
987 if( aVoltage <= 1000 )
988 return 7.1;
989 if( aVoltage <= 1250 )
990 return 9.0;
991 if( aVoltage <= 1600 )
992 return 11.0;
993 if( aVoltage <= 2000 )
994 return 14.0;
995 if( aVoltage <= 2500 )
996 return 18.0;
997 if( aVoltage <= 3200 )
998 return 22.0;
999 if( aVoltage <= 4000 )
1000 return 28.0;
1001 if( aVoltage <= 5000 )
1002 return 36.0;
1003 if( aVoltage <= 6300 )
1004 return 45.0;
1005 if( aVoltage <= 8000 )
1006 return 56.0;
1007 if( aVoltage <= 10000 )
1008 return 71.0;
1009 if( aVoltage <= 12500 )
1010 return 90.0;
1011 if( aVoltage <= 16000 )
1012 return 110.0;
1013 if( aVoltage <= 20000 )
1014 return 140.0;
1015 if( aVoltage <= 25000 )
1016 return 180.0;
1017 if( aVoltage <= 32000 )
1018 return 220.0;
1019 if( aVoltage <= 40000 )
1020 return 280.0;
1021 if( aVoltage <= 50000 )
1022 return 360.0;
1023 if( aVoltage <= 63000 )
1024 return 450.0;
1025 }
1026 if( aPD == POLLUTION_DEGREE::PD2
1027 && ( aMG == MATERIAL_GROUP::MG_IIIa || aMG == MATERIAL_GROUP::MG_IIIb ) )
1028 {
1029 if( aVoltage <= 10 )
1030 return 0.400;
1031 if( aVoltage <= 12.5 )
1032 return 0.420;
1033 if( aVoltage <= 16 )
1034 return 0.450;
1035 if( aVoltage <= 20 )
1036 return 0.480;
1037 if( aVoltage <= 25 )
1038 return 0.500;
1039 if( aVoltage <= 32 )
1040 return 0.53;
1041 if( aVoltage <= 40 )
1042 return 1.10;
1043 if( aVoltage <= 50 )
1044 return 1.20;
1045 if( aVoltage <= 63 )
1046 return 1.25;
1047 if( aVoltage <= 80 )
1048 return 1.30;
1049 if( aVoltage <= 100 )
1050 return 1.40;
1051 if( aVoltage <= 125 )
1052 return 1.50;
1053 if( aVoltage <= 160 )
1054 return 1.60;
1055 if( aVoltage <= 50000 )
1056 return aVoltage / 100;
1057 if( aVoltage <= 63000 )
1058 return 600.0;
1059 }
1060 if( aPD == POLLUTION_DEGREE::PD3 && aMG == MATERIAL_GROUP::MG_I )
1061 {
1062 if( aVoltage <= 10 )
1063 return 1.000;
1064 if( aVoltage <= 12.5 )
1065 return 1.050;
1066 if( aVoltage <= 16 )
1067 return 1.100;
1068 if( aVoltage <= 20 )
1069 return 1.200;
1070 if( aVoltage <= 25 )
1071 return 1.250;
1072 if( aVoltage <= 32 )
1073 return 1.30;
1074 if( aVoltage <= 40 )
1075 return 1.40;
1076 if( aVoltage <= 50 )
1077 return 1.50;
1078 if( aVoltage <= 63 )
1079 return 1.60;
1080 if( aVoltage <= 80 )
1081 return 1.70;
1082 if( aVoltage <= 100 )
1083 return 1.80;
1084 if( aVoltage <= 125 )
1085 return 1.90;
1086 if( aVoltage <= 160 )
1087 return 2.00;
1088 if( aVoltage <= 200 )
1089 return 2.50;
1090 if( aVoltage <= 250 )
1091 return 3.20;
1092 if( aVoltage <= 320 )
1093 return 4.00;
1094 if( aVoltage <= 400 )
1095 return 5.0;
1096 if( aVoltage <= 500 )
1097 return 6.3;
1098 if( aVoltage <= 630 )
1099 return 8.0;
1100 if( aVoltage <= 800 )
1101 return 10.0;
1102 if( aVoltage <= 1000 )
1103 return 12.5;
1104 if( aVoltage <= 1250 )
1105 return 16.0;
1106 if( aVoltage <= 1600 )
1107 return 20.0;
1108 if( aVoltage <= 2000 )
1109 return 25.0;
1110 if( aVoltage <= 2500 )
1111 return 32.0;
1112 if( aVoltage <= 3200 )
1113 return 40.0;
1114 if( aVoltage <= 4000 )
1115 return 50.0;
1116 if( aVoltage <= 5000 )
1117 return 63.0;
1118 if( aVoltage <= 6300 )
1119 return 80.0;
1120 if( aVoltage <= 8000 )
1121 return 100.0;
1122 if( aVoltage <= 10000 )
1123 return 125.0;
1124 }
1125 if( aPD == POLLUTION_DEGREE::PD3 && aMG == MATERIAL_GROUP::MG_II )
1126 {
1127 if( aVoltage <= 10 )
1128 return 1.000;
1129 if( aVoltage <= 12.5 )
1130 return 1.050;
1131 if( aVoltage <= 16 )
1132 return 1.100;
1133 if( aVoltage <= 20 )
1134 return 1.200;
1135 if( aVoltage <= 25 )
1136 return 1.250;
1137 if( aVoltage <= 32 )
1138 return 1.30;
1139 if( aVoltage <= 40 )
1140 return 1.60;
1141 if( aVoltage <= 50 )
1142 return 1.70;
1143 if( aVoltage <= 63 )
1144 return 1.80;
1145 if( aVoltage <= 80 )
1146 return 1.90;
1147 if( aVoltage <= 100 )
1148 return 2.00;
1149 if( aVoltage <= 125 )
1150 return 2.10;
1151 if( aVoltage <= 160 )
1152 return 2.20;
1153 if( aVoltage <= 200 )
1154 return 2.80;
1155 if( aVoltage <= 250 )
1156 return 3.60;
1157 if( aVoltage <= 320 )
1158 return 4.50;
1159 if( aVoltage <= 400 )
1160 return 5.6;
1161 if( aVoltage <= 500 )
1162 return 7.1;
1163 if( aVoltage <= 630 )
1164 return 9.0;
1165 if( aVoltage <= 800 )
1166 return 11.0;
1167 if( aVoltage <= 1000 )
1168 return 14.0;
1169 if( aVoltage <= 1250 )
1170 return 18.0;
1171 if( aVoltage <= 1600 )
1172 return 22.0;
1173 if( aVoltage <= 2000 )
1174 return 28.0;
1175 if( aVoltage <= 2500 )
1176 return 36.0;
1177 if( aVoltage <= 3200 )
1178 return 45.0;
1179 if( aVoltage <= 4000 )
1180 return 56.0;
1181 if( aVoltage <= 5000 )
1182 return 71.0;
1183 if( aVoltage <= 6300 )
1184 return 90.0;
1185 if( aVoltage <= 8000 )
1186 return 110.0;
1187 if( aVoltage <= 10000 )
1188 return 140.0;
1189 }
1190 if( aPD == POLLUTION_DEGREE::PD3
1191 && ( aMG == MATERIAL_GROUP::MG_IIIa || aMG == MATERIAL_GROUP::MG_IIIb ) )
1192 {
1193 if( aVoltage <= 10 )
1194 return 1.000;
1195 if( aVoltage <= 12.5 )
1196 return 1.050;
1197 if( aVoltage <= 16 )
1198 return 1.100;
1199 if( aVoltage <= 20 )
1200 return 1.200;
1201 if( aVoltage <= 25 )
1202 return 1.250;
1203 if( aVoltage <= 32 )
1204 return 1.30;
1205 if( aVoltage <= 40 )
1206 return 1.80;
1207 if( aVoltage <= 50 )
1208 return 1.90;
1209 if( aVoltage <= 63 )
1210 return 2.00;
1211 if( aVoltage <= 80 )
1212 return 2.10;
1213 if( aVoltage <= 100 )
1214 return 2.20;
1215 if( aVoltage <= 125 )
1216 return 2.40;
1217 if( aVoltage <= 160 )
1218 return 2.50;
1219 if( aVoltage <= 200 )
1220 return 3.20;
1221 if( aVoltage <= 250 )
1222 return 4.00;
1223 if( aVoltage <= 320 )
1224 return 5.00;
1225 if( aVoltage <= 400 )
1226 return 6.3;
1227 if( aVoltage <= 500 )
1228 return 8.0;
1229 if( aVoltage <= 630 )
1230 return 10.0;
1231 if( aVoltage <= 800 )
1232 return 12.5;
1233 if( aVoltage <= 1000 )
1234 return 16.0;
1235 if( aVoltage <= 1250 )
1236 return 20.0;
1237 if( aVoltage <= 1600 )
1238 return 25.0;
1239 if( aVoltage <= 2000 )
1240 return 32.0;
1241 if( aVoltage <= 2500 )
1242 return 40.0;
1243 if( aVoltage <= 3200 )
1244 return 50.0;
1245 if( aVoltage <= 4000 )
1246 return 63.0;
1247 if( aVoltage <= 5000 )
1248 return 80.0;
1249 if( aVoltage <= 6300 )
1250 return 100.0;
1251 if( aVoltage <= 8000 )
1252 return 125.0;
1253 if( aVoltage <= 10000 )
1254 return 160.0;
1255 }
1256
1257 return -1; // Pointed out of the table.
1258}
1259
1261 const double aAltitude )
1262{
1263 // Based on IEC60664-1 : 2020-05 chart G.1
1264
1265#if 0 // Not handled in IEC60664-1
1266 double frequency = 50;
1267 bool coatedOrPotted = false;
1268
1269 if( frequency > 30e3 )
1270 return -1; // Requires 60664-3
1271 if( coatedOrPotted )
1272 return -1; // Requires 60664-4
1273#endif
1274
1275 double clearance1 = GetClearanceToWithstandTransientVoltage(
1278 aPD, aField );
1279 double clearance2 = GetClearanceToWithstandPeaks(
1281 : m_peakVoltage,
1282 aField );
1283
1284 if( ( clearance1 == -1 ) || ( clearance2 == -1 ) )
1285 {
1286 clearance1 = -1;
1287 clearance2 = -1;
1288 }
1289
1290 double clearance = ( clearance1 > clearance2 ) ? clearance1 : clearance2;
1291 clearance *= GetClearanceAltitudeCorrectionFactor( aAltitude );
1292 return clearance;
1293}
1294
1296{
1297 // Based on IEC60664-1 : 2020-05 chart H.1
1298
1299#if 0 // Not handled in IEC60664-1
1300 double frequency = 50;
1301 bool coatedOrPotted = false;
1302
1303 if( frequency > 30e3 )
1304 return -1; // Requires 60664-3
1305
1306 if( coatedOrPotted )
1307 return -1; // Requires 60664-4
1308#endif
1309
1310 double creepage = GetBasicCreepageDistance( m_RMSvoltage, aPD, aMG );
1311
1313 {
1314 creepage *= 2;
1315 }
1316 return creepage;
1317}
1318
1319
1321{
1324
1325 if( m_creepage < m_clearance || m_clearance <= 0 )
1327
1329
1330 return true;
1331}
double GetRatedImpulseWithstandVoltage()
Definition: iec60664.cpp:595
double ComputeCreepageDistance(const POLLUTION_DEGREE aPD, const MATERIAL_GROUP aMG)
Definition: iec60664.cpp:1295
double GetClearanceAltitudeCorrectionFactor(const double aAltitude)
Definition: iec60664.cpp:43
POLLUTION_DEGREE
Definition: iec60664.h:35
POLLUTION_DEGREE m_pollutionDegree
Definition: iec60664.h:117
double GetClearanceToWithstandPeaks(const double aVoltage, const FIELD aField)
Definition: iec60664.cpp:447
double m_peakVoltage
Definition: iec60664.h:108
double GetMinGrooveWidth()
Definition: iec60664.h:95
double ComputeClearanceDistance(const POLLUTION_DEGREE aPD, const FIELD aField, const double aAltitude)
Definition: iec60664.cpp:1260
double m_clearance
Definition: iec60664.h:111
INSULATION_TYPE m_insulationType
Definition: iec60664.h:118
double m_RMSvoltage
Definition: iec60664.h:107
double m_creepage
Definition: iec60664.h:112
double m_altitude
Definition: iec60664.h:110
double GetBasicCreepageDistance(const double aVoltage, const POLLUTION_DEGREE aPD, const MATERIAL_GROUP aMG)
Definition: iec60664.cpp:704
double m_minGrooveWidth
Definition: iec60664.h:113
double m_ratedVoltage
Definition: iec60664.h:102
FIELD m_field
Definition: iec60664.h:114
bool Compute()
Definition: iec60664.cpp:1320
MATERIAL_GROUP GetMaterialGroupFromCTI(const double aCTI)
Definition: iec60664.cpp:690
MATERIAL_GROUP
Definition: iec60664.h:51
double GetClearanceToWithstandTransientVoltage(const double aVoltage, const POLLUTION_DEGREE aPD, const FIELD aField)
Definition: iec60664.cpp:290
double m_transientVoltage
Definition: iec60664.h:109
MATERIAL_GROUP m_materialGroup
Definition: iec60664.h:116
OV_CATEGORY m_overvoltageCat
Definition: iec60664.h:115
double GetClearanceForRMSVoltage(const double aVRMS, const FIELD aField=FIELD::INHOMOGENEOUS)
Definition: iec60664.cpp:72
bool m_pcbMaterial
Definition: iec60664.h:105