Qucs-core
0.0.18
Main Page
Related Pages
Modules
Namespaces
Data Structures
Files
File List
Globals
All
Data Structures
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Groups
Pages
qucs-core
src
components
dcblock.cpp
Go to the documentation of this file.
1
/*
2
* dcblock.cpp - DC block class implementation
3
*
4
* Copyright (C) 2003, 2004, 2005, 2008 Stefan Jahn <stefan@lkcc.org>
5
*
6
* This is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2, or (at your option)
9
* any later version.
10
*
11
* This software 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
17
* along with this package; see the file COPYING. If not, write to
18
* the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
19
* Boston, MA 02110-1301, USA.
20
*
21
* $Id$
22
*
23
*/
24
25
#if HAVE_CONFIG_H
26
# include <config.h>
27
#endif
28
29
#include "
component.h
"
30
#include "
dcblock.h
"
31
32
using namespace
qucs
;
33
34
dcblock::dcblock () : circuit (2) {
35
type
=
CIR_DCBLOCK
;
36
}
37
38
void
dcblock::initSP
(
void
) {
39
allocMatrixS ();
40
setS (
NODE_1
,
NODE_1
, 0.0);
41
setS (
NODE_2
,
NODE_2
, 0.0);
42
setS (
NODE_1
,
NODE_2
, 1.0);
43
setS (
NODE_2
,
NODE_1
, 1.0);
44
}
45
46
void
dcblock::initDC
(
void
) {
47
setISource (
false
);
48
setVoltageSources (0);
49
allocMatrixMNA ();
50
}
51
52
void
dcblock::initAC
(
void
) {
53
setISource (
false
);
54
setVoltageSources (1);
55
allocMatrixMNA ();
56
voltageSource (
VSRC_1
,
NODE_1
,
NODE_2
);
57
}
58
59
#define qState 0 // charge state
60
#define cState 1 // current state
61
62
void
dcblock::initTR
(
void
) {
63
setStates (2);
64
initDC ();
65
setISource (
true
);
66
}
67
68
void
dcblock::calcTR
(nr_double_t) {
69
nr_double_t
c
= getPropertyDouble (
"C"
);
70
nr_double_t g,
i
;
71
nr_double_t
v
=
real
(getV (
NODE_1
) - getV (
NODE_2
));
72
73
setState (
qState
, c * v);
74
integrate
(
qState
, c, g, i);
75
setY (
NODE_1
,
NODE_1
, +g); setY (
NODE_2
,
NODE_2
, +g);
76
setY (
NODE_1
,
NODE_2
, -g); setY (
NODE_2
,
NODE_1
, -g);
77
setI (
NODE_1
, -i);
78
setI (
NODE_2
, +i);
79
}
80
81
// properties
82
PROP_REQ
[] = {
83
PROP_NO_PROP
};
84
PROP_OPT
[] = {
85
{
"C"
,
PROP_REAL
, { 1e-6,
PROP_NO_STR
},
PROP_POS_RANGE
},
86
PROP_NO_PROP
};
87
struct
define_t
dcblock
::cirdef =
88
{
"DCBlock"
, 2,
PROP_COMPONENT
,
PROP_NO_SUBSTRATE
,
PROP_LINEAR
,
PROP_DEF
};
PROP_POS_RANGE
#define PROP_POS_RANGE
Definition:
netdefs.h:129
NODE_2
#define NODE_2
Definition:
circuit.h:35
qucs::real
matrix real(matrix a)
Real part matrix.
Definition:
matrix.cpp:568
qState
#define qState
Definition:
dcblock.cpp:59
PROP_DEF
#define PROP_DEF
Definition:
netdefs.h:189
qucs::PROP_OPT
PROP_OPT[]
Definition:
acsolver.cpp:232
PROP_REAL
#define PROP_REAL
Definition:
netdefs.h:174
PROP_NO_PROP
#define PROP_NO_PROP
Definition:
netdefs.h:122
c
c
Definition:
parse_netlist.y:394
PROP_NO_STR
#define PROP_NO_STR
Definition:
netdefs.h:125
dcblock::calcTR
void calcTR(nr_double_t)
Definition:
dcblock.cpp:68
PROP_LINEAR
#define PROP_LINEAR
Definition:
netdefs.h:120
dcblock::initDC
void initDC(void)
Definition:
dcblock.cpp:46
dcblock::initTR
void initTR(void)
Definition:
dcblock.cpp:62
dcblock::initAC
void initAC(void)
Definition:
dcblock.cpp:52
VSRC_1
#define VSRC_1
Definition:
circuit.h:40
i
i
Definition:
parse_mdl.y:516
dcblock::PROP_NO_SUBSTRATE
PROP_NO_SUBSTRATE
Definition:
dcblock.cpp:88
PROP_COMPONENT
#define PROP_COMPONENT
Definition:
netdefs.h:116
dcblock.h
qucs
Definition:
applications.h:30
qucs::integrate
nr_complex_t integrate(vector v, const nr_complex_t)
Definition:
vector.cpp:1207
type
type
Definition:
parse_vcd.y:164
v
v
Definition:
parse_zvr.y:141
dcblock
Definition:
dcblock.cpp:87
NODE_1
#define NODE_1
Definition:
circuit.h:34
qucs::CIR_DCBLOCK
Definition:
component_id.h:53
component.h
qucs::PROP_REQ
PROP_REQ[]
Definition:
acsolver.cpp:229
dcblock::initSP
void initSP(void)
placehoder for S-Parameter initialisation function
Definition:
dcblock.cpp:38
define_t
Definition:
netdefs.h:102
Generated on Mon Sep 1 2014 20:08:25 for Qucs-core by
1.8.6