Scicos_blocks: clean Electrical blocks interfaces 28/13228/2
Paul Bignier [Tue, 26 Nov 2013 10:03:29 +0000 (11:03 +0100)]
Removed unused 'job' and 'gr_i' values.

Change-Id: Ide2d455354e098add173bc79d2bd389e9695be5b

24 files changed:
scilab/modules/scicos_blocks/macros/Electrical/CCS.sci
scilab/modules/scicos_blocks/macros/Electrical/CVS.sci
scilab/modules/scicos_blocks/macros/Electrical/Capacitor.sci
scilab/modules/scicos_blocks/macros/Electrical/ConstantVoltage.sci
scilab/modules/scicos_blocks/macros/Electrical/CurrentSensor.sci
scilab/modules/scicos_blocks/macros/Electrical/Diode.sci
scilab/modules/scicos_blocks/macros/Electrical/Ground.sci
scilab/modules/scicos_blocks/macros/Electrical/Gyrator.sci
scilab/modules/scicos_blocks/macros/Electrical/IdealTransformer.sci
scilab/modules/scicos_blocks/macros/Electrical/Inductor.sci
scilab/modules/scicos_blocks/macros/Electrical/MOTOR.sci
scilab/modules/scicos_blocks/macros/Electrical/NMOS.sci
scilab/modules/scicos_blocks/macros/Electrical/NPN.sci
scilab/modules/scicos_blocks/macros/Electrical/OpAmp.sci
scilab/modules/scicos_blocks/macros/Electrical/PMOS.sci
scilab/modules/scicos_blocks/macros/Electrical/PNP.sci
scilab/modules/scicos_blocks/macros/Electrical/PotentialSensor.sci
scilab/modules/scicos_blocks/macros/Electrical/Resistor.sci
scilab/modules/scicos_blocks/macros/Electrical/SineVoltage.sci
scilab/modules/scicos_blocks/macros/Electrical/Switch.sci
scilab/modules/scicos_blocks/macros/Electrical/VVsourceAC.sci
scilab/modules/scicos_blocks/macros/Electrical/VariableResistor.sci
scilab/modules/scicos_blocks/macros/Electrical/VoltageSensor.sci
scilab/modules/scicos_blocks/macros/Electrical/VsourceAC.sci

index 164e7e5..31d6002 100644 (file)
 function [x,y,typ]=CCS(job,arg1,arg2)
     // the automatically generated interface block for Modelica CCS.mo model
     //   - avec un dialogue de saisie de parametre
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f,CCS_draw_ports)
-    case "getinputs" then
-        [x,y,typ]=CCS_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=CCS_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         x=arg1
     case "define" then
@@ -42,16 +37,31 @@ function [x,y,typ]=CCS(job,arg1,arg2)
         PrametersValue=[]
         ParametersName=[]
         model=scicos_model()
-        Typein=[];Typeout=[];MI=[];MO=[]
+        Typein=[];
+        Typeout=[];
+        MI=[];
+        MO=[]
         P=[2,50,1,0; 70,98,2,0;70,2,-2,0]
 
         PortName=["Iin";"p";"n"]
 
         for i=1:size(P,"r")
-            if P(i,3)==1  then  Typein= [Typein; "E"];MI=[MI;PortName(i)];end
-            if P(i,3)==2  then  Typein= [Typein; "I"];MI=[MI;PortName(i)];end
-            if P(i,3)==-1 then  Typeout=[Typeout;"E"];MO=[MO;PortName(i)];end
-            if P(i,3)==-2 then  Typeout=[Typeout;"I"];MO=[MO;PortName(i)];end
+            if P(i,3)==1  then
+                Typein= [Typein; "E"];
+                MI=[MI;PortName(i)];
+            end
+            if P(i,3)==2  then
+                Typein= [Typein; "I"];
+                MI=[MI;PortName(i)];
+            end
+            if P(i,3)==-1 then
+                Typeout=[Typeout;"E"];
+                MO=[MO;PortName(i)];
+            end
+            if P(i,3)==-2 then
+                Typeout=[Typeout;"I"];
+                MO=[MO;PortName(i)];
+            end
         end
         model=scicos_model()
         mo=modelica()
@@ -61,7 +71,7 @@ function [x,y,typ]=CCS(job,arg1,arg2)
         model.rpar=PrametersValue;
         mo.parameters=list(ParametersName,PrametersValue,zeros(ParametersName));
         exprs=[]
-        gr_i=["";"if orient then";"  xpolys(orig(1)+[0.7142857,0.7142857,0.3714286,0.0571429,0.3714286;0.7142857,0.7142857,0.4285714,0.4142857,0.4285714]*sz(1),orig(2)+[0.7,0,0.53,0.49,0.45;0.98,0.3,0.49,0.49,0.49]*sz(2),[2,2,6,6,6])";"  xstring(orig(1)+0.7714286*sz(1),orig(2)+0.75*sz(2),""CCS"")";"  xpolys(orig(1)+[0.7142857,0.7142857,0.7142857;0.7142857,0.6,0.8285714]*sz(1),orig(2)+[0.35,0.63,0.63;0.63,0.55,0.55]*sz(2),[5,5,5])";"  xrects([orig(1)+0.4285714*sz(1); orig(2)+0.7*sz(2);0.5714286*sz(1);0.4*sz(2)],0)";"else";"  xpolys(orig(1)+[0.2857143,0.2857143,0.6285714,0.9428571,0.6285714;0.2857143,0.2857143,0.5714286,0.5857143,0.5714286]*sz(1),orig(2)+[0.7,0,0.53,0.49,0.45;0.98,0.3,0.49,0.49,0.49]*sz(2),[2,2,6,6,6])";"  xstring(orig(1)+sz(1)-(0.7714286*sz(1)),orig(2)+0.75*sz(2),""CCS"")";"  xpolys(orig(1)+[0.2857143,0.2857143,0.2857143;0.2857143,0.4,0.1714286]*sz(1),orig(2)+[0.35,0.63,0.63;0.63,0.55,0.55]*sz(2),[5,5,5])";"  xrects([orig(1)+0*sz(1); orig(2)+0.7*sz(2);0.5714286*sz(1);0.4*sz(2)],0)";"end"]
+        gr_i=[]
         model.blocktype="c"
         model.dep_ut=[%f %t]
         mo.model=ModelName
@@ -73,183 +83,3 @@ function [x,y,typ]=CCS(job,arg1,arg2)
         x.graphics.out_implicit=Typeout;
     end
 endfunction
