2 // Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3 // Copyright (C) 2011-2011 - DIGITEO - Bruno JOFRET
5 // This file must be used under the terms of the CeCILL.
6 // This source file is licensed as described in the file COPYING, which
7 // you should have received as part of this distribution. The terms
8 // are also available at
9 // http://www.cecill.info/licences/Licence_CeCILL_V2.1-en.txt
12 function [x,y,typ]=SELF_SWITCH(job,arg1,arg2)
13 function diagram = genSwitchInnerDiagram(stateOpen)
14 diagram = scicos_diagram();
16 diagram.objs(1) = IN_f("define");
19 diagram.objs(2)=OUT_f("define");
21 diagram.objs(3)=CONST_m("define");
22 diagram.objs(3).graphics.exprs = "0";
23 diagram.objs(3).model.rpar = 0;
25 diagram.objs(4)=SWITCH_f("define");
27 diagram.objs(4).model.ipar = 1;
28 diagram.objs(4).graphics.exprs = ["2";"2"];
30 diagram.objs(4).model.ipar = 0;
31 diagram.objs(4).graphics.exprs = ["2";"1"];
35 diagram.objs(5) = scicos_link(xx=[0, 0], yy=[0, 0], from=[1, 1], to=[4, 1]);
36 // CONST_m <-> SWITCH_f
37 diagram.objs(6) = scicos_link(xx=[0, 0], yy=[0, 0], from=[3, 1], to=[4, 2]);
39 diagram.objs(7) = scicos_link(xx=[0, 0], yy=[0, 0], from=[4, 1], to=[2, 1]);
44 stateOpen = x.model.opar(1);
45 x.model.rpar = genSwitchInnerDiagram(~stateOpen);
46 x.model.opar = list(~stateOpen);
50 x.graphics.style="SELF_SWITCH_OFF"
52 x.graphics.style="SELF_SWITCH_ON"
56 // By default SWITCH is open
68 x.model.dep_ut=[%f %f]
69 x.model.rpar = genSwitchInnerDiagram(stateOpen);
70 x.model.opar = list(stateOpen);
71 x.graphics.in_implicit=["E"]
72 x.graphics.in_style=""
73 x.graphics.out_implicit=["E"];
74 x.graphics.out_style=""
75 x.graphics.style="SELF_SWITCH_OFF"