[19ebe3]: / src / lib / simulator / src / electronics / components / dependentsource.cpp  Maximize  Restore  History

Download this file

152 lines (117 with data), 3.7 kB

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
/***************************************************************************
* Copyright (C) 2005 by David Saxton *
* david@bluehaze.org *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "dependentsource.h"
// #include "ecnode.h"
// #include "libraryitem.h"
// #include <klocale.h>
// #include <qpainter.h>
//Added by qt3to4:
//#include <Q3PointArray>
//BEGIN class DependentSource
DependentSource::DependentSource(Circuit& ownerCircuit)
: Component(ownerCircuit)
{
/*
createProperty("gain", Variant::Type::Double);
property("gain")->setCaption(i18n("Gain"));
property("gain")->setValue(1.0);
*/
Property *gain = new Property("gain", Variant::Type::Double);
gain->setCaption(tr("Gain"));
gain->setValue(1.0);
addProperty(gain);
}
DependentSource::~DependentSource() {
}
//END class DependentSource
//BEGIN class ECCCCS
ECCCCS::ECCCCS(Circuit& ownerCircuit)
: DependentSource(ownerCircuit),
m_cccs(1) {
}
ECCCCS::~ECCCCS() {}
/*
void ECCCCS::dataChanged() {
double gain = dataDouble("gain");
QString display = QString::number(gain / getMultiplier(gain), 'g', 3) + getNumberMag(gain) + QChar(' ');
setDisplayText("gain", display);
m_cccs.setGain(gain);
}
*/
void ECCCCS::propertyChanged(Property& theProperty, QVariant newValue, QVariant oldValue)
{
Q_UNUSED(oldValue);
Q_ASSERT(theProperty.name() == "gain");
m_cccs.setGain(newValue.asDouble());
}
//END class ECCCCS
//BEGIN class ECCCVS
ECCCVS::ECCCVS(Circuit& ownerCircuit)
: DependentSource(ownerCircuit),
m_ccvs(1) {
}
ECCCVS::~ECCCVS() {}
/*
void ECCCVS::dataChanged() {
double gain = dataDouble("gain");
QString display = QString::number(gain / getMultiplier(gain), 'g', 3) + getNumberMag(gain) + QChar(' ');
setDisplayText("gain", display);
m_ccvs.setGain(gain);
}
*/
void ECCCVS::propertyChanged(Property& theProperty, QVariant newValue, QVariant oldValue)
{
Q_UNUSED(oldValue);
Q_ASSERT(theProperty.name() == "gain");
m_ccvs.setGain( newValue.asDouble() );
}
//END class ECCCVS
//BEGIN class ECVCCS
ECVCCS::ECVCCS(Circuit &ownerCircuit)
: DependentSource(ownerCircuit),
m_vccs(1) {
}
ECVCCS::~ECVCCS() {}
/*
void ECVCCS::dataChanged() {
double gain = dataDouble("gain");
QString display = QString::number(gain / getMultiplier(gain), 'g', 3) + getNumberMag(gain) + QChar(' ');
setDisplayText("gain", display);
m_vccs.setGain(gain);
}
*/
void ECVCCS::propertyChanged(Property& theProperty, QVariant newValue, QVariant oldValue)
{
Q_UNUSED(oldValue);
Q_ASSERT( theProperty.name() == "gain");
m_vccs.setGain( newValue.asDouble() );
}
//END class ECVCCS
//BEGIN class ECVCVS
ECVCVS::ECVCVS(Circuit &ownerCircuit)
: DependentSource(ownerCircuit),
m_vcvs(1) {
}
ECVCVS::~ECVCVS() {}
/*
void ECVCVS::dataChanged() {
double gain = dataDouble("gain");
QString display = QString::number(gain / getMultiplier(gain), 'g', 3) + getNumberMag(gain) + QChar(' ');
setDisplayText("gain", display);
m_vcvs.setGain(gain);
}
*/
void ECVCVS::propertyChanged(Property& theProperty, QVariant newValue, QVariant oldValue)
{
Q_UNUSED(oldValue);
Q_ASSERT(theProperty.name() == "gain");
m_vcvs.setGain( newValue.asDouble() );
}
//END class ECVCVS