summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdhitya Kamakshidasan2016-07-12 15:26:11 +0530
committerGitHub2016-07-12 15:26:11 +0530
commit3e26a30a0319cadf4e76685911007be1f4e17998 (patch)
treed259b229d2d0191b253b0e14a7b70d3f6377482e
parent316be2fb6c6253e62ef2832fed867f9843593eaa (diff)
parentab71e33eda061e34ff1980c31ca1ce910c268d4c (diff)
downloadxcos-on-web-3e26a30a0319cadf4e76685911007be1f4e17998.tar.gz
xcos-on-web-3e26a30a0319cadf4e76685911007be1f4e17998.tar.bz2
xcos-on-web-3e26a30a0319cadf4e76685911007be1f4e17998.zip
Merge pull request #168 from ASP1234/master
Implement Blocks and dependency fn
-rw-r--r--data_structures_correct/TRASH_f.js23
-rw-r--r--data_structures_correct/TrigFun.js21
-rw-r--r--data_structures_correct/VARIABLE_DELAY.js28
-rw-r--r--data_structures_correct/VanneReglante.js37
-rw-r--r--data_structures_correct/VariableResistor.js29
-rw-r--r--data_structures_correct/VirtualCLK0.js22
-rw-r--r--data_structures_correct/WRITEC_f.js31
7 files changed, 191 insertions, 0 deletions
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/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/WRITEC_f.js b/data_structures_correct/WRITEC_f.js
new file mode 100644
index 0000000..ae17903
--- /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 = ["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;
+ }
+}