diff options
23 files changed, 1219 insertions, 27 deletions
diff --git a/combined.js b/combined.js index 5e0c942..ccecc33 100644 --- a/combined.js +++ b/combined.js @@ -6161,7 +6161,10 @@ function INIMPL_f() { var gr_i = new ScilabString(["xstringb(orig(1),orig(2),"INIMPL_f",sz(1),sz(2));"]);
this.x = new standard_define(new ScilabDouble([1, 1]), model, exprs, gr_i);
this.x.graphics.out_implicit = new ScilabString(["I"]);
- return new ImplicitInBlock(this.x);
+
+ this.implicitInBlock = new ImplicitInBlock(this.x);
+ this.displayParameter = [this.implicitInBlock.ordering];
+ return this.implicitInBlock;
}
INIMPL_f.prototype.details = function INIMPL_f() {
return this.x;
@@ -6366,7 +6369,11 @@ function IN_f () { var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"IN_f\",sz(1),sz(2));"]);
this.x = new standard_define(new ScilabDouble([1,1]),model,exprs,gr_i);
- return new ExplicitInBlock(this.x);
+
+ this.explicitInBlock = new ExplicitInBlock(this.x);
+ this.displayParameter = [this.explicitInBlock.ordering];
+ return this.explicitInBlock;
+
}
IN_f.prototype.details = function IN_f() {
@@ -6433,6 +6440,36 @@ function LOGBLK_f() { }
}
+function LOGIC() {
+
+ LOGIC.prototype.define = function LOGIC() {
+ this.mat = [[0],[0],[0],[1]];
+
+ var model = scicos_model();
+ model.sim = list(new ScilabString(["logic"]), new ScilabDouble([4]));
+ model.in = new ScilabDouble([1], [1]);
+ model.in2 = new ScilabDouble([1], [1]);
+ model.out = new ScilabDouble([1]);
+ model.out2 = new ScilabDouble([1]);
+ model.evtin = new ScilabDouble([1]);
+ model.intyp = new ScilabDouble([5, 5]);
+ model.outtyp = new ScilabDouble([5]);
+ model.opar = list(int8(...this.mat));
+ model.blocktype = new ScilabString(["c"]);
+ model.firing = new ScilabBoolean([false]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var exprs = new ScilabString([sci2exp(this.mat)], [sci2exp(0)]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"LOGIC\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([2, 2]), model, exprs, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ LOGIC.prototype.details = function LOGIC() {
+ return this.x;
+ }
+}
function LOGICAL_OP() {
LOGICAL_OP.prototype.define = function LOGICAL_OP() {
@@ -7779,7 +7816,10 @@ function OUTIMPL_f() { var gr_i = new ScilabString(["xstringb(orig(1),orig(2),"OUTIMPL_f",sz(1),sz(2));"]);
this.x = new standard_define(new ScilabDouble([1, 1]), model, exprs, gr_i);
this.x.graphics.in_implicit = new ScilabString(["I"]);
- return new ImplicitOutBlock(this.x);
+
+ this.implicitOutBlock = new ImplicitOutBlock(this.x);
+ this.displayParameter = [this.implicitOutBlock.ordering];
+ return this.implicitOutBlock;
}
OUTIMPL_f.prototype.details = function OUTIMPL_f() {
return this.x;
@@ -7828,7 +7868,10 @@ function OUT_f () { var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"OUT_f\",sz(1),sz(2));"]);
this.x = new standard_define(new ScilabDouble([1,1]),model,exprs,gr_i);
this.x.graphics.style = new ScilabString(["OUT_f"]);
- return new ExplicitOutBlock(this.x);
+
+ this.explicitOutBlock = new ExplicitOutBlock(this.x);
+ this.displayParameter = [this.explicitOutBlock.ordering];
+ return this.explicitOutBlock;
}
OUT_f.prototype.details = function OUT_f() {
@@ -10462,6 +10505,90 @@ function SUM_f() { }
}
+function SUPER_f() {
+
+ SUPER_f.prototype.define = function SUPER_f() {
+ var scs = scicos_diagram();
+ scs.props.title = new ScilabString(["Super_Block"]);
+
+ var in1 = new IN_f().internal();
+ in1.graphics.orig = new ScilabDouble([40, 40]);
+ in1.graphics.sz = new ScilabDouble([20, 20]);
+ in1.graphics.flip = new ScilabBoolean([true]);
+ in1.graphics.pout = new ScilabDouble([0]);
+ in1.model.uid = new ScilabString([count]);
+ in1.doc = list(new ScilabString([count++]));
+
+ var out = new OUT_f().internal();
+ out.graphics.orig = new ScilabDouble([240, 40]);
+ out.graphics.sz = new ScilabDouble([20, 20]);
+ out.graphics.flip = new ScilabBoolean([true]);
+ out.graphics.pin = new ScilabDouble([0]);
+ out.model.outtyp = new ScilabDouble();
+ out.model.uid = new ScilabString([count]);
+ out.doc = list(new ScilabString([count++]));
+ scs.objs.push(in1);
+ scs.objs.push(out);
+
+ var model = scicos_model();
+ model.sim = new ScilabString(["super"]);
+ model.in = new ScilabDouble([1]);
+ model.out = new ScilabDouble([1]);
+ model.rpar = scs;
+ model.blocktype = new ScilabString(["h"]);
+ model.dep_ut = new ScilabBoolean([false, false]);
+
+ var gr_i = ["xstringb(orig(1),orig(2),\"SUPER_f\",sz(1),sz(2));"];
+ this.x = new standard_define(new ScilabDouble([2, 2]), model, new ScilabDouble(), gr_i);
+ return new SuperBlock(this.x);
+ }
+
+ SUPER_f.prototype.details = function SUPER_f() {
+ return this.x;
+ }
+}
+function Switch() {
+
+ Switch.prototype.define = function Switch() {
+ var model = scicos_model();
+
+ this.Ron = 0.01;
+ this.Roff = 1e5;
+ this.S = [["Ron"], ["Roff"]];
+
+ var scope = {
+ Ron: 0.01,
+ Roff: 1e5
+ }
+ this.Z = math.eval('[ Ron ; Roff ]', scope)._data;
+
+ model.sim = new ScilabString(["Switch"]);
+ model.blocktype = new ScilabString(["c"]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var mo = new modelica_function();
+ mo.model = model.sim;
+ mo.inputs = new ScilabString(["p"], ["inp"]);
+ mo.outputs = new ScilabString(["n"]);
+ mo.parameters = list(new ScilabString(...this.S), new ScilabDouble(...this.Z));
+ model.equations = mo;
+ model.in = new ScilabDouble(...ones(size(getData(mo.inputs), "*"), 1));
+ model.out = new ScilabDouble(...ones(size(getData(mo.outputs), "*"), 1));
+ model.rpar = new ScilabDouble(...this.Z);
+
+ var exprs = new ScilabString(...this.Z);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"Switch\",sz(1),sz(2));"]);
+ this.x = standard_define(new ScilabDouble([2, 2]), model, exprs, list(gr_i, new ScilabDouble(0)));
+ this.x.graphics.in_implicit = new ScilabString([["I"], ["E"]]);
+ this.x.graphics.out_implicit = new ScilabString(["I"]);
+ return new BasicBlock(this.x);
+ }
+
+ Switch.prototype.details = function Switch() {
+ this.x;
+ }
+}
function SWITCH2_m() {
SWITCH2_m.prototype.define = function SWITCH2_m() {
@@ -10709,3 +10836,359 @@ function TOWS_c() { return this.x;
}
}
+function TRASH_f() {
+
+ TRASH_f.prototype.define = function TRASH_f() {
+ this.in1 = -1;
+
+ var model = scicos_model();
+ model.sim = new ScilabString(["trash"]);
+ model.in = new ScilabDouble([this.in1]);
+ model.evtin = new ScilabDouble([1]);
+ model.blocktype = new ScilabString(["d"]);
+ model.dep_ut = new ScilabBoolean([false, false]);
+
+ var exprs = new ScilabString([" "]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"TRASH_f\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([2, 2]), model, exprs, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ TRASH_f.prototype.details = function TRASH_f() {
+ return this.x;
+ }
+}
+function TrigFun() {
+
+ TrigFun.prototype.define = function TrigFun() {
+ var model = scicos_model();
+ model.sim = list(new ScilabString(["sin_blk"]), new ScilabDouble([4]));
+ model.in = new ScilabDouble([-1]);
+ model.out = new ScilabDouble([-1]);
+ model.blocktype = new ScilabString(["c"]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var exprs = new ScilabString(["sin"]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"TrigFun\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([4, 2]), model, exprs, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ TrigFun.prototype.details = function TrigFun() {
+ return this.x;
+ }
+}
+function VanneReglante() {
+
+ VanneReglante.prototype.define = function VanneReglante() {
+ var model = scicos_model();
+ model.in = new ScilabDouble([1], [1]);
+ model.out = new ScilabDouble([1]);
+
+ this.Cvmax = 8005.42;
+ this.p_rho = 0;
+
+ model.rpar = new ScilabDouble([this.Cvmax], [this.p_rho]);
+ model.sim = new ScilabString(["VanneReglante"]);
+ model.blocktype = new ScilabString(["c"]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var mo = new modelica_function();
+ mo.model = new ScilabString(["VanneReglante"]);
+ mo.inputs = new ScilabString(["C1", "Ouv"]);
+ mo.outputs = new ScilabString(["C2"]);
+ mo.parameters = list(new ScilabString(["Cvmax"], ["p_rho"]), new ScilabDouble([this.Cvmax], [this.p_rho]));
+ model.equations = mo;
+ model.in = new ScilabDouble(...ones(size(getData(mo.inputs), "*"), 1));
+ model.out = new ScilabDouble(...ones(size(getData(mo.outputs), "*"), 1));
+
+ var exprs = new ScilabString([this.Cvmax], [this.p_rho]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"VanneReglante\",sz(1),sz(2));"]);
+ this.x = standard_define([2, 2], model, exprs, list(gr_i, new ScilabDouble([0])));
+ this.x.graphics.in_implicit = new ScilabString(["I"], ["E"]);
+ this.x.graphics.out_implicit = new ScilabString(["I"]);
+ return new BasicBlock(this.x);
+ }
+
+ VanneReglante.prototype.details = function VanneReglante() {
+ return this.x;
+ }
+}
+function VariableResistor() {
+
+ VariableResistor.prototype.define = function VariableResistor() {
+ var model = scicos_model();
+ model.sim = new ScilabString(["VariableResistor"]);
+ model.blocktype = new ScilabString(["c"]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var mo = new modelica_function();
+ mo.model = new ScilabString(["VariableResistor"]);
+ mo.inputs = new ScilabString(["p", "R"]);
+ mo.outputs = new ScilabString(["n"]);
+ model.equations = mo;
+ model.in = new ScilabDouble(...ones(size(getData(mo.inputs), "*"), 1));
+ model.out = new ScilabDouble(...ones(size(getData(mo.outputs), "*"), 1));
+
+ var exprs = new ScilabDouble();
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"VariableResistor\",sz(1),sz(2));"]);;
+ this.x = standard_define([2, 2], model, exprs, list(gr_i, 0));
+ this.x.graphics.in_implicit = new ScilabString(["I", "E"]);
+ this.x.graphics.out_implicit = new ScilabString(["I"]);
+ return new BasicBlock(this.x);
+ }
+
+ VariableResistor.prototype.details = function VariableResistor() {
+ return this.x;
+ }
+}
+function VARIABLE_DELAY() {
+
+ VARIABLE_DELAY.prototype.define = function VARIABLE_DELAY() {
+ this.nin = 1;
+ this.T = 1;
+ this.init = 0;
+ this.N = 1024;
+
+ var model = scicos_model();
+ model.sim = list(new ScilabString(["variable_delay"]), new ScilabDouble([4]));
+ model.in = new ScilabDouble([this.nin], [1]);
+ model.out = new ScilabDouble([this.nin]);
+ model.rpar = new ScilabDouble([this.T, this.init]);
+ model.ipar = new ScilabDouble([this.N]);
+ model.blocktype = new ScilabString(["d"]);
+ model.dep_ut = new ScilabBoolean([false, false]);
+
+ var exprs = new ScilabString([this.T], [this.init], [this.N]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"VARIABLE_DELAY\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([3, 2]), model, exprs, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ VARIABLE_DELAY.prototype.details = function VARIABLE_DELAY() {
+ return this.x;
+ }
+}
+function VirtualCLK0() {
+
+ VirtualCLK0.prototype.define = function VirtualCLK0() {
+ var model = scicos_model();
+ model.sim = new ScilabString(["vrtclk0"]);
+ model.evtin = new ScilabDouble([1]);
+ model.opar = list();
+ model.ipar = new ScilabDouble();
+ model.blocktype = new ScilabString(["d"]);
+ model.firing = new ScilabDouble([-1]);
+ model.dep_ut = new ScilabBoolean([false, false]);
+
+ var exprs = new ScilabDouble();
+ this.x = new standard_define(new ScilabDouble([2, 2]), model, exprs, new ScilabString([" "]));
+ return new BasicBlock(this.x);
+ }
+
+ VirtualCLK0.prototype.details = function VirtualCLK0() {
+ return this.x;
+ }
+
+}
+function VoltageSensor() {
+
+ VoltageSensor.prototype.define = function VoltageSensor() {
+ var model = scicos_model();
+ model.in = new ScilabDouble([1]);
+ model.out = new ScilabDouble([1], [, 1]);
+ model.sim = new ScilabString(["VoltageSensor"]);
+ model.blocktype = new ScilabString(["c"]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var mo = new modelica_function();
+ mo.model = new ScilabString(["VoltageSensor"]);
+ mo.inputs = new ScilabString(["p"]);
+ mo.outputs = new ScilabString(["n"], ["v"]);
+ model.equations = mo;
+
+ var exprs = new ScilabDouble();
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"VoltageSensor\",sz(1),sz(2));"]);;
+ this.x = standard_define([2, 2], model, exprs, list(gr_i, new ScilabDouble([0])));
+ this.x.graphics.in_implicit = new ScilabString(["I"]);
+ this.x.graphics.out_implicit = new ScilabString(["I"], ["E"]);
+ return new VoltageSensorBlock(this.x);
+ }
+
+ VoltageSensor.prototype.details = function VoltageSensor() {
+ return this.x;
+ }
+}
+function VsourceAC() {
+
+ VsourceAC.prototype.define = function VsourceAC() {
+ var model = scicos_model();
+ model.in = new ScilabDouble([1]);
+ model.out = new ScilabDouble([1]);
+
+ this.VA = 220;
+
+ this.FR = 50;
+ model.rpar = new ScilabDouble([this.VA], [this.FR]);
+ model.sim = new ScilabString(["VsourceAC"]);
+ model.blocktype = new ScilabString(["c"]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var mo = modelica_function();
+ mo.model = new ScilabString(["VsourceAC"]);
+ mo.inputs = new ScilabString(["p"]);
+ mo.outputs = new ScilabString(["n"]);
+ mo.parameters = list(new ScilabString(["VA"], ["f"]), list(new ScilabDouble([this.VA]), new ScilabDouble([this.FR])));
+ model.equations = mo;
+
+ var exprs = new ScilabString([this.VA], [this.FR]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"VsourceAC\",sz(1),sz(2));"]);
+
+ this.x = standard_define([2, 2], model, exprs, list(gr_i, 0));
+ this.x.graphics.in_implicit = new ScilabString(["I"]);
+ this.x.graphics.out_implicit = new ScilabString(["I"]);
+
+ return new BasicBlock(this.x);
+ }
+
+ VsourceAC.prototype.details = function VsourceAC() {
+ return this.x;
+ }
+}
+function VVsourceAC() {
+
+ VVsourceAC.prototype.define = function VVsourceAC() {
+ var model = scicos_model();
+
+ model.in = new ScilabDouble([1], [1]);
+ model.out = new ScilabDouble([1]);
+
+ this.VA = 220;
+ this.FR = 50;
+
+ model.rpar = new ScilabDouble([this.FR]);
+ model.sim = new ScilabString(["VVsourceAC"]);
+ model.blocktype = new ScilabString(["c"]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var mo = modelica_function();
+ mo.model = new ScilabString(["VVsourceAC"]);
+ mo.inputs = new ScilabString(["p", "VA"]);
+ mo.outputs = new ScilabString(["n"]);
+ mo.parameters = list(new ScilabString(["f"]), list(new ScilabDouble([this.FR])));
+ model.equations = mo;
+
+ var exprs = new ScilabString([this.FR]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"VVsourceAC\",sz(1),sz(2));"]);
+
+
+ this.x = standard_define([2, 2], model, exprs, list(gr_i, 0));
+ this.x.graphics.in_implicit = new ScilabString(["I", "E"]);
+ this.x.graphics.out_implicit = new ScilabString(["I"]);
+
+ return new BasicBlock(this.x);
+ }
+
+ VVsourceAC.prototype.details = function VVsourceAC() {
+ return this.x;
+ }
+}
+function WRITEAU_f() {
+
+ WRITEAU_f.prototype.define = function WRITEAU_f() {
+ this.in1 = 1;
+ this.nin = math.sum(this.in1);
+ this.frmt = "uc ";
+ this.fname = "/dev/audio";
+ this.swap = 0;
+ this.lunit = 0;
+ this.N = 2;
+
+ var model = scicos_model();
+ model.sim = list(new ScilabString(["writeau"]), new ScilabDouble([2]));
+ model.in = new ScilabDouble([this.in1]);
+ model.evtin = new ScilabDouble([1]);
+ model.dstate = new ScilabDouble([-1], [this.lunit], ...zeros((this.nin + 1) * this.N, 1));
+ model.ipar = new ScilabDouble([this.fname.length], ..._str2code(this.frmt), [this.N], [this.swap], ..._str2code(this.fname));
+ model.blocktype = new ScilabString(["d"]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var exprs = new ScilabString([this.N], [this.swap]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"WRITEAU_f\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([4, 2]), model, exprs, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ WRITEAU_f.prototype.details = function WRITEAU_f() {
+ return this.x;
+ }
+}
+function WRITEC_f() {
+
+ WRITEC_f.prototype.define = function WRITEC_f() {
+ this.in = 1;
+ this.nin = math.sum(this.in);
+ this.frmt = "c ";
+ this.fname = "foo";
+ this.swap = 0;
+ this.lunit = 0;
+ this.N = 2;
+
+ var model = scicos_model();
+ model.sim = list(new ScilabString(["writec"]), new ScilabDouble([2]));
+ model.in = new ScilabDouble([this.in]);
+ model.evtin = new ScilabDouble([1]);
+ model.dstate = new ScilabDouble([-1], [this.lunit], ...zeros((this.nin + 1) * this.N, 1));
+ model.ipar = new ScilabDouble([this.fname.length], ..._str2code(this.frmt), [this.N], [this.swap], ..._str2code(this.fname));
+ model.blocktype = new ScilabString(["d"]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var exprs = new ScilabString([sci2exp(this.in)], [this.fname], [this.frmt], [this.N], [this.swap]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"WRITEC_f\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([4, 2]), model, exprs, gr_i);
+ return new BasicBlock(this.x);
+ }
+
+ WRITEC_f.prototype.details = function WRITEC_f() {
+ return this.x;
+ }
+}
+function ZCROSS_f() {
+
+ ZCROSS_f.prototype.define = function ZCROSS_f() {
+ this.rpar = [[-1], [-1], [0], [0]];
+
+ this.in = 1;
+
+ var model = scicos_model();
+ model.sim = list(new ScilabString(["zcross"]), new ScilabDouble([1]));
+ model.in = new ScilabDouble([this.in]);
+ model.nzcross = new ScilabDouble([this.in]);
+ model.evtout = new ScilabDouble([1]);
+ model.rpar = new ScilabDouble([-1], [-1], [0], [0]);
+ model.blocktype = new ScilabString(["z"]);
+ model.firing = new ScilabDouble([-1]);
+ model.dep_ut = new ScilabBoolean([true, false]);
+
+ var exprs = new ScilabString([sci2exp(this.in)]);
+
+ var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"ZCROSS_f\",sz(1),sz(2));"]);
+ this.x = new standard_define(new ScilabDouble([2, 2]), model, exprs, gr_i);
+
+ return new BasicBlock(this.x);
+ }
+
+ ZCROSS_f.prototype.details = function ZCROSS_f() {
+ return this.x;
+ }
+}
diff --git a/data_structures_correct/INIMPL_f.js b/data_structures_correct/INIMPL_f.js index 68555d7..81d2374 100644 --- a/data_structures_correct/INIMPL_f.js +++ b/data_structures_correct/INIMPL_f.js @@ -20,7 +20,10 @@ function INIMPL_f() { var gr_i = new ScilabString(["xstringb(orig(1),orig(2),"INIMPL_f",sz(1),sz(2));"]);
this.x = new standard_define(new ScilabDouble([1, 1]), model, exprs, gr_i);
this.x.graphics.out_implicit = new ScilabString(["I"]);
- return new ImplicitInBlock(this.x);
+
+ this.implicitInBlock = new ImplicitInBlock(this.x);
+ this.displayParameter = [this.implicitInBlock.ordering];
+ return this.implicitInBlock;
}
INIMPL_f.prototype.details = function INIMPL_f() {
return this.x;
diff --git a/data_structures_correct/IN_f.js b/data_structures_correct/IN_f.js index 1a2545a..c269a7a 100644 --- a/data_structures_correct/IN_f.js +++ b/data_structures_correct/IN_f.js @@ -39,7 +39,11 @@ function IN_f () { var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"IN_f\",sz(1),sz(2));"]); this.x = new standard_define(new ScilabDouble([1,1]),model,exprs,gr_i); - return new ExplicitInBlock(this.x); + + this.explicitInBlock = new ExplicitInBlock(this.x); + this.displayParameter = [this.explicitInBlock.ordering]; + return this.explicitInBlock; + } IN_f.prototype.details = function IN_f() { diff --git a/data_structures_correct/LOGIC.js b/data_structures_correct/LOGIC.js new file mode 100644 index 0000000..0c1db7e --- /dev/null +++ b/data_structures_correct/LOGIC.js @@ -0,0 +1,30 @@ +function LOGIC() { + + LOGIC.prototype.define = function LOGIC() { + this.mat = [[0],[0],[0],[1]]; + + var model = scicos_model(); + model.sim = list(new ScilabString(["logic"]), new ScilabDouble([4])); + model.in = new ScilabDouble([1], [1]); + model.in2 = new ScilabDouble([1], [1]); + model.out = new ScilabDouble([1]); + model.out2 = new ScilabDouble([1]); + model.evtin = new ScilabDouble([1]); + model.intyp = new ScilabDouble([5, 5]); + model.outtyp = new ScilabDouble([5]); + model.opar = list(int8(...this.mat)); + model.blocktype = new ScilabString(["c"]); + model.firing = new ScilabBoolean([false]); + model.dep_ut = new ScilabBoolean([true, false]); + + var exprs = new ScilabString([sci2exp(this.mat)], [sci2exp(0)]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"LOGIC\",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([2, 2]), model, exprs, gr_i); + return new BasicBlock(this.x); + } + + LOGIC.prototype.details = function LOGIC() { + return this.x; + } +} diff --git a/data_structures_correct/OUTIMPL_f.js b/data_structures_correct/OUTIMPL_f.js index 25207b3..82cd6c2 100644 --- a/data_structures_correct/OUTIMPL_f.js +++ b/data_structures_correct/OUTIMPL_f.js @@ -22,7 +22,10 @@ function OUTIMPL_f() { var gr_i = new ScilabString(["xstringb(orig(1),orig(2),"OUTIMPL_f",sz(1),sz(2));"]);
this.x = new standard_define(new ScilabDouble([1, 1]), model, exprs, gr_i);
this.x.graphics.in_implicit = new ScilabString(["I"]);
- return new ImplicitOutBlock(this.x);
+
+ this.implicitOutBlock = new ImplicitOutBlock(this.x);
+ this.displayParameter = [this.implicitOutBlock.ordering];
+ return this.implicitOutBlock;
}
OUTIMPL_f.prototype.details = function OUTIMPL_f() {
return this.x;
diff --git a/data_structures_correct/OUT_f.js b/data_structures_correct/OUT_f.js index 277148c..e480a65 100644 --- a/data_structures_correct/OUT_f.js +++ b/data_structures_correct/OUT_f.js @@ -41,7 +41,10 @@ function OUT_f () { var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"OUT_f\",sz(1),sz(2));"]); this.x = new standard_define(new ScilabDouble([1,1]),model,exprs,gr_i); this.x.graphics.style = new ScilabString(["OUT_f"]); - return new ExplicitOutBlock(this.x); + + this.explicitOutBlock = new ExplicitOutBlock(this.x); + this.displayParameter = [this.explicitOutBlock.ordering]; + return this.explicitOutBlock; } OUT_f.prototype.details = function OUT_f() { diff --git a/data_structures_correct/SUPER_f.js b/data_structures_correct/SUPER_f.js new file mode 100644 index 0000000..fb95e3a --- /dev/null +++ b/data_structures_correct/SUPER_f.js @@ -0,0 +1,42 @@ +function SUPER_f() { + + SUPER_f.prototype.define = function SUPER_f() { + var scs = scicos_diagram(); + scs.props.title = new ScilabString(["Super_Block"]); + + var in1 = new IN_f().internal(); + in1.graphics.orig = new ScilabDouble([40, 40]); + in1.graphics.sz = new ScilabDouble([20, 20]); + in1.graphics.flip = new ScilabBoolean([true]); + in1.graphics.pout = new ScilabDouble([0]); + in1.model.uid = new ScilabString([count]); + in1.doc = list(new ScilabString([count++])); + + var out = new OUT_f().internal(); + out.graphics.orig = new ScilabDouble([240, 40]); + out.graphics.sz = new ScilabDouble([20, 20]); + out.graphics.flip = new ScilabBoolean([true]); + out.graphics.pin = new ScilabDouble([0]); + out.model.outtyp = new ScilabDouble(); + out.model.uid = new ScilabString([count]); + out.doc = list(new ScilabString([count++])); + scs.objs.push(in1); + scs.objs.push(out); + + var model = scicos_model(); + model.sim = new ScilabString(["super"]); + model.in = new ScilabDouble([1]); + model.out = new ScilabDouble([1]); + model.rpar = scs; + model.blocktype = new ScilabString(["h"]); + model.dep_ut = new ScilabBoolean([false, false]); + + var gr_i = ["xstringb(orig(1),orig(2),\"SUPER_f\",sz(1),sz(2));"]; + this.x = new standard_define(new ScilabDouble([2, 2]), model, new ScilabDouble(), gr_i); + return new SuperBlock(this.x); + } + + SUPER_f.prototype.details = function SUPER_f() { + return this.x; + } +} diff --git a/data_structures_correct/Switch.js b/data_structures_correct/Switch.js new file mode 100644 index 0000000..79c5736 --- /dev/null +++ b/data_structures_correct/Switch.js @@ -0,0 +1,42 @@ +function Switch() { + + Switch.prototype.define = function Switch() { + var model = scicos_model(); + + this.Ron = 0.01; + this.Roff = 1e5; + this.S = [["Ron"], ["Roff"]]; + + var scope = { + Ron: 0.01, + Roff: 1e5 + } + this.Z = math.eval('[ Ron ; Roff ]', scope)._data; + + model.sim = new ScilabString(["Switch"]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([true, false]); + + var mo = new modelica_function(); + mo.model = model.sim; + mo.inputs = new ScilabString(["p"], ["inp"]); + mo.outputs = new ScilabString(["n"]); + mo.parameters = list(new ScilabString(...this.S), new ScilabDouble(...this.Z)); + model.equations = mo; + model.in = new ScilabDouble(...ones(size(getData(mo.inputs), "*"), 1)); + model.out = new ScilabDouble(...ones(size(getData(mo.outputs), "*"), 1)); + model.rpar = new ScilabDouble(...this.Z); + + var exprs = new ScilabString(...this.Z); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"Switch\",sz(1),sz(2));"]); + this.x = standard_define(new ScilabDouble([2, 2]), model, exprs, list(gr_i, new ScilabDouble(0))); + this.x.graphics.in_implicit = new ScilabString([["I"], ["E"]]); + this.x.graphics.out_implicit = new ScilabString(["I"]); + return new BasicBlock(this.x); + } + + Switch.prototype.details = function Switch() { + this.x; + } +} diff --git a/data_structures_correct/TRASH_f.js b/data_structures_correct/TRASH_f.js new file mode 100644 index 0000000..27da7c0 --- /dev/null +++ b/data_structures_correct/TRASH_f.js @@ -0,0 +1,23 @@ +function TRASH_f() { + + TRASH_f.prototype.define = function TRASH_f() { + this.in1 = -1; + + var model = scicos_model(); + model.sim = new ScilabString(["trash"]); + model.in = new ScilabDouble([this.in1]); + model.evtin = new ScilabDouble([1]); + model.blocktype = new ScilabString(["d"]); + model.dep_ut = new ScilabBoolean([false, false]); + + var exprs = new ScilabString([" "]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"TRASH_f\",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([2, 2]), model, exprs, gr_i); + return new BasicBlock(this.x); + } + + TRASH_f.prototype.details = function TRASH_f() { + return this.x; + } +} diff --git a/data_structures_correct/TrigFun.js b/data_structures_correct/TrigFun.js new file mode 100644 index 0000000..e23141c --- /dev/null +++ b/data_structures_correct/TrigFun.js @@ -0,0 +1,21 @@ +function TrigFun() { + + TrigFun.prototype.define = function TrigFun() { + var model = scicos_model(); + model.sim = list(new ScilabString(["sin_blk"]), new ScilabDouble([4])); + model.in = new ScilabDouble([-1]); + model.out = new ScilabDouble([-1]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([true, false]); + + var exprs = new ScilabString(["sin"]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"TrigFun\",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([4, 2]), model, exprs, gr_i); + return new BasicBlock(this.x); + } + + TrigFun.prototype.details = function TrigFun() { + return this.x; + } +} diff --git a/data_structures_correct/VARIABLE_DELAY.js b/data_structures_correct/VARIABLE_DELAY.js new file mode 100644 index 0000000..11f8d4b --- /dev/null +++ b/data_structures_correct/VARIABLE_DELAY.js @@ -0,0 +1,28 @@ +function VARIABLE_DELAY() { + + VARIABLE_DELAY.prototype.define = function VARIABLE_DELAY() { + this.nin = 1; + this.T = 1; + this.init = 0; + this.N = 1024; + + var model = scicos_model(); + model.sim = list(new ScilabString(["variable_delay"]), new ScilabDouble([4])); + model.in = new ScilabDouble([this.nin], [1]); + model.out = new ScilabDouble([this.nin]); + model.rpar = new ScilabDouble([this.T, this.init]); + model.ipar = new ScilabDouble([this.N]); + model.blocktype = new ScilabString(["d"]); + model.dep_ut = new ScilabBoolean([false, false]); + + var exprs = new ScilabString([this.T], [this.init], [this.N]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"VARIABLE_DELAY\",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([3, 2]), model, exprs, gr_i); + return new BasicBlock(this.x); + } + + VARIABLE_DELAY.prototype.details = function VARIABLE_DELAY() { + return this.x; + } +} diff --git a/data_structures_correct/VVsourceAC.js b/data_structures_correct/VVsourceAC.js new file mode 100644 index 0000000..120b3bb --- /dev/null +++ b/data_structures_correct/VVsourceAC.js @@ -0,0 +1,39 @@ +function VVsourceAC() { + + VVsourceAC.prototype.define = function VVsourceAC() { + var model = scicos_model(); + + model.in = new ScilabDouble([1], [1]); + model.out = new ScilabDouble([1]); + + this.VA = 220; + this.FR = 50; + + model.rpar = new ScilabDouble([this.FR]); + model.sim = new ScilabString(["VVsourceAC"]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([true, false]); + + var mo = modelica_function(); + mo.model = new ScilabString(["VVsourceAC"]); + mo.inputs = new ScilabString(["p", "VA"]); + mo.outputs = new ScilabString(["n"]); + mo.parameters = list(new ScilabString(["f"]), list(new ScilabDouble([this.FR]))); + model.equations = mo; + + var exprs = new ScilabString([this.FR]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"VVsourceAC\",sz(1),sz(2));"]); + + + this.x = standard_define([2, 2], model, exprs, list(gr_i, 0)); + this.x.graphics.in_implicit = new ScilabString(["I", "E"]); + this.x.graphics.out_implicit = new ScilabString(["I"]); + + return new BasicBlock(this.x); + } + + VVsourceAC.prototype.details = function VVsourceAC() { + return this.x; + } +} diff --git a/data_structures_correct/VanneReglante.js b/data_structures_correct/VanneReglante.js new file mode 100644 index 0000000..a501c2f --- /dev/null +++ b/data_structures_correct/VanneReglante.js @@ -0,0 +1,37 @@ +function VanneReglante() { + + VanneReglante.prototype.define = function VanneReglante() { + var model = scicos_model(); + model.in = new ScilabDouble([1], [1]); + model.out = new ScilabDouble([1]); + + this.Cvmax = 8005.42; + this.p_rho = 0; + + model.rpar = new ScilabDouble([this.Cvmax], [this.p_rho]); + model.sim = new ScilabString(["VanneReglante"]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([true, false]); + + var mo = new modelica_function(); + mo.model = new ScilabString(["VanneReglante"]); + mo.inputs = new ScilabString(["C1", "Ouv"]); + mo.outputs = new ScilabString(["C2"]); + mo.parameters = list(new ScilabString(["Cvmax"], ["p_rho"]), new ScilabDouble([this.Cvmax], [this.p_rho])); + model.equations = mo; + model.in = new ScilabDouble(...ones(size(getData(mo.inputs), "*"), 1)); + model.out = new ScilabDouble(...ones(size(getData(mo.outputs), "*"), 1)); + + var exprs = new ScilabString([this.Cvmax], [this.p_rho]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"VanneReglante\",sz(1),sz(2));"]); + this.x = standard_define([2, 2], model, exprs, list(gr_i, new ScilabDouble([0]))); + this.x.graphics.in_implicit = new ScilabString(["I"], ["E"]); + this.x.graphics.out_implicit = new ScilabString(["I"]); + return new BasicBlock(this.x); + } + + VanneReglante.prototype.details = function VanneReglante() { + return this.x; + } +} diff --git a/data_structures_correct/VariableResistor.js b/data_structures_correct/VariableResistor.js new file mode 100644 index 0000000..4e5a5e1 --- /dev/null +++ b/data_structures_correct/VariableResistor.js @@ -0,0 +1,29 @@ +function VariableResistor() { + + VariableResistor.prototype.define = function VariableResistor() { + var model = scicos_model(); + model.sim = new ScilabString(["VariableResistor"]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([true, false]); + + var mo = new modelica_function(); + mo.model = new ScilabString(["VariableResistor"]); + mo.inputs = new ScilabString(["p", "R"]); + mo.outputs = new ScilabString(["n"]); + model.equations = mo; + model.in = new ScilabDouble(...ones(size(getData(mo.inputs), "*"), 1)); + model.out = new ScilabDouble(...ones(size(getData(mo.outputs), "*"), 1)); + + var exprs = new ScilabDouble(); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"VariableResistor\",sz(1),sz(2));"]);; + this.x = standard_define([2, 2], model, exprs, list(gr_i, 0)); + this.x.graphics.in_implicit = new ScilabString(["I", "E"]); + this.x.graphics.out_implicit = new ScilabString(["I"]); + return new BasicBlock(this.x); + } + + VariableResistor.prototype.details = function VariableResistor() { + return this.x; + } +} diff --git a/data_structures_correct/VirtualCLK0.js b/data_structures_correct/VirtualCLK0.js new file mode 100644 index 0000000..79f8e6e --- /dev/null +++ b/data_structures_correct/VirtualCLK0.js @@ -0,0 +1,22 @@ +function VirtualCLK0() { + + VirtualCLK0.prototype.define = function VirtualCLK0() { + var model = scicos_model(); + model.sim = new ScilabString(["vrtclk0"]); + model.evtin = new ScilabDouble([1]); + model.opar = list(); + model.ipar = new ScilabDouble(); + model.blocktype = new ScilabString(["d"]); + model.firing = new ScilabDouble([-1]); + model.dep_ut = new ScilabBoolean([false, false]); + + var exprs = new ScilabDouble(); + this.x = new standard_define(new ScilabDouble([2, 2]), model, exprs, new ScilabString([" "])); + return new BasicBlock(this.x); + } + + VirtualCLK0.prototype.details = function VirtualCLK0() { + return this.x; + } + +} diff --git a/data_structures_correct/VoltageSensor.js b/data_structures_correct/VoltageSensor.js new file mode 100644 index 0000000..0d00317 --- /dev/null +++ b/data_structures_correct/VoltageSensor.js @@ -0,0 +1,29 @@ +function VoltageSensor() { + + VoltageSensor.prototype.define = function VoltageSensor() { + var model = scicos_model(); + model.in = new ScilabDouble([1]); + model.out = new ScilabDouble([1], [, 1]); + model.sim = new ScilabString(["VoltageSensor"]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([true, false]); + + var mo = new modelica_function(); + mo.model = new ScilabString(["VoltageSensor"]); + mo.inputs = new ScilabString(["p"]); + mo.outputs = new ScilabString(["n"], ["v"]); + model.equations = mo; + + var exprs = new ScilabDouble(); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"VoltageSensor\",sz(1),sz(2));"]);; + this.x = standard_define([2, 2], model, exprs, list(gr_i, new ScilabDouble([0]))); + this.x.graphics.in_implicit = new ScilabString(["I"]); + this.x.graphics.out_implicit = new ScilabString(["I"], ["E"]); + return new VoltageSensorBlock(this.x); + } + + VoltageSensor.prototype.details = function VoltageSensor() { + return this.x; + } +} diff --git a/data_structures_correct/VsourceAC.js b/data_structures_correct/VsourceAC.js new file mode 100644 index 0000000..59cc3b4 --- /dev/null +++ b/data_structures_correct/VsourceAC.js @@ -0,0 +1,37 @@ +function VsourceAC() { + + VsourceAC.prototype.define = function VsourceAC() { + var model = scicos_model(); + model.in = new ScilabDouble([1]); + model.out = new ScilabDouble([1]); + + this.VA = 220; + + this.FR = 50; + model.rpar = new ScilabDouble([this.VA], [this.FR]); + model.sim = new ScilabString(["VsourceAC"]); + model.blocktype = new ScilabString(["c"]); + model.dep_ut = new ScilabBoolean([true, false]); + + var mo = modelica_function(); + mo.model = new ScilabString(["VsourceAC"]); + mo.inputs = new ScilabString(["p"]); + mo.outputs = new ScilabString(["n"]); + mo.parameters = list(new ScilabString(["VA"], ["f"]), list(new ScilabDouble([this.VA]), new ScilabDouble([this.FR]))); + model.equations = mo; + + var exprs = new ScilabString([this.VA], [this.FR]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"VsourceAC\",sz(1),sz(2));"]); + + this.x = standard_define([2, 2], model, exprs, list(gr_i, 0)); + this.x.graphics.in_implicit = new ScilabString(["I"]); + this.x.graphics.out_implicit = new ScilabString(["I"]); + + return new BasicBlock(this.x); + } + + VsourceAC.prototype.details = function VsourceAC() { + return this.x; + } +} diff --git a/data_structures_correct/WRITEAU_f.js b/data_structures_correct/WRITEAU_f.js new file mode 100644 index 0000000..8bc9657 --- /dev/null +++ b/data_structures_correct/WRITEAU_f.js @@ -0,0 +1,31 @@ +function WRITEAU_f() { + + WRITEAU_f.prototype.define = function WRITEAU_f() { + this.in1 = 1; + this.nin = math.sum(this.in1); + this.frmt = "uc "; + this.fname = "/dev/audio"; + this.swap = 0; + this.lunit = 0; + this.N = 2; + + var model = scicos_model(); + model.sim = list(new ScilabString(["writeau"]), new ScilabDouble([2])); + model.in = new ScilabDouble([this.in1]); + model.evtin = new ScilabDouble([1]); + model.dstate = new ScilabDouble([-1], [this.lunit], ...zeros((this.nin + 1) * this.N, 1)); + model.ipar = new ScilabDouble([this.fname.length], ..._str2code(this.frmt), [this.N], [this.swap], ..._str2code(this.fname)); + model.blocktype = new ScilabString(["d"]); + model.dep_ut = new ScilabBoolean([true, false]); + + var exprs = new ScilabString([this.N], [this.swap]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"WRITEAU_f\",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([4, 2]), model, exprs, gr_i); + return new BasicBlock(this.x); + } + + WRITEAU_f.prototype.details = function WRITEAU_f() { + return this.x; + } +} diff --git a/data_structures_correct/WRITEC_f.js b/data_structures_correct/WRITEC_f.js new file mode 100644 index 0000000..0e6fefa --- /dev/null +++ b/data_structures_correct/WRITEC_f.js @@ -0,0 +1,31 @@ +function WRITEC_f() { + + WRITEC_f.prototype.define = function WRITEC_f() { + this.in = 1; + this.nin = math.sum(this.in); + this.frmt = "c "; + this.fname = "foo"; + this.swap = 0; + this.lunit = 0; + this.N = 2; + + var model = scicos_model(); + model.sim = list(new ScilabString(["writec"]), new ScilabDouble([2])); + model.in = new ScilabDouble([this.in]); + model.evtin = new ScilabDouble([1]); + model.dstate = new ScilabDouble([-1], [this.lunit], ...zeros((this.nin + 1) * this.N, 1)); + model.ipar = new ScilabDouble([this.fname.length], ..._str2code(this.frmt), [this.N], [this.swap], ..._str2code(this.fname)); + model.blocktype = new ScilabString(["d"]); + model.dep_ut = new ScilabBoolean([true, false]); + + var exprs = new ScilabString([sci2exp(this.in)], [this.fname], [this.frmt], [this.N], [this.swap]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"WRITEC_f\",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([4, 2]), model, exprs, gr_i); + return new BasicBlock(this.x); + } + + WRITEC_f.prototype.details = function WRITEC_f() { + return this.x; + } +} diff --git a/data_structures_correct/ZCROSS_f.js b/data_structures_correct/ZCROSS_f.js new file mode 100644 index 0000000..8d2e66a --- /dev/null +++ b/data_structures_correct/ZCROSS_f.js @@ -0,0 +1,29 @@ +function ZCROSS_f() { + + ZCROSS_f.prototype.define = function ZCROSS_f() { + this.rpar = [[-1], [-1], [0], [0]]; + + this.in = 1; + + var model = scicos_model(); + model.sim = list(new ScilabString(["zcross"]), new ScilabDouble([1])); + model.in = new ScilabDouble([this.in]); + model.nzcross = new ScilabDouble([this.in]); + model.evtout = new ScilabDouble([1]); + model.rpar = new ScilabDouble([-1], [-1], [0], [0]); + model.blocktype = new ScilabString(["z"]); + model.firing = new ScilabDouble([-1]); + model.dep_ut = new ScilabBoolean([true, false]); + + var exprs = new ScilabString([sci2exp(this.in)]); + + var gr_i = new ScilabString(["xstringb(orig(1),orig(2),\"ZCROSS_f\",sz(1),sz(2));"]); + this.x = new standard_define(new ScilabDouble([2, 2]), model, exprs, gr_i); + + return new BasicBlock(this.x); + } + + ZCROSS_f.prototype.details = function ZCROSS_f() { + return this.x; + } +} diff --git a/dependencies.js b/dependencies.js index 4e44388..2c09e5e 100644 --- a/dependencies.js +++ b/dependencies.js @@ -15,7 +15,7 @@ $.ajax({ url: "/data_structures_correct/" }, success: function (data) { - + // @Parameter: data will have the required filenames in the mentioned folder // For each url, add the script to the body div element with getScript function for (i in data) { @@ -25,6 +25,47 @@ $.ajax({ }); */ +// Added to handle ordering for a few blocks. + +window.inBitMap='0'; +window.outBitMap='0'; + +String.prototype.replaceAt=function(index, character) { + return this.substr(0, index) + character + this.substr(index+character.length); +} + +/* + Maverick, Adhitya + ImplicitInBlock, ImplicitOutBlock, ExplicitInBlock, ExplicitOutBlock + These blocks need their orderings to be handled. + We are using a bitmap to do the same. +*/ + +function handleOrdering(inOrOut){ + var bitmap; + if(inOrOut=='in'){ + bitmap=window.inBitMap; + } + else{ + bitmap=window.outBitMap; + } + var index = bitmap.indexOf('0'); + if(index == -1){ + bitmap += '0'; + index = bitmap.indexOf('0'); + } + bitmap = bitmap.replaceAt(index,'1'); + if(inOrOut=='in'){ + window.inBitMap=bitmap; + } + else{ + window.outBitMap=bitmap; + } + var position = 1+index; + + return position; +} + function AfficheBlock() { if (arguments.length > 0) { var options = arguments[0]; @@ -682,7 +723,7 @@ function ImplicitOutBlock() { this.dependsOnT = "1"; this.id = options.id; this.interfaceFunctionName = arguments.callee.caller.name; - this.ordering = options.ordering; + this.ordering = handleOrdering('out'); this.parent = options.parent; if (options.model.sim instanceof Array) { this.simulationFunctionName = getData(options.model.sim[0])[0]; @@ -767,7 +808,7 @@ function ImplicitInBlock() { this.dependsOnT = "1"; this.id = options.id; this.interfaceFunctionName = arguments.callee.caller.name; - this.ordering = options.ordering; + this.ordering = handleOrdering('in'); this.parent = options.parent; if (options.model.sim instanceof Array) { this.simulationFunctionName = getData(options.model.sim[0])[0]; @@ -847,7 +888,7 @@ function ExplicitInBlock() { this.connectable = options.connectable; // Not Known this.id = options.id; this.interfaceFunctionName = arguments.callee.caller.name; - this.ordering = options.ordering; + this.ordering = handleOrdering('in'); this.parent = options.parent; if (options.model.sim instanceof Array) { this.simulationFunctionName = getData(options.model.sim[0])[0]; @@ -919,6 +960,7 @@ function ExplicitInBlock() { } } + function ExplicitOutBlock() { if (arguments.length > 0) { var options = arguments[0]; @@ -927,7 +969,7 @@ function ExplicitOutBlock() { this.connectable = options.connectable; // Not Known this.id = options.id; this.interfaceFunctionName = arguments.callee.caller.name; - this.ordering = options.ordering; + this.ordering = handleOrdering('out'); this.parent = options.parent; if (options.model.sim instanceof Array) { this.simulationFunctionName = getData(options.model.sim[0])[0]; @@ -999,6 +1041,86 @@ function ExplicitOutBlock() { } } +function VoltageSensorBlock() { + if (arguments.length > 0) { + var options = arguments[0]; + this.angle = options.angle; // Not Known + this.blockType = getData(options.model.blocktype)[0]; + this.connectable = options.connectable; // Not Known + var dep_ut = getData(options.model.dep_ut); + if (dep_ut[0] == "true") + this.dependsOnU = "1"; + this.id = options.id; + this.interfaceFunctionName = arguments.callee.caller.name; + this.ordering = options.ordering; + this.parent = options.parent; + if (options.model.sim instanceof Array) { + this.simulationFunctionName = getData(options.model.sim[0])[0]; + var func_type; + switch (getData(options.model.sim[1])[0].toString()) { + case "-2.0": + func_type = "ESELECT"; + break; + case "-1.0": + func_type = "IFTHENELSE"; + break; + case "1.0": + func_type = "TYPE_1"; + break; + case "2.0": + func_type = "TYPE_2"; + break; + case "3.0": + func_type = "TYPE_3"; + break; + case "4.0": + func_type = "C_OR_FORTRAN"; + break; + case "5.0": + func_type = "SCILAB"; + break; + case "99.0": + func_type = "DEBUG"; + break; + case "1001.0": + func_type = "DYNAMIC_FORTRAN_1"; + break; + case "2001.0": + func_type = "DYNAMIC_C_1"; + break; + case "2004.0": + func_type = "DYNAMIC_EXPLICIT_4"; + break; + case "10001.0": + func_type = "OLDBLOCKS"; + break; + case "10004.0": + func_type = "IMPLICIT_C_OR_FORTRAN"; + break; + case "30004.0": + func_type = "MODELICA"; + break; + } + this.simulationFunctionType = func_type; + } else { + this.simulationFunctionName = getData(options.model.sim)[0]; + this.simulationFunctionType = "DEFAULT"; + } + this.style = arguments.callee.caller.name; + this.value = options.value; // Not Known + this.exprs = options.graphics.exprs; + this.realParameters = options.model.rpar; + this.integerParameters = options.model.ipar; + this.objectsParameters = options.model.opar; + this.nbZerosCrossing = options.model.nzcross; + this.nmode = options.model.nmode; + this.oDState = list(); + this.equations = options.model.equations; // Not Known + this.blockName = "VoltageSensorBlock"; + this.blockElementName = arguments.callee.caller.name; + } +} + function Summation() { if (arguments.length > 0) { var options = arguments[0]; @@ -1079,6 +1201,87 @@ function Summation() { } } +function SuperBlock() { + if (arguments.length > 0) { + var options = arguments[0]; + this.angle = options.angle; // Not Known + this.blockType = getData(options.model.blocktype)[0]; + this.connectable = options.connectable; // Not Known + var dep_ut = getData(options.model.dep_ut); + if (dep_ut[0] == "true") { + this.dependsOnU = "1"; + } + if (dep_ut[1] == "true") { + this.dependsOnT = "1"; + } + this.id = options.id; + this.interfaceFunctionName = arguments.callee.caller.name; + this.ordering = options.ordering; + this.parent = options.parent; + if (options.model.sim instanceof Array) { + this.simulationFunctionName = getData(options.model.sim[0])[0]; + var func_type; + switch (getData(options.model.sim[1])[0].toString()) { + case "-2.0": + func_type = "ESELECT"; + break; + case "-1.0": + func_type = "IFTHENELSE"; + break; + case "1.0": + func_type = "TYPE_1"; + break; + case "2.0": + func_type = "TYPE_2"; + break; + case "3.0": + func_type = "TYPE_3"; + break; + case "4.0": + func_type = "C_OR_FORTRAN"; + break; + case "5.0": + func_type = "SCILAB"; + break; + case "99.0": + func_type = "DEBUG"; + break; + case "1001.0": + func_type = "DYNAMIC_FORTRAN_1"; + break; + case "2001.0": + func_type = "DYNAMIC_C_1"; + break; + case "2004.0": + func_type = "DYNAMIC_EXPLICIT_4"; + break; + case "10001.0": + func_type = "OLDBLOCKS"; + break; + case "10004.0": + func_type = "IMPLICIT_C_OR_FORTRAN"; + break; + case "30004.0": + func_type = "MODELICA"; + break; + } + this.simulationFunctionType = func_type; + } else { + this.simulationFunctionName = getData(options.model.sim)[0]; + this.simulationFunctionType = "DEFAULT"; + } + this.style = arguments.callee.caller.name; + this.value = options.value; // Not Known + this.vertex = options.vertex; // Not Known + this.visible = options.visible; // Not Known + this.realParameters = options.model.rpar; + this.oDState = list(); + this.equations = list(); // Not Known + this.blockName = "SuperBlock"; + this.blockElementName = arguments.callee.caller.name; + } +} + function zeros() { if (arguments.length == 0) { return [0]; @@ -1147,7 +1350,7 @@ function inverse() { function _str2code() { var conversion = "0123456789abcdefghijklmnopqrstuvwxyz_#!$ ();:+-*/\\=.,'[]%|&<>~^"; - var conversion2 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ00?0 00000000$000\"{}000`0@0r"; + var conversion2 = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ00?0 00000000$000\"{}000`0@0r"; var str = arguments[0]; var code = []; for (var i = 0; i < str.length; i++) { diff --git a/finalmodsheet.xsl b/finalmodsheet.xsl index 25ffff6..8b9c804 100644 --- a/finalmodsheet.xsl +++ b/finalmodsheet.xsl @@ -172,7 +172,7 @@ Look for TAG:Break1!!! </xsl:template> <xsl:template name="Object" match="Object"> <xsl:element name="Array"> - <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock'"> + <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock' or name(..)='VoltageSensorBlock'"> <xsl:if test="@as"> <xsl:attribute name="as"> <xsl:value-of select="@as" /> @@ -200,7 +200,7 @@ Look for TAG:Break1!!! --> <xsl:template name="Array" match="Array"> <xsl:element name="Array"> - <xsl:if test="name(..)='BasicBlock' or @as='context' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock'"> + <xsl:if test="name(..)='BasicBlock' or @as='context' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock' or nmae(..)='VoltageSensorBlock'"> <xsl:if test="@as"> <xsl:attribute name="as"> <xsl:value-of select="@as" /> @@ -1581,7 +1581,7 @@ Look for TAG:Break1!!! </xsl:template> <xsl:template name="ScilabDouble" match="ScilabDouble"> <xsl:element name="ScilabDouble"> - <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock'"> + <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock' or name(..)='VoltageSensorBlock'"> <xsl:if test="@as"> <xsl:attribute name="as"> <xsl:value-of select="@as" /> @@ -1613,7 +1613,7 @@ Look for TAG:Break1!!! </xsl:template> <xsl:template name="ScilabString" match="ScilabString"> <xsl:element name="ScilabString"> - <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock'"> + <xsl:if test="name(..)='BasicBlock' or name(..)='AfficheBlock' or name(..)='BigSom' or name(..)='RoundBlock' or name(..)='GroundBlock' or name(..)='EventInBlock' or name(..)='EventOutBlock' or name(..)='ImplicitInBlock' or name(..)='Product' or name(..)='ImplicitOutBlock' or name(..)='SuperBlock' or name(..)='ExplicitInBlock' or name(..)='ExplicitOutBlock' or name(..)='Summation' or name(..)='TextBlock' or name(..)='VoltageSensorBlock'"> <xsl:if test="@as"> <xsl:attribute name="as"> <xsl:value-of select="@as" /> @@ -878,7 +878,6 @@ editor.addAction('deleteBlock', function(editor, cell) { graph.getModel().beginUpdate(); try { - // getEdgeId(@edgeObject) finds all the associated edges and split-block, and deletes them function getEdgeId(edgeObject) { @@ -981,6 +980,22 @@ // If the cell is a vertex, select the cell else { var portCount = selectionCells[k].getChildCount(); + /* + Maverick, Adhitya + switch-case statements to handle the ordering of following blocks. + The variables window.inBitMap and window.outBitMap are defined in + the file 'dependencies.js'. + */ + switch(selectionCells[k].value.nodeName){ + case 'ImplicitInBlock': + case 'ExplicitInBlock': + window.inBitMap = window.inBitMap.replaceAt(parseInt(selectionCells[k].value.getAttribute('ordering'))-1,'0') ; + break; + case 'ImplicitOutBlock': + case 'ExplicitOutBlock': + window.outBitMap = window.outBitMap.replaceAt(parseInt(selectionCells[k].value.getAttribute('ordering'))-1,'0') ; + break; + } cells.push(selectionCells[k]); for (var i = 0; i < portCount; i++) { var edgeCount = selectionCells[k].getChildAt(i).getEdgeCount(); @@ -999,7 +1014,6 @@ } } } - graph.removeCells(cells, true); } finally { graph.getModel().endUpdate(); @@ -1295,7 +1309,7 @@ Ports will be automatically handled with the respective constructor calls. */ if (!(curNodeName.endsWith('Link') || curNodeName.endsWith('Port'))) { - var ifaceFuncName = cell.interfaceFunctionName; + var ifaceFuncName = null; /* Maverick @@ -1311,13 +1325,21 @@ temporaryMapObject.outputIds = []; temporaryMapObject.controlIds = []; temporaryMapObject.commandIds = []; + + switch(curNodeName){ + case 'ExplicitInBlock': ifaceFuncName='IN_f'; break; + case 'ExplicitOutBlock': ifaceFuncName='OUT_f'; break; + case 'ImplicitInBlock': ifaceFuncName='INIMPL_f'; break; + case 'ImplicitOutBlock': ifaceFuncName='OUTIMPL_f'; break; + default: ifaceFuncName=cell.interfaceFunctionName; + } - - var details_instance = null; + var details_instance=null if (ifaceFuncName != null) { - details_instance = new window[ifaceFuncName](); } + + if (details_instance != null) { var details = details_instance.define(); var enc = new mxCodec(mxUtils.createXmlDocument()); @@ -1325,8 +1347,10 @@ var temp = enc.encode(parent); var stylesheet = graph.getStylesheet(); var styleName = currentNode.getAttribute('style'); - if (styleName.indexOf(';') != -1) { - styleName = styleName.substring(0, styleName.indexOf(';')); + if(styleName!=null){ + if (styleName.indexOf(';') != -1) { + styleName = styleName.substring(0, styleName.indexOf(';')); + } } var style = stylesheet.styles[styleName]; @@ -2614,7 +2638,6 @@ // Get the stylesheet for the graph var stylesheet = graph.getStylesheet(); - console.log(name); // From the stylesheet, get the style of the particular block var style = stylesheet.styles[name]; |