[xcos] OpAmp icon was too big
[scilab.git] / scilab / modules / scicos_blocks / macros / Electrical / OpAmp.sci
1 //  Scicos
2 //
3 //  Copyright (C) INRIA - METALAU Project <scicos@inria.fr>
4 //
5 // This program is free software; you can redistribute it and/or modify
6 // it under the terms of the GNU General Public License as published by
7 // the Free Software Foundation; either version 2 of the License, or
8 // (at your option) any later version.
9 //
10 // This program is distributed in the hope that it will be useful,
11 // but WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13 // GNU General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License
16 // along with this program; if not, write to the Free Software
17 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 //
19 // See the file ../license.txt
20 //
21
22 function [x,y,typ]=OpAmp(job,arg1,arg2)
23     x=[];
24     y=[];
25     typ=[];
26     select job
27     case "set" then
28         x=arg1;
29         graphics=arg1.graphics;
30         exprs=graphics.exprs
31         model=arg1.model;
32         while %f do
33             [ok,OLGain,SatH,SatL,exprs]=scicos_getvalue(..
34             msprintf(_("Set %s block parameters"), "Operational Amplifier"),..
35              _(["Open Loop Gain";
36                 "Positive saturation voltage";
37                 "Negative saturation voltage"]),..
38             list("vec",1,"vec",1,"vec",1),exprs);
39             if ~ok then
40                 break,
41             end
42             model.equations.parameters(2)=list(OLGain,SatH,SatL)
43             graphics.exprs=exprs
44             x.graphics=graphics;
45             x.model=model
46             break
47         end
48     case "define" then
49         //  OLGain=1000;
50         //  SatH=10;
51         // SatL=-10;
52         // S=['OLGain';'SatH';'SatL'];
53         // Z = evstr(S);
54         S=[];
55         Z=[];
56         model=scicos_model();
57         model.sim="OpAmp";
58         model.blocktype="c";
59         model.dep_ut=[%t %f];
60         mo=modelica();
61         mo.model=model.sim;
62         mo.inputs=["in_p";"in_n"];
63         mo.outputs=["out"];
64         mo.parameters=list(S,Z);
65         model.equations=mo;
66         model.in=ones(size(mo.inputs,"*"),1);
67         model.out=ones(size(mo.outputs,"*"),1);
68         model.rpar=Z;
69         exprs=string(Z);
70         gr_i=[]
71         x=standard_define([3 5],model,exprs,gr_i)
72         x.graphics.in_implicit=["I";"I"]
73         x.graphics.out_implicit=["I"]
74         x.graphics.sz = [2.5 3]
75     end
76 endfunction
77 // OpAmp
78