-
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.
Added verilog-A ideal voltage controlled resistor.
- Loading branch information
Richard C Crozier
committed
Feb 13, 2014
1 parent
4b24c29
commit f5961b5
Showing
12 changed files
with
198 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
// Qucs resistive potentiometer model: | ||
// This model can be used to construct working lin, log and inverse log | ||
// potentiometers, or other devices with designer specified resistive taper functions. | ||
// All required parameters can be extracted directly from | ||
// manufacturers data sheets. | ||
// | ||
// The structure and theoretical background to the potentiometer | ||
// Verilog-a model are presented in the Qucs potentiometer report. | ||
// | ||
// This 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. | ||
// | ||
// Copyright (C), Richard Crozier, richard DOT crozier AT yahoo DOT co DOT uk, February 2013. | ||
// | ||
`include "disciplines.vams" | ||
`include "constants.vams" | ||
// | ||
module vcresistor (C1, C2, P1, P2); | ||
inout P1, P2; | ||
input C1, C2; | ||
electrical C1, C2, P1, P2; | ||
|
||
`define attr(txt) (*txt*) | ||
// | ||
parameter real gain = 1 from [1e-6 : inf] | ||
`attr(info="Gain" unit = "Ohm/Volt"); | ||
|
||
real resistance; | ||
|
||
analog begin | ||
|
||
// Macromodel | ||
// | ||
// resistance is the voltage across the input ports | ||
resistance = V(C1,C2) * gain; | ||
|
||
if (resistance>0.0) | ||
I(P1, P2) <+ V(P1, P2)/resistance ; | ||
else | ||
V(P1, P2) <+ 0.0 ; | ||
|
||
end | ||
|
||
endmodule |
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,90 @@ | ||
/*************************************************************************** | ||
vcresistor.cpp - description | ||
------------------- | ||
begin : Feb 13 2014 | ||
copyright : (C) 2014 by Richard Crozier | ||
email : richard dot crozier at yahoo dot co dot uk | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* 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 "vcresistor.h" | ||
|
||
|
||
vcresistor::vcresistor() | ||
{ | ||
Description = QObject::tr("voltage controlled voltage source"); | ||
|
||
// The resistor shape | ||
Lines.append(new Line(5, 18, 5, -18, QPen(Qt::darkBlue,2))); | ||
Lines.append(new Line(17, 18, 17, -18, QPen(Qt::darkBlue,2))); | ||
Lines.append(new Line(5, 18, 17, 18, QPen(Qt::darkBlue,2))); | ||
Lines.append(new Line(5, -18, 17, -18, QPen(Qt::darkBlue,2))); | ||
|
||
// horizontal lines on top and bottom of left hand side | ||
Lines.append(new Line(-30,-30,-12,-30,QPen(Qt::darkBlue,2))); | ||
Lines.append(new Line(-30, 30,-12, 30,QPen(Qt::darkBlue,2))); | ||
// horizontal lines on top and bottom of right hand side | ||
Lines.append(new Line( 11,-30, 30,-30,QPen(Qt::darkBlue,2))); | ||
Lines.append(new Line( 11, 30, 30, 30,QPen(Qt::darkBlue,2))); | ||
// vertical lines on top and bottom of left hand side | ||
Lines.append(new Line(-12,-30,-12,-23,QPen(Qt::darkBlue,2))); | ||
Lines.append(new Line(-12, 30,-12, 23,QPen(Qt::darkBlue,2))); | ||
// vertical lines on top and bottom of right hand side | ||
Lines.append(new Line( 11,-30, 11,-18,QPen(Qt::darkBlue,2))); | ||
Lines.append(new Line( 11, 30, 11, 18,QPen(Qt::darkBlue,2))); | ||
|
||
// downward pointing arrow | ||
Lines.append(new Line(-12,-18,-12, 18,QPen(Qt::darkBlue,1))); | ||
Lines.append(new Line(-12, 18,-17, 9,QPen(Qt::darkBlue,1))); | ||
Lines.append(new Line(-12, 18, -7, 9,QPen(Qt::darkBlue,1))); | ||
|
||
Lines.append(new Line(-25,-27, 25,-27,QPen(Qt::darkGray,1))); | ||
Lines.append(new Line( 25,-27, 25, 27,QPen(Qt::darkGray,1))); | ||
Lines.append(new Line( 25, 27,-25, 27,QPen(Qt::darkGray,1))); | ||
Lines.append(new Line(-25, 27,-25,-27,QPen(Qt::darkGray,1))); | ||
|
||
|
||
Ports.append(new Port(-30,-30)); | ||
Ports.append(new Port(-30, 30)); | ||
Ports.append(new Port( 30,-30)); | ||
Ports.append(new Port( 30, 30)); | ||
|
||
|
||
x1 = -30; y1 = -30; | ||
x2 = 30; y2 = 30; | ||
|
||
tx = x1+4; | ||
ty = y2+4; | ||
Model = "vcresistor"; | ||
Name = "VCR"; | ||
|
||
Props.append(new Property("gain", "1", true, | ||
QObject::tr("resistance gain"))); | ||
} | ||
|
||
vcresistor::~vcresistor() | ||
{ | ||
} | ||
|
||
Component* vcresistor::newOne() | ||
{ | ||
return new vcresistor(); | ||
} | ||
|
||
Element* vcresistor::info(QString& Name, char* &BitmapFile, bool getNewOne) | ||
{ | ||
Name = QObject::tr("Voltage Controlled Resistor"); | ||
BitmapFile = (char *) "vcresistor"; | ||
|
||
if(getNewOne) return new vcresistor(); | ||
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,32 @@ | ||
/*************************************************************************** | ||
vcresistor.h - description | ||
------------------- | ||
begin : Feb 13 2014 | ||
copyright : (C) 2014 Richard Crozier | ||
email : richard dot crozier at yahoo.co.uk | ||
***************************************************************************/ | ||
|
||
/*************************************************************************** | ||
* * | ||
* 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. * | ||
* * | ||
***************************************************************************/ | ||
|
||
#ifndef VCRESISTOR_H | ||
#define VCRESISTOR_H | ||
|
||
#include "component.h" | ||
|
||
|
||
class vcresistor : public Component { | ||
public: | ||
vcresistor(); | ||
~vcresistor(); | ||
Component* newOne(); | ||
static Element* info(QString&, char* &, bool getNewOne=false); | ||
}; | ||
|
||
#endif |
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