KiCad PCB EDA Suite
Loading...
Searching...
No Matches
sim_types.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) 2016 CERN
5 * Copyright The KiCad Developers, see AUTHORS.txt for contributors.
6 *
7 * @author Maciej Suminski <[email protected]>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 3
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <https://www.gnu.org/licenses/>.
21 */
22
23#ifndef SIM_TYPES_H
24#define SIM_TYPES_H
25
26#include <cmath>
27#include <limits>
28
46
49{
50 // Y axis
51 SPT_VOLTAGE = 0x0001,
52 SPT_CURRENT = 0x0002,
53 SPT_AC_PHASE = 0x0004,
54 SPT_AC_GAIN = 0x0008,
55 SPT_POWER = 0x0010,
56 SPT_SP_AMP = 0x0020,
57 SPT_SP_SMITH = 0x0040,
60
61 // X axis
62 SPT_TIME = 0x0100,
65 SPT_SWEEP = 0x0800,
67
68 SPT_UNKNOWN = 0x0000
69};
70
71
82inline double MagnitudeToDb( double aMagnitude )
83{
84 // Also catches a NaN magnitude, which has no dB value either
85 if( !( aMagnitude > 0.0 ) )
86 return std::numeric_limits<double>::quiet_NaN();
87
88 return 20.0 * std::log10( aMagnitude );
89}
90
91#endif /* SIM_TYPES_H */
SIM_TRACE_TYPE
Definition sim_types.h:49
@ SPT_TIME
Definition sim_types.h:62
@ SPT_LOG_FREQUENCY
Definition sim_types.h:64
@ SPT_AC_PHASE
Definition sim_types.h:53
@ SPT_SWEEP
Definition sim_types.h:65
@ SPT_UNKNOWN
Definition sim_types.h:68
@ SPT_AC_GAIN
Definition sim_types.h:54
@ SPT_Y_AXIS_MASK
Definition sim_types.h:59
@ SPT_SP_AMP
Definition sim_types.h:56
@ SPT_X_AXIS_MASK
Definition sim_types.h:66
@ SPT_VOLTAGE
Definition sim_types.h:51
@ SPT_POWER
Definition sim_types.h:55
@ SPT_CURRENT
Definition sim_types.h:52
@ SPT_SP_MASK
Definition sim_types.h:58
@ SPT_LIN_FREQUENCY
Definition sim_types.h:63
@ SPT_SP_SMITH
Definition sim_types.h:57
double MagnitudeToDb(double aMagnitude)
Convert a linear magnitude to decibels.
Definition sim_types.h:82
SIM_TYPE
< Possible simulation types
Definition sim_types.h:31
@ ST_SP
Definition sim_types.h:42
@ ST_LAST
Definition sim_types.h:44
@ ST_TRAN
Definition sim_types.h:41
@ ST_UNKNOWN
Definition sim_types.h:32
@ ST_NOISE
Definition sim_types.h:36
@ ST_AC
Definition sim_types.h:33
@ ST_DISTO
Definition sim_types.h:35
@ ST_TF
Definition sim_types.h:40
@ ST_SENS
Definition sim_types.h:39
@ ST_DC
Definition sim_types.h:34
@ ST_OP
Definition sim_types.h:37
@ ST_FFT
Definition sim_types.h:43
@ ST_PZ
Definition sim_types.h:38