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 (C) 2020-2022 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
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
65namespace ESERIES
66{
67
68enum
69{
77 E192
78};
79
80/* \brief Creates a vector of integers of E series values
81 *
82 */
83class ESERIES_VALUES : public std::vector<uint16_t>
84{
85public:
86 ESERIES_VALUES( int aESeries );
87
88private:
89 static const std::vector<uint16_t> s_e24table;
90 static const std::vector<uint16_t> s_e192table;
91};
92
97{
98public:
100};
101
106{
107public:
109};
110
115{
116public:
118};
119
124{
125public:
127};
128
133{
134public:
136};
137
142{
143public:
145};
146
151{
152public:
154};
155
160{
161public:
163};
164
172class ESERIES_IN_DECADE : public std::vector<double>
173{
174public:
175 ESERIES_IN_DECADE( int eSeries, int decadeExponent );
176};
177} // namespace ESERIES
Creates a vector of integers of the E12 series values.
Definition: eseries.h:124
Creates a vector of integers of the E192 series values.
Definition: eseries.h:160
Creates a vector of integers of the E1 series values.
Definition: eseries.h:97
Creates a vector of integers of the E24 series values.
Definition: eseries.h:133
Creates a vector of integers of the E3 series values.
Definition: eseries.h:106
Creates a vector of integers of the E48 series values.
Definition: eseries.h:142
Creates a vector of integers of the E6 series values.
Definition: eseries.h:115
Creates a vector of integers of the E96 series values.
Definition: eseries.h:151
Creates a vector of doubles of the values in the requested eseries and decade.
Definition: eseries.h:173
static const std::vector< uint16_t > s_e192table
Definition: eseries.h:90
static const std::vector< uint16_t > s_e24table
Definition: eseries.h:89
E-Values derived from a geometric sequence formula by Charles Renard were already accepted and widely...
Definition: eseries.cpp:25
@ E3
Definition: eseries.h:71
@ E24
Definition: eseries.h:74
@ E192
Definition: eseries.h:77
@ E12
Definition: eseries.h:73
@ E6
Definition: eseries.h:72
@ E96
Definition: eseries.h:76
@ E1
Definition: eseries.h:70
@ E48
Definition: eseries.h:75