KiCad PCB EDA Suite
Loading...
Searching...
No Matches
eseries.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 (C) 2020 <
[email protected]
>
5
* Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6
*
7
* This program is free software: you can redistribute it and/or modify it
8
* under the terms of the GNU General Public License as published by the
9
* Free Software Foundation, either version 3 of the License, or (at your
10
* option) any later version.
11
*
12
* This program is distributed in the hope that it will be useful, but
13
* WITHOUT ANY WARRANTY; without even the implied warranty of
14
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15
* General Public License for more details.
16
*
17
* You should have received a copy of the GNU General Public License along
18
* with this program. If not, see <http://www.gnu.org/licenses/>.
19
*/
20
21
#pragma once
22
23
#include <array>
24
#include <vector>
25
#include <string>
26
#include <cstdint>
27
38
39
// The resistor calculator cannot operate on series larger than E24 due to calculation time
40
41
// Values are stored in the 100-999 decade. This is so that all values are integers
42
// and can be stored precisely. If the values are real values with a fraction part then
43
// the fractional part is typically imprecisely stores. In the 100 decade the values
44
// can be stored as precise values in integers. If used in floating point types
45
// they are as precise as before
46
47
// If you want the values in the first decade then simply divide every value in
48
// the list by the first value in the list.
49
50
// E96 is a proper subset of E192. It is every 2nd value. E48 is every 4th value of E192.
51
// That is, all the series with 3 significant figures are subsets of the same series, E192.
52
53
// E24 is not a subset of E48 or E192. All series below E48 have only 2 significant figures
54
// and are differently from the series with 3 significant figures.
55
56
// E12, E6 and E3 are proper subsets of E24. Specifically they are evenly spaced
57
// values selected from E24. E12 is every 2nd value, E6 every 4th, E3 every 8th.
58
59
// E1 is not in the IEC standard.
60
61
// The value 0 is not present in any series. It does not fit in any decade.
62
// It must be special cased in any calcuation or method of selection of
63
// values.
64
65
namespace
ESERIES
66
{
67
68
enum
69
{
70
E1
,
71
E3
,
72
E6
,
73
E12
,
74
E24
,
75
E48
,
76
E96
,
77
E192
78
};
79
80
/* \brief Creates a vector of integers of E series values
81
*
82
*/
83
class
ESERIES_VALUES
:
public
std::vector<uint16_t>
84
{
85
public
:
86
ESERIES_VALUES
(
int
aESeries );
87
88
private
:
89
static
const
std::vector<uint16_t>
s_e24table
;
90
static
const
std::vector<uint16_t>
s_e192table
;
91
};
92
96
class
E1_VALUES
:
public
ESERIES_VALUES
97
{
98
public
:
99
E1_VALUES
() :
ESERIES_VALUES
(
E1
) {}
100
};
101
105
class
E3_VALUES
:
public
ESERIES_VALUES
106
{
107
public
:
108
E3_VALUES
() :
ESERIES_VALUES
(
E3
) {}
109
};
110
114
class
E6_VALUES
:
public
ESERIES_VALUES
115
{
116
public
:
117
E6_VALUES
() :
ESERIES_VALUES
(
E6
) {}
118
};
119
123
class
E12_VALUES
:
public
ESERIES_VALUES
124
{
125
public
:
126
E12_VALUES
() :
ESERIES_VALUES
(
E12
) {}
127
};
128
132
class
E24_VALUES
:
public
ESERIES_VALUES
133
{
134
public
:
135
E24_VALUES
() :
ESERIES_VALUES
(
E24
) {}
136
};
137
141
class
E48_VALUES
:
public
ESERIES_VALUES
142
{
143
public
:
144
E48_VALUES
() :
ESERIES_VALUES
(
E48
) {}
145
};
146
150
class
E96_VALUES
:
public
ESERIES_VALUES
151
{
152
public
:
153
E96_VALUES
() :
ESERIES_VALUES
(
E96
) {}
154
};
155
159
class
E192_VALUES
:
public
ESERIES_VALUES
160
{
161
public
:
162
E192_VALUES
() :
ESERIES_VALUES
(
E192
) {}
163
};
164
172
class
ESERIES_IN_DECADE
:
public
std::vector<double>
173
{
174
public
:
175
ESERIES_IN_DECADE
(
int
eSeries,
int
decadeExponent );
176
};
177
}
// namespace ESERIES
ESERIES::E12_VALUES::E12_VALUES
E12_VALUES()
Definition
eseries.h:126
ESERIES::E192_VALUES::E192_VALUES
E192_VALUES()
Definition
eseries.h:162
ESERIES::E1_VALUES::E1_VALUES
E1_VALUES()
Definition
eseries.h:99
ESERIES::E24_VALUES::E24_VALUES
E24_VALUES()
Definition
eseries.h:135
ESERIES::E3_VALUES::E3_VALUES
E3_VALUES()
Definition
eseries.h:108
ESERIES::E48_VALUES::E48_VALUES
E48_VALUES()
Definition
eseries.h:144
ESERIES::E6_VALUES::E6_VALUES
E6_VALUES()
Definition
eseries.h:117
ESERIES::E96_VALUES::E96_VALUES
E96_VALUES()
Definition
eseries.h:153
ESERIES::ESERIES_IN_DECADE::ESERIES_IN_DECADE
ESERIES_IN_DECADE(int eSeries, int decadeExponent)
Definition
eseries.cpp:84
ESERIES::ESERIES_VALUES::s_e192table
static const std::vector< uint16_t > s_e192table
Definition
eseries.h:90
ESERIES::ESERIES_VALUES::s_e24table
static const std::vector< uint16_t > s_e24table
Definition
eseries.h:89
ESERIES::ESERIES_VALUES::ESERIES_VALUES
ESERIES_VALUES(int aESeries)
Definition
eseries.cpp:47
ESERIES
E-Values derived from a geometric sequence formula by Charles Renard were already accepted and widely...
Definition
eseries.cpp:25
ESERIES::E3
@ E3
Definition
eseries.h:71
ESERIES::E24
@ E24
Definition
eseries.h:74
ESERIES::E192
@ E192
Definition
eseries.h:77
ESERIES::E12
@ E12
Definition
eseries.h:73
ESERIES::E6
@ E6
Definition
eseries.h:72
ESERIES::E96
@ E96
Definition
eseries.h:76
ESERIES::E1
@ E1
Definition
eseries.h:70
ESERIES::E48
@ E48
Definition
eseries.h:75
src
pcb_calculator
eseries.h
Generated on Sun Sep 21 2025 01:05:27 for KiCad PCB EDA Suite by
1.13.2