summaryrefslogtreecommitdiff
path: root/js/Electrical
diff options
context:
space:
mode:
authorSunil Shetye2018-08-29 10:48:12 +0530
committerSunil Shetye2018-08-29 18:03:04 +0530
commit352623792d2b9400510599c487540b1e763a7d3c (patch)
tree7711522f3fcd42a9d5f22b9fa3328763452a6918 /js/Electrical
parent17a1beeeae647a6fbd0904a5d794ce7754df7eb2 (diff)
downloadsci2js-352623792d2b9400510599c487540b1e763a7d3c.tar.gz
sci2js-352623792d2b9400510599c487540b1e763a7d3c.tar.bz2
sci2js-352623792d2b9400510599c487540b1e763a7d3c.zip
add the common code to get method also
type is a function get the popup title from the value set in the get method
Diffstat (limited to 'js/Electrical')
-rw-r--r--js/Electrical/CCS.js3
-rw-r--r--js/Electrical/CVS.js3
-rw-r--r--js/Electrical/Capacitor.js5
-rw-r--r--js/Electrical/ConstantVoltage.js5
-rw-r--r--js/Electrical/CurrentSensor.js3
-rw-r--r--js/Electrical/Diode.js5
-rw-r--r--js/Electrical/Ground.js3
-rw-r--r--js/Electrical/Gyrator.js6
-rw-r--r--js/Electrical/IdealTransformer.js6
-rw-r--r--js/Electrical/Inductor.js5
-rw-r--r--js/Electrical/MOTOR.js3
-rw-r--r--js/Electrical/NMOS.js5
-rw-r--r--js/Electrical/NPN.js6
-rw-r--r--js/Electrical/OpAmp.js5
-rw-r--r--js/Electrical/PMOS.js5
-rw-r--r--js/Electrical/PNP.js6
-rw-r--r--js/Electrical/PotentialSensor.js3
-rw-r--r--js/Electrical/Resistor.js5
-rw-r--r--js/Electrical/SineVoltage.js5
-rw-r--r--js/Electrical/Switch.js5
-rw-r--r--js/Electrical/VVsourceAC.js5
-rw-r--r--js/Electrical/VariableResistor.js3
-rw-r--r--js/Electrical/VoltageSensor.js3
-rw-r--r--js/Electrical/VsourceAC.js5
24 files changed, 60 insertions, 48 deletions
diff --git a/js/Electrical/CCS.js b/js/Electrical/CCS.js
index 19deb542..9afa75ad 100644
--- a/js/Electrical/CCS.js
+++ b/js/Electrical/CCS.js
@@ -60,7 +60,6 @@ function CCS() {
return new BasicBlock(this.x);
}
CCS.prototype.get_popup_title = function CCS() {
- var set_param_popup_title = "Set parameters";
- return set_param_popup_title;
+ return;
}
}
diff --git a/js/Electrical/CVS.js b/js/Electrical/CVS.js
index 6e1767c3..4ac0360b 100644
--- a/js/Electrical/CVS.js
+++ b/js/Electrical/CVS.js
@@ -60,7 +60,6 @@ function CVS() {
return new BasicBlock(this.x);
}
CVS.prototype.get_popup_title = function CVS() {
- var set_param_popup_title = "Set parameters";
- return set_param_popup_title;
+ return;
}
}
diff --git a/js/Electrical/Capacitor.js b/js/Electrical/Capacitor.js
index e80cf10d..50e5ac3e 100644
--- a/js/Electrical/Capacitor.js
+++ b/js/Electrical/Capacitor.js
@@ -27,6 +27,8 @@ function Capacitor() {
return this.x;
}
Capacitor.prototype.get = function Capacitor() {
+ var exprs = this.graphics.exprs;
+ this.set_param_popup_title = "Set Capacitor block parameter";
var options = {
C:["C (F)",this.C],
v:["Initial Voltage",this.v],
@@ -53,7 +55,6 @@ function Capacitor() {
return new BasicBlock(this.x);
}
Capacitor.prototype.get_popup_title = function Capacitor() {
- var set_param_popup_title = "Set Capacitor block parameter";
- return set_param_popup_title;
+ return this.set_param_popup_title;
}
}
diff --git a/js/Electrical/ConstantVoltage.js b/js/Electrical/ConstantVoltage.js
index f9dd58a2..d1a1efb9 100644
--- a/js/Electrical/ConstantVoltage.js
+++ b/js/Electrical/ConstantVoltage.js
@@ -26,6 +26,8 @@ function ConstantVoltage() {
return this.x;
}
ConstantVoltage.prototype.get = function ConstantVoltage() {
+ var exprs = this.graphics.exprs;
+ this.set_param_popup_title = "Set ConstantVoltage block parameter";
var options = {
V:["V (volt)",this.V],
}
@@ -50,7 +52,6 @@ function ConstantVoltage() {
return new BasicBlock(this.x);
}
ConstantVoltage.prototype.get_popup_title = function ConstantVoltage() {
- var set_param_popup_title = "Set ConstantVoltage block parameter";
- return set_param_popup_title;
+ return this.set_param_popup_title;
}
}
diff --git a/js/Electrical/CurrentSensor.js b/js/Electrical/CurrentSensor.js
index 1f63e923..3e80c859 100644
--- a/js/Electrical/CurrentSensor.js
+++ b/js/Electrical/CurrentSensor.js
@@ -29,7 +29,6 @@ function CurrentSensor() {
return new BasicBlock(this.x);
}
CurrentSensor.prototype.get_popup_title = function CurrentSensor() {
- var set_param_popup_title = "Set parameters";
- return set_param_popup_title;
+ return;
}
}
diff --git a/js/Electrical/Diode.js b/js/Electrical/Diode.js
index a0182582..b50e5e1c 100644
--- a/js/Electrical/Diode.js
+++ b/js/Electrical/Diode.js
@@ -29,6 +29,8 @@ function Diode() {
return this.x;
}
Diode.prototype.get = function Diode() {
+ var exprs = this.graphics.exprs;
+ this.set_param_popup_title = "Set Diode block parameter";
var options = {
Ids:["Saturation cuurent (A)",this.Ids],
Vt:["Voltage equivalent to temperature (Volt)",this.Vt],
@@ -59,7 +61,6 @@ function Diode() {
return new BasicBlock(this.x);
}
Diode.prototype.get_popup_title = function Diode() {
- var set_param_popup_title = "Set Diode block parameter";
- return set_param_popup_title;
+ return this.set_param_popup_title;
}
}
diff --git a/js/Electrical/Ground.js b/js/Electrical/Ground.js
index 6422b54e..da4710ca 100644
--- a/js/Electrical/Ground.js
+++ b/js/Electrical/Ground.js
@@ -28,7 +28,6 @@ function Ground() {
return new GroundBlock(this.x);
}
Ground.prototype.get_popup_title = function Ground() {
- var set_param_popup_title = "Set parameters";
- return set_param_popup_title;
+ return;
}
}
diff --git a/js/Electrical/Gyrator.js b/js/Electrical/Gyrator.js
index 6c97cfce..71c2b2af 100644
--- a/js/Electrical/Gyrator.js
+++ b/js/Electrical/Gyrator.js
@@ -53,6 +53,9 @@ function Gyrator() {
return this.x;
}
Gyrator.prototype.get = function Gyrator() {
+ var exprs = this.graphics.exprs;
+ var exprs = this.x.graphics.exprs;
+ this.set_param_popup_title = "Set Gyrator block parameters:";
var options = {
G1:["G1",this.G1],
G2:["G2",this.G2],
@@ -77,7 +80,6 @@ function Gyrator() {
return new BasicBlock(this.x);
}
Gyrator.prototype.get_popup_title = function Gyrator() {
- var set_param_popup_title = "Set Gyrator block parameters:";
- return set_param_popup_title;
+ return this.set_param_popup_title;
}
}
diff --git a/js/Electrical/IdealTransformer.js b/js/Electrical/IdealTransformer.js
index d7a4c0f6..69d389e8 100644
--- a/js/Electrical/IdealTransformer.js
+++ b/js/Electrical/IdealTransformer.js
@@ -53,6 +53,9 @@ function IdealTransformer() {
return this.x;
}
IdealTransformer.prototype.get = function IdealTransformer() {
+ var exprs = this.graphics.exprs;
+ var exprs = this.x.graphics.exprs;
+ this.set_param_popup_title = "Set Transformer block parameters:";
var options = {
N:["N",this.N],
}
@@ -75,7 +78,6 @@ function IdealTransformer() {
return new BasicBlock(this.x);
}
IdealTransformer.prototype.get_popup_title = function IdealTransformer() {
- var set_param_popup_title = "Set Transformer block parameters:";
- return set_param_popup_title;
+ return this.set_param_popup_title;
}
}
diff --git a/js/Electrical/Inductor.js b/js/Electrical/Inductor.js
index 02e62b40..1ae39c6e 100644
--- a/js/Electrical/Inductor.js
+++ b/js/Electrical/Inductor.js
@@ -26,6 +26,8 @@ function Inductor() {
return this.x;
}
Inductor.prototype.get = function Inductor() {
+ var exprs = this.graphics.exprs;
+ this.set_param_popup_title = "Set Inductor block parameter";
var options = {
L:["L (H)",this.L],
}
@@ -50,7 +52,6 @@ function Inductor() {
return new BasicBlock(this.x);
}
Inductor.prototype.get_popup_title = function Inductor() {
- var set_param_popup_title = "Set Inductor block parameter";
- return set_param_popup_title;
+ return this.set_param_popup_title;
}
}
diff --git a/js/Electrical/MOTOR.js b/js/Electrical/MOTOR.js
index 85fea4fa..7c834816 100644
--- a/js/Electrical/MOTOR.js
+++ b/js/Electrical/MOTOR.js
@@ -24,7 +24,6 @@ function MOTOR() {
return new BasicBlock(this.x);
}
MOTOR.prototype.get_popup_title = function MOTOR() {
- var set_param_popup_title = "Set parameters";
- return set_param_popup_title;
+ return;
}
}
diff --git a/js/Electrical/NMOS.js b/js/Electrical/NMOS.js
index a2cda843..79570aba 100644
--- a/js/Electrical/NMOS.js
+++ b/js/Electrical/NMOS.js
@@ -33,6 +33,8 @@ function NMOS() {
return this.x;
}
NMOS.prototype.get = function NMOS() {
+ var exprs = this.graphics.exprs;
+ this.set_param_popup_title = "Set NMOS Transistor block parameters";
var options = {
W:["Width [m]",this.W],
L:["Length [m]",this.L],
@@ -72,7 +74,6 @@ function NMOS() {
return new BasicBlock(this.x);
}
NMOS.prototype.get_popup_title = function NMOS() {
- var set_param_popup_title = "Set NMOS Transistor block parameters";
- return set_param_popup_title;
+ return this.set_param_popup_title;
}
}
diff --git a/js/Electrical/NPN.js b/js/Electrical/NPN.js
index 36e33963..5d38e053 100644
--- a/js/Electrical/NPN.js
+++ b/js/Electrical/NPN.js
@@ -53,6 +53,9 @@ function NPN() {
return this.x;
}
NPN.prototype.get = function NPN() {
+ var exprs = this.graphics.exprs;
+ var exprs = this.x.graphics.exprs;
+ this.set_param_popup_title = "Set NPN block parameters:";
var options = {
Bf:["Bf : Forward beta",this.Bf],
Br:["Br : Reverse beta",this.Br],
@@ -107,7 +110,6 @@ function NPN() {
return new BasicBlock(this.x);
}
NPN.prototype.get_popup_title = function NPN() {
- var set_param_popup_title = "Set NPN block parameters:";
- return set_param_popup_title;
+ return this.set_param_popup_title;
}
}
diff --git a/js/Electrical/OpAmp.js b/js/Electrical/OpAmp.js
index dee90c80..266c2f7e 100644
--- a/js/Electrical/OpAmp.js
+++ b/js/Electrical/OpAmp.js
@@ -27,6 +27,8 @@ function OpAmp() {
return this.x;
}
OpAmp.prototype.get = function OpAmp() {
+ var exprs = this.graphics.exprs;
+ this.set_param_popup_title = "Set the Operational Amplifier parameters";
var options = {
OLGain:["Open Loop Gain",this.OLGain],
SatH:["Positive saturation voltage",this.SatH],
@@ -54,7 +56,6 @@ function OpAmp() {
return new BasicBlock(this.x);
}
OpAmp.prototype.get_popup_title = function OpAmp() {
- var set_param_popup_title = "Set the Operational Amplifier parameters";
- return set_param_popup_title;
+ return this.set_param_popup_title;
}
}
diff --git a/js/Electrical/PMOS.js b/js/Electrical/PMOS.js
index ac8c4a1a..11a1d8a0 100644
--- a/js/Electrical/PMOS.js
+++ b/js/Electrical/PMOS.js
@@ -33,6 +33,8 @@ function PMOS() {
return this.x;
}
PMOS.prototype.get = function PMOS() {
+ var exprs = this.graphics.exprs;
+ this.set_param_popup_title = "Set PMOS Transistor parameters";
var options = {
W:["Width [m]",this.W],
L:["Length [m]",this.L],
@@ -72,7 +74,6 @@ function PMOS() {
return new BasicBlock(this.x);
}
PMOS.prototype.get_popup_title = function PMOS() {
- var set_param_popup_title = "Set PMOS Transistor parameters";
- return set_param_popup_title;
+ return this.set_param_popup_title;
}
}
diff --git a/js/Electrical/PNP.js b/js/Electrical/PNP.js
index 7c6fe0ed..6d660004 100644
--- a/js/Electrical/PNP.js
+++ b/js/Electrical/PNP.js
@@ -53,6 +53,9 @@ function PNP() {
return this.x;
}
PNP.prototype.get = function PNP() {
+ var exprs = this.graphics.exprs;
+ var exprs = this.x.graphics.exprs;
+ this.set_param_popup_title = "Set PNP block parameters:";
var options = {
Bf:["Bf : Forward beta",this.Bf],
Br:["Br : Reverse beta",this.Br],
@@ -107,7 +110,6 @@ function PNP() {
return new BasicBlock(this.x);
}
PNP.prototype.get_popup_title = function PNP() {
- var set_param_popup_title = "Set PNP block parameters:";
- return set_param_popup_title;
+ return this.set_param_popup_title;
}
}
diff --git a/js/Electrical/PotentialSensor.js b/js/Electrical/PotentialSensor.js
index e291c457..8967885a 100644
--- a/js/Electrical/PotentialSensor.js
+++ b/js/Electrical/PotentialSensor.js
@@ -29,7 +29,6 @@ function PotentialSensor() {
return new BasicBlock(this.x);
}
PotentialSensor.prototype.get_popup_title = function PotentialSensor() {
- var set_param_popup_title = "Set parameters";
- return set_param_popup_title;
+ return;
}
}
diff --git a/js/Electrical/Resistor.js b/js/Electrical/Resistor.js
index 19fba9fa..5fb15d83 100644
--- a/js/Electrical/Resistor.js
+++ b/js/Electrical/Resistor.js
@@ -26,6 +26,8 @@ function Resistor() {
return this.x;
}
Resistor.prototype.get = function Resistor() {
+ var exprs = this.graphics.exprs;
+ this.set_param_popup_title = "Set Resistor block parameter";
var options = {
R:["R (ohm)",this.R],
}
@@ -50,7 +52,6 @@ function Resistor() {
return new BasicBlock(this.x);
}
Resistor.prototype.get_popup_title = function Resistor() {
- var set_param_popup_title = "Set Resistor block parameter";
- return set_param_popup_title;
+ return this.set_param_popup_title;
}
}
diff --git a/js/Electrical/SineVoltage.js b/js/Electrical/SineVoltage.js
index d91676da..b23ec90f 100644
--- a/js/Electrical/SineVoltage.js
+++ b/js/Electrical/SineVoltage.js
@@ -30,6 +30,8 @@ function SineVoltage() {
return this.x;
}
SineVoltage.prototype.get = function SineVoltage() {
+ var exprs = this.graphics.exprs;
+ this.set_param_popup_title = "Set voltage source parameter";
var options = {
V:["Amplitude (Volt)",this.V],
ph:["phase (rad)",this.ph],
@@ -62,7 +64,6 @@ function SineVoltage() {
return new BasicBlock(this.x);
}
SineVoltage.prototype.get_popup_title = function SineVoltage() {
- var set_param_popup_title = "Set voltage source parameter";
- return set_param_popup_title;
+ return this.set_param_popup_title;
}
}
diff --git a/js/Electrical/Switch.js b/js/Electrical/Switch.js
index 2641b80a..4126940c 100644
--- a/js/Electrical/Switch.js
+++ b/js/Electrical/Switch.js
@@ -29,6 +29,8 @@ function Switch() {
return this.x;
}
Switch.prototype.get = function Switch() {
+ var exprs = this.graphics.exprs;
+ this.set_param_popup_title = "Set non-ideal electrical switch parameters";
var options = {
Ron:["Resistance in On state (Ohm)",this.Ron],
Roff:["Resistance in Off state (Ohm)",this.Roff],
@@ -54,7 +56,6 @@ function Switch() {
return new BasicBlock(this.x);
}
Switch.prototype.get_popup_title = function Switch() {
- var set_param_popup_title = "Set non-ideal electrical switch parameters";
- return set_param_popup_title;
+ return this.set_param_popup_title;
}
}
diff --git a/js/Electrical/VVsourceAC.js b/js/Electrical/VVsourceAC.js
index c0dcb9ab..8ee8ea7c 100644
--- a/js/Electrical/VVsourceAC.js
+++ b/js/Electrical/VVsourceAC.js
@@ -27,6 +27,8 @@ function VVsourceAC() {
return this.x;
}
VVsourceAC.prototype.get = function VVsourceAC() {
+ var exprs = this.graphics.exprs;
+ this.set_param_popup_title = "Set voltage source parameter";
var options = {
FR:["Frequency (Hz)",this.FR],
}
@@ -51,7 +53,6 @@ function VVsourceAC() {
return new BasicBlock(this.x);
}
VVsourceAC.prototype.get_popup_title = function VVsourceAC() {
- var set_param_popup_title = "Set voltage source parameter";
- return set_param_popup_title;
+ return this.set_param_popup_title;
}
}
diff --git a/js/Electrical/VariableResistor.js b/js/Electrical/VariableResistor.js
index 1a29fb02..0c6315ad 100644
--- a/js/Electrical/VariableResistor.js
+++ b/js/Electrical/VariableResistor.js
@@ -29,7 +29,6 @@ function VariableResistor() {
return new BasicBlock(this.x);
}
VariableResistor.prototype.get_popup_title = function VariableResistor() {
- var set_param_popup_title = "Set parameters";
- return set_param_popup_title;
+ return;
}
}
diff --git a/js/Electrical/VoltageSensor.js b/js/Electrical/VoltageSensor.js
index 16bc8373..965b5c36 100644
--- a/js/Electrical/VoltageSensor.js
+++ b/js/Electrical/VoltageSensor.js
@@ -29,7 +29,6 @@ function VoltageSensor() {
return new VoltageSensorBlock(this.x);
}
VoltageSensor.prototype.get_popup_title = function VoltageSensor() {
- var set_param_popup_title = "Set parameters";
- return set_param_popup_title;
+ return;
}
}
diff --git a/js/Electrical/VsourceAC.js b/js/Electrical/VsourceAC.js
index 79440423..6afabf23 100644
--- a/js/Electrical/VsourceAC.js
+++ b/js/Electrical/VsourceAC.js
@@ -27,6 +27,8 @@ function VsourceAC() {
return this.x;
}
VsourceAC.prototype.get = function VsourceAC() {
+ var exprs = this.graphics.exprs;
+ this.set_param_popup_title = "Set voltage source parameter";
var options = {
VA:["Amplitude (Volt)",this.VA],
FR:["Frequency (Hz)",this.FR],
@@ -53,7 +55,6 @@ function VsourceAC() {
return new BasicBlock(this.x);
}
VsourceAC.prototype.get_popup_title = function VsourceAC() {
- var set_param_popup_title = "Set voltage source parameter";
- return set_param_popup_title;
+ return this.set_param_popup_title;
}
}