-//=========================
-function CCS_draw_ports(o)
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    xset("pattern",default_color(0))
-    // draw input/output ports
-    //------------------------
-    // [x_in_Icon,y_in_Icon,type(2=imp_in/-2:imp_out/1=exp_input/-1_exp_output),orientation(degree)]
-    P=[2,50,1,0; 70,98,2,0;70,2,-2,0]
-
-    //============================
-    // setting the input/ outputs and direction
-    // implicit port: if it's located in the right it's output and while,
-    // else black
-    // explicit ports:
-
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    xset("pattern",default_color(1))
-    xset("thickness",1)
-
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-
-            if P(i,3)==1 then // explicit
-                inR=in*R;
-                xfpoly(orig(1)+inR(:,1)+P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if  P(i,3)==-1 then
-                outR=out*R;
-                xfpoly(orig(1)+outR(:,1)+P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                in2R=in2*R;
-                xfpoly(orig(1)+in2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                out2R=out2*R;
-                xpoly(orig(1)+out2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, "lines",1)
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-
-            if P(i,3)==1 then // explicit
-                inR=in*R;
-                xfpoly(orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-            if P(i,3)==-1 then // explicit
-                outR=out*R;
-                xfpoly(orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                in2R=in2*R;
-                xfpoly(orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)
-            end
-            if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                out2R=out2*R;
-                xpoly(orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, "lines",1)
-            end
-        end
-    end
-endfunction
-//=========================
-function [x,y,typ]=CCS_inputs(o)
-    // Copyright INRIA
-    xf=60
-    yf=40
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    //[orig,sz,orient]=o(2)(1:3);
-    inp=size(o.model.in,1);clkinp=size(o.model.evtin,1);
-
-    // [x_in_Icon,y_in_Icon,type(2=imp/1=exp_input/-1_exp_output),orientation(degree)]
-    P=[2,50,1,0; 70,98,2,0;70,2,-2,0]
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    x=[];y=[];typ=[]
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==1 then // explicit_input
-                inR=in($,:)*R;
-                x=[x,orig(1)+inR(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==2) then  // implicit
-                in2R=in2($,:)*R;
-                x=[x,orig(1)+in2R(:,1)+P(i,1)*sz(1)/100];// Black
-                y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==1 then // explicit_input
-                inR=in($,:)*R;
-                x=[x,orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==2) then  // implicit
-                in2R=in2($,:)*R;
-                x=[x,orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    end
-
-
-endfunction
-//=========================
-function [x,y,typ]=CCS_outputs(o)
-    // Copyright INRIA
-    xf=60
-    yf=40
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    out=size(o.model.out,1);clkout=size(o.model.evtout,1);
-    P=[2,50,1,0; 70,98,2,0;70,2,-2,0]
-
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    x=[];y=[];typ=[];
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==-1 then // explicit_output
-                outR=out($,:)*R;
-                x=[x,orig(1)+outR(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==-2) then  // implicit
-                out2R=out2($,:)*R;
-                x=[x,orig(1)+out2R(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==-1 then // explicit_output
-                outR=out($,:)*R;
-                x=[x,orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==-2) then  // implicit
-                out2R=out2($,:)*R;
-                x=[x,orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    end
-
-endfunction
index 00a8ea0..a4c7a6b 100644 (file)
 function [x,y,typ]=CVS(job,arg1,arg2)
     // the automatically generated interface block for Modelica CVS.mo model
     //   - avec un dialogue de saisie de parametre
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f,CVS_draw_ports)
-    case "getinputs" then
-        [x,y,typ]=CVS_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=CVS_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         x=arg1
     case "define" then
@@ -42,15 +37,30 @@ function [x,y,typ]=CVS(job,arg1,arg2)
         PrametersValue=[]
         ParametersName=[]
         model=scicos_model()
-        Typein=[];Typeout=[];MI=[];MO=[]
+        Typein=[];
+        Typeout=[];
+        MI=[];
+        MO=[]
         P=[2,50,1,0; 70,98,2,0;70,2,-2,0]
 
         PortName=["vin";"p";"n"]
         for i=1:size(P,"r")
-            if P(i,3)==1  then  Typein= [Typein; "E"];MI=[MI;PortName(i)];end
-            if P(i,3)==2  then  Typein= [Typein; "I"];MI=[MI;PortName(i)];end
-            if P(i,3)==-1 then  Typeout=[Typeout;"E"];MO=[MO;PortName(i)];end
-            if P(i,3)==-2 then  Typeout=[Typeout;"I"];MO=[MO;PortName(i)];end
+            if P(i,3)==1  then
+                Typein= [Typein; "E"];
+                MI=[MI;PortName(i)];
+            end
+            if P(i,3)==2  then
+                Typein= [Typein; "I"];
+                MI=[MI;PortName(i)];
+            end
+            if P(i,3)==-1 then
+                Typeout=[Typeout;"E"];
+                MO=[MO;PortName(i)];
+            end
+            if P(i,3)==-2 then
+                Typeout=[Typeout;"I"];
+                MO=[MO;PortName(i)];
+            end
         end
         model=scicos_model()
         mo=modelica()
@@ -60,7 +70,7 @@ function [x,y,typ]=CVS(job,arg1,arg2)
         model.rpar=PrametersValue;
         mo.parameters=list(ParametersName,PrametersValue,zeros(ParametersName));
         exprs=[]
-        gr_i=["";"if orient then";"  xpolys(orig(1)+[0.7142857,0.7142857,0.3714286,0.0571429,0.3714286;0.7142857,0.7142857,0.4285714,0.4142857,0.4285714]*sz(1),orig(2)+[0.7,0,0.54,0.5,0.46;0.98,0.3,0.5,0.5,0.5]*sz(2),[2,2,6,6,6])";"  xstring(orig(1)+0.1428571*sz(1),orig(2)+0.75*sz(2),""CVS"")";"  xrects([orig(1)+0.4285714*sz(1); orig(2)+0.7*sz(2);0.5714286*sz(1);0.4*sz(2)],0)";"  xstring(orig(1)+0.7*sz(1),orig(2)+0.55*sz(2),""+"")";"  xstring(orig(1)+0.7*sz(1),orig(2)+0.35*sz(2),""-"")";"else";"  xpolys(orig(1)+[0.2857143,0.2857143,0.6285714,0.9428571,0.6285714;0.2857143,0.2857143,0.5714286,0.5857143,0.5714286]*sz(1),orig(2)+[0.7,0,0.54,0.5,0.46;0.98,0.3,0.5,0.5,0.5]*sz(2),[2,2,6,6,6])";"  xstring(orig(1)+0.6*sz(1),orig(2)+0.75*sz(2),""CVS"")";"  xrects([orig(1)+0*sz(1); orig(2)+0.7*sz(2);0.5714286*sz(1);0.4*sz(2)],0)";"  xstring(orig(1)+sz(1)-(0.7*sz(1)),orig(2)+0.55*sz(2),""+"")";"  xstring(orig(1)+sz(1)-(0.7*sz(1)),orig(2)+0.35*sz(2),""-"")";"end"]
+        gr_i=[]
         model.blocktype="c"
         model.dep_ut=[%f %t]
         mo.model=ModelName
@@ -72,183 +82,3 @@ function [x,y,typ]=CVS(job,arg1,arg2)
         x.graphics.out_implicit=Typeout;
     end
 endfunction
-//=========================
-function CVS_draw_ports(o)
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    xset("pattern",default_color(0))
-    // draw input/output ports
-    //------------------------
-    // [x_in_Icon,y_in_Icon,type(2=imp_in/-2:imp_out/1=exp_input/-1_exp_output),orientation(degree)]
-    P=[2,50,1,0; 70,98,2,0;70,2,-2,0]
-
-    //============================
-    // setting the input/ outputs and direction
-    // implicit port: if it's located in the right it's output and while,
-    // else black
-    // explicit ports:
-
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    xset("pattern",default_color(1))
-    xset("thickness",1)
-
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-
-            if P(i,3)==1 then // explicit
-                inR=in*R;
-                xfpoly(orig(1)+inR(:,1)+P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if  P(i,3)==-1 then
-                outR=out*R;
-                xfpoly(orig(1)+outR(:,1)+P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                in2R=in2*R;
-                xfpoly(orig(1)+in2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                out2R=out2*R;
-                xpoly(orig(1)+out2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, "lines",1)
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-
-            if P(i,3)==1 then // explicit
-                inR=in*R;
-                xfpoly(orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-            if P(i,3)==-1 then // explicit
-                outR=out*R;
-                xfpoly(orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                in2R=in2*R;
-                xfpoly(orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)
-            end
-            if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                out2R=out2*R;
-                xpoly(orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, "lines",1)
-            end
-        end
-    end
-endfunction
-//=========================
-function [x,y,typ]=CVS_inputs(o)
-    // Copyright INRIA
-    xf=60
-    yf=40
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    //[orig,sz,orient]=o(2)(1:3);
-    inp=size(o.model.in,1);clkinp=size(o.model.evtin,1);
-
-    // [x_in_Icon,y_in_Icon,type(2=imp/1=exp_input/-1_exp_output),orientation(degree)]
-    P=[2,50,1,0; 70,98,2,0;70,2,-2,0]
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    x=[];y=[];typ=[]
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==1 then // explicit_input
-                inR=in($,:)*R;
-                x=[x,orig(1)+inR(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==2) then  // implicit
-                in2R=in2($,:)*R;
-                x=[x,orig(1)+in2R(:,1)+P(i,1)*sz(1)/100];// Black
-                y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==1 then // explicit_input
-                inR=in($,:)*R;
-                x=[x,orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==2) then  // implicit
-                in2R=in2($,:)*R;
-                x=[x,orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    end
-
-
-endfunction
-//=========================
-function [x,y,typ]=CVS_outputs(o)
-    // Copyright INRIA
-    xf=60
-    yf=40
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    out=size(o.model.out,1);clkout=size(o.model.evtout,1);
-    P=[2,50,1,0; 70,98,2,0;70,2,-2,0]
-
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    x=[];y=[];typ=[];
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==-1 then // explicit_output
-                outR=out($,:)*R;
-                x=[x,orig(1)+outR(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==-2) then  // implicit
-                out2R=out2($,:)*R;
-                x=[x,orig(1)+out2R(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==-1 then // explicit_output
-                outR=out($,:)*R;
-                x=[x,orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==-2) then  // implicit
-                out2R=out2($,:)*R;
-                x=[x,orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    end
-
-endfunction
index 404ac95..3d6a9dc 100644 (file)
@@ -24,29 +24,26 @@ function [x,y,typ]=Capacitor(job,arg1,arg2)
     //   -  sans entree ni sortie de conditionnement
     //   -  avec une entree et une sortie de type implicit et de dimension 1
     //   - avec un dialogue de saisie de parametre
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        C=arg1.graphics.exprs(1);
-        standard_draw(arg1,%f)
-    case "getinputs" then
-        [x,y,typ]=standard_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=standard_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         while %t do
             [ok,C,v,exprs]=scicos_getvalue("Set Capacitor block parameter",..
             ["C (F)";"Initial Voltage"],list("vec",1,"vec",1),exprs)
-            if ~ok then break,end
+            if ~ok then
+                break,
+            end
             model.rpar=C
             model.equations.parameters(2)=list(C,v)
             graphics.exprs=exprs
-            x.graphics=graphics;x.model=model
+            x.graphics=graphics;
+            x.model=model
             break
         end
     case "define" then
@@ -66,30 +63,7 @@ function [x,y,typ]=Capacitor(job,arg1,arg2)
         model.out=ones(size(mo.outputs,"*"),1)
 
         exprs=string([C;v])
-        gr_i=["xset(''thickness'',2)"
-        "xx=orig(1)+[0 1/3 1/3 1/3 ]*sz(1);";
-        "yy=orig(2)+[1/2 1/2 1 0]*sz(2);";
-        "xpoly(xx,yy);"
-        "xsegs(orig(1)+ sz(1)*2/3*[1 1 1 3/2],orig(2)+(sz(2)*1/2)*[2 0 1 1],0);";
-        "if orient then"
-        "  xrects([orig(1)+sz(1)*1/2;orig(2)+sz(2);sz(1)*1/6;sz(2)],scs_color(33));"
-        "  xstring(orig(1)+sz(1)*1/12,orig(2)+sz(2)*3/4,''+'');";
-        "  xstring(orig(1)+sz(1)*7/8,orig(2)+sz(2)*3/4,''-'');";
-        "else"
-        "  xrects([orig(1)+sz(1)*1/3;orig(2)+sz(2);sz(1)*1/6;sz(2)],scs_color(33));"
-        "  xstring(orig(1)+sz(1)*1/12,orig(2)+sz(2)*3/4,''-'');";
-        "  xstring(orig(1)+sz(1)*7/8,orig(2)+sz(2)*3/4,''+'');";
-        "end"
-        "txt=''C= ''+C;"
-        "style=2;"
-        "rectstr=stringbox(txt,orig(1),orig(2),0,style,1);"
-        "if ~exists(''%zoom'') then %zoom=1, end;"
-        "w=(rectstr(1,3)-rectstr(1,2))*%zoom;"
-        "h=(rectstr(2,2)-rectstr(2,4))*%zoom;"
-        "xstringb(orig(1)+sz(1)/2-w/2,orig(2)-h-4,txt,w,h,''fill'');"
-        "e=gce();"
-        "e.font_style=style;"
-        ];
+        gr_i=[];
         x=standard_define([2 1.1],model,exprs,list(gr_i,0))
         x.graphics.in_implicit=["I"]
         x.graphics.out_implicit=["I"]
index 3b7968c..cff44ef 100644 (file)
 //
 
 function [x,y,typ]=ConstantVoltage(job,arg1,arg2)
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f)
-    case "getinputs" then
-        [x,y,typ]=standard_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=standard_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         while %t do
             [ok,V,exprs]=scicos_getvalue("Set ConstantVoltage block parameter",..
             "V (volt)",list("vec",1),exprs)
-            if ~ok then break,end
+            if ~ok then
+                break,
+            end
             model.rpar=V
             model.equations.parameters(2)=list(V)
             graphics.exprs=exprs
-            x.graphics=graphics;x.model=model
+            x.graphics=graphics;
+            x.model=model
             break
         end
 
@@ -62,13 +60,7 @@ function [x,y,typ]=ConstantVoltage(job,arg1,arg2)
         model.equations=mo
         exprs=string(V)
 
-        gr_i=["xset(''thickness'',2)"
-        "xx=[0 5 5 5]/12;";
-        "if orient then yy=[1 1 2 0]/2;else yy=[2,2,3,1]/4,end"
-        "xpoly(orig(1)+xx*sz(1),orig(2)+yy*sz(2));";
-        "xx=[2 2 2 3]/3;";
-        "if orient then yy=[1,3,2,2]/4;else yy=[0 2 1 1]/2;end"
-        "xpoly(orig(1)+xx*sz(1),orig(2)+yy*sz(2));"]
+        gr_i=[]
 
         x=standard_define([1.5 1.1],model,exprs,list(gr_i,0))
         x.graphics.in_implicit=["I"]
index 59f2dfe..84d4229 100644 (file)
 //
 
 function [x,y,typ]=CurrentSensor(job,arg1,arg2)
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f,sensor_draw_ports)
-    case "getinputs" then
-        [x,y,typ]=standard_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=sensor_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
     case "define" then
         model=scicos_model()
-        model.in=1;model.out=[1; 1];
+        model.in=1;
+        model.out=[1; 1];
         model.sim="CurrentSensor"
         model.blocktype="c"
         model.dep_ut=[%t %f]
@@ -44,114 +39,9 @@ function [x,y,typ]=CurrentSensor(job,arg1,arg2)
         mo.outputs=["n";"i"]
         model.equations=mo
         exprs=[]
-        gr_i=["xarc(orig(1)+sz(1)*1/8,orig(2)+sz(2)*4.3/5,sz(1)*3/4,sz(2)*3/4,0,360*64);";
-        "xsegs(orig(1)+sz(1)*[0 1/8],orig(2)+sz(2)*[1/2 1/2],0)";
-        "xsegs(orig(1)+sz(1)*[7/8 1],orig(2)+sz(2)*[1/2 1/2],0)";
-        "xsegs(orig(1)+sz(1)*[1.5/8 2.5/8],orig(2)+sz(2)*[1.3/2 1.2/2],0)";
-        "xsegs(orig(1)+sz(1)*[2.5/8 3.2/8],orig(2)+sz(2)*[1.62/2 1.3/2],0)";
-        "xsegs(orig(1)+sz(1)*[1/2 1/2],orig(2)+sz(2)*[4.25/5 1.3/2],0)";
-        "xsegs(orig(1)+sz(1)*[4.9/8 5.5/8],orig(2)+sz(2)*[1.3/2 1.65/2],0)";
-        "xsegs(orig(1)+sz(1)*[5.5/8 6.5/8],orig(2)+sz(2)*[1.2/2 1.32/2],0)";
-        "xsegs(orig(1)+sz(1)*[1/2 4.5/8],orig(2)+sz(2)*[1/2 1.32/2],0) ";
-        "xsegs(orig(1)+sz(1)*[1/2 1/2],orig(2)+sz(2)*[0.9/8 -1/8],0)";
-        "xfarc(orig(1)+sz(1)*0.93/2,orig(2)+sz(2)*1/2,sz(1)*0.2/4,sz(2)*0.2/4,0,360*64);";
-        " xx=orig(1)+sz(1)*4.2/8+[.9 1 0 .9]*sz(1)/12;";
-        "yy=orig(2)+sz(2)*1.27/2+[0.1 1 0.3 0.1]*sz(2)/7;";
-        "xfpoly(xx,yy);"
-        "xstring(orig(1)+sz(1)/2,orig(2)+sz(2)/5,''A'')"]
+        gr_i=[]
         x=standard_define([2 2],model,exprs,list(gr_i,0))
         x.graphics.in_implicit=["I"]
         x.graphics.out_implicit=["I";"E"]
     end
 endfunction
-
-function sensor_draw_ports(o)
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    xset("pattern",default_color(0))
-    // draw input/output ports
-    //------------------------
-
-    if orient then  //standard orientation
-        // set port shape
-        out2=[ 0  -1
-        1  -1
-        1   1
-        0   1]*diag([xf/7,yf/14])
-
-        in2= [-1  -1
-        0  -1
-        0   1
-        -1   1]*diag([xf/7,yf/14])
-        dy=sz(2)/2
-        xset("pattern",default_color(1))
-        xpoly(out2(:,1)+(orig(1)+sz(1)),..
-        out2(:,2)+(orig(2)+sz(2)-dy),"lines",1)
-
-
-        dy=sz(2)/2
-        xfpoly(in2(:,1)+orig(1),..
-        in2(:,2)+(orig(2)+sz(2)-dy),1)
-    else //tilded orientation
-        out2=[0  -1
-        -1  -1
-        -1   1
-        0   1]*diag([xf/7,yf/14])
-
-        in2= [1  -1
-        0  -1
-        0   1
-        1   1]*diag([xf/7,yf/14])
-
-
-        dy=sz(2)/2
-        xset("pattern",default_color(1))
-        xpoly(out2(:,1)+ones(4,1)*orig(1)-1,..
-        out2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),"lines",1)
-        dy=sz(2)/2
-        xfpoly(in2(:,1)+ones(4,1)*(orig(1)+sz(1))+1,..
-        in2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),1)
-    end
-    // valve command port port
-    //------------------------
-    // set port shape
-
-
-
-    out= [-1  1
-    0  0
-    1  1
-    -1  1]*diag([xf/14,yf/7])
-
-
-
-    dx=sz(1)/2
-
-    xpoly(out(:,1)+ones(4,1)*(orig(1)+dx),..
-    out(:,2)+ones(4,1)*(orig(2)-sz(2)*2/8),"lines",1)
-
-endfunction
-
-function [x,y,typ]=sensor_outputs(o)
-    xf=60
-    yf=40
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    //[orig,sz,orient]=o(2)(1:3);
-    inp=size(o.model.in,1);clkinp=size(o.model.evtin,1);
-
-    if orient then
-        x1=orig(1)+sz(1)
-        dx1=-xf/7
-        x2=orig(1)
-        dx2=xf/7
-    else
-        x1=orig(1)
-        dx1=yf/7
-        x2=orig(1)+sz(1)
-        dx2=-xf/7
-    end
-
-    y=[orig(2)+sz(2)-(sz(2)/2) ,orig(2)-sz(2)*2/8]
-    x=[(x1+dx2)  orig(1)+sz(1)/2]
-    typ=[2 1]
-
-endfunction
index c214ae1..0ca08fd 100644 (file)
 //
 
 function [x,y,typ]=Diode(job,arg1,arg2)
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f)
-    case "getinputs" then
-        [x,y,typ]=standard_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=standard_outputs(arg1)
-    case "getorigin" then
-
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         while %t do
             [ok,Ids,Vt,Maxexp,R,exprs]=scicos_getvalue("Set Diode block parameter",..
@@ -41,19 +35,26 @@ function [x,y,typ]=Diode(job,arg1,arg2)
             "Voltage equivalent to temperature (Volt)";..
             "Max exponent for linear continuation";..
             "R (ohm)"],        list("vec",1,"vec",1,"vec",1,"vec",1),exprs)
-            if ~ok then break,end
+            if ~ok then
+                break,
+            end
             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
+            x.graphics=graphics;
+            x.model=model
             break
         end
     case "define" then
-        Ids=1.e-6; Vt=0.04; Maxexp=15; R=1.e8;
+        Ids=1.e-6;
+        Vt=0.04;
+        Maxexp=15;
+        R=1.e8;
         model=scicos_model()
         model.rpar=[Ids;Vt;Maxexp;R]
 
-        model.in=1;model.out=1;
+        model.in=1;
+        model.out=1;
         model.sim="Diode";
         model.blocktype="c"
         model.dep_ut=[%t %f]
@@ -65,15 +66,7 @@ function [x,y,typ]=Diode(job,arg1,arg2)
 
         model.equations=mo
         exprs=string([Ids;Vt;Maxexp;R])
-        gr_i=["xset(''thickness'',2)"
-        "if orient then"
-        "  xx=orig(1)+[0,1,1,2,2,2,2,3,2,1,1,2]*(sz(1)/3);";
-        "  yy=orig(2)+[2,2,3,2,3,1,2,2,2,1,2,2]*(sz(2)/4);";
-        "else"
-        "  xx=orig(1)+[0,1,1,1,1,2,2,3.06,2,2,1,2]*(sz(1)/3);";
-        "  yy=orig(2)+[2,2,3,1,2,3,2,2,2,1,2,2]*(sz(2)/4);";
-        "end"
-        "xpoly(xx,yy);"]
+        gr_i=[]
         x=standard_define([2 1],model,exprs,list(gr_i,0))
         x.graphics.in_implicit=["I"]
         x.graphics.out_implicit=["I"]
index 1fb4fa6..7317243 100644 (file)
@@ -24,21 +24,10 @@ function [x,y,typ]=Ground(job,arg1,arg2)
     //   -  sans entree ni sortie de conditionnement
     //   -  avec une entree et une sortie de type implicit et de dimension 1
     //   - avec un dialogue de saisie de parametre
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f,ground_draw_ports)
-    case "getinputs" then
-        xf=60
-        yf=40
-        orig=arg1.graphics.orig;sz=arg1.graphics.sz;
-        x=orig(1)+(sz(1)/2)
-        y=(orig(2)+yf/7+sz(2))
-        typ=2
-    case "getoutputs" then
-        x=[];y=[],typ=[]
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
     case "define" then
@@ -53,31 +42,9 @@ function [x,y,typ]=Ground(job,arg1,arg2)
         mo.inputs="p";
         model.equations=mo
         exprs=""
-        gr_i=["xset(''thickness'',3)";
-        "xsegs(orig(1)+sz(1)*[1/2 1/2],orig(2)+sz(2)*[1 1/2],0);";
-        "xsegs(orig(1)+sz(1)*[0 1],orig(2)+sz(2)*[1/2 1/2],0);";
-        "xsegs(orig(1)+sz(1)*[2/8 6/8],orig(2)+sz(2)*[1/4 1/4],0);";
-        "xsegs(orig(1)+sz(1)*[3/8 5/8],orig(2)+sz(2)*[0 0],0);"]
+        gr_i=[]
         x=standard_define([1 1],model,exprs,list(gr_i,0))
         x.graphics.in_implicit=["I"]
         x.graphics.out_implicit=["I"]
     end
 endfunction
-
-function ground_draw_ports(o)
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    xset("pattern",default_color(0))
-    // draw input ports
-    //------------------------
-
-    //------------------------
-    // set port shape
-
-    in= 0.8*[ -1  -1
-    1  -1
-    1   1
-    -1   1]*diag([xf/14,yf/7])
-
-    xfpoly(in(:,1)+ones(4,1)*(orig(1)+sz(1)/2),..
-    in(:,2)+ones(4,1)*(orig(2)+sz(2)+yf/14),1)
-endfunction
index 16dae91..8cec7e6 100644 (file)
 function [x,y,typ]=Gyrator(job,arg1,arg2)
     // the automatically generated interface block for Modelica Gyrator.mo model
     //   - avec un dialogue de saisie de parametre
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f,Gyrator_draw_ports)
-    case "getinputs" then
-        [x,y,typ]=Gyrator_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=Gyrator_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         x=arg1
         exprs=x.graphics.exprs
         while %t do
             [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 then break,end
+            if ~ok then
+                break,
+            end
             x.model.equations.parameters(2)=list(G1,G2)
             x.graphics.exprs=exprs
             break
@@ -50,14 +47,29 @@ function [x,y,typ]=Gyrator(job,arg1,arg2)
         PrametersValue=[1;1]
         ParametersName=["G1";"G2"]
         model=scicos_model()
-        Typein=[];Typeout=[];MI=[];MO=[]
+        Typein=[];
+        Typeout=[];
+        MI=[];
+        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:size(P,"r")
-            if P(i,3)==1  then  Typein= [Typein; "E"];MI=[MI;PortName(i)];end
-            if P(i,3)==2  then  Typein= [Typein; "I"];MI=[MI;PortName(i)];end
-            if P(i,3)==-1 then  Typeout=[Typeout;"E"];MO=[MO;PortName(i)];end
-            if P(i,3)==-2 then  Typeout=[Typeout;"I"];MO=[MO;PortName(i)];end
+            if P(i,3)==1  then
+                Typein= [Typein; "E"];
+                MI=[MI;PortName(i)];
+            end
+            if P(i,3)==2  then
+                Typein= [Typein; "I"];
+                MI=[MI;PortName(i)];
+            end
+            if P(i,3)==-1 then
+                Typeout=[Typeout;"E"];
+                MO=[MO;PortName(i)];
+            end
+            if P(i,3)==-2 then
+                Typeout=[Typeout;"I"];
+                MO=[MO;PortName(i)];
+            end
         end
         model=scicos_model()
         mo=modelica()
@@ -67,7 +79,7 @@ function [x,y,typ]=Gyrator(job,arg1,arg2)
         model.rpar=PrametersValue;
         mo.parameters=list(ParametersName,PrametersValue,zeros(ParametersName));
         exprs=["1";"1"]
-        gr_i=["";"if orient then";"  xrects([orig(1)+0.2*sz(1); orig(2)+1*sz(2);0.6*sz(1);1*sz(2)],0)";"  xpolys(orig(1)+[0.02,0.02,0.8,0.8,0.3,0.395;0.2,0.2,0.98,0.98,0.7,0.595]*sz(1),orig(2)+[0.9166667,0.0833333,0.9166667,0.0833333,0.75,0.3166667;0.9166667,0.0833333,0.9166667,0.0833333,0.75,0.3166667]*sz(2),[2,2,2,2,2,2])";"  xset(''color'',[0,0])";"  xfpolys(orig(1)+[0.65,0.35;0.7,0.4;0.65,0.4;0.65,0.35]*sz(1),orig(2)+[0.7833333,0.3166667;0.75,0.35;0.7166667,0.2833333;0.7833333,0.3166667]*sz(2),[2,2])";"  xpolys(orig(1)+[0.48,0.515,0.46;0.47,0.505,0.535]*sz(1),orig(2)+[0.5416667,0.5416667,0.5416667;0.4583333,0.4583333,0.5416667]*sz(2),[6,6,6])";"else";"  xrects([orig(1)+0.2*sz(1); orig(2)+1*sz(2);0.6*sz(1);1*sz(2)],0)";"  xpolys(orig(1)+[0.98,0.98,0.2,0.2,0.7,0.605;0.8,0.8,0.02,0.02,0.3,0.405]*sz(1),orig(2)+[0.9166667,0.0833333,0.9166667,0.0833333,0.75,0.3166667;0.9166667,0.0833333,0.9166667,0.0833333,0.75,0.3166667]*sz(2),[2,2,2,2,2,2])";"  xset(''color'',[0,0])";"  xfpolys(orig(1)+[0.35,0.65;0.3,0.6;0.35,0.6;0.35,0.65]*sz(1),orig(2)+[0.7833333,0.3166667;0.75,0.35;0.7166667,0.2833333;0.7833333,0.3166667]*sz(2),[2,2])";"  xpolys(orig(1)+[0.52,0.485,0.54;0.53,0.495,0.465]*sz(1),orig(2)+[0.5416667,0.5416667,0.5416667;0.4583333,0.4583333,0.5416667]*sz(2),[6,6,6])";"end";"  xstring(orig(1)+0.35*sz(1),orig(2)+0.5*sz(2),""G1"")";"  xstring(orig(1)+0.35*sz(1),orig(2)+0.0833333*sz(2),""G2"")"]
+        gr_i=[]
         model.blocktype="c"
         model.dep_ut=[%f %t]
         mo.model=ModelName
@@ -79,183 +91,3 @@ function [x,y,typ]=Gyrator(job,arg1,arg2)
         x.graphics.out_implicit=Typeout;
     end
 endfunction
-//=========================
-function Gyrator_draw_ports(o)
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    xset("pattern",default_color(0))
-    // draw input/output ports
-    //------------------------
-    // [x_in_Icon,y_in_Icon,type(2=imp_in/-2:imp_out/1=exp_input/-1_exp_output),orientation(degree)]
-    P=[2.5,90,2,0;2.5,10,2,0;97.5,90,-2,0;97.5,10,-2,0]
-
-    //============================
-    // setting the input/ outputs and direction
-    // implicit port: if it's located in the right it's output and while,
-    // else black
-    // explicit ports:
-
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    xset("pattern",default_color(1))
-    xset("thickness",1)
-
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-
-            if P(i,3)==1 then // explicit
-                inR=in*R;
-                xfpoly(orig(1)+inR(:,1)+P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if  P(i,3)==-1 then
-                outR=out*R;
-                xfpoly(orig(1)+outR(:,1)+P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                in2R=in2*R;
-                xfpoly(orig(1)+in2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                out2R=out2*R;
-                xpoly(orig(1)+out2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, "lines",1)
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-
-            if P(i,3)==1 then // explicit
-                inR=in*R;
-                xfpoly(orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-            if P(i,3)==-1 then // explicit
-                outR=out*R;
-                xfpoly(orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                in2R=in2*R;
-                xfpoly(orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)
-            end
-            if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                out2R=out2*R;
-                xpoly(orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, "lines",1)
-            end
-        end
-    end
-endfunction
-//=========================
-function [x,y,typ]=Gyrator_inputs(o)
-    // Copyright INRIA
-    xf=60
-    yf=40
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    //[orig,sz,orient]=o(2)(1:3);
-    inp=size(o.model.in,1);clkinp=size(o.model.evtin,1);
-
-    // [x_in_Icon,y_in_Icon,type(2=imp/1=exp_input/-1_exp_output),orientation(degree)]
-    P=[2.5,90,2,0;2.5,10,2,0;97.5,90,2,0;97.5,10,2,0]
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    x=[];y=[];typ=[]
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==1 then // explicit_input
-                inR=in($,:)*R;
-                x=[x,orig(1)+inR(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==2) then  // implicit
-                in2R=in2($,:)*R;
-                x=[x,orig(1)+in2R(:,1)+P(i,1)*sz(1)/100];// Black
-                y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==1 then // explicit_input
-                inR=in($,:)*R;
-                x=[x,orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==2) then  // implicit
-                in2R=in2($,:)*R;
-                x=[x,orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    end
-
-
-endfunction
-//=========================
-function [x,y,typ]=Gyrator_outputs(o)
-    // Copyright INRIA
-    xf=60
-    yf=40
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    out=size(o.model.out,1);clkout=size(o.model.evtout,1);
-    P=[2.5,90,2,0;2.5,10,2,0;97.5,90,2,0;97.5,10,2,0]
-
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    x=[];y=[];typ=[];
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==-1 then // explicit_output
-                outR=out($,:)*R;
-                x=[x,orig(1)+outR(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==-2) then  // implicit
-                out2R=out2($,:)*R;
-                x=[x,orig(1)+out2R(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==-1 then // explicit_output
-                outR=out($,:)*R;
-                x=[x,orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==-2) then  // implicit
-                out2R=out2($,:)*R;
-                x=[x,orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    end
-
-endfunction
index a4b4f7e..2eddd21 100644 (file)
 function [x,y,typ]=IdealTransformer(job,arg1,arg2)
     // the automatically generated interface block for Modelica Transformer.mo model
     //   - avec un dialogue de saisie de parametre
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f,trns_draw_ports)
-    case "getinputs" then
-        [x,y,typ]=trns_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=trns_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         x=arg1
         exprs=x.graphics.exprs
         while %t do
             [ok,N,exprs]=scicos_getvalue(["Set Transformer block parameters:";"";"N:"+...
             " Turn ratio (N1/N2)"],["N"],list("vec",1),exprs)
-            if ~ok then break,end
+            if ~ok then
+                break,
+            end
             x.model.equations.parameters(2)=list(N)
             x.graphics.exprs=exprs
             break
@@ -51,14 +48,29 @@ function [x,y,typ]=IdealTransformer(job,arg1,arg2)
         PrametersValue=[1]
         ParametersName=["N"]
         model=scicos_model()
-        Typein=[];Typeout=[];MI=[];MO=[]
+        Typein=[];
+        Typeout=[];
+        MI=[];
+        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:size(P,"r")
-            if P(i,3)==1  then  Typein= [Typein; "E"];MI=[MI;PortName(i)];end
-            if P(i,3)==2  then  Typein= [Typein; "I"];MI=[MI;PortName(i)];end
-            if P(i,3)==-1 then  Typeout=[Typeout;"E"];MO=[MO;PortName(i)];end
-            if P(i,3)==-2 then  Typeout=[Typeout;"I"];MO=[MO;PortName(i)];end
+            if P(i,3)==1  then
+                Typein= [Typein; "E"];
+                MI=[MI;PortName(i)];
+            end
+            if P(i,3)==2  then
+                Typein= [Typein; "I"];
+                MI=[MI;PortName(i)];
+            end
+            if P(i,3)==-1 then
+                Typeout=[Typeout;"E"];
+                MO=[MO;PortName(i)];
+            end
+            if P(i,3)==-2 then
+                Typeout=[Typeout;"I"];
+                MO=[MO;PortName(i)];
+            end
         end
         model=scicos_model()
         mo=modelica()
@@ -68,7 +80,7 @@ function [x,y,typ]=IdealTransformer(job,arg1,arg2)
         model.rpar=PrametersValue;
         mo.parameters=list(ParametersName,PrametersValue,zeros(ParametersName));
         exprs=["1"]
-        gr_i=["";"if orient then";"  xarcs([orig(1)+[0.275,0.275,0.275,0.275]*sz(1); orig(2)+[0.2916667,0.5,0.7083333,0.9166667]*sz(2);[0.125,0.125,0.125,0.125]*sz(1);[0.2083333,0.2083333,0.2083333,0.2083333]*sz(2);[-5760,-5760,-5760,-5760];[11520,11520,11520,11520]],[2,2,2,2])";"  xpolys(orig(1)+[0.02,0.02;0.34,0.34]*sz(1),orig(2)+[0.9166667,0.0833333;0.9166667,0.0833333]*sz(2),[2,2])";"  xarcs([orig(1)+[0.6,0.6,0.6,0.6]*sz(1); orig(2)+[0.2916667,0.5,0.7083333,0.9166667]*sz(2);[0.125,0.125,0.125,0.125]*sz(1);[0.2083333,0.2083333,0.2083333,0.2083333]*sz(2);[5760,5760,5760,5760];[11520,11520,11520,11520]],[2,2,2,2])";"  xpolys(orig(1)+[0.66,0.66;0.98,0.98]*sz(1),orig(2)+[0.9166667,0.0833333;0.9166667,0.0833333]*sz(2),[2,2])";"else";"  xarcs([orig(1)+[0.6,0.6,0.6,0.6]*sz(1); orig(2)+[0.2916667,0.5,0.7083333,0.9166667]*sz(2);[0.125,0.125,0.125,0.125]*sz(1);[0.2083333,0.2083333,0.2083333,0.2083333]*sz(2);[5760,5760,5760,5760];[11520,11520,11520,11520]],[2,2,2,2])";"  xpolys(orig(1)+[0.98,0.98;0.66,0.66]*sz(1),orig(2)+[0.9166667,0.0833333;0.9166667,0.0833333]*sz(2),[2,2])";"  xarcs([orig(1)+[0.275,0.275,0.275,0.275]*sz(1); orig(2)+[0.2916667,0.5,0.7083333,0.9166667]*sz(2);[0.125,0.125,0.125,0.125]*sz(1);[0.2083333,0.2083333,0.2083333,0.2083333]*sz(2);[-5760,-5760,-5760,-5760];[11520,11520,11520,11520]],[2,2,2,2])";"  xpolys(orig(1)+[0.34,0.34;0.02,0.02]*sz(1),orig(2)+[0.9166667,0.0833333;0.9166667,0.0833333]*sz(2),[2,2])";"end"]
+        gr_i=[]
         model.blocktype="c"
         model.dep_ut=[%f %t]
         mo.model=ModelName
@@ -80,183 +92,3 @@ function [x,y,typ]=IdealTransformer(job,arg1,arg2)
         x.graphics.out_implicit=Typeout;
     end
 endfunction
-//=========================
-function trns_draw_ports(o)
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    xset("pattern",default_color(0))
-    // draw input/output ports
-    //------------------------
-    // [x_in_Icon,y_in_Icon,type(2=imp_in/-2:imp_out/1=exp_input/-1_exp_output),orientation(degree)]
-    P=[2.5,90,2,0;2.5,10,2,0;97.5,90,-2,0;97.5,10,-2,0]
-
-    //============================
-    // setting the input/ outputs and direction
-    // implicit port: if it's located in the right it's output and while,
-    // else black
-    // explicit ports:
-
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    xset("pattern",default_color(1))
-    xset("thickness",1)
-
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-
-            if P(i,3)==1 then // explicit
-                inR=in*R;
-                xfpoly(orig(1)+inR(:,1)+P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if  P(i,3)==-1 then
-                outR=out*R;
-                xfpoly(orig(1)+outR(:,1)+P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                in2R=in2*R;
-                xfpoly(orig(1)+in2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                out2R=out2*R;
-                xpoly(orig(1)+out2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, "lines",1)
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-
-            if P(i,3)==1 then // explicit
-                inR=in*R;
-                xfpoly(orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-            if P(i,3)==-1 then // explicit
-                outR=out*R;
-                xfpoly(orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                in2R=in2*R;
-                xfpoly(orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)
-            end
-            if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                out2R=out2*R;
-                xpoly(orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, "lines",1)
-            end
-        end
-    end
-endfunction
-//=========================
-function [x,y,typ]=trns_inputs(o)
-    // Copyright INRIA
-    xf=60
-    yf=40
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    //[orig,sz,orient]=o(2)(1:3);
-    inp=size(o.model.in,1);clkinp=size(o.model.evtin,1);
-
-    // [x_in_Icon,y_in_Icon,type(2=imp/1=exp_input/-1_exp_output),orientation(degree)]
-    P=[2.5,90,2,0;2.5,10,2,0;97.5,90,2,0;97.5,10,2,0]
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    x=[];y=[];typ=[]
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==1 then // explicit_input
-                inR=in($,:)*R;
-                x=[x,orig(1)+inR(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==2) then  // implicit
-                in2R=in2($,:)*R;
-                x=[x,orig(1)+in2R(:,1)+P(i,1)*sz(1)/100];// Black
-                y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==1 then // explicit_input
-                inR=in($,:)*R;
-                x=[x,orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==2) then  // implicit
-                in2R=in2($,:)*R;
-                x=[x,orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    end
-
-
-endfunction
-//=========================
-function [x,y,typ]=trns_outputs(o)
-    // Copyright INRIA
-    xf=60
-    yf=40
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    out=size(o.model.out,1);clkout=size(o.model.evtout,1);
-    P=[2.5,90,2,0;2.5,10,2,0;97.5,90,2,0;97.5,10,2,0]
-
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    x=[];y=[];typ=[];
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==-1 then // explicit_output
-                outR=out($,:)*R;
-                x=[x,orig(1)+outR(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==-2) then  // implicit
-                out2R=out2($,:)*R;
-                x=[x,orig(1)+out2R(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==-1 then // explicit_output
-                outR=out($,:)*R;
-                x=[x,orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==-2) then  // implicit
-                out2R=out2($,:)*R;
-                x=[x,orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    end
-
-endfunction
index 1a0bb62..0bd2b7d 100644 (file)
 
 function [x,y,typ]=Inductor(job,arg1,arg2)
     // Copyright INRIA
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        L=arg1.graphics.exprs;
-        standard_draw(arg1,%f)
-    case "getinputs" then
-        [x,y,typ]=standard_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=standard_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         while %t do
             [ok,L,exprs]=scicos_getvalue("Set Inductor block parameter",..
             "L (H)",list("vec",1),exprs)
-            if ~ok then break,end
+            if ~ok then
+                break,
+            end
             model.rpar=L
             model.equations.parameters(2)=list(L)
             graphics.exprs=exprs
-            x.graphics=graphics;x.model=model
+            x.graphics=graphics;
+            x.model=model
             break
         end
     case "define" then
@@ -63,22 +60,7 @@ function [x,y,typ]=Inductor(job,arg1,arg2)
         model.equations=mo;
         exprs=string(L)
 
-        gr_i=["tt=linspace(0.04,0.96,100)'';"
-        "xpoly(tt*sz(1)+orig(1),+orig(2)+abs(sin(18*(tt-0.04)))*sz(2),""lines"");";
-        "xx=orig(1)+[0 0.04 0.04 0.04 0]*sz(1);";
-        "yy=orig(2)+[1/2 1/2 0  1/2 1/2]*sz(2);";
-        "xpoly(xx,yy) ";
-        "xx=orig(1)+[0.96 0.96 1   0.96 0.96 ]*sz(1);";
-        "yy=orig(2)+[abs(sin(18*0.92))   1/2   1/2 1/2 abs(sin(18*0.92))]*sz(2);";
-        "xpoly(xx,yy) ";
-        "txt=''L= ''+L;"
-        "style=2;"
-        "rectstr=stringbox(txt,orig(1),orig(2),0,style,1);"
-        "if ~exists(''%zoom'') then %zoom=1, end;"
-        "w=(rectstr(1,3)-rectstr(1,2))*%zoom;"
-        "h=(rectstr(2,2)-rectstr(2,4))*%zoom;"
-        "xstringb(orig(1)+sz(1)/2-w/2,orig(2)-h-4,txt,w,h,''fill'');"
-        "e=gce();"]
+        gr_i=[]
 
         x=standard_define([2 0.9],model,exprs,list(gr_i,0))
         x.graphics.in_implicit=["I"]
index 7fb12cb..5575640 100644 (file)
@@ -25,18 +25,10 @@ function [x,y,typ]=MOTOR(job,arg1,arg2)
     //   -  avec deux entrees et une sortie de type implicit et de dimension 1
     //   -  avec des ports disposes en des positions non standard
 
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f,motor_draw_ports)
-    case "getinputs" then
-        [x,y,typ]=motor_inputs(arg1)
-        //[x,y,typ]=standard_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=motor_outputs(arg1)
-        // [x,y,typ]=standard_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
     case "define" then
@@ -46,11 +38,7 @@ function [x,y,typ]=MOTOR(job,arg1,arg2)
         model.sim="motor"
         model.blocktype="c"
         model.dep_ut=[%t %f]
-        gr_i=["xrects([orig(1)+sz(1)/3;orig(2)+sz(2);sz(1)/3;sz(2)],scs_color(32))";
-        "xrects([orig(1)+2*sz(1)/3;orig(2)+0.87*sz(2);sz(1)/6;0.74*sz(2)],scs_color(33))";
-        "xrects([orig(1)+sz(1)/3-sz(1)/6;orig(2)+0.87*sz(2);sz(1)/6;0.74*sz(2)],scs_color(33))";
-        "xrects([orig(1)+5*sz(1)/6;orig(2)+(0.5+1/20)*sz(2);sz(1)/6;sz(2)/10],scs_color(33))";
-        "xrects([orig(1);orig(2)+(0.5+1/20)*sz(2);sz(1)/6;sz(2)/10],scs_color(33))"];
+        gr_i=[];
 
 
         exprs=""
@@ -59,92 +47,3 @@ function [x,y,typ]=MOTOR(job,arg1,arg2)
         x.graphics.in_implicit=["I"]
     end
 endfunction
-function motor_draw_ports(o)
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-
-
-    xset("pattern",default_color(0));xset("thickness",1)
-    // draw input/output ports
-    //------------------------
-
-    if orient then  //standard orientation
-        // set port shape
-        out2=[ 0  -1
-        1  -1
-        1   1
-        0   1]*diag([xf/7,yf/14])
-
-
-        dy=sz(2)/2
-        xset("pattern",default_color(1))
-        xpoly(out2(:,1)+(orig(1)+sz(1)),..
-        out2(:,2)+(orig(2)+sz(2)-dy),"lines",1)
-
-    else //tilded orientation
-        out2=[0  -1
-        -1  -1
-        -1   1
-        0   1]*diag([xf/7,yf/14])
-
-        dy=sz(2)/2
-        xset("pattern",default_color(1))
-        xpoly(out2(:,1)+ones(4,1)*orig(1)-1,..
-        out2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),"lines",1)
-
-    end
-    // motor command  ports
-    //------------------------
-    // set port shape
-
-
-
-    up= [-1  1
-    -1  0
-    1  0
-    1  1]*diag([xf/14,yf/7])
-
-    down= [-1  0
-    -1 -1
-    1 -1
-    1  0]*diag([xf/14,yf/7])
-
-
-    dx=sz(1)/2
-
-    xpoly(up(:,1)+ones(4,1)*(orig(1)+dx),..
-    up(:,2)+ones(4,1)*(orig(2)+sz(2)),"lines",1)
-
-    xfpoly(down(:,1)+ones(4,1)*(orig(1)+dx),..
-    down(:,2)+ones(4,1)*orig(2),1)
-
-
-endfunction
-
-function [x,y,typ]=motor_inputs(o)
-    xf=60
-    yf=40
-    orig=o.graphics.orig
-    sz=o.graphics.sz
-
-    x=orig(1)+sz(1)/2
-    y=orig(2)-yf/7
-    typ=2
-endfunction
-function [x,y,typ]=motor_outputs(o)
-    xf=60
-    yf=40
-
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    if orient then
-        xo=orig(1)+sz(1)
-        dx=xf/7
-    else
-        xo=orig(1)
-        dx=-xf/7
-    end
-    y=[orig(2)+sz(2)-sz(2)/2 orig(2)+yf/7+sz(2)]
-    x=[xo+dx orig(1)+sz(1)/2]
-    typ=[2 2]
-
-
-endfunction
index f217aa9..64a440e 100644 (file)
 //
 
 function [x,y,typ]=NMOS(job,arg1,arg2)
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f)
-
-    case "getinputs" then
-        [x,y,typ]=standard_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=standard_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         while %t do
             [ok,W,L,Beta,Vt,K2,K5,dW,dL,RDS,exprs]=scicos_getvalue("Set NMOS Transistor block parameters",..
@@ -48,10 +42,13 @@ function [x,y,typ]=NMOS(job,arg1,arg2)
             "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 then break,end
+            if ~ok then
+                break,
+            end
             model.equations.parameters(2)=list(W,L,Beta,Vt,K2,K5,dW,dL,RDS)
             graphics.exprs=exprs
-            x.graphics=graphics;x.model=model
+            x.graphics=graphics;
+            x.model=model
             break
         end
     case "define" then
@@ -78,28 +75,7 @@ function [x,y,typ]=NMOS(job,arg1,arg2)
         model.in=ones(size(mo.inputs,"*"),1)
         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=[" Thick=xget(''thickness'');xset(''thickness'',2);";
-        "if orient then,";
-        "x1=orig(1)+  [0, 15,15,15]*(sz(1)/32);";
-        "x2=orig(1)+[17,17,19,19,32,19,19,17]*(sz(1)/32);";
-        "x3=orig(1)+  [17,17,19,19,21,26,26,32,26,26,21,19,19,17]*(sz(1)/32);";
-        "x4=orig(1)+[17,17,19,19,32,19,19,17]*(sz(1)/32);";
-        "else,";
-        "x1=orig(1)+  [32, 17,17,17]*(sz(1)/32);";
-        "x2=orig(1)+[15,15,13,13,0,13,13,15]*(sz(1)/32);";
-        "x3=orig(1)+  [15,15,13,13,11, 6, 6, 0, 6, 6,11,13,13,15]*(sz(1)/32);";
-        "x4=orig(1)+[15,15,13,13,0,13,13,15]*(sz(1)/32);";
-        "end;"
-        "y1=orig(2)+5+[27,27,48,27]*(sz(2)/70);";
-        "y2=orig(2)+5+[48,40,40,44,44,44,48,48]*(sz(2)/70);";
-        "y3=orig(2)+5+[30,23,23,27,27, 31,27,27,27,23,27,27,30,30]*(sz(2)/70);";
-        "y4=orig(2)+5+[16,7,7, 11,11, 11, 16,16]*(sz(2)/70);";
-        "xpoly(x1,y1);";
-        "xpoly(x2,y2);";
-        "xpoly(x3,y3);";
-        "xpoly(x4,y4);";
-        "xset(''thickness'',Thick);"
-        ]
+        gr_i=[]
 
         x=standard_define([2 2],model,exprs,gr_i)
         x.graphics.in_implicit=["I"]
index 2656a39..37272fa 100644 (file)
 function [x,y,typ]=NPN(job,arg1,arg2)
     // the automatically generated interface block for Modelica NPN.mo model
     //   - avec un dialogue de saisie de parametre
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f,NPN_draw_ports)
-    case "getinputs" then
-        [x,y,typ]=NPN_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=NPN_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         x=arg1
         exprs=x.graphics.exprs
@@ -50,14 +45,29 @@ function [x,y,typ]=NPN(job,arg1,arg2)
         PrametersValue=[50;0.1;0;0.02;1.200D-10;5.000D-09;1.000D-12;4.000D-13;5.000D-13;0.8;0.4;0.8;0.333;1.000D-15;1.000D-15;0.02585;40]
         ParametersName=["Bf";"Br";"Is";"Vak";"Tauf";"Taur";"Ccs";"Cje";"Cjc";"Phie";"Me";"Phic";"Mc";"Gbc";"Gbe";"Vt";"EMinMax"]
         model=scicos_model()
-        Typein=[];Typeout=[];MI=[];MO=[]
+        Typein=[];
+        Typeout=[];
+        MI=[];
+        MO=[]
         P=[100,90,-2,0; 0,50,2,0; 100,10,-2,0]
         PortName=["C";"B";"E"]
         for i=1:size(P,"r")
-            if P(i,3)==1  then  Typein= [Typein; "E"];MI=[MI;PortName(i)];end
-            if P(i,3)==2  then  Typein= [Typein; "I"];MI=[MI;PortName(i)];end
-            if P(i,3)==-1 then  Typeout=[Typeout;"E"];MO=[MO;PortName(i)];end
-            if P(i,3)==-2 then  Typeout=[Typeout;"I"];MO=[MO;PortName(i)];end
+            if P(i,3)==1  then
+                Typein= [Typein; "E"];
+                MI=[MI;PortName(i)];
+            end
+            if P(i,3)==2  then
+                Typein= [Typein; "I"];
+                MI=[MI;PortName(i)];
+            end
+            if P(i,3)==-1 then
+                Typeout=[Typeout;"E"];
+                MO=[MO;PortName(i)];
+            end
+            if P(i,3)==-2 then
+                Typeout=[Typeout;"I"];
+                MO=[MO;PortName(i)];
+            end
         end
         model=scicos_model()
         mo=modelica()
@@ -67,7 +77,7 @@ function [x,y,typ]=NPN(job,arg1,arg2)
         model.rpar=PrametersValue;
         mo.parameters=list(ParametersName,PrametersValue,zeros(ParametersName));
         exprs=["50";"0.1";"1.e-16";"0.02";"0.12e-9";"5e-9";"1e-12";"0.4e-12";"0.5e-12";"0.8";"0.4";"0.8";"0.333";"1e-15";"1e-15";"0.02585";"40"]
-        gr_i=["";"if orient then";"  xpolys(orig(1)+[0.45,0.45,0.65,0.45,0.65,1;0.45,0,0.45,0.65,1,0.65]*sz(1),orig(2)+[0.8333333,0.5,0.9166667,0.4166667,0.0833333,0.9166667;0.1666667,0.5,0.5833333,0.0833333,0.0833333,0.9166667]*sz(2),[1,1,1,1,1,1])";"  xset(''color'',0)";"  xfpolys(orig(1)+[0.65;0.62;0.58;0.65]*sz(1),orig(2)+[0.0833333;0.2;0.1333333;0.0833333]*sz(2),2)";"else";"  xpolys(orig(1)+[0.55,0.55,0.35,0.55,0.35,0;0.55,1,0.55,0.35,0,0.35]*sz(1),orig(2)+[0.8333333,0.5,0.9166667,0.4166667,0.0833333,0.9166667;0.1666667,0.5,0.5833333,0.0833333,0.0833333,0.9166667]*sz(2),[1,1,1,1,1,1])";"  xset(''color'',0)";"  xfpolys(orig(1)+[0.35;0.38;0.42;0.35]*sz(1),orig(2)+[0.0833333;0.2;0.1333333;0.0833333]*sz(2),2)";"end"]
+        gr_i=[]
         model.blocktype="c"
         model.dep_ut=[%f %t]
         mo.model=ModelName
@@ -79,183 +89,3 @@ function [x,y,typ]=NPN(job,arg1,arg2)
         x.graphics.out_implicit=Typeout;
     end
 endfunction
-//=========================
-function NPN_draw_ports(o)
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    xset("pattern",default_color(0))
-    // draw input/output ports
-    //------------------------
-    // [x_in_Icon,y_in_Icon,type(2=imp_in/-2:imp_out/1=exp_input/-1_exp_output),orientation(degree)]
-    P=[100,90,-2,0;0,50,2,0;100,10,-2,0]
-
-    //============================
-    // setting the input/ outputs and direction
-    // implicit port: if it's located in the right it's output and while,
-    // else black
-    // explicit ports:
-
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    xset("pattern",default_color(1))
-    xset("thickness",1)
-
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-
-            if P(i,3)==1 then // explicit
-                inR=in*R;
-                xfpoly(orig(1)+inR(:,1)+P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if  P(i,3)==-1 then
-                outR=out*R;
-                xfpoly(orig(1)+outR(:,1)+P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                in2R=in2*R;
-                xfpoly(orig(1)+in2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                out2R=out2*R;
-                xpoly(orig(1)+out2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, "lines",1)
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-
-            if P(i,3)==1 then // explicit
-                inR=in*R;
-                xfpoly(orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-            if P(i,3)==-1 then // explicit
-                outR=out*R;
-                xfpoly(orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                in2R=in2*R;
-                xfpoly(orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)
-            end
-            if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                out2R=out2*R;
-                xpoly(orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, "lines",1)
-            end
-        end
-    end
-endfunction
-//=========================
-function [x,y,typ]=NPN_inputs(o)
-    // Copyright INRIA
-    xf=60
-    yf=40
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    //[orig,sz,orient]=o(2)(1:3);
-    inp=size(o.model.in,1);clkinp=size(o.model.evtin,1);
-
-    // [x_in_Icon,y_in_Icon,type(2=imp/1=exp_input/-1_exp_output),orientation(degree)]
-    P=[100,90,-2,0;0,50,2,0;100,10,-2,0]
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    x=[];y=[];typ=[]
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==1 then // explicit_input
-                inR=in($,:)*R;
-                x=[x,orig(1)+inR(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==2) then  // implicit
-                in2R=in2($,:)*R;
-                x=[x,orig(1)+in2R(:,1)+P(i,1)*sz(1)/100];// Black
-                y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==1 then // explicit_input
-                inR=in($,:)*R;
-                x=[x,orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==2) then  // implicit
-                in2R=in2($,:)*R;
-                x=[x,orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    end
-
-
-endfunction
-//=========================
-function [x,y,typ]=NPN_outputs(o)
-    // Copyright INRIA
-    xf=60
-    yf=40
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    out=size(o.model.out,1);clkout=size(o.model.evtout,1);
-    P=[100,90,-2,0;0,50,2,0;100,10,-2,0]
-
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    x=[];y=[];typ=[];
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==-1 then // explicit_output
-                outR=out($,:)*R;
-                x=[x,orig(1)+outR(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==-2) then  // implicit
-                out2R=out2($,:)*R;
-                x=[x,orig(1)+out2R(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==-1 then // explicit_output
-                outR=out($,:)*R;
-                x=[x,orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==-2) then  // implicit
-                out2R=out2($,:)*R;
-                x=[x,orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    end
-
-endfunction
index 0c961bc..5f23166 100644 (file)
 //
 
 function [x,y,typ]=OpAmp(job,arg1,arg2)
-    x=[];y=[];typ=[]
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f)
-    case "getinputs" then
-        [x,y,typ]=standard_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=standard_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         while %f do
             [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 then break,end
+            if ~ok then
+                break,
+            end
             model.equations.parameters(2)=list(OLGain,SatH,SatL)
             graphics.exprs=exprs
-            x.graphics=graphics;x.model=model
+            x.graphics=graphics;
+            x.model=model
             break
         end
     case "define" then
@@ -66,27 +64,7 @@ function [x,y,typ]=OpAmp(job,arg1,arg2)
         model.out=ones(size(mo.outputs,"*"),1);
         model.rpar=Z;
         exprs=string(Z);
-        gr_i=["";
-        "if orient then";
-        "  xx=orig(1)+[30,28,08,08,00,08,08,00,08,08,28,28]*(sz(1)/32);";
-        "  xstring(orig(1)+10*(sz(1)/32),orig(2)+24*(sz(2)/70),''-'');";
-        "  xstring(orig(1)+10*(sz(1)/32),orig(2)+46*(sz(2)/70),''+'');";
-        "else";
-        "  xx=orig(1)+[02,04,24,24,32,24,24,32,24,24,04,04]*(sz(1)/32);";
-        "  xstring(orig(1)+20*(sz(1)/32),orig(2)+24*(sz(2)/70),''-'');";
-        "  xstring(orig(1)+20*(sz(1)/32),orig(2)+46*(sz(2)/70),''+'');";
-        "end";
-        "yy=orig(2)+[35,35,12,24,24,24,48,48,48,60,35,35]*(sz(2)/70);";
-        "xpoly(xx,yy);";
-        "txt=''OP'';"
-        "style=2;"
-        "rectstr=stringbox(txt,orig(1)+13*(sz(1)/32),orig(2)+30*(sz(2)/70),0,style,0);"
-        "if ~exists(''%zoom'') then %zoom=1, end;"
-        "w=(rectstr(1,3)-rectstr(1,2))*%zoom;"
-        "h=(rectstr(2,2)-rectstr(2,4))*%zoom;"
-        "xstringb(orig(1)+13*(sz(1)/32),orig(2)+30*(sz(2)/70),txt,w,h,''fill'');"
-        "e=gce();"
-        "e.font_style=style;"]
+        gr_i=[]
         x=standard_define([3 5],model,exprs,gr_i)
         x.graphics.in_implicit=["I";"I"]
         x.graphics.out_implicit=["I"]
index 2e4ec9e..9219fe1 100644 (file)
 //
 
 function [x,y,typ]=PMOS(job,arg1,arg2)
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f)
-
-    case "getinputs" then
-        [x,y,typ]=standard_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=standard_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         while %t do
             [ok,W,L,Beta,Vt,K2,K5,dW,dL,RDS,exprs]=scicos_getvalue("Set PMOS Transistor parameters",..
@@ -48,10 +42,13 @@ function [x,y,typ]=PMOS(job,arg1,arg2)
             "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 then break,end
+            if ~ok then
+                break,
+            end
             model.equations.parameters(2)=list(W,L,Beta,Vt,K2,K5,dW,dL,RDS)
             graphics.exprs=exprs
-            x.graphics=graphics;x.model=model
+            x.graphics=graphics;
+            x.model=model
             break
         end
     case "define" then
@@ -77,28 +74,7 @@ function [x,y,typ]=PMOS(job,arg1,arg2)
         model.in=ones(size(mo.inputs,"*"),1)
         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=[" Thick=xget(''thickness'');xset(''thickness'',2);";
-        "if orient then,";
-        "x1=orig(1)+  [0, 15,15,15]*(sz(1)/32);";
-        "x2=orig(1)+[17,17,19,19,32,19,19,17]*(sz(1)/32);";
-        "x3=orig(1)+  [17,17,19,19,22, 22,27,32,27,22,22,19,19,17]*(sz(1)/32);";
-        "x4=orig(1)+[17,17,19,19,32,19,19,17]*(sz(1)/32);";
-        "else,";
-        "x1=orig(1)+  [32, 17,17,17]*(sz(1)/32);";
-        "x2=orig(1)+[15,15,13,13,0,13,13,15]*(sz(1)/32);";
-        "x3=orig(1)+  [15,15,13,13,10, 10, 5, 0,05,10,10,13,13,15]*(sz(1)/32);";
-        "x4=orig(1)+[15,15,13,13,0,13,13,15]*(sz(1)/32);";
-        "end,"
-        "y1=orig(2)+5+[27,27,48,27]*(sz(2)/70);";
-        "y2=orig(2)+5+[48,40,40,44,44,44,48,48]*(sz(2)/70);";
-        "y3=orig(2)+5+[30,23,23,27,27, 31,27,27,27,23,27,27,30,30]*(sz(2)/70);";
-        "y4=orig(2)+5+[16,7,7, 11,11, 11, 16,16]*(sz(2)/70);";
-        "xpoly(x1,y1);";
-        "xpoly(x2,y2);";
-        "xpoly(x3,y3);";
-        "xpoly(x4,y4);";
-        "xset(''thickness'',Thick);"
-        ]
+        gr_i=[]
 
         x=standard_define([2 2],model,exprs,gr_i)
         x.graphics.in_implicit=["I"]
index 93b70cd..d52a335 100644 (file)
 function [x,y,typ]=PNP(job,arg1,arg2)
     // the automatically generated interface block for Modelica PNP.mo model
     //   - avec un dialogue de saisie de parametre
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f,PNP_draw_ports)
-    case "getinputs" then
-        [x,y,typ]=PNP_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=PNP_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         x=arg1
         exprs=x.graphics.exprs
         while %t do
             [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 then break,end
+            if ~ok then
+                break,
+            end
             x.model.equations.parameters(2)=list(Bf,Br,Is,Vak,Tauf,Taur,Ccs,Cje,Cjc,Phie,Me,Phic,Mc,Gbc,Gbe,Vt,EMinMax)
             x.graphics.exprs=exprs
             break
@@ -51,14 +48,29 @@ function [x,y,typ]=PNP(job,arg1,arg2)
         PrametersValue=[50;0.1;0;0.02;1.200D-10;5.000D-09;1.000D-12;4.000D-13;5.000D-13;0.8;0.4;0.8;0.333;1.000D-15;1.000D-15;0.02585;40]
         ParametersName=["Bf";"Br";"Is";"Vak";"Tauf";"Taur";"Ccs";"Cje";"Cjc";"Phie";"Me";"Phic";"Mc";"Gbc";"Gbe";"Vt";"EMinMax"]
         model=scicos_model()
-        Typein=[];Typeout=[];MI=[];MO=[]
+        Typein=[];
+        Typeout=[];
+        MI=[];
+        MO=[]
         P=[100,90,-2,0;0,50,2,0;100,10,-2,0]
         PortName=["C";"B";"E"]
         for i=1:size(P,"r")
-            if P(i,3)==1  then  Typein= [Typein; "E"];MI=[MI;PortName(i)];end
-            if P(i,3)==2  then  Typein= [Typein; "I"];MI=[MI;PortName(i)];end
-            if P(i,3)==-1 then  Typeout=[Typeout;"E"];MO=[MO;PortName(i)];end
-            if P(i,3)==-2 then  Typeout=[Typeout;"I"];MO=[MO;PortName(i)];end
+            if P(i,3)==1  then
+                Typein= [Typein; "E"];
+                MI=[MI;PortName(i)];
+            end
+            if P(i,3)==2  then
+                Typein= [Typein; "I"];
+                MI=[MI;PortName(i)];
+            end
+            if P(i,3)==-1 then
+                Typeout=[Typeout;"E"];
+                MO=[MO;PortName(i)];
+            end
+            if P(i,3)==-2 then
+                Typeout=[Typeout;"I"];
+                MO=[MO;PortName(i)];
+            end
         end
         model=scicos_model()
         mo=modelica()
@@ -68,7 +80,7 @@ function [x,y,typ]=PNP(job,arg1,arg2)
         model.rpar=PrametersValue;
         mo.parameters=list(ParametersName,PrametersValue,zeros(ParametersName));
         exprs=["50";"0.1";"1.e-16";"0.02";"0.12e-9";"5e-9";"1e-12";"0.4e-12";"0.5e-12";"0.8";"0.4";"0.8";"0.333";"1e-15";"1e-15";"0.02585";"40"]
-        gr_i=["";"if orient then";"  xpolys(orig(1)+[0.45,0.45,1,0.65,0.45,0.65;0.45,0.005,0.65,0.45,0.65,0.995]*sz(1),orig(2)+[0.8333333,0.5,0.9166667,0.9166667,0.4166667,0.0833333;0.1666667,0.5,0.9166667,0.5833333,0.0833333,0.0833333]*sz(2),[1,1,1,1,1,1])";"  xset(''color'',0)";"  xfpolys(orig(1)+[0.45;0.525;0.485;0.45]*sz(1),orig(2)+[0.4166667;0.3583333;0.2916667;0.4166667]*sz(2),2)";"else";"  xpolys(orig(1)+[0.55,0.55,0,0.35,0.55,0.35;0.55,0.995,0.35,0.55,0.35,0.005]*sz(1),orig(2)+[0.8333333,0.5,0.9166667,0.9166667,0.4166667,0.0833333;0.1666667,0.5,0.9166667,0.5833333,0.0833333,0.0833333]*sz(2),[1,1,1,1,1,1])";"  xset(''color'',0)";"  xfpolys(orig(1)+[0.55;0.475;0.515;0.55]*sz(1),orig(2)+[0.4166667;0.3583333;0.2916667;0.4166667]*sz(2),2)";"end"]
+        gr_i=[]
         model.blocktype="c"
         model.dep_ut=[%f %t]
         mo.model=ModelName
@@ -80,183 +92,3 @@ function [x,y,typ]=PNP(job,arg1,arg2)
         x.graphics.out_implicit=Typeout;
     end
 endfunction
-//=========================
-function PNP_draw_ports(o)
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    xset("pattern",default_color(0))
-    // draw input/output ports
-    //------------------------
-    // [x_in_Icon,y_in_Icon,type(2=imp_in/-2:imp_out/1=exp_input/-1_exp_output),orientation(degree)]
-    P=[100,90,-2,0;0,50,2,0;100,10,-2,0]
-
-    //============================
-    // setting the input/ outputs and direction
-    // implicit port: if it's located in the right it's output and while,
-    // else black
-    // explicit ports:
-
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    xset("pattern",default_color(1))
-    xset("thickness",1)
-
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-
-            if P(i,3)==1 then // explicit
-                inR=in*R;
-                xfpoly(orig(1)+inR(:,1)+P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if  P(i,3)==-1 then
-                outR=out*R;
-                xfpoly(orig(1)+outR(:,1)+P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                in2R=in2*R;
-                xfpoly(orig(1)+in2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                out2R=out2*R;
-                xpoly(orig(1)+out2R(:,1)+P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, "lines",1)
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-
-            if P(i,3)==1 then // explicit
-                inR=in*R;
-                xfpoly(orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100,orig(2)+inR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-            if P(i,3)==-1 then // explicit
-                outR=out*R;
-                xfpoly(orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100,orig(2)+outR(:,2)+P(i,2)*sz(2)/100,1)
-            end
-
-            if P(i,3)==2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                in2R=in2*R;
-                xfpoly(orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  in2R(:,2)+P(i,2)*sz(2)/100,1)
-            end
-            if P(i,3)==-2 then  // deciding the port's color: black, if x<sz(1)/2 else white.
-                out2R=out2*R;
-                xpoly(orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100,orig(2)+  out2R(:,2)+P(i,2)*sz(2)/100, "lines",1)
-            end
-        end
-    end
-endfunction
-//=========================
-function [x,y,typ]=PNP_inputs(o)
-    // Copyright INRIA
-    xf=60
-    yf=40
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    //[orig,sz,orient]=o(2)(1:3);
-    inp=size(o.model.in,1);clkinp=size(o.model.evtin,1);
-
-    // [x_in_Icon,y_in_Icon,type(2=imp/1=exp_input/-1_exp_output),orientation(degree)]
-    P=[100,90,-2,0;0,50,2,0;100,10,-2,0]
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    x=[];y=[];typ=[]
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==1 then // explicit_input
-                inR=in($,:)*R;
-                x=[x,orig(1)+inR(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==2) then  // implicit
-                in2R=in2($,:)*R;
-                x=[x,orig(1)+in2R(:,1)+P(i,1)*sz(1)/100];// Black
-                y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==1 then // explicit_input
-                inR=in($,:)*R;
-                x=[x,orig(1)+sz(1)-inR(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+inR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==2) then  // implicit
-                in2R=in2($,:)*R;
-                x=[x,orig(1)+sz(1)-in2R(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+in2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    end
-
-
-endfunction
-//=========================
-function [x,y,typ]=PNP_outputs(o)
-    // Copyright INRIA
-    xf=60
-    yf=40
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    out=size(o.model.out,1);clkout=size(o.model.evtout,1);
-    P=[100,90,-2,0;0,50,2,0;100,10,-2,0]
-
-    in=  [-1 -1; 1  0;-1  1; -1 -1; -1 0]*diag([xf/28,yf/28]) ;// left_triangle
-    out= [-1 -1; 1  0;-1  1; -1 -1;  1 0]*diag([xf/28,yf/28]) ;// downward_triangle
-    in2= [-1 -1; 1 -1; 1  1; -1  1; -1 -1; 0 0]*diag([xf/28,yf/28])
-    out2=[ 1  1;-1  1;-1 -1;  1 -1;  1  1; 0 0]*diag([xf/28,yf/28])
-
-    x=[];y=[];typ=[];
-    if orient then
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==-1 then // explicit_output
-                outR=out($,:)*R;
-                x=[x,orig(1)+outR(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==-2) then  // implicit
-                out2R=out2($,:)*R;
-                x=[x,orig(1)+out2R(:,1)+P(i,1)*sz(1)/100];
-                y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    else
-        for i=1:size(P,"r")
-            theta=P(i,4)*%pi/180;
-            R=[cos(theta),sin(theta);sin(-theta),cos(theta)];
-            if (P(i,3))==-1 then // explicit_output
-                outR=out($,:)*R;
-                x=[x,orig(1)+sz(1)-outR(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+outR(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,1];
-            end
-            if(P(i,3)==-2) then  // implicit
-                out2R=out2($,:)*R;
-                x=[x,orig(1)+sz(1)-out2R(:,1)-P(i,1)*sz(1)/100];
-                y=[y,orig(2)+out2R(:,2)+P(i,2)*sz(2)/100];
-                typ=[typ,2];
-            end
-        end
-    end
-
-endfunction
index 3808b9f..619ac5e 100644 (file)
@@ -24,16 +24,10 @@ function [x,y,typ]= PotentialSensor(job,arg1,arg2)
     //   -  sans entree ni sortie de conditionnement
     //   -  avec une entree et une sortie de type implicit et de dimension 1
     //   - avec un dialogue de saisie de parametre
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f)
-    case "getinputs" then
-        [x,y,typ]=standard_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=standard_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
     case "define" then
@@ -49,19 +43,7 @@ function [x,y,typ]= PotentialSensor(job,arg1,arg2)
         mo.inputs="p";
         mo.outputs=["v"]
         model.equations=mo
-        gr_i=["xarc(orig(1)+sz(1)*1/8,orig(2)+sz(2)*4.3/5,sz(1)*3/4,sz(2)*3/4,0,360*64);";
-        "xsegs(orig(1)+sz(1)*[0 1/8],orig(2)+sz(2)*[1/2 1/2],0)";
-        " xsegs(orig(1)+sz(1)*[7/8 1],orig(2)+sz(2)*[1/2 1/2],0)";
-        "xsegs(orig(1)+sz(1)*[1.5/8 2.5/8],orig(2)+sz(2)*[1.3/2 1.2/2],0)";
-        "xsegs(orig(1)+sz(1)*[2.5/8 3.2/8],orig(2)+sz(2)*[1.62/2 1.3/2],0)";
-        "xsegs(orig(1)+sz(1)*[1/2 1/2],orig(2)+sz(2)*[4.25/5 1.3/2],0)";
-        "xsegs(orig(1)+sz(1)*[4.9/8 5.5/8],orig(2)+sz(2)*[1.3/2 1.65/2],0)";
-        "xsegs(orig(1)+sz(1)*[5.5/8 6.5/8],orig(2)+sz(2)*[1.2/2 1.32/2],0)";
-        "xsegs(orig(1)+sz(1)*[1/2 4.5/8],orig(2)+sz(2)*[1/2 1.32/2],0) ";
-        "xfarc(orig(1)+sz(1)*0.93/2,orig(2)+sz(2)*1/2,sz(1)*0.2/4,sz(2)*0.2/4,0,360*64);";
-        " xx=orig(1)+sz(1)*4.2/8+[.9 1 0 .9]*sz(1)/12;";
-        "yy=orig(2)+sz(2)*1.27/2+[0.1 1 0.3 0.1]*sz(2)/7;";
-        "xfpoly(xx,yy);"]
+        gr_i=[]
 
         x=standard_define([2 2],model,"",list(gr_i,0))
         x.graphics.in_implicit=["I"]
index dd48e5f..8bb798b 100644 (file)
@@ -24,29 +24,26 @@ function [x,y,typ]=Resistor(job,arg1,arg2)
     //   -  sans entree ni sortie de conditionnement
     //   -  avec une entree et une sortie de type implicit et de dimension 1
     //   - avec un dialogue de saisie de parametre
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        R=arg1.graphics.exprs;
-        standard_draw(arg1,%f)
-    case "getinputs" then
-        [x,y,typ]=standard_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=standard_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         while %t do
             [ok,R,exprs]=scicos_getvalue("Set Resistor block parameter",..
             "R (ohm)",list("vec",1),exprs)
-            if ~ok then break,end
+            if ~ok then
+                break,
+            end
             model.rpar=R
             model.equations.parameters(2)=list(R)
             graphics.exprs=exprs
-            x.graphics=graphics;x.model=model
+            x.graphics=graphics;
+            x.model=model
             break
         end
     case "define" then
@@ -65,17 +62,7 @@ function [x,y,typ]=Resistor(job,arg1,arg2)
         model.in=ones(size(mo.inputs,"*"),1)
         model.out=ones(size(mo.outputs,"*"),1)
         exprs=string(R)
-        gr_i=["xx=[0,1,1,7,7,8,7,7,1,1]/8;";
-        "yy=[1,1,0,0,1,1,1,2,2,1]/2;";
-        "xpoly(orig(1)+xx*sz(1),orig(2)+yy*sz(2)); "
-        "txt=''R= ''+R;"
-        "style=2;"
-        "rectstr=stringbox(txt,orig(1),orig(2),0,style,1);"
-        "if ~exists(''%zoom'') then %zoom=1, end;"
-        "w=(rectstr(1,3)-rectstr(1,2))*%zoom;"
-        "h=(rectstr(2,2)-rectstr(2,4))*%zoom;"
-        "xstringb(orig(1)+sz(1)/2-w/2,orig(2)-h-4,txt,w,h,''fill'');"
-        "e=gce();"]
+        gr_i=[]
         x=standard_define([2 1],model,exprs,list(gr_i,0))
         x.graphics.in_implicit=["I"]
         x.graphics.out_implicit=["I"]
index 3bd78b8..1baa222 100644 (file)
@@ -24,29 +24,27 @@ function [x,y,typ]= SineVoltage(job,arg1,arg2)
     //   -  sans entree ni sortie de conditionnement
     //   -  avec une entree et une sortie de type implicit et de dimension 1
     //   - avec un dialogue de saisie de parametre
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f)
-    case "getinputs" then
-        [x,y,typ]=standard_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=standard_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         while %t do
             [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 then break,end
+            if ~ok then
+                break,
+            end
             model.rpar=[V;ph;frq;offset;start]
             model.equations.parameters(2)=list(V,ph,frq,offset,start)
             graphics.exprs=exprs
-            x.graphics=graphics;x.model=model
+            x.graphics=graphics;
+            x.model=model
             break
         end
     case "define" then
@@ -71,12 +69,7 @@ function [x,y,typ]= SineVoltage(job,arg1,arg2)
 
         exprs=[string(V);string(ph);string(frq);string(offset);string(start)]
 
-        gr_i=["xarc(orig(1)+sz(1)*1/8,orig(2)+sz(2)*4.3/5,sz(1)*3/4,sz(2)*3/4,0,360*64);";
-        "xsegs(orig(1)+sz(1)*[0 1/8],orig(2)+sz(2)*[1/2 1/2],0)";
-        "xsegs(orig(1)+sz(1)*[7/8 1],orig(2)+sz(2)*[1/2 1/2],0)";
-        "V=string(model.rpar(1));"
-        "xstringb(orig(1),orig(2)+sz(2)*0.2,''~'',sz(1),sz(2)*0.3,''fill'')"
-        "xstringb(orig(1),orig(2)+sz(2)*0.5,V,sz(1),sz(2)*0.3,''fill'')"]
+        gr_i=[]
 
 
         x=standard_define([2 2],model,exprs,gr_i)
index b61aa9a..eb248f3 100644 (file)
@@ -24,28 +24,25 @@ function [x,y,typ]=Switch(job,arg1,arg2)
     //   -  sans entree ni sortie de conditionnement
     //   -  avec une entree et une sortie de type implicit et de dimension 1
     //   - avec un dialogue de saisie de parametre
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        R=arg1.graphics.exprs;
-        standard_draw(arg1,%f,VR_draw_ports)
-    case "getinputs" then
-        [x,y,typ]=VR_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=standard_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         while %t do
             [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 then break,end
+            if ~ok then
+                break,
+            end
             model.equations.parameters(2)=list(Ron,Roff)
             graphics.exprs=exprs
-            x.graphics=graphics;x.model=model
+            x.graphics=graphics;
+            x.model=model
             break
         end
     case "define" then
@@ -67,97 +64,9 @@ function [x,y,typ]=Switch(job,arg1,arg2)
         model.out=ones(size(mo.outputs,"*"),1)
         model.rpar=Z;
         exprs=string(Z);
-        gr_i=[" Thick=xget(''thickness'');xset(''thickness'',2);";
-        "x=orig(1)+[0,3,5.0]*sz(1)/8;";
-        "y=orig(2)+[1,1,2.5]*sz(2)/2;";
-        "xpoly(x,y,''lines'',0);";
-        "xpoly(orig(1)+3*sz(1)/8,orig(2)+1*sz(2)/2,''marks'',1);";
-        "x=orig(1)+[5,8]*sz(1)/8;";
-        "y=orig(2)+[1,1]*sz(2)/2;";
-        "xpoly(x,y,''lines'',0);";
-        "xstring(orig(1)+3,orig(2)+1.8,''sw'');";
-        "xset(''thickness'',Thick)"];
+        gr_i=[];
         x=standard_define([2 2],model,exprs,list(gr_i,0))
         x.graphics.in_implicit=["I";"E"]
         x.graphics.out_implicit=["I"]
     end
 endfunction
-// Switch
-
-function VR_draw_ports(o)
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    xset("pattern",default_color(0))
-    dy=sz(2)/2
-    // draw input/output ports
-    //------------------------
-    xset("pattern",default_color(1))
-    if orient then  //standard orientation
-        // set port shape
-        out2=[ 0  -1
-        1  -1
-        1   1
-        0   1]*diag([xf/7,yf/14])
-
-        in2= [-1  -1
-        0  -1
-        0   1
-        -1   1]*diag([xf/7,yf/14])
-
-
-        xpoly(out2(:,1)+(orig(1)+sz(1)),..
-        out2(:,2)+(orig(2)+sz(2)-dy),"lines",1)
-
-        xfpoly(in2(:,1)+orig(1),..
-        in2(:,2)+(orig(2)+sz(2)-dy),1)
-    else //tilded orientation
-        out2=[0  -1
-        -1  -1
-        -1   1
-        0   1]*diag([xf/7,yf/14])
-
-        in2= [1  -1
-        0  -1
-        0   1
-        1   1]*diag([xf/7,yf/14])
-
-
-        xset("pattern",default_color(1))
-        xpoly(out2(:,1)+ones(4,1)*orig(1)-1,..
-        out2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),"lines",1)
-
-        xfpoly(in2(:,1)+ones(4,1)*(orig(1)+sz(1))+1,..
-        in2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),1)
-    end
-
-    // set port shape
-
-    in= [-1/14  1/7
-    0      0
-    1/14   1/7
-    -1/14  1/7]*diag([xf,yf])
-
-
-    dx=sz(1)/2
-    xfpoly(in(:,1)+ones(4,1)*(orig(1)+dx),..
-    in(:,2)+ones(4,1)*(orig(2)+sz(2)),1)
-
-
-endfunction
-
-function [x,y,typ]=VR_inputs(o)
-    xf=60;yf=40
-    graphics=o.graphics
-    orig=graphics.orig;sz=graphics.sz;
-    if graphics.flip then
-        xo=orig(1);dx=-xf/7
-    else
-        xo=orig(1)+sz(1);dx=yf/7
-    end
-    y=orig(2)+sz(2)/2
-    x=(xo+dx)*ones(y)
-
-    x=[x,orig(1)+(sz(1)/2)]
-    y=[y,orig(2)+yf/7+sz(2)]
-    typ=[2 1]
-endfunction
-
index e917ff9..9e951af 100644 (file)
@@ -24,29 +24,27 @@ function [x,y,typ]=VVsourceAC(job,arg1,arg2)
     //   -  sans entree ni sortie de conditionnement
     //   -  avec une entree et une sortie de type implicit et de dimension 1
     //   - avec un dialogue de saisie de parametre
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f,VVac_draw_ports)
-    case "getinputs" then
-        [x,y,typ]=VVac_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=standard_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         while %t do
             [ok,FR,exprs]=scicos_getvalue("Set voltage source parameter",..
             ["Frequency (Hz)"],..
             list("vec",-1),exprs)
-            if ~ok then break,end
+            if ~ok then
+                break,
+            end
             model.rpar=[FR]
             model.equations.parameters(2)=list(FR)
             graphics.exprs=exprs
-            x.graphics=graphics;x.model=model
+            x.graphics=graphics;
+            x.model=model
             break
         end
     case "define" then
@@ -67,91 +65,10 @@ function [x,y,typ]=VVsourceAC(job,arg1,arg2)
         model.equations=mo
 
         exprs=[string(FR)]
-        gr_i=["xarc(orig(1)+sz(1)*1/8,orig(2)+sz(2)*4.3/5,sz(1)*3/4,sz(2)*3/4,0,360*64);";
-        "xsegs(orig(1)+sz(1)*[0 1/8],orig(2)+sz(2)*[1/2 1/2],0)";
-        "xsegs(orig(1)+sz(1)*[7/8 1],orig(2)+sz(2)*[1/2 1/2],0)";
-        "V=string(model.rpar(1));"
-        "xstringb(orig(1),orig(2)+sz(2)*0.2,''~'',sz(1),sz(2)*0.3,''fill'')"
-        "xstringb(orig(1),orig(2)+sz(2)*0.5,V,sz(1),sz(2)*0.3,''fill'')"]
+        gr_i=[]
 
         x=standard_define([2 2],model,exprs,list(gr_i,0))
         x.graphics.in_implicit=["I","E"]
         x.graphics.out_implicit=["I"]
     end
 endfunction
-function VVac_draw_ports(o)
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    xset("pattern",default_color(0))
-    dy=sz(2)/2
-    // draw input/output ports
-    //------------------------
-    xset("pattern",default_color(1))
-    if orient then  //standard orientation
-        // set port shape
-        out2=[ 0  -1
-        1  -1
-        1   1
-        0   1]*diag([xf/7,yf/14])
-
-        in2= [-1  -1
-        0  -1
-        0   1
-        -1   1]*diag([xf/7,yf/14])
-
-
-        xpoly(out2(:,1)+(orig(1)+sz(1)),..
-        out2(:,2)+(orig(2)+sz(2)-dy),"lines",1)
-
-        xfpoly(in2(:,1)+orig(1),..
-        in2(:,2)+(orig(2)+sz(2)-dy),1)
-    else //tilded orientation
-        out2=[0  -1
-        -1  -1
-        -1   1
-        0   1]*diag([xf/7,yf/14])
-
-        in2= [1  -1
-        0  -1
-        0   1
-        1   1]*diag([xf/7,yf/14])
-
-
-        xset("pattern",default_color(1))
-        xpoly(out2(:,1)+ones(4,1)*orig(1)-1,..
-        out2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),"lines",1)
-
-        xfpoly(in2(:,1)+ones(4,1)*(orig(1)+sz(1))+1,..
-        in2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),1)
-    end
-
-    // set port shape
-
-    in= [-1/14  1/7
-    0      0
-    1/14   1/7
-    -1/14  1/7]*diag([xf,yf])
-
-
-    dx=sz(1)/2
-    xfpoly(in(:,1)+ones(4,1)*(orig(1)+dx),..
-    in(:,2)+ones(4,1)*(orig(2)+sz(2)),1)
-
-
-endfunction
-
-function [x,y,typ]=VVac_inputs(o)
-    xf=60;yf=40
-    graphics=o.graphics
-    orig=graphics.orig;sz=graphics.sz;
-    if graphics.flip then
-        xo=orig(1);dx=-xf/7
-    else
-        xo=orig(1)+sz(1);dx=yf/7
-    end
-    y=orig(2)+sz(2)/2
-    x=(xo+dx)*ones(y)
-
-    x=[x,orig(1)+(sz(1)/2)]
-    y=[y,orig(2)+yf/7+sz(2)]
-    typ=[2 1]
-endfunction
index 430b7db..7484852 100644 (file)
@@ -24,17 +24,10 @@ function [x,y,typ]=VariableResistor(job,arg1,arg2)
     //   -  sans entree ni sortie de conditionnement
     //   -  avec une entree et une sortie de type implicit et de dimension 1
     //   - avec un dialogue de saisie de parametre
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        R=arg1.graphics.exprs;
-        standard_draw(arg1,%f,VR_draw_ports)
-    case "getinputs" then
-        [x,y,typ]=VR_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=standard_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
     case "define" then
@@ -50,87 +43,9 @@ function [x,y,typ]=VariableResistor(job,arg1,arg2)
         model.in=ones(size(mo.inputs,"*"),1)
         model.out=ones(size(mo.outputs,"*"),1)
         exprs=[]
-        gr_i=[ "xx=[0,1,1,7,7,8,7,7,1,1]/8;";
-        "yy=[1,1,0,0,1,1,1,2,2,1]/2;";
-        "xpoly(orig(1)+xx*sz(1),orig(2)+yy*sz(2)); "]
+        gr_i=[]
         x=standard_define([2 2],model,exprs,list(gr_i,0))
         x.graphics.in_implicit=["I","E"]
         x.graphics.out_implicit=["I"]
     end
 endfunction
-function VR_draw_ports(o)
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    xset("pattern",default_color(0))
-    dy=sz(2)/2
-    // draw input/output ports
-    //------------------------
-    xset("pattern",default_color(1))
-    if orient then  //standard orientation
-        // set port shape
-        out2=[ 0  -1
-        1  -1
-        1   1
-        0   1]*diag([xf/7,yf/14])
-
-        in2= [-1  -1
-        0  -1
-        0   1
-        -1   1]*diag([xf/7,yf/14])
-
-
-        xpoly(out2(:,1)+(orig(1)+sz(1)),..
-        out2(:,2)+(orig(2)+sz(2)-dy),"lines",1)
-
-        xfpoly(in2(:,1)+orig(1),..
-        in2(:,2)+(orig(2)+sz(2)-dy),1)
-    else //tilded orientation
-        out2=[0  -1
-        -1  -1
-        -1   1
-        0   1]*diag([xf/7,yf/14])
-
-        in2= [1  -1
-        0  -1
-        0   1
-        1   1]*diag([xf/7,yf/14])
-
-
-        xset("pattern",default_color(1))
-        xpoly(out2(:,1)+ones(4,1)*orig(1)-1,..
-        out2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),"lines",1)
-
-        xfpoly(in2(:,1)+ones(4,1)*(orig(1)+sz(1))+1,..
-        in2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),1)
-    end
-
-    // set port shape
-
-    in= [-1/14  1/7
-    0      0
-    1/14   1/7
-    -1/14  1/7]*diag([xf,yf])
-
-
-    dx=sz(1)/2
-    xfpoly(in(:,1)+ones(4,1)*(orig(1)+dx),..
-    in(:,2)+ones(4,1)*(orig(2)+sz(2)),1)
-
-
-endfunction
-
-function [x,y,typ]=VR_inputs(o)
-    xf=60;yf=40
-    graphics=o.graphics
-    orig=graphics.orig;sz=graphics.sz;
-    if graphics.flip then
-        xo=orig(1);dx=-xf/7
-    else
-        xo=orig(1)+sz(1);dx=yf/7
-    end
-    y=orig(2)+sz(2)/2
-    x=(xo+dx)*ones(y)
-
-    x=[x,orig(1)+(sz(1)/2)]
-    y=[y,orig(2)+yf/7+sz(2)]
-    typ=[2 1]
-endfunction
index 0011891..5e33531 100644 (file)
 //
 
 function [x,y,typ]=VoltageSensor(job,arg1,arg2)
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f,sensor_draw_ports)
-    case "getinputs" then
-        [x,y,typ]=standard_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=sensor_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
     case "define" then
         model=scicos_model()
-        model.in=1;model.out=[1; 1];
+        model.in=1;
+        model.out=[1; 1];
         model.sim="VoltageSensor"
         model.blocktype="c"
         model.dep_ut=[%t %f]
@@ -44,113 +39,9 @@ function [x,y,typ]=VoltageSensor(job,arg1,arg2)
         mo.outputs=["n";"v"]
         model.equations=mo
         exprs=[]
-        gr_i=["xarc(orig(1)+sz(1)*1/8,orig(2)+sz(2)*4.3/5,sz(1)*3/4,sz(2)*3/4,0,360*64);";
-        "xsegs(orig(1)+sz(1)*[0 1/8],orig(2)+sz(2)*[1/2 1/2],0)";
-        "xsegs(orig(1)+sz(1)*[7/8 1],orig(2)+sz(2)*[1/2 1/2],0)";
-        "xsegs(orig(1)+sz(1)*[1.5/8 2.5/8],orig(2)+sz(2)*[1.3/2 1.2/2],0)";
-        "xsegs(orig(1)+sz(1)*[2.5/8 3.2/8],orig(2)+sz(2)*[1.62/2 1.3/2],0)";
-        "xsegs(orig(1)+sz(1)*[1/2 1/2],orig(2)+sz(2)*[4.25/5 1.3/2],0)";
-        "xsegs(orig(1)+sz(1)*[4.9/8 5.5/8],orig(2)+sz(2)*[1.3/2 1.65/2],0)";
-        "xsegs(orig(1)+sz(1)*[5.5/8 6.5/8],orig(2)+sz(2)*[1.2/2 1.32/2],0)";
-        "xsegs(orig(1)+sz(1)*[1/2 4.5/8],orig(2)+sz(2)*[1/2 1.32/2],0) ";
-        "xsegs(orig(1)+sz(1)*[1/2 1/2],orig(2)+sz(2)*[0.9/8 -1/8],0)";
-        "xfarc(orig(1)+sz(1)*0.93/2,orig(2)+sz(2)*1/2,sz(1)*0.2/4,sz(2)*0.2/4,0,360*64);";
-        " xx=orig(1)+sz(1)*4.2/8+[.9 1 0 .9]*sz(1)/12;";
-        "yy=orig(2)+sz(2)*1.27/2+[0.1 1 0.3 0.1]*sz(2)/7;";
-        "xfpoly(xx,yy);"
-        "xstring(orig(1)+sz(1)/2,orig(2)+sz(2)/5,''V'')"]
+        gr_i=[]
         x=standard_define([2 2],model,exprs,list(gr_i,0))
         x.graphics.in_implicit=["I"]
         x.graphics.out_implicit=["I";"E"]
     end
 endfunction
-
-function sensor_draw_ports(o)
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    xset("pattern",default_color(0))
-    // draw input/output ports
-    //------------------------
-
-    if orient then  //standard orientation
-        // set port shape
-        out2=[ 0  -1
-        1  -1
-        1   1
-        0   1]*diag([xf/7,yf/14])
-
-        in2= [-1  -1
-        0  -1
-        0   1
-        -1   1]*diag([xf/7,yf/14])
-        dy=sz(2)/2
-        xset("pattern",default_color(1))
-        xpoly(out2(:,1)+(orig(1)+sz(1)),..
-        out2(:,2)+(orig(2)+sz(2)-dy),"lines",1)
-
-
-        dy=sz(2)/2
-        xfpoly(in2(:,1)+orig(1),..
-        in2(:,2)+(orig(2)+sz(2)-dy),1)
-    else //tilded orientation
-        out2=[0  -1
-        -1  -1
-        -1   1
-        0   1]*diag([xf/7,yf/14])
-
-        in2= [1  -1
-        0  -1
-        0   1
-        1   1]*diag([xf/7,yf/14])
-
-
-        dy=sz(2)/2
-        xset("pattern",default_color(1))
-        xpoly(out2(:,1)+ones(4,1)*orig(1)-1,..
-        out2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),"lines",1)
-        dy=sz(2)/2
-        xfpoly(in2(:,1)+ones(4,1)*(orig(1)+sz(1))+1,..
-        in2(:,2)+ones(4,1)*(orig(2)+sz(2)-dy),1)
-    end
-    // valve command port port
-    //------------------------
-    // set port shape
-
-
-
-    out= [-1  1
-    0  0
-    1  1
-    -1  1]*diag([xf/14,yf/7])
-
-
-
-    dx=sz(1)/2
-
-    xpoly(out(:,1)+ones(4,1)*(orig(1)+dx),..
-    out(:,2)+ones(4,1)*(orig(2)-sz(2)*2/8),"lines",1)
-
-endfunction
-
-function [x,y,typ]=sensor_outputs(o)
-    xf=60
-    yf=40
-    [orig,sz,orient]=(o.graphics.orig,o.graphics.sz,o.graphics.flip)
-    //[orig,sz,orient]=o(2)(1:3);
-    inp=size(o.model.in,1);clkinp=size(o.model.evtin,1);
-
-    if orient then
-        x1=orig(1)+sz(1)
-        dx1=-xf/7
-        x2=orig(1)
-        dx2=xf/7
-    else
-        x1=orig(1)
-        dx1=yf/7
-        x2=orig(1)+sz(1)
-        dx2=-xf/7
-    end
-
-    y=[orig(2)+sz(2)-(sz(2)/2) ,orig(2)-sz(2)*2/8]
-    x=[(x1+dx2)  orig(1)+sz(1)/2]
-    typ=[2 1]
-endfunction
index 0e33281..da08729 100644 (file)
@@ -24,29 +24,27 @@ function [x,y,typ]=VsourceAC(job,arg1,arg2)
     //   -  sans entree ni sortie de conditionnement
     //   -  avec une entree et une sortie de type implicit et de dimension 1
     //   - avec un dialogue de saisie de parametre
-    x=[];y=[];typ=[];
+    x=[];
+    y=[];
+    typ=[];
     select job
-    case "plot" then
-        standard_draw(arg1,%f)
-    case "getinputs" then
-        [x,y,typ]=standard_inputs(arg1)
-    case "getoutputs" then
-        [x,y,typ]=standard_outputs(arg1)
-    case "getorigin" then
-        [x,y]=standard_origin(arg1)
     case "set" then
         x=arg1;
-        graphics=arg1.graphics;exprs=graphics.exprs
+        graphics=arg1.graphics;
+        exprs=graphics.exprs
         model=arg1.model;
         while %t do
             [ok,VA,FR,exprs]=scicos_getvalue("Set voltage source parameter",..
             ["Amplitude (Volt)";"Frequency (Hz)"],..
             list("vec",-1,"vec",-1),exprs)
-            if ~ok then break,end
+            if ~ok then
+                break,
+            end
             model.rpar=[VA;FR]
             model.equations.parameters(2)=list(VA,FR)
             graphics.exprs=exprs
-            x.graphics=graphics;x.model=model
+            x.graphics=graphics;
+            x.model=model
             break
         end
     case "define" then
@@ -67,12 +65,7 @@ function [x,y,typ]=VsourceAC(job,arg1,arg2)
         model.equations=mo
 
         exprs=[string(VA);string(FR)]
-        gr_i=["xarc(orig(1)+sz(1)*1/8,orig(2)+sz(2)*4.3/5,sz(1)*3/4,sz(2)*3/4,0,360*64);";
-        "xsegs(orig(1)+sz(1)*[0 1/8],orig(2)+sz(2)*[1/2 1/2],0)";
-        "xsegs(orig(1)+sz(1)*[7/8 1],orig(2)+sz(2)*[1/2 1/2],0)";
-        "V=string(model.rpar(1));"
-        "xstringb(orig(1),orig(2)+sz(2)*0.2,''~'',sz(1),sz(2)*0.3,''fill'')"
-        "xstringb(orig(1),orig(2)+sz(2)*0.5,V,sz(1),sz(2)*0.3,''fill'')"]
+        gr_i=[]
 
         x=standard_define([2 2],model,exprs,list(gr_i,0))
         x.graphics.in_implicit=["I"]