-
Notifications
You must be signed in to change notification settings - Fork 215
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Hoping this is staying on my end for now so not describing in depth, if it goes through to a developer, hopefully i can edit it later. Sorry.
- Loading branch information
Showing
15 changed files
with
309 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
* wprobe.cpp - AC/DC and transient watt probe class implementation | ||
* | ||
* Copyright (C) 2015, Pedro Macedo | ||
* 2017, Alberto Silva, 1120196@isep.ipp.pt | ||
* | ||
* This file is part of Qucs | ||
* | ||
* Qucs 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, or (at your option) | ||
* any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Qucs. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
//Taking iprobe as basis | ||
|
||
#if HAVE_CONFIG_H | ||
# include <config.h> | ||
#endif | ||
|
||
#include "component.h" | ||
#include "wprobe.h" | ||
|
||
using namespace qucs; | ||
|
||
wprobe::wprobe () : circuit (4) { | ||
type = CIR_WPROBE; | ||
setProbe (true); | ||
setVSource (true); | ||
setVoltageSources (1); | ||
} | ||
|
||
// NODE 1 --> I+ | ||
// NODE 2 --> I- | ||
// NODE 3 --> V+ | ||
// NODE 4 --> V- | ||
|
||
void wprobe::initDC (void) { | ||
allocMatrixMNA (); | ||
voltageSource (VSRC_1, NODE_1, NODE_2); | ||
} | ||
|
||
void wprobe::initAC (void) { | ||
initDC (); | ||
} | ||
|
||
void wprobe::saveOperatingPoints (void) { | ||
nr_double_t Vr = real (getV (NODE_3) - getV (NODE_4)); | ||
nr_double_t Vi = imag (getV (NODE_3) - getV (NODE_4)); | ||
setOperatingPoint ("Vr", Vr); | ||
setOperatingPoint ("Vi", Vi); //This section works just like a voltmeter | ||
} | ||
|
||
void wprobe::calcOperatingPoints (void) { | ||
//Reading the current and voltage values to calculate potency values | ||
nr_double_t VAr = real (getV (NODE_3) * getJ (NODE_1)); | ||
nr_double_t VAi = -imag (getV (NODE_3) * getJ (NODE_1)); | ||
setOperatingPoint ("VAr", VAr); | ||
setOperatingPoint ("VAi", VAi); | ||
|
||
nr_double_t Wr = VAr; | ||
setOperatingPoint ("W", Wr); | ||
|
||
nr_double_t var = VAi; | ||
setOperatingPoint ("var", var); | ||
//necessary calculations for Potency Factor | ||
nr_double_t alpha = std::atan(VAi/VAr); | ||
nr_double_t S1 = VAr/std::cos(alpha); | ||
setOperatingPoint ("FP", VAr/S1); | ||
} | ||
|
||
void wprobe::initTR (void) { | ||
initDC (); | ||
} | ||
|
||
// properties | ||
PROP_REQ [] = { PROP_NO_PROP }; | ||
PROP_OPT [] = { PROP_NO_PROP }; | ||
struct define_t wprobe::cirdef = | ||
{ "WProbe", 4, PROP_COMPONENT, PROP_NO_SUBSTRATE, PROP_LINEAR, PROP_DEF }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* wprobe.h - AC/DC and transient watt probe class definitions | ||
* | ||
* Copyright (C) 2015, Pedro Macedo | ||
* 2017, Alberto Silva, 1120196@isep.ipp.pt | ||
* | ||
* This file is part of Qucs | ||
* | ||
* Qucs 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, or (at your option) | ||
* any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Qucs. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
//Taking vprobe as a basis | ||
|
||
#ifndef __WPROBE_H__ | ||
#define __WPROBE_H__ | ||
|
||
class wprobe : public qucs::circuit | ||
{ | ||
public: | ||
CREATOR (wprobe); | ||
void initDC (void); | ||
void initAC (void); | ||
void initTR (void); | ||
void saveOperatingPoints (void); | ||
void calcOperatingPoints (void); | ||
}; | ||
|
||
#endif /* __WPROBE_H__ */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
/* | ||
* wprobe.cpp - Construction of the Wattmeter Probe | ||
* | ||
* Copyright (C) 2015, Pedro Macedo | ||
* 2017, Alberto Silva, 1120196@isep.ipp.pt | ||
* | ||
* This file is part of Qucs | ||
* | ||
* Qucs 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, or (at your option) | ||
* any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Qucs. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
//Taking vprobe as a basis | ||
#include "wprobe.h" | ||
|
||
wProbe::wProbe() | ||
{ | ||
Description = QObject::tr("power probe"); | ||
|
||
//Large box | ||
Lines.append(new Line(-20,-33, 20,-33,QPen(Qt::darkGreen,2))); | ||
Lines.append(new Line(-20, 14, 20, 14,QPen(Qt::darkGreen,2))); | ||
Lines.append(new Line(-20,-33,-20, 14,QPen(Qt::darkGreen,2))); | ||
Lines.append(new Line( 20,-33, 20, 14,QPen(Qt::darkGreen,2))); | ||
|
||
//Small box | ||
Lines.append(new Line(-16,-28, 16,-28,QPen(Qt::darkYellow,2))); | ||
Lines.append(new Line(-16, -10, 16, -10,QPen(Qt::darkYellow,2))); | ||
Lines.append(new Line(-16,-28,-16, -10,QPen(Qt::darkYellow,2))); | ||
Lines.append(new Line( 16,-28, 16, -10,QPen(Qt::darkYellow,2))); | ||
|
||
//Letter W | ||
Lines.append(new Line(-9,-22, -2, -11,QPen(Qt::darkGreen,3))); | ||
Lines.append(new Line(0, -17, -2, -11,QPen(Qt::darkGreen,3))); | ||
Lines.append(new Line(0, -17, 2, -11,QPen(Qt::darkGreen,3))); | ||
Lines.append(new Line(9,-22, 2, -11,QPen(Qt::darkGreen,3))); | ||
|
||
//+ and - signs | ||
Lines.append(new Line(-12, 5,-12, 11,QPen(Qt::red,2))); | ||
Lines.append(new Line(-15, 8, -9, 8,QPen(Qt::red,2))); | ||
Lines.append(new Line( 9, 8, 15, 8,QPen(Qt::black,2))); | ||
|
||
//Current Entries | ||
Ports.append(new Port(-30, 0)); | ||
Ports.append(new Port( 30, 0)); | ||
|
||
//Voltage Entries | ||
Lines.append(new Line(-10, 14,-10, 20,QPen(Qt::darkBlue,2))); | ||
Lines.append(new Line( 10, 14, 10, 20,QPen(Qt::darkBlue,2))); | ||
Ports.append(new Port(-10, 20)); | ||
Ports.append(new Port( 10, 20)); | ||
|
||
//Letter V | ||
Lines.append(new Line(-3, 7 ,0, 13,QPen(Qt::darkGreen,2))); | ||
Lines.append(new Line( 0, 13, 3, 7,QPen(Qt::darkGreen,2))); | ||
|
||
//Letter A | ||
Lines.append(new Line( 11, -9, 15,0,QPen(Qt::darkGreen,2))); | ||
Lines.append(new Line( 7, 0, 11, -9,QPen(Qt::darkGreen,2))); | ||
Lines.append(new Line( 14, -3, 8, -3,QPen(Qt::darkGreen,2))); | ||
|
||
//Arrow | ||
Lines.append(new Line(-30, 0,-20, 0,QPen(Qt::darkBlue,1))); | ||
Lines.append(new Line( 30, 0, 20, 0,QPen(Qt::darkBlue,1))); | ||
Lines.append(new Line(-20, 0, 20, 0,QPen(Qt::darkBlue,2))); | ||
Lines.append(new Line( 4, 0, -4, -3,QPen(Qt::darkBlue,2))); | ||
Lines.append(new Line( 4, 0, -4, 4,QPen(Qt::darkBlue,2))); | ||
|
||
x1 = -24; y1 = -35; | ||
x2 = 24; y2 = 20; | ||
|
||
tx = x2+4; | ||
ty = y1+4; | ||
Model = "WProbe"; | ||
Name = "Pr"; | ||
} | ||
|
||
wProbe::~wProbe() | ||
{ | ||
} | ||
|
||
Component* wProbe::newOne() | ||
{ | ||
return new wProbe(); | ||
} | ||
|
||
Element* wProbe::info(QString& Name, char* &BitmapFile, bool getNewOne) | ||
{ | ||
Name = QObject::tr("Power Probe"); | ||
BitmapFile = (char *) "wprobe"; | ||
|
||
if(getNewOne) return new wProbe(); | ||
return 0; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* | ||
* wprobe.h - Header file for Wattmeter Probe | ||
* | ||
* Copyright (C) 2015, Pedro Macedo | ||
* 2017, Alberto Silva, 1120196@isep.ipp.pt | ||
* | ||
* This file is part of Qucs | ||
* | ||
* Qucs 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, or (at your option) | ||
* any later version. | ||
* | ||
* This software is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU General Public License | ||
* along with Qucs. If not, see <http://www.gnu.org/licenses/>. | ||
* | ||
*/ | ||
|
||
#ifndef WPROBE_H | ||
#define WPROBE_H | ||
|
||
#include "component.h" | ||
|
||
//Following vprobe as basis | ||
class wProbe : public Component { | ||
public: | ||
wProbe(); | ||
~wProbe(); | ||
Component* newOne(); | ||
static Element* info(QString&, char* &, bool getNewOne=false); | ||
}; | ||
|
||
#endif |
Oops, something went wrong.