KiCad PCB EDA Suite
Loading...
Searching...
No Matches
iec60664.h
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 The 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#ifndef IEC_60664_H
23#define IEC_60664_H
24#include <stdexcept>
25#include <math.h>
26
28{
29public:
32
33
35 {
36 PD1 = 1,
40 };
41
42 enum class OV_CATEGORY
43 {
44 OV_I = 1,
48 };
49
58
65
66 enum class FIELD
67 {
70 };
71
72 enum class WAVEFORM
73 {
76 };
77
78
79 void SetAltitude( const double aAltitude ) { m_altitude = aAltitude; };
81 void SetPCBMaterial( const bool aPCB ) { m_pcbMaterial = aPCB; };
82 void SetMaterialGroup( const MATERIAL_GROUP aMG ) { m_materialGroup = aMG; };
83 void SetFrequency( const double aF ) { m_frequency = aF; };
84 void SetInsulationType( const INSULATION_TYPE aIns ) { m_insulationType = aIns; };
86 void SetField( const FIELD aField ) { m_field = aField; };
87 void SetRatedVoltage( const double aV ) { m_ratedVoltage = aV; };
88 void SetRMSVoltage( const double aV ) { m_RMSvoltage = aV; };
89 void SetPeakVoltage( const double aV ) { m_peakVoltage = aV; };
90 void SetTransientVoltage( const double aV ) { m_transientVoltage = aV; };
91
92
93 bool Compute();
94
95 double GetMinGrooveWidth() { return m_minGrooveWidth; };
96 double GetClearanceDistance() { return m_clearance; };
97 double GetCreepageDistance() { return m_creepage; };
98
100
101private:
102 double m_ratedVoltage = 100e3;
103 double m_frequency = 50;
104 bool m_coated = false;
105 bool m_pcbMaterial = false;
106
107 double m_RMSvoltage = 100e3;
108 double m_peakVoltage = 100e3;
109 double m_transientVoltage = 100e3;
110 double m_altitude = 100e3;
111 double m_clearance = -1;
112 double m_creepage = -1;
113 double m_minGrooveWidth = -1;
119
120
121 double GetMinGrooveWidth( const POLLUTION_DEGREE aPD, const double aDistIso = 100 );
122 double GetClearanceAltitudeCorrectionFactor( const double aAltitude );
123 double GetClearanceForRMSVoltage( const double aVRMS,
124 const FIELD aField = FIELD::INHOMOGENEOUS );
125 MATERIAL_GROUP GetMaterialGroupFromCTI( const double aCTI );
126 double GetClearanceToWithstandTransientVoltage( const double aVoltage,
127 const POLLUTION_DEGREE aPD,
128 const FIELD aField );
129 double GetClearanceToWithstandPeaks( const double aVoltage, const FIELD aField );
130 double GetBasicCreepageDistance( const double aVoltage, const POLLUTION_DEGREE aPD,
131 const MATERIAL_GROUP aMG );
132 double ComputeClearanceDistance( const POLLUTION_DEGREE aPD, const FIELD aField,
133 const double aAltitude );
134 double ComputeCreepageDistance( const POLLUTION_DEGREE aPD, const MATERIAL_GROUP aMG );
135};
136
137#endif
void SetPollutionDegree(const POLLUTION_DEGREE aPD)
Definition iec60664.h:80
double GetCreepageDistance()
Definition iec60664.h:97
double GetRatedImpulseWithstandVoltage()
Definition iec60664.cpp:595
double ComputeCreepageDistance(const POLLUTION_DEGREE aPD, const MATERIAL_GROUP aMG)
void SetRatedVoltage(const double aV)
Definition iec60664.h:87
void SetRMSVoltage(const double aV)
Definition iec60664.h:88
double GetClearanceAltitudeCorrectionFactor(const double aAltitude)
Definition iec60664.cpp:43
void SetPCBMaterial(const bool aPCB)
Definition iec60664.h:81
POLLUTION_DEGREE
Definition iec60664.h:35
void SetFrequency(const double aF)
Definition iec60664.h:83
IEC60664()
Definition iec60664.h:30
POLLUTION_DEGREE m_pollutionDegree
Definition iec60664.h:117
double GetClearanceToWithstandPeaks(const double aVoltage, const FIELD aField)
Definition iec60664.cpp:447
void SetTransientVoltage(const double aV)
Definition iec60664.h:90
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)
double m_clearance
Definition iec60664.h:111
INSULATION_TYPE m_insulationType
Definition iec60664.h:118
double m_RMSvoltage
Definition iec60664.h:107
void SetField(const FIELD aField)
Definition iec60664.h:86
double m_frequency
Definition iec60664.h:103
double m_creepage
Definition iec60664.h:112
void SetAltitude(const double aAltitude)
Definition iec60664.h:79
double m_altitude
Definition iec60664.h:110
double GetBasicCreepageDistance(const double aVoltage, const POLLUTION_DEGREE aPD, const MATERIAL_GROUP aMG)
Definition iec60664.cpp:704
bool m_coated
Definition iec60664.h:104
double m_minGrooveWidth
Definition iec60664.h:113
void SetPeakVoltage(const double aV)
Definition iec60664.h:89
~IEC60664()
Definition iec60664.h:31
INSULATION_TYPE
Definition iec60664.h:60
double m_ratedVoltage
Definition iec60664.h:102
FIELD m_field
Definition iec60664.h:114
bool Compute()
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
void SetMaterialGroup(const MATERIAL_GROUP aMG)
Definition iec60664.h:82
void SetInsulationType(const INSULATION_TYPE aIns)
Definition iec60664.h:84
void SetOvervoltageCategory(const OV_CATEGORY aOV)
Definition iec60664.h:85
double GetClearanceDistance()
Definition iec60664.h:96
double GetClearanceForRMSVoltage(const double aVRMS, const FIELD aField=FIELD::INHOMOGENEOUS)
Definition iec60664.cpp:72
bool m_pcbMaterial
Definition iec60664.h:105