diff options
Diffstat (limited to 'js/Electrical')
48 files changed, 494 insertions, 422 deletions
diff --git a/js/Electrical/CCS.js b/js/Electrical/CCS.js index e141318c..37468aff 100644 --- a/js/Electrical/CCS.js +++ b/js/Electrical/CCS.js @@ -11,24 +11,24 @@ function CCS() { MO = []; P = [[2,50,1,0],[70,98,2,0],[70,2,-2,0]]; PortName = [["Iin"],["p"],["n"]]; -for (i=1;i<=size(P,"r");i+=1) { - if (P[i-1][3-1]==1) { - Typein = [[Typein],["E"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==2) { - Typein = [[Typein],["I"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-1) { - Typeout = [[Typeout],["E"]]; - MO = [[MO],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-2) { - Typeout = [[Typeout],["I"]]; - MO = [[MO],[PortName[i-1]]]; -} -} + for (i=1;i<=size(P,"r");i+=1) { + if (P[i-1][3-1]==1) { + Typein = [[Typein],["E"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==2) { + Typein = [[Typein],["I"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-1) { + Typeout = [[Typeout],["E"]]; + MO = [[MO],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-2) { + Typeout = [[Typeout],["I"]]; + MO = [[MO],[PortName[i-1]]]; + } + } model = scicos_model(); mo = modelica(); model.sim = ModelName; @@ -44,19 +44,20 @@ for (i=1;i<=size(P,"r");i+=1) { model.equations = mo; model.in1 = ones(size(MI,"*"),1); model.out = ones(size(MO,"*"),1); - x = standard_define([2.1,3],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = Typein; - x.graphics.out_implicit = Typeout; + this.x = standard_define([2.1,3],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = Typein; + this.x.graphics.out_implicit = Typeout; } CCS.prototype.details = function CCS() { + return this.x; } CCS.prototype.get = function CCS() { } CCS.prototype.set = function CCS() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; - x = arg1; + this.x = arg1; } } diff --git a/js/Electrical/CCS.pickle b/js/Electrical/CCS.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/CCS.pickle +++ b/js/Electrical/CCS.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/CVS.js b/js/Electrical/CVS.js index fe672d4d..14967c72 100644 --- a/js/Electrical/CVS.js +++ b/js/Electrical/CVS.js @@ -11,24 +11,24 @@ function CVS() { MO = []; P = [[2,50,1,0],[70,98,2,0],[70,2,-2,0]]; PortName = [["vin"],["p"],["n"]]; -for (i=1;i<=size(P,"r");i+=1) { - if (P[i-1][3-1]==1) { - Typein = [[Typein],["E"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==2) { - Typein = [[Typein],["I"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-1) { - Typeout = [[Typeout],["E"]]; - MO = [[MO],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-2) { - Typeout = [[Typeout],["I"]]; - MO = [[MO],[PortName[i-1]]]; -} -} + for (i=1;i<=size(P,"r");i+=1) { + if (P[i-1][3-1]==1) { + Typein = [[Typein],["E"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==2) { + Typein = [[Typein],["I"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-1) { + Typeout = [[Typeout],["E"]]; + MO = [[MO],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-2) { + Typeout = [[Typeout],["I"]]; + MO = [[MO],[PortName[i-1]]]; + } + } model = scicos_model(); mo = modelica(); model.sim = ModelName; @@ -44,19 +44,20 @@ for (i=1;i<=size(P,"r");i+=1) { model.equations = mo; model.in1 = ones(size(MI,"*"),1); model.out = ones(size(MO,"*"),1); - x = standard_define([2.1,3],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = Typein; - x.graphics.out_implicit = Typeout; + this.x = standard_define([2.1,3],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = Typein; + this.x.graphics.out_implicit = Typeout; } CVS.prototype.details = function CVS() { + return this.x; } CVS.prototype.get = function CVS() { } CVS.prototype.set = function CVS() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; - x = arg1; + this.x = arg1; } } diff --git a/js/Electrical/CVS.pickle b/js/Electrical/CVS.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/CVS.pickle +++ b/js/Electrical/CVS.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/Capacitor.js b/js/Electrical/Capacitor.js index 531ad691..ea76cb96 100644 --- a/js/Electrical/Capacitor.js +++ b/js/Electrical/Capacitor.js @@ -18,30 +18,31 @@ function Capacitor() { model.out = ones(size(mo.outputs,"*"),1); exprs = string([[C],[v]]); gr_i = []; - x = standard_define([2,1.1],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,1.1],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I"]; } Capacitor.prototype.details = function Capacitor() { + return this.x; } Capacitor.prototype.get = function Capacitor() { } Capacitor.prototype.set = function Capacitor() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,C,v,exprs] = scicos_getvalue("Set Capacitor block parameter",[["C (F)"],["Initial Voltage"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - model.rpar = C; - model.equations.parameters[2-1] = list(C,v); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,C,v,exprs] = scicos_getvalue("Set Capacitor block parameter",[["C (F)"],["Initial Voltage"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + model.rpar = C; + model.equations.parameters[2-1] = list(C,v); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/Capacitor.pickle b/js/Electrical/Capacitor.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/Capacitor.pickle +++ b/js/Electrical/Capacitor.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/ConstantVoltage.js b/js/Electrical/ConstantVoltage.js index 2f831d32..b01c4f44 100644 --- a/js/Electrical/ConstantVoltage.js +++ b/js/Electrical/ConstantVoltage.js @@ -17,30 +17,31 @@ function ConstantVoltage() { model.equations = mo; exprs = string(V); gr_i = []; - x = standard_define([1.5,1.1],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([1.5,1.1],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I"]; } ConstantVoltage.prototype.details = function ConstantVoltage() { + return this.x; } ConstantVoltage.prototype.get = function ConstantVoltage() { } ConstantVoltage.prototype.set = function ConstantVoltage() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,V,exprs] = scicos_getvalue("Set ConstantVoltage block parameter","V (volt)",list("vec",1),exprs); - if (!ok) { -break; -} - model.rpar = V; - model.equations.parameters[2-1] = list(V); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,V,exprs] = scicos_getvalue("Set ConstantVoltage block parameter","V (volt)",list("vec",1),exprs); + if (!ok) { + break; + } + model.rpar = V; + model.equations.parameters[2-1] = list(V); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/ConstantVoltage.pickle b/js/Electrical/ConstantVoltage.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/ConstantVoltage.pickle +++ b/js/Electrical/ConstantVoltage.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/CurrentSensor.js b/js/Electrical/CurrentSensor.js index bb9d9952..1cf2a40c 100644 --- a/js/Electrical/CurrentSensor.js +++ b/js/Electrical/CurrentSensor.js @@ -14,15 +14,16 @@ function CurrentSensor() { model.equations = mo; exprs = []; gr_i = []; - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = [["I"],["E"]]; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = [["I"],["E"]]; } CurrentSensor.prototype.details = function CurrentSensor() { + return this.x; } CurrentSensor.prototype.get = function CurrentSensor() { } CurrentSensor.prototype.set = function CurrentSensor() { - x = arg1; + this.x = arg1; } } diff --git a/js/Electrical/CurrentSensor.pickle b/js/Electrical/CurrentSensor.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/CurrentSensor.pickle +++ b/js/Electrical/CurrentSensor.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/Diode.js b/js/Electrical/Diode.js index 644cb091..846dbafc 100644 --- a/js/Electrical/Diode.js +++ b/js/Electrical/Diode.js @@ -20,30 +20,31 @@ function Diode() { model.equations = mo; exprs = string([[Ids],[Vt],[Maxexp],[R]]); gr_i = []; - x = standard_define([2,1],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,1],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I"]; } Diode.prototype.details = function Diode() { + return this.x; } Diode.prototype.get = function Diode() { } Diode.prototype.set = function Diode() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,Ids,Vt,Maxexp,R,exprs] = scicos_getvalue("Set Diode block parameter",[["Saturation cuurent (A)"],["Voltage equivalent to temperature (Volt)"],["Max exponent for linear continuation"],["R (ohm)"]],list("vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - model.rpar = [[Ids],[Vt],[Maxexp],[R]]; - model.equations.parameters = list(["Ids","Vt","Maxexp","R"],list(Ids,Vt,Maxexp,R)); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,Ids,Vt,Maxexp,R,exprs] = scicos_getvalue("Set Diode block parameter",[["Saturation cuurent (A)"],["Voltage equivalent to temperature (Volt)"],["Max exponent for linear continuation"],["R (ohm)"]],list("vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + model.rpar = [[Ids],[Vt],[Maxexp],[R]]; + model.equations.parameters = list(["Ids","Vt","Maxexp","R"],list(Ids,Vt,Maxexp,R)); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/Diode.pickle b/js/Electrical/Diode.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/Diode.pickle +++ b/js/Electrical/Diode.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/Ground.js b/js/Electrical/Ground.js index 077617fd..789de6c8 100644 --- a/js/Electrical/Ground.js +++ b/js/Electrical/Ground.js @@ -13,15 +13,16 @@ function Ground() { model.equations = mo; exprs = ""; gr_i = []; - x = standard_define([1,1],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([1,1],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I"]; } Ground.prototype.details = function Ground() { + return this.x; } Ground.prototype.get = function Ground() { } Ground.prototype.set = function Ground() { - x = arg1; + this.x = arg1; } } diff --git a/js/Electrical/Ground.pickle b/js/Electrical/Ground.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/Ground.pickle +++ b/js/Electrical/Ground.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/Gyrator.js b/js/Electrical/Gyrator.js index 75389bd7..5c6371fb 100644 --- a/js/Electrical/Gyrator.js +++ b/js/Electrical/Gyrator.js @@ -11,24 +11,24 @@ function Gyrator() { MO = []; P = [[2.5,90,2,0],[2.5,10,2,0],[97.5,90,-2,0],[97.5,10,-2,0]]; PortName = [["p1"],["n1"],["p2"],["n2"]]; -for (i=1;i<=size(P,"r");i+=1) { - if (P[i-1][3-1]==1) { - Typein = [[Typein],["E"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==2) { - Typein = [[Typein],["I"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-1) { - Typeout = [[Typeout],["E"]]; - MO = [[MO],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-2) { - Typeout = [[Typeout],["I"]]; - MO = [[MO],[PortName[i-1]]]; -} -} + for (i=1;i<=size(P,"r");i+=1) { + if (P[i-1][3-1]==1) { + Typein = [[Typein],["E"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==2) { + Typein = [[Typein],["I"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-1) { + Typeout = [[Typeout],["E"]]; + MO = [[MO],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-2) { + Typeout = [[Typeout],["I"]]; + MO = [[MO],[PortName[i-1]]]; + } + } model = scicos_model(); mo = modelica(); model.sim = ModelName; @@ -44,29 +44,30 @@ for (i=1;i<=size(P,"r");i+=1) { model.equations = mo; model.in1 = ones(size(MI,"*"),1); model.out = ones(size(MO,"*"),1); - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = Typein; - x.graphics.out_implicit = Typeout; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = Typein; + this.x.graphics.out_implicit = Typeout; } Gyrator.prototype.details = function Gyrator() { + return this.x; } Gyrator.prototype.get = function Gyrator() { } Gyrator.prototype.set = function Gyrator() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; - x = arg1; - exprs = x.graphics.exprs; + this.x = arg1; + exprs = this.x.graphics.exprs; while (true) { - [ok,G1,G2,exprs] = scicos_getvalue([["Set Gyrator block parameters:"],[""],["G1: Gyration conductance"],["G2: Gyration conductance"]],[["G1"],["G2"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - x.model.equations.parameters[2-1] = list(G1,G2); - x.graphics.exprs = exprs; -break; -} + [ok,G1,G2,exprs] = scicos_getvalue([["Set Gyrator block parameters:"],[""],["G1: Gyration conductance"],["G2: Gyration conductance"]],[["G1"],["G2"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + this.x.model.equations.parameters[2-1] = list(G1,G2); + this.x.graphics.exprs = exprs; + break; + } } } diff --git a/js/Electrical/Gyrator.pickle b/js/Electrical/Gyrator.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/Gyrator.pickle +++ b/js/Electrical/Gyrator.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/IdealTransformer.js b/js/Electrical/IdealTransformer.js index 8e73dc7b..b24da82d 100644 --- a/js/Electrical/IdealTransformer.js +++ b/js/Electrical/IdealTransformer.js @@ -11,24 +11,24 @@ function IdealTransformer() { MO = []; P = [[2.5,90,2,0],[2.5,10,2,0],[97.5,90,-2,0],[97.5,10,-2,0]]; PortName = [["p1"],["n1"],["p2"],["n2"]]; -for (i=1;i<=size(P,"r");i+=1) { - if (P[i-1][3-1]==1) { - Typein = [[Typein],["E"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==2) { - Typein = [[Typein],["I"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-1) { - Typeout = [[Typeout],["E"]]; - MO = [[MO],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-2) { - Typeout = [[Typeout],["I"]]; - MO = [[MO],[PortName[i-1]]]; -} -} + for (i=1;i<=size(P,"r");i+=1) { + if (P[i-1][3-1]==1) { + Typein = [[Typein],["E"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==2) { + Typein = [[Typein],["I"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-1) { + Typeout = [[Typeout],["E"]]; + MO = [[MO],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-2) { + Typeout = [[Typeout],["I"]]; + MO = [[MO],[PortName[i-1]]]; + } + } model = scicos_model(); mo = modelica(); model.sim = ModelName; @@ -44,29 +44,30 @@ for (i=1;i<=size(P,"r");i+=1) { model.equations = mo; model.in1 = ones(size(MI,"*"),1); model.out = ones(size(MO,"*"),1); - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = Typein; - x.graphics.out_implicit = Typeout; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = Typein; + this.x.graphics.out_implicit = Typeout; } IdealTransformer.prototype.details = function IdealTransformer() { + return this.x; } IdealTransformer.prototype.get = function IdealTransformer() { } IdealTransformer.prototype.set = function IdealTransformer() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; - x = arg1; - exprs = x.graphics.exprs; + this.x = arg1; + exprs = this.x.graphics.exprs; while (true) { - [ok,N,exprs] = scicos_getvalue([["Set Transformer block parameters:"],[""],["N:"+" Turn ratio (N1/N2)"]],["N"],list("vec",1),exprs); - if (!ok) { -break; -} - x.model.equations.parameters[2-1] = list(N); - x.graphics.exprs = exprs; -break; -} + [ok,N,exprs] = scicos_getvalue([["Set Transformer block parameters:"],[""],["N:"+" Turn ratio (N1/N2)"]],["N"],list("vec",1),exprs); + if (!ok) { + break; + } + this.x.model.equations.parameters[2-1] = list(N); + this.x.graphics.exprs = exprs; + break; + } } } diff --git a/js/Electrical/IdealTransformer.pickle b/js/Electrical/IdealTransformer.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/IdealTransformer.pickle +++ b/js/Electrical/IdealTransformer.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/Inductor.js b/js/Electrical/Inductor.js index 679331e9..915a8d35 100644 --- a/js/Electrical/Inductor.js +++ b/js/Electrical/Inductor.js @@ -17,30 +17,31 @@ function Inductor() { model.equations = mo; exprs = string(L); gr_i = []; - x = standard_define([2,0.9],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,0.9],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I"]; } Inductor.prototype.details = function Inductor() { + return this.x; } Inductor.prototype.get = function Inductor() { } Inductor.prototype.set = function Inductor() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,L,exprs] = scicos_getvalue("Set Inductor block parameter","L (H)",list("vec",1),exprs); - if (!ok) { -break; -} - model.rpar = L; - model.equations.parameters[2-1] = list(L); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,L,exprs] = scicos_getvalue("Set Inductor block parameter","L (H)",list("vec",1),exprs); + if (!ok) { + break; + } + model.rpar = L; + model.equations.parameters[2-1] = list(L); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/Inductor.pickle b/js/Electrical/Inductor.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/Inductor.pickle +++ b/js/Electrical/Inductor.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/MOTOR.js b/js/Electrical/MOTOR.js index f0622cc9..f6612689 100644 --- a/js/Electrical/MOTOR.js +++ b/js/Electrical/MOTOR.js @@ -9,15 +9,16 @@ function MOTOR() { model.dep_ut = [true,false]; gr_i = []; exprs = ""; - x = standard_define([2,2],model,exprs,gr_i); - x.graphics.out_implicit = [["I"],["I"]]; - x.graphics.in_implicit = ["I"]; + this.x = standard_define([2,2],model,exprs,gr_i); + this.x.graphics.out_implicit = [["I"],["I"]]; + this.x.graphics.in_implicit = ["I"]; } MOTOR.prototype.details = function MOTOR() { + return this.x; } MOTOR.prototype.get = function MOTOR() { } MOTOR.prototype.set = function MOTOR() { - x = arg1; + this.x = arg1; } } diff --git a/js/Electrical/MOTOR.pickle b/js/Electrical/MOTOR.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/MOTOR.pickle +++ b/js/Electrical/MOTOR.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/NMOS.js b/js/Electrical/NMOS.js index 88c85350..932f4ac4 100644 --- a/js/Electrical/NMOS.js +++ b/js/Electrical/NMOS.js @@ -24,29 +24,30 @@ function NMOS() { model.out = ones(size(mo.outputs,"*"),1); exprs = [[string(W)],[string(L)],[string(Beta)],[string(Vt)],[string(K2)],[string(K5)],[string(dW)],[string(dL)],[string(RDS)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = [["I"],["I"],["I"]]; + this.x = standard_define([2,2],model,exprs,gr_i); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = [["I"],["I"],["I"]]; } NMOS.prototype.details = function NMOS() { + return this.x; } NMOS.prototype.get = function NMOS() { } NMOS.prototype.set = function NMOS() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,W,L,Beta,Vt,K2,K5,dW,dL,RDS,exprs] = scicos_getvalue("Set NMOS Transistor block parameters",[["Width [m]"],["Length [m]"],["Transconductance parameter [A/(V*V)]"],["Zero bias threshold voltage [V]"],["Bulk threshold parameter"],["Reduction of pinch-off region"],["Narrowing of channel [m]"],["Shortening of channel [m]"],["Drain-Source-Resistance [Ohm]"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - model.equations.parameters[2-1] = list(W,L,Beta,Vt,K2,K5,dW,dL,RDS); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,W,L,Beta,Vt,K2,K5,dW,dL,RDS,exprs] = scicos_getvalue("Set NMOS Transistor block parameters",[["Width [m]"],["Length [m]"],["Transconductance parameter [A/(V*V)]"],["Zero bias threshold voltage [V]"],["Bulk threshold parameter"],["Reduction of pinch-off region"],["Narrowing of channel [m]"],["Shortening of channel [m]"],["Drain-Source-Resistance [Ohm]"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1),exprs); + if (!ok) { + break; + } + model.equations.parameters[2-1] = list(W,L,Beta,Vt,K2,K5,dW,dL,RDS); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/NMOS.pickle b/js/Electrical/NMOS.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/NMOS.pickle +++ b/js/Electrical/NMOS.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/NPN.js b/js/Electrical/NPN.js index c8627dd3..93484238 100644 --- a/js/Electrical/NPN.js +++ b/js/Electrical/NPN.js @@ -11,24 +11,24 @@ function NPN() { MO = []; P = [[100,90,-2,0],[0,50,2,0],[100,10,-2,0]]; PortName = [["C"],["B"],["E"]]; -for (i=1;i<=size(P,"r");i+=1) { - if (P[i-1][3-1]==1) { - Typein = [[Typein],["E"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==2) { - Typein = [[Typein],["I"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-1) { - Typeout = [[Typeout],["E"]]; - MO = [[MO],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-2) { - Typeout = [[Typeout],["I"]]; - MO = [[MO],[PortName[i-1]]]; -} -} + for (i=1;i<=size(P,"r");i+=1) { + if (P[i-1][3-1]==1) { + Typein = [[Typein],["E"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==2) { + Typein = [[Typein],["I"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-1) { + Typeout = [[Typeout],["E"]]; + MO = [[MO],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-2) { + Typeout = [[Typeout],["I"]]; + MO = [[MO],[PortName[i-1]]]; + } + } model = scicos_model(); mo = modelica(); model.sim = ModelName; @@ -44,29 +44,30 @@ for (i=1;i<=size(P,"r");i+=1) { model.equations = mo; model.in1 = ones(size(MI,"*"),1); model.out = ones(size(MO,"*"),1); - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = Typein; - x.graphics.out_implicit = Typeout; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = Typein; + this.x.graphics.out_implicit = Typeout; } NPN.prototype.details = function NPN() { + return this.x; } NPN.prototype.get = function NPN() { } NPN.prototype.set = function NPN() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; - x = arg1; - exprs = x.graphics.exprs; + this.x = arg1; + exprs = this.x.graphics.exprs; while (true) { - [ok,Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax,exprs] = scicos_getvalue([["Set NPN block parameters:"],[""]],[["Bf : Forward beta"],["Br : Reverse beta"],["Is : Transport saturation current"],["Vak : Early voltage (inverse), 1/Volt"],["Tauf: Ideal forward transit time"],["Taur: Ideal reverse transit time"],["Ccs : Collector-substrat(ground) cap."],["Cje : Base-emitter zero bias depletion cap."],["Cjc : Base-coll. zero bias depletion cap."],["Phie: Base-emitter diffusion voltage"],["Me : Base-emitter gradation exponent"],["Phic: Base-collector diffusion voltage"],["Mc : Base-collector gradation exponent"],["Gbc : Base-collector conductance"],["Gbe : Base-emitter conductance"],["Vt : Voltage equivalent of temperature"],["EMinmax: if x > EMinMax, the exp(x) is linearized"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - x.model.equations.parameters[2-1] = list(Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax); - x.graphics.exprs = exprs; -break; -} + [ok,Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax,exprs] = scicos_getvalue([["Set NPN block parameters:"],[""]],[["Bf : Forward beta"],["Br : Reverse beta"],["Is : Transport saturation current"],["Vak : Early voltage (inverse), 1/Volt"],["Tauf: Ideal forward transit time"],["Taur: Ideal reverse transit time"],["Ccs : Collector-substrat(ground) cap."],["Cje : Base-emitter zero bias depletion cap."],["Cjc : Base-coll. zero bias depletion cap."],["Phie: Base-emitter diffusion voltage"],["Me : Base-emitter gradation exponent"],["Phic: Base-collector diffusion voltage"],["Mc : Base-collector gradation exponent"],["Gbc : Base-collector conductance"],["Gbe : Base-emitter conductance"],["Vt : Voltage equivalent of temperature"],["EMinmax: if x > EMinMax, the exp(x) is linearized"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + this.x.model.equations.parameters[2-1] = list(Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax); + this.x.graphics.exprs = exprs; + break; + } } } diff --git a/js/Electrical/NPN.pickle b/js/Electrical/NPN.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/NPN.pickle +++ b/js/Electrical/NPN.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/OpAmp.js b/js/Electrical/OpAmp.js index 51cc1f58..ceaa3228 100644 --- a/js/Electrical/OpAmp.js +++ b/js/Electrical/OpAmp.js @@ -18,29 +18,30 @@ function OpAmp() { model.rpar = Z; exprs = string(Z); gr_i = []; - x = standard_define([3,5],model,exprs,gr_i); - x.graphics.in_implicit = [["I"],["I"]]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([3,5],model,exprs,gr_i); + this.x.graphics.in_implicit = [["I"],["I"]]; + this.x.graphics.out_implicit = ["I"]; } OpAmp.prototype.details = function OpAmp() { + return this.x; } OpAmp.prototype.get = function OpAmp() { } OpAmp.prototype.set = function OpAmp() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (false) { - [ok,OLGain,SatH,SatL,exprs] = scicos_getvalue("Set the Operational Amplifier parameters",[["Open Loop Gain"],["Positive saturation voltage"],["Negative saturation voltage"]],list("vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - model.equations.parameters[2-1] = list(OLGain,SatH,SatL); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,OLGain,SatH,SatL,exprs] = scicos_getvalue("Set the Operational Amplifier parameters",[["Open Loop Gain"],["Positive saturation voltage"],["Negative saturation voltage"]],list("vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + model.equations.parameters[2-1] = list(OLGain,SatH,SatL); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/OpAmp.pickle b/js/Electrical/OpAmp.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/OpAmp.pickle +++ b/js/Electrical/OpAmp.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/PMOS.js b/js/Electrical/PMOS.js index 0f01116c..4a314521 100644 --- a/js/Electrical/PMOS.js +++ b/js/Electrical/PMOS.js @@ -24,29 +24,30 @@ function PMOS() { model.out = ones(size(mo.outputs,"*"),1); exprs = [[string(W)],[string(L)],[string(Beta)],[string(Vt)],[string(K2)],[string(K5)],[string(dW)],[string(dL)],[string(RDS)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = [["I"],["I"],["I"]]; + this.x = standard_define([2,2],model,exprs,gr_i); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = [["I"],["I"],["I"]]; } PMOS.prototype.details = function PMOS() { + return this.x; } PMOS.prototype.get = function PMOS() { } PMOS.prototype.set = function PMOS() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,W,L,Beta,Vt,K2,K5,dW,dL,RDS,exprs] = scicos_getvalue("Set PMOS Transistor parameters",[["Width [m]"],["Length [m]"],["Transconductance parameter [A/(V*V)]"],["Zero bias threshold voltage [V]"],["Bulk threshold parameter"],["Reduction of pinch-off region"],["Narrowing of channel [m]"],["Shortening of channel [m]"],["Drain-Source-Resistance [Ohm]"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - model.equations.parameters[2-1] = list(W,L,Beta,Vt,K2,K5,dW,dL,RDS); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,W,L,Beta,Vt,K2,K5,dW,dL,RDS,exprs] = scicos_getvalue("Set PMOS Transistor parameters",[["Width [m]"],["Length [m]"],["Transconductance parameter [A/(V*V)]"],["Zero bias threshold voltage [V]"],["Bulk threshold parameter"],["Reduction of pinch-off region"],["Narrowing of channel [m]"],["Shortening of channel [m]"],["Drain-Source-Resistance [Ohm]"]],list("vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1,"vec",-1),exprs); + if (!ok) { + break; + } + model.equations.parameters[2-1] = list(W,L,Beta,Vt,K2,K5,dW,dL,RDS); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/PMOS.pickle b/js/Electrical/PMOS.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/PMOS.pickle +++ b/js/Electrical/PMOS.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/PNP.js b/js/Electrical/PNP.js index e86b176c..bd3fcad3 100644 --- a/js/Electrical/PNP.js +++ b/js/Electrical/PNP.js @@ -11,24 +11,24 @@ function PNP() { MO = []; P = [[100,90,-2,0],[0,50,2,0],[100,10,-2,0]]; PortName = [["C"],["B"],["E"]]; -for (i=1;i<=size(P,"r");i+=1) { - if (P[i-1][3-1]==1) { - Typein = [[Typein],["E"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==2) { - Typein = [[Typein],["I"]]; - MI = [[MI],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-1) { - Typeout = [[Typeout],["E"]]; - MO = [[MO],[PortName[i-1]]]; -} - if (P[i-1][3-1]==-2) { - Typeout = [[Typeout],["I"]]; - MO = [[MO],[PortName[i-1]]]; -} -} + for (i=1;i<=size(P,"r");i+=1) { + if (P[i-1][3-1]==1) { + Typein = [[Typein],["E"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==2) { + Typein = [[Typein],["I"]]; + MI = [[MI],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-1) { + Typeout = [[Typeout],["E"]]; + MO = [[MO],[PortName[i-1]]]; + } + if (P[i-1][3-1]==-2) { + Typeout = [[Typeout],["I"]]; + MO = [[MO],[PortName[i-1]]]; + } + } model = scicos_model(); mo = modelica(); model.sim = ModelName; @@ -44,29 +44,30 @@ for (i=1;i<=size(P,"r");i+=1) { model.equations = mo; model.in1 = ones(size(MI,"*"),1); model.out = ones(size(MO,"*"),1); - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = Typein; - x.graphics.out_implicit = Typeout; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = Typein; + this.x.graphics.out_implicit = Typeout; } PNP.prototype.details = function PNP() { + return this.x; } PNP.prototype.get = function PNP() { } PNP.prototype.set = function PNP() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; - x = arg1; - exprs = x.graphics.exprs; + this.x = arg1; + exprs = this.x.graphics.exprs; while (true) { - [ok,Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax,exprs] = scicos_getvalue([["Set PNP block parameters:"],[""]],[["Bf : Forward beta"],["Br : Reverse beta"],["Is : Transport saturation current"],["Vak : Early voltage (inverse), 1/Volt"],["Tauf: Ideal forward transit time"],["Taur: Ideal reverse transit time"],["Ccs : Collector-substrat(ground) cap."],["Cje : Base-emitter zero bias depletion cap."],["Cjc : Base-coll. zero bias depletion cap."],["Phie: Base-emitter diffusion voltage"],["Me : Base-emitter gradation exponent"],["Phic: Base-collector diffusion voltage"],["Mc : Base-collector gradation exponent"],["Gbc : Base-collector conductance"],["Gbe : Base-emitter conductance"],["Vt : Voltage equivalent of temperature"],["EMinMax: if x > EMinMax, the exp(x) function is linearized"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - x.model.equations.parameters[2-1] = list(Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax); - x.graphics.exprs = exprs; -break; -} + [ok,Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax,exprs] = scicos_getvalue([["Set PNP block parameters:"],[""]],[["Bf : Forward beta"],["Br : Reverse beta"],["Is : Transport saturation current"],["Vak : Early voltage (inverse), 1/Volt"],["Tauf: Ideal forward transit time"],["Taur: Ideal reverse transit time"],["Ccs : Collector-substrat(ground) cap."],["Cje : Base-emitter zero bias depletion cap."],["Cjc : Base-coll. zero bias depletion cap."],["Phie: Base-emitter diffusion voltage"],["Me : Base-emitter gradation exponent"],["Phic: Base-collector diffusion voltage"],["Mc : Base-collector gradation exponent"],["Gbc : Base-collector conductance"],["Gbe : Base-emitter conductance"],["Vt : Voltage equivalent of temperature"],["EMinMax: if x > EMinMax, the exp(x) function is linearized"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + this.x.model.equations.parameters[2-1] = list(Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax); + this.x.graphics.exprs = exprs; + break; + } } } diff --git a/js/Electrical/PNP.pickle b/js/Electrical/PNP.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/PNP.pickle +++ b/js/Electrical/PNP.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/PotentialSensor.js b/js/Electrical/PotentialSensor.js index 98fc2d10..036090ad 100644 --- a/js/Electrical/PotentialSensor.js +++ b/js/Electrical/PotentialSensor.js @@ -14,15 +14,16 @@ function PotentialSensor() { mo.outputs = ["v"]; model.equations = mo; gr_i = []; - x = standard_define([2,2],model,"",list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["E"]; + this.x = standard_define([2,2],model,"",list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["E"]; } PotentialSensor.prototype.details = function PotentialSensor() { + return this.x; } PotentialSensor.prototype.get = function PotentialSensor() { } PotentialSensor.prototype.set = function PotentialSensor() { - x = arg1; + this.x = arg1; } } diff --git a/js/Electrical/PotentialSensor.pickle b/js/Electrical/PotentialSensor.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/PotentialSensor.pickle +++ b/js/Electrical/PotentialSensor.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/Resistor.js b/js/Electrical/Resistor.js index fd6d084b..c7d1de80 100644 --- a/js/Electrical/Resistor.js +++ b/js/Electrical/Resistor.js @@ -17,30 +17,31 @@ function Resistor() { model.out = ones(size(mo.outputs,"*"),1); exprs = string(R); gr_i = []; - x = standard_define([2,1],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,1],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I"]; } Resistor.prototype.details = function Resistor() { + return this.x; } Resistor.prototype.get = function Resistor() { } Resistor.prototype.set = function Resistor() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,R,exprs] = scicos_getvalue("Set Resistor block parameter","R (ohm)",list("vec",1),exprs); - if (!ok) { -break; -} - model.rpar = R; - model.equations.parameters[2-1] = list(R); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,R,exprs] = scicos_getvalue("Set Resistor block parameter","R (ohm)",list("vec",1),exprs); + if (!ok) { + break; + } + model.rpar = R; + model.equations.parameters[2-1] = list(R); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/Resistor.pickle b/js/Electrical/Resistor.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/Resistor.pickle +++ b/js/Electrical/Resistor.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/SineVoltage.js b/js/Electrical/SineVoltage.js index 4f74d5d2..3cab0ebd 100644 --- a/js/Electrical/SineVoltage.js +++ b/js/Electrical/SineVoltage.js @@ -21,30 +21,31 @@ function SineVoltage() { model.equations = mo; exprs = [[string(V)],[string(ph)],[string(frq)],[string(offset)],[string(start)]]; gr_i = []; - x = standard_define([2,2],model,exprs,gr_i); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,2],model,exprs,gr_i); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I"]; } SineVoltage.prototype.details = function SineVoltage() { + return this.x; } SineVoltage.prototype.get = function SineVoltage() { } SineVoltage.prototype.set = function SineVoltage() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,V,ph,frq,offset,start,exprs] = scicos_getvalue("Set voltage source parameter",[["Amplitude (Volt)"],["phase (rad)"],["Frequency (Hz)"],["Voltageoffset (V)"],["Timeoffset (s)"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); - if (!ok) { -break; -} - model.rpar = [[V],[ph],[frq],[offset],[start]]; - model.equations.parameters[2-1] = list(V,ph,frq,offset,start); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,V,ph,frq,offset,start,exprs] = scicos_getvalue("Set voltage source parameter",[["Amplitude (Volt)"],["phase (rad)"],["Frequency (Hz)"],["Voltageoffset (V)"],["Timeoffset (s)"]],list("vec",1,"vec",1,"vec",1,"vec",1,"vec",1),exprs); + if (!ok) { + break; + } + model.rpar = [[V],[ph],[frq],[offset],[start]]; + model.equations.parameters[2-1] = list(V,ph,frq,offset,start); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/SineVoltage.pickle b/js/Electrical/SineVoltage.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/SineVoltage.pickle +++ b/js/Electrical/SineVoltage.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/Switch.js b/js/Electrical/Switch.js index 701dc49b..0fce8536 100644 --- a/js/Electrical/Switch.js +++ b/js/Electrical/Switch.js @@ -20,29 +20,30 @@ function Switch() { model.rpar = Z; exprs = string(Z); gr_i = []; - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = [["I"],["E"]]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = [["I"],["E"]]; + this.x.graphics.out_implicit = ["I"]; } Switch.prototype.details = function Switch() { + return this.x; } Switch.prototype.get = function Switch() { } Switch.prototype.set = function Switch() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,Ron,Roff,exprs] = scicos_getvalue("Set non-ideal electrical switch parameters",[["Resistance in On state (Ohm)"],["Resistance in Off state (Ohm)"]],list("vec",1,"vec",1),exprs); - if (!ok) { -break; -} - model.equations.parameters[2-1] = list(Ron,Roff); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,Ron,Roff,exprs] = scicos_getvalue("Set non-ideal electrical switch parameters",[["Resistance in On state (Ohm)"],["Resistance in Off state (Ohm)"]],list("vec",1,"vec",1),exprs); + if (!ok) { + break; + } + model.equations.parameters[2-1] = list(Ron,Roff); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/Switch.pickle b/js/Electrical/Switch.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/Switch.pickle +++ b/js/Electrical/Switch.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/VVsourceAC.js b/js/Electrical/VVsourceAC.js index 2985b8cb..4b707ec4 100644 --- a/js/Electrical/VVsourceAC.js +++ b/js/Electrical/VVsourceAC.js @@ -18,30 +18,31 @@ function VVsourceAC() { model.equations = mo; exprs = [string(FR)]; gr_i = []; - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I","E"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I","E"]; + this.x.graphics.out_implicit = ["I"]; } VVsourceAC.prototype.details = function VVsourceAC() { + return this.x; } VVsourceAC.prototype.get = function VVsourceAC() { } VVsourceAC.prototype.set = function VVsourceAC() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,FR,exprs] = scicos_getvalue("Set voltage source parameter",["Frequency (Hz)"],list("vec",-1),exprs); - if (!ok) { -break; -} - model.rpar = [FR]; - model.equations.parameters[2-1] = list(FR); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,FR,exprs] = scicos_getvalue("Set voltage source parameter",["Frequency (Hz)"],list("vec",-1),exprs); + if (!ok) { + break; + } + model.rpar = [FR]; + model.equations.parameters[2-1] = list(FR); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/VVsourceAC.pickle b/js/Electrical/VVsourceAC.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/VVsourceAC.pickle +++ b/js/Electrical/VVsourceAC.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/VariableResistor.js b/js/Electrical/VariableResistor.js index cb325cd6..0eb5c9ce 100644 --- a/js/Electrical/VariableResistor.js +++ b/js/Electrical/VariableResistor.js @@ -14,15 +14,16 @@ function VariableResistor() { model.out = ones(size(mo.outputs,"*"),1); exprs = []; gr_i = []; - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I","E"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I","E"]; + this.x.graphics.out_implicit = ["I"]; } VariableResistor.prototype.details = function VariableResistor() { + return this.x; } VariableResistor.prototype.get = function VariableResistor() { } VariableResistor.prototype.set = function VariableResistor() { - x = arg1; + this.x = arg1; } } diff --git a/js/Electrical/VariableResistor.pickle b/js/Electrical/VariableResistor.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/VariableResistor.pickle +++ b/js/Electrical/VariableResistor.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/VoltageSensor.js b/js/Electrical/VoltageSensor.js index 090bae94..ea912b49 100644 --- a/js/Electrical/VoltageSensor.js +++ b/js/Electrical/VoltageSensor.js @@ -14,15 +14,16 @@ function VoltageSensor() { model.equations = mo; exprs = []; gr_i = []; - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = [["I"],["E"]]; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = [["I"],["E"]]; } VoltageSensor.prototype.details = function VoltageSensor() { + return this.x; } VoltageSensor.prototype.get = function VoltageSensor() { } VoltageSensor.prototype.set = function VoltageSensor() { - x = arg1; + this.x = arg1; } } diff --git a/js/Electrical/VoltageSensor.pickle b/js/Electrical/VoltageSensor.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/VoltageSensor.pickle +++ b/js/Electrical/VoltageSensor.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file diff --git a/js/Electrical/VsourceAC.js b/js/Electrical/VsourceAC.js index 24b691b8..5b1dd0fe 100644 --- a/js/Electrical/VsourceAC.js +++ b/js/Electrical/VsourceAC.js @@ -18,30 +18,31 @@ function VsourceAC() { model.equations = mo; exprs = [[string(VA)],[string(FR)]]; gr_i = []; - x = standard_define([2,2],model,exprs,list(gr_i,0)); - x.graphics.in_implicit = ["I"]; - x.graphics.out_implicit = ["I"]; + this.x = standard_define([2,2],model,exprs,list(gr_i,0)); + this.x.graphics.in_implicit = ["I"]; + this.x.graphics.out_implicit = ["I"]; } VsourceAC.prototype.details = function VsourceAC() { + return this.x; } VsourceAC.prototype.get = function VsourceAC() { } VsourceAC.prototype.set = function VsourceAC() { - x = arg1; + this.x = arg1; graphics = arg1.graphics; exprs = graphics.exprs; model = arg1.model; while (true) { - [ok,VA,FR,exprs] = scicos_getvalue("Set voltage source parameter",[["Amplitude (Volt)"],["Frequency (Hz)"]],list("vec",-1,"vec",-1),exprs); - if (!ok) { -break; -} - model.rpar = [[VA],[FR]]; - model.equations.parameters[2-1] = list(VA,FR); - graphics.exprs = exprs; - x.graphics = graphics; - x.model = model; -break; -} + [ok,VA,FR,exprs] = scicos_getvalue("Set voltage source parameter",[["Amplitude (Volt)"],["Frequency (Hz)"]],list("vec",-1,"vec",-1),exprs); + if (!ok) { + break; + } + model.rpar = [[VA],[FR]]; + model.equations.parameters[2-1] = list(VA,FR); + graphics.exprs = exprs; + this.x.graphics = graphics; + this.x.model = model; + break; + } } } diff --git a/js/Electrical/VsourceAC.pickle b/js/Electrical/VsourceAC.pickle index 154645d8..0d1dde24 100644 --- a/js/Electrical/VsourceAC.pickle +++ b/js/Electrical/VsourceAC.pickle @@ -2,6 +2,8 @@ c__builtin__ set p0 ((lp1 -tp2 -Rp3 +S'x' +p2 +atp3 +Rp4 .
\ No newline at end of file |