summaryrefslogtreecommitdiffstats
path: root/scilab/modules/scicos_blocks
diff options
context:
space:
mode:
authorAllan CORNET <allan.cornet@scilab.org>2010-01-12 12:11:01 +0100
committerAllan CORNET <allan.cornet@scilab.org>2010-01-12 12:11:01 +0100
commit79d05d4634741f3966db766381af5157c603a98d (patch)
tree6624cd26e8600464059538371ec4b8d50355c7f0 /scilab/modules/scicos_blocks
parent0dabfcb3fa406dac34cecc21685ec9974c67a184 (diff)
downloadscilab-79d05d4634741f3966db766381af5157c603a98d.zip
scilab-79d05d4634741f3966db766381af5157c603a98d.tar.gz
revert to initial merged version Electrical.mo & Hydraulics.mo
Diffstat (limited to 'scilab/modules/scicos_blocks')
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/CCS.mo28
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/CVS.mo28
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/Capacitor.mo30
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/ConstantVoltage.mo28
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/CurrentSensor.mo31
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/Diode.mo39
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/ExternFunction.mo28
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/Ground.mo26
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/Gyrator.mo42
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/IdealTransformer.mo46
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/InPutPort.mo28
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/Inductor.mo32
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/NMOS.mo64
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/NPN.mo89
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/OpAmp.mo36
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/OutPort.mo25
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/OutPutPort.mo30
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/PMOS.mo60
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/PNP.mo89
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/Pin.mo25
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/PotentialSensor.mo29
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/Resistor.mo30
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/SineVoltage.mo39
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/Switch.mo32
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/VVsourceAC.mo32
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/VariableResistor.mo28
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/VoltageSensor.mo31
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/VsourceAC.mo34
-rw-r--r--scilab/modules/scicos_blocks/macros/Electrical/VsourceDC.mo28
-rw-r--r--scilab/modules/scicos_blocks/macros/Hydraulics/Bache.mo140
-rw-r--r--scilab/modules/scicos_blocks/macros/Hydraulics/Hydraulics.mo321
-rw-r--r--scilab/modules/scicos_blocks/macros/Hydraulics/PerteDP.mo80
-rw-r--r--scilab/modules/scicos_blocks/macros/Hydraulics/PortPHQ1.mo31
-rw-r--r--scilab/modules/scicos_blocks/macros/Hydraulics/PortPHQ2.mo32
-rw-r--r--scilab/modules/scicos_blocks/macros/Hydraulics/Puits.mo47
-rw-r--r--scilab/modules/scicos_blocks/macros/Hydraulics/Source.mo47
-rw-r--r--scilab/modules/scicos_blocks/macros/Hydraulics/ThermoCarre.mo35
-rw-r--r--scilab/modules/scicos_blocks/macros/Hydraulics/VanneReglante.mo73
38 files changed, 321 insertions, 1572 deletions
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/CCS.mo b/scilab/modules/scicos_blocks/macros/Electrical/CCS.mo
deleted file mode 100644
index 7d8e7da..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/CCS.mo
+++ /dev/null
@@ -1,28 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22class CCS "controlled voltage source"
23 Pin p, n;
24 Real Iin;
25equation
26 Iin = n.i;
27 0 = p.i + n.i;
28end CCS;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/CVS.mo b/scilab/modules/scicos_blocks/macros/Electrical/CVS.mo
deleted file mode 100644
index 95f6b4c..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/CVS.mo
+++ /dev/null
@@ -1,28 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model CVS "controlled voltage source"
23 Pin p, n;
24 Real vin;
25equation
26 vin = p.v - n.v;
27 0 = p.i + n.i;
28end CVS;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Capacitor.mo b/scilab/modules/scicos_blocks/macros/Electrical/Capacitor.mo
deleted file mode 100644
index 25f763d..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/Capacitor.mo
+++ /dev/null
@@ -1,30 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model Capacitor
23 Pin p, n;
24 Real v;
25 parameter Real C(fixed=true)=1e-5 "Capacitance";
26equation
27 C*der(v) = p.i;
28 v = p.v - n.v;
29 p.i = -n.i;
30end Capacitor;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/ConstantVoltage.mo b/scilab/modules/scicos_blocks/macros/Electrical/ConstantVoltage.mo
deleted file mode 100644
index 231ba71..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/ConstantVoltage.mo
+++ /dev/null
@@ -1,28 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22class ConstantVoltage "Source for constant voltage"
23 Pin p, n;
24 parameter Real V = 1 "Volts";
25equation
26 V = p.v - n.v;
27 p.i + n.i = 0;
28end ConstantVoltage;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/CurrentSensor.mo b/scilab/modules/scicos_blocks/macros/Electrical/CurrentSensor.mo
deleted file mode 100644
index 3873c31..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/CurrentSensor.mo
+++ /dev/null
@@ -1,31 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model CurrentSensor
23 Pin p;
24 Pin n;
25 Real i;
26 equation
27 p.v = n.v;
28 p.i = i;
29 n.i = -i;
30 end CurrentSensor;
31
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Diode.mo b/scilab/modules/scicos_blocks/macros/Electrical/Diode.mo
deleted file mode 100644
index 636008a..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/Diode.mo
+++ /dev/null
@@ -1,39 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model Diode "Simple diode"
23 Pin p, n;
24 parameter Real Ids=1.e-6 "Saturation current";
25 parameter Real Vt=0.04 "Voltage equivalent of temperature (kT/qn)";
26 parameter Real Maxexp=15 "Max. exponent for linear continuation";
27 parameter Real R=1.e8 "Parallel ohmic resistance";
28 Real v;
29 equation
30 v = p.v - n.v;
31
32 p.i = if noEvent(v/Vt > Maxexp) then
33 Ids*(exp(Maxexp)*(1 + v/Vt - Maxexp) - 1) + v/R
34 else
35 Ids*(exp(v/Vt) - 1) + v/R;
36
37 p.i = -n.i;
38
39 end Diode;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/ExternFunction.mo b/scilab/modules/scicos_blocks/macros/Electrical/ExternFunction.mo
deleted file mode 100644
index 69a5971..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/ExternFunction.mo
+++ /dev/null
@@ -1,28 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22class ExternFunction "external function ExternFunction"
23 // input Real u "1 Real input";
24 Real u "1 Real input";
25 // output Real y "1 Real output";
26 Real y "1 Real output";
27external;
28end ExternFunction;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Ground.mo b/scilab/modules/scicos_blocks/macros/Electrical/Ground.mo
deleted file mode 100644
index 2e59e69..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/Ground.mo
+++ /dev/null
@@ -1,26 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model Ground "Ground"
23 Pin p;
24equation
25 p.v = 0;
26end Ground;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Gyrator.mo b/scilab/modules/scicos_blocks/macros/Electrical/Gyrator.mo
deleted file mode 100644
index 52a3e17..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/Gyrator.mo
+++ /dev/null
@@ -1,42 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model Gyrator "Gyrator"
23 parameter Real G1=1 "Gyration conductance";
24 parameter Real G2=1 "Gyration conductance";
25
26 Pin p1,n1,p2,n2;
27 Real v2,v1,i1,i2;
28
29equation
30
31 v1=p1.v-n1.v;
32 0=p1.i+n1.i;
33 i1=p1.i;
34
35 v2=p2.v-n2.v;
36 0=p2.i+n2.i;
37 i2=p2.i;
38
39 i1 = G2*v2;
40 i2 = -G1*v1;
41
42end Gyrator;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/IdealTransformer.mo b/scilab/modules/scicos_blocks/macros/Electrical/IdealTransformer.mo
deleted file mode 100644
index bffa5f8..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/IdealTransformer.mo
+++ /dev/null
@@ -1,46 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model IdealTransformer "Transformer with two ports"
23 parameter Real N=1 "Transformer turn ration N1/N2";
24 Pin p1, n1, p2, n2;
25 Real v2,v1,i1,i2;
26
27equation
28 v1=p1.v-n1.v;
29 0=p1.i+n1.i;
30 i1=p1.i;
31
32 v2=p2.v-n2.v;
33 0=p2.i+n2.i;
34 i2=p2.i;
35
36/* v1 = L1*der(i1) + M*der(i2);
37 v2 = M*der(i1) + L2*der(i2);
38 Results very often in high index
39 problem not handled in Scicos /Masoud
40*/
41
42v1=N*v2;
43i2=-N*i1;
44
45end IdealTransformer;
46
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/InPutPort.mo b/scilab/modules/scicos_blocks/macros/Electrical/InPutPort.mo
deleted file mode 100644
index 553531e..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/InPutPort.mo
+++ /dev/null
@@ -1,28 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model InPutPort
23 Real vo;
24 // input Real vi;
25 Real vi;
26 equation
27 vi=vo;
28end InPutPort;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Inductor.mo b/scilab/modules/scicos_blocks/macros/Electrical/Inductor.mo
deleted file mode 100644
index cba7729..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/Inductor.mo
+++ /dev/null
@@ -1,32 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model Inductor "Ideal electrical inductor"
23 Pin p, n;
24 Real v;
25 Real i;
26 parameter Real L=1e-6 "Inductance";
27equation
28 v = L*der(i);
29 v = p.v - n.v;
30 0 = p.i + n.i;
31 i = p.i;
32end Inductor;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/NMOS.mo b/scilab/modules/scicos_blocks/macros/Electrical/NMOS.mo
deleted file mode 100644
index ed28339..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/NMOS.mo
+++ /dev/null
@@ -1,64 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model NMOS "Simple MOS Transistor"
23 parameter Real W=20.e-6 "Width";
24 parameter Real L=6.e-6 "Length";
25 parameter Real Beta=0.041e-3 "Transconductance parameter";
26 parameter Real Vt=0.8 "Zero bias threshold voltage";
27 parameter Real K2=1.144 "Bulk threshold parameter";
28 parameter Real K5= 0.7311"Reduction of pinch-off region";
29 parameter Real dW=-2.5e-6 "narrowing of channel";
30 parameter Real dL= -1.5e-6"shortening of channel";
31 parameter Real RDS=1.e+7 "Drain-Source-Resistance";
32
33 Pin D "Drain";
34 Pin G "Gate";
35 Pin S "Source";
36 Pin B "Bulk";
37
38 Real v;
39 Real uds;
40 Real ubs;
41 Real ugst;
42 Real ud;
43 Real us;
44 Real id,gds;
45equation
46 //assert (L + dL > 0, "Effective length must be positive");
47 //assert (W + dW > 0, "Effective width must be positive");
48
49 gds = if noEvent(RDS < 1.e-20 and RDS > -1.e-20) then 1.e20 else 1/RDS;
50 v = Beta*(W + dW)/(L + dL);
51 ud = if noEvent(D.v < S.v) then S.v else D.v;
52 us = if noEvent(D.v < S.v) then D.v else S.v;
53 uds = ud - us;
54 ubs = if noEvent(B.v > us) then 0 else B.v - us;
55 ugst = (G.v - us - Vt + K2*ubs)*K5;
56 id = if noEvent(ugst <= 0) then uds*gds else if noEvent(ugst > uds) then v*uds*(ugst
57 - uds/2) + uds*gds else v*ugst*ugst/2 + uds*gds;
58 G.i = 0;
59 D.i = if noEvent(D.v < S.v) then -id else id;
60 S.i = -D.i;
61 B.i = 0;
62end NMOS;
63
64
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/NPN.mo b/scilab/modules/scicos_blocks/macros/Electrical/NPN.mo
deleted file mode 100644
index e45496a..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/NPN.mo
+++ /dev/null
@@ -1,89 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model NPN "Simple BJT according to Ebers-Moll"
23 parameter Real Bf=50 "Forward beta";
24 parameter Real Br=0.1 "Reverse beta";
25 parameter Real Is=1.e-16 "Transport saturation current";
26 parameter Real Vak=0.02 "Early voltage (inverse), 1/Volt";
27 parameter Real Tauf=0.12e-9 "Ideal forward transit time";
28 parameter Real Taur=5e-9 "Ideal reverse transit time";
29 parameter Real Ccs=1e-12 "Collector-substrat(ground) cap.";
30 parameter Real Cje=0.4e-12 "Base-emitter zero bias depletion cap.";
31 parameter Real Cjc=0.5e-12 "Base-coll. zero bias depletion cap.";
32 parameter Real Phie=0.8 "Base-emitter diffusion voltage";
33 parameter Real Me=0.4 "Base-emitter gradation exponent";
34 parameter Real Phic=0.8 "Base-collector diffusion voltage";
35 parameter Real Mc=0.333 "Base-collector gradation exponent";
36 parameter Real Gbc=1e-15 "Base-collector conductance";
37 parameter Real Gbe=1e-15 "Base-emitter conductance";
38 parameter Real Vt=0.02585 "Voltage equivalent of temperature";
39 parameter Real EMinMax=40 "if x > EMax, the exp(x) function is linearized";
40 Real vbc;
41 Real vbe;
42 Real qbk;
43 Real ibc;
44 Real ibe;
45 Real cbc;
46 Real cbe;
47 Real ExMin;
48 Real ExMax;
49 Real Capcje;
50 Real Capcjc;
51 Real EMax;
52 Real EMin;
53
54 Pin C "Collector";
55 Pin B "Base";
56 Pin E "Emitter";
57equation
58 EMax=EMinMax;
59 EMin=-2*EMinMax;
60 ExMin = exp(EMin);
61 ExMax = exp(EMax);
62 vbc = B.v - C.v;
63 vbe = B.v - E.v;
64 qbk = 1 - vbc*Vak;
65
66 ibc = if noEvent(vbc/Vt < EMin) then Is*(ExMin*(vbc/Vt - EMin + 1) - 1) + vbc*Gbc
67 else if noEvent(vbc/Vt > EMax) then Is*(ExMax*(vbc/Vt - EMax + 1) - 1) + vbc*Gbc
68 else Is*(exp(vbc/Vt) - 1) + vbc*Gbc;
69
70 ibe = if noEvent(vbe/Vt < EMin) then Is*(ExMin*(vbe/Vt - EMin + 1) - 1) + vbe*Gbe
71 else if noEvent(vbe/Vt > EMax) then Is*(ExMax*(vbe/Vt - EMax + 1) - 1) + vbe*Gbe
72 else Is*(exp(vbe/Vt) - 1) + vbe*Gbe;
73
74 Capcjc = if (vbc/Phic > 0) then Cjc*(1 + Mc*vbc/Phic) else Cjc*(1 - vbc/Phic);
75 Capcje = if (vbe/Phie > 0) then Cje*(1 + Me*vbe/Phie) else Cje*(1 - vbe/Phie);
76
77 cbc = if noEvent(vbc/Vt < EMin) then Taur*Is/Vt*ExMin*(vbc/Vt - EMin + 1) + Capcjc
78 else if noEvent(vbc/Vt > EMax) then Taur*Is/Vt*ExMax*(vbc/Vt - EMax + 1) + Capcjc
79 else Taur*Is/Vt*exp(vbc/Vt) + Capcjc;
80
81 cbe = if noEvent(vbe/Vt < EMin) then Tauf*Is/Vt*ExMin*(vbe/Vt - EMin + 1) + Capcje
82 else if noEvent(vbe/Vt > EMax) then Tauf*Is/Vt*ExMax*(vbe/Vt - EMax + 1) + Capcje
83 else Tauf*Is/Vt*exp(vbe/Vt) + Capcje;
84
85 C.i = (ibe - ibc)*qbk - ibc/Br - cbc*der(vbc) + Ccs*der(C.v);
86 B.i = ibe/Bf + ibc/Br + cbc*der(vbc) + cbe*der(vbe);
87 E.i = -B.i - C.i + Ccs*der(C.v);
88end NPN;
89
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/OpAmp.mo b/scilab/modules/scicos_blocks/macros/Electrical/OpAmp.mo
deleted file mode 100644
index dcea28c..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/OpAmp.mo
+++ /dev/null
@@ -1,36 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model OpAmp
23// parameter Real OLGain=1000 "Open Loop gain";
24// parameter Real SatH=10 "Positive saturation voltage";
25// parameter Real SatL=-10 "Negative Saturation voltage";
26 Pin in_p "Positive pin of the input port";
27 Pin in_n "Negative pin of the input port";
28 Pin out "Output pin";
29equation
30 in_p.i = 0;
31 in_n.i = 0;
32 in_p.v - in_n.v=0;
33end OpAmp;
34
35
36
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/OutPort.mo b/scilab/modules/scicos_blocks/macros/Electrical/OutPort.mo
deleted file mode 100644
index 67b8efd..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/OutPort.mo
+++ /dev/null
@@ -1,25 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model OutPort
23 // output Real v;
24 Real v;
25end OutPort;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/OutPutPort.mo b/scilab/modules/scicos_blocks/macros/Electrical/OutPutPort.mo
deleted file mode 100644
index 384d33a..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/OutPutPort.mo
+++ /dev/null
@@ -1,30 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22
23model OutPutPort
24// output Real vo;
25 Real vo;
26 Real vi;
27equation
28 vi = vo;
29end OutPutPort;
30
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/PMOS.mo b/scilab/modules/scicos_blocks/macros/Electrical/PMOS.mo
deleted file mode 100644
index f3a0157..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/PMOS.mo
+++ /dev/null
@@ -1,60 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model PMOS "Simple MOS Transistor"
23 parameter Real W=50.0e-6 "Width";
24 parameter Real L=6.0e-6 "Length";
25 parameter Real Beta=0.0105e-3 "Transconductance parameter";
26 parameter Real Vt=-1 "Zero bias threshold voltage";
27 parameter Real K2=0.41 "Bulk threshold parameter";
28 parameter Real K5=0.839 "Reduction of pinch-off region";
29 parameter Real dW=-2.5e-6 "Narrowing of channel";
30 parameter Real dL=-2.1e-6 "Shortening of channel";
31 parameter Real RDS=1.e+7 "Drain-Source-Resistance";
32
33 Pin D "Drain";
34 Pin G "Gate";
35 Pin S "Source";
36 Pin B "Bulk";
37
38 Real v;
39 Real uds;
40 Real ubs;
41 Real ugst;
42 Real ud;
43 Real us;
44 Real id,gds;
45equation
46 gds = 1/RDS;//if (RDS < 1.e-20 and RDS > -1.e-20) then 1.e20 else 1/RDS;
47 v = Beta*(W + dW)/(L + dL);
48 ud = if noEvent(D.v > S.v) then S.v else D.v;
49 us = if noEvent(D.v > S.v) then D.v else S.v;
50 uds = ud - us;
51 ubs = if noEvent(B.v < us) then 0 else B.v - us;
52 ugst = (G.v - us - Vt + K2*ubs)*K5;
53 id = if noEvent(ugst >= 0) then uds*gds else if noEvent(ugst < uds) then -v*uds*(
54 ugst - uds/2) + uds*gds else -v*ugst*ugst/2 + uds*gds;
55 G.i = 0;
56 D.i = if noEvent(D.v > S.v) then -id else id;
57 S.i = -D.i;
58 B.i = 0;
59end PMOS;
60
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/PNP.mo b/scilab/modules/scicos_blocks/macros/Electrical/PNP.mo
deleted file mode 100644
index 6ecfd30..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/PNP.mo
+++ /dev/null
@@ -1,89 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model PNP "Simple BJT according to Ebers-Moll"
23 parameter Real Bf=50 "Forward beta";
24 parameter Real Br=0.1 "Reverse beta";
25 parameter Real Is=1.e-16 "Transport saturation current";
26 parameter Real Vak=0.02 "Early voltage (inverse), 1/Volt";
27 parameter Real Tauf=0.12e-9 "Ideal forward transit time";
28 parameter Real Taur=5e-9 "Ideal reverse transit time";
29 parameter Real Ccs=1e-12 "Collector-substrat(ground) cap.";
30 parameter Real Cje=0.4e-12 "Base-emitter zero bias depletion cap.";
31 parameter Real Cjc=0.5e-12 "Base-coll. zero bias depletion cap.";
32 parameter Real Phie=0.8 "Base-emitter diffusion voltage";
33 parameter Real Me=0.4 "Base-emitter gradation exponent";
34 parameter Real Phic=0.8 "Base-collector diffusion voltage";
35 parameter Real Mc=0.333 "Base-collector gradation exponent";
36 parameter Real Gbc=1e-15 "Base-collector conductance";
37 parameter Real Gbe=1e-15 "Base-emitter conductance";
38 parameter Real Vt=0.02585 "Voltage equivalent of temperature";
39 parameter Real EMinMax=40 "if x < EMin, the exp(x) function is linearized";
40 Real vbc;
41 Real vbe;
42 Real qbk;
43 Real ibc;
44 Real ibe;
45 Real cbc;
46 Real cbe;
47 Real ExMin;
48 Real ExMax;
49 Real Capcje;
50 Real Capcjc;
51 Real EMax;
52 Real EMin;
53
54 Pin C "Collector";
55 Pin B "Base";
56 Pin E "Emitter";
57equation
58 EMax=EMinMax;
59 EMin=-2*EMinMax;
60 ExMin = exp(EMin);
61 ExMax = exp(EMax);
62 vbc = C.v - B.v;
63 vbe = E.v - B.v;
64 qbk = 1 - vbc*Vak;
65
66 ibc = if noEvent(vbc/Vt < EMin) then Is*(ExMin*(vbc/Vt - EMin + 1) - 1) + vbc*
67 Gbc else if noEvent(vbc/Vt > EMax) then Is*(ExMax*(vbc/Vt - EMax + 1) - 1) +
68 vbc*Gbc else Is*(exp(vbc/Vt) - 1) + vbc*Gbc;
69
70 ibe = if noEvent(vbe/Vt < EMin) then Is*(ExMin*(vbe/Vt - EMin + 1) - 1) + vbe*
71 Gbe else if noEvent(vbe/Vt > EMax) then Is*(ExMax*(vbe/Vt - EMax + 1) - 1) +
72 vbe*Gbe else Is*(exp(vbe/Vt) - 1) + vbe*Gbe;
73
74 Capcjc = if (vbc/Phic > 0) then Cjc*(1 + Mc*vbc/Phic) else Cjc*(1 - vbc/Phic)^(-Mc);
75 Capcje = if (vbe/Phie > 0) then Cje*(1 + Me*vbe/Phie) else Cje*(1 - vbe/Phie)^(-Me);
76
77 cbc = if noEvent(vbc/Vt < EMin) then Taur*Is/Vt*ExMin*(vbc/Vt - EMin + 1) +
78 Capcjc else if noEvent(vbc/Vt > EMax) then Taur*Is/Vt*ExMax*(vbc/Vt - EMax + 1)
79 + Capcjc else Taur*Is/Vt*exp(vbc/Vt) + Capcjc;
80 cbe = if noEvent(vbe/Vt < EMin) then Tauf*Is/Vt*ExMin*(vbe/Vt - EMin + 1) +
81 Capcje else if noEvent(vbe/Vt > EMax) then Tauf*Is/Vt*ExMax*(vbe/Vt - EMax + 1)
82 + Capcje else Tauf*Is/Vt*exp(vbe/Vt) + Capcje;
83
84 C.i = -((ibe - ibc)*qbk - ibc/Br - cbc*der(vbc) + Ccs*der(C.v));
85 B.i = -(ibe/Bf + ibc/Br + cbe*der(vbe) + cbc*der(vbc));
86 E.i = -B.i - C.i - Ccs*der(C.v);
87end PNP;
88
89
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Pin.mo b/scilab/modules/scicos_blocks/macros/Electrical/Pin.mo
deleted file mode 100644
index 8703482..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/Pin.mo
+++ /dev/null
@@ -1,25 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22connector Pin
23 Real v;
24 flow Real i;
25end Pin;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/PotentialSensor.mo b/scilab/modules/scicos_blocks/macros/Electrical/PotentialSensor.mo
deleted file mode 100644
index 8e188aa..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/PotentialSensor.mo
+++ /dev/null
@@ -1,29 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model PotentialSensor
23 Pin p;
24 Real v;
25 equation
26 p.i = 0;
27 v = p.v;
28 end PotentialSensor;
29
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Resistor.mo b/scilab/modules/scicos_blocks/macros/Electrical/Resistor.mo
deleted file mode 100644
index 5f1e8a3..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/Resistor.mo
+++ /dev/null
@@ -1,30 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model Resistor
23 Pin p, n;
24 parameter Real R=1 "Resistance";
25
26equation
27 R*p.i = p.v - n.v;
28 p.i = -n.i;
29
30end Resistor;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/SineVoltage.mo b/scilab/modules/scicos_blocks/macros/Electrical/SineVoltage.mo
deleted file mode 100644
index b02383c..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/SineVoltage.mo
+++ /dev/null
@@ -1,39 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model SineVoltage "Sine voltage source"
23 parameter Real V=1 "Amplitude of sine wave";
24 parameter Real phase=0 "Phase of sine wave";
25 parameter Real freqHz=1 "Frequency of sine wave";
26 parameter Real offset=0 "Offset volatge of sine wave";
27 parameter Real startTime=0 "sine wave start time";
28 parameter Real PI=3.141592653589793;
29 Pin p, n;
30 Real v;
31
32equation
33
34 v = offset + (if time < startTime then 0 else V*sin(2*PI*freqHz*(time - startTime) +phase));
35 v= p.v - n.v;
36 0 = p.i + n.i;
37end SineVoltage;
38
39
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/Switch.mo b/scilab/modules/scicos_blocks/macros/Electrical/Switch.mo
deleted file mode 100644
index 9432c6d..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/Switch.mo
+++ /dev/null
@@ -1,32 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model Switch
23 parameter Real Ron=0.01 "Resistance when the Switch is closed";
24 parameter Real Roff=1e5 "Resistance when the switch is open";
25 Pin p,n;
26 Real inp,Rx;
27equation
28 Rx*p.i= p.v - n.v;
29 p.i = -n.i;
30 Rx=if inp >0 then Ron
31 else Roff;
32end Switch;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/VVsourceAC.mo b/scilab/modules/scicos_blocks/macros/Electrical/VVsourceAC.mo
deleted file mode 100644
index 1a9813a..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/VVsourceAC.mo
+++ /dev/null
@@ -1,32 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model VVsourceAC "Sin-wave voltage source"
23 Pin p, n;
24 Real v;
25 Real VA "voltage";
26 parameter Real f = 50 "Frequency";
27 parameter Real PI=3.141592653589793;
28equation
29 v = VA*sin(2*PI*f*time);
30 v = p.v - n.v;
31 0 = p.i + n.i;
32end VVsourceAC;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/VariableResistor.mo b/scilab/modules/scicos_blocks/macros/Electrical/VariableResistor.mo
deleted file mode 100644
index b1d8f54..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/VariableResistor.mo
+++ /dev/null
@@ -1,28 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model VariableResistor
23 Pin p, n;
24 Real R "Resistance";
25equation
26 R*p.i = p.v - n.v;
27 p.i = -n.i;
28end VariableResistor;
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/VoltageSensor.mo b/scilab/modules/scicos_blocks/macros/Electrical/VoltageSensor.mo
deleted file mode 100644
index 53412a9..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/VoltageSensor.mo
+++ /dev/null
@@ -1,31 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model VoltageSensor
23 Pin p;
24 Pin n;
25 Real v;
26 equation
27 p.i = 0;
28 n.i = 0;
29 v = p.v - n.v;
30 end VoltageSensor;
31
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/VsourceAC.mo b/scilab/modules/scicos_blocks/macros/Electrical/VsourceAC.mo
deleted file mode 100644
index 955647e..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/VsourceAC.mo
+++ /dev/null
@@ -1,34 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model VsourceAC "Sin-wave voltage source"
23 Pin p, n;
24 Real v;
25 parameter Real VA = 220 "Amplitude";
26 parameter Real f = 50 "Frequency";
27 parameter Real PI=3.141592653589793;
28equation
29 v = VA*sin(2*PI*f*time);
30 v = p.v - n.v;
31 0 = p.i + n.i;
32end VsourceAC;
33
34
diff --git a/scilab/modules/scicos_blocks/macros/Electrical/VsourceDC.mo b/scilab/modules/scicos_blocks/macros/Electrical/VsourceDC.mo
deleted file mode 100644
index 8ee2386..0000000
--- a/scilab/modules/scicos_blocks/macros/Electrical/VsourceDC.mo
+++ /dev/null
@@ -1,28 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22model VsourceDC "Constant voltage source"
23 Pin p, n;
24 Real v;
25 parameter Real A = 220 "Amplitude";
26equation
27 v = A;
28end VsourceDC;
diff --git a/scilab/modules/scicos_blocks/macros/Hydraulics/Bache.mo b/scilab/modules/scicos_blocks/macros/Hydraulics/Bache.mo
deleted file mode 100644
index c5e21da..0000000
--- a/scilab/modules/scicos_blocks/macros/Hydraulics/Bache.mo
+++ /dev/null
@@ -1,140 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22class Bache
23 parameter Real Patm "Pression dans le ciel de la bache";
24 parameter Real A "Section de la bache";
25 parameter Real ze1 "Altitude du piquage d'entrée 1";
26 parameter Real ze2 "Altitude du piquage d'entrée 2";
27 parameter Real zs1 "Altitude du piquage de sortie 1";
28 parameter Real zs2 "Altitude du piquage de sortie 2";
29 parameter Real z0 "Altitude initiale du fluide";
30 parameter Real T0 "Temperature initiale du fluide";
31 parameter Real p_rho
32 "Si > 0, masse volumique imposée du fluide";
33// parameter Integer mode "Région IF97. 1:liquide - 2:vapeur - 4:saturation - 0:calcul automatique";
34
35 parameter Real g=9.80665 "Accélération de la pesanteur";
36 parameter Real e=0.25 "Ouverture des piquages";
37 parameter Real k=1
38 "Coefficient de perte de charge des piquages";
39 parameter Real eps=1.e-0 "Limite inf. de la fonction carrée";
40 parameter Real zmin=1.e-6
41 "Hauteur minimum d'eau pour l'équation de l'énergie";
42 Real z(start=z0) "Hauteur du fluide";
43 Real Tm(start=T0) "Température moyenne";
44 Real Pm(start=1.e5) "Pression moyenne";
45 Real Hm(start=100000) "Enthalpie spécifique moyenne";
46 Real rho(start=998) "Masse volumique";
47 Real BQ "Bilan de masse";
48 Real BH "Bilan d'énergie";
49 Real Oe1;
50 Real Oe2;
51 Real Os1;
52 Real Os2;
53 Real region(start=1) "Numéro de région IF97";
54 Real Max_e1;
55 Real Max_e2;
56 Real Max_s1;
57 Real Max_s2;
58 Real ThermoCar1;
59 Real ThermoCar2;
60
61 Real yNiveau ;
62
63public
64// SortieReelle yNiveau ;
65 PortPHQ1 Ce1 ;
66 PortPHQ2 Cs2 ;
67// PortTher Cth ; /* Port non utilisé dans le modèle désiré, non implanté sur le bloc SCICOS */
68 PortPHQ1 Ce2 ;
69 PortPHQ2 Cs1 ;
70
71//initial equation
72
73// Hm = 100000;
74
75equation
76
77 Ce2.Q = 0;
78 Ce2.H = 1.e5;
79
80 Cs1.Q = 0;
81 Cs1.H = 1.e5;
82
83 Max_e1 = if (z - ze1 < 0.0) then 0.0 else (z - ze1);
84 ThermoCar1 = if (abs(Ce1.Q) > eps) then Ce1.Q*abs(Ce1.Q) else Ce1.Q*eps;
85 (Patm + rho*g*Max_e1 - Ce1.P)*Oe1 = k*ThermoCar1/2/rho;
86
87 Oe1 = if (Ce1.Q >= 0.0) then 1.0
88 elseif (z > ze1 + e) then 1.0
89 elseif (z < ze1) then 0.0
90 else (z - ze1)/e;
91
92
93 Max_e2 = if (z - ze2 < 0.0) then 0.0 else (z - ze2);
94
95 Ce2.P = Patm + rho*g*Max_e2;
96 Oe2 = 0;
97
98 Max_s1 = if (z - zs1 < 0.0) then 0.0 else (z - zs1);
99 Cs1.P = Patm + rho*g*Max_s1;
100 Os1 = 0;
101
102 Max_s2 = if (z - zs2 < 0.0) then 0.0 else (z - zs2);
103 ThermoCar2 =if (abs(Cs2.Q) > eps) then Cs2.Q*abs(Cs2.Q) else Cs2.Q*eps;
104 (Patm + rho*g*Max_s2 - Cs2.P)*Os2 = k*ThermoCar2/2/rho;
105
106 Os2 = if (Cs2.Q <= 0.0) then 1.0
107 elseif (z > zs2 + e) then 1.0
108 elseif (z < zs2) then 0.0
109 else (z - zs2)/e;
110
111
112 /* Bilan de masse */
113 BQ = Ce1.Q + Ce2.Q - Cs1.Q - Cs2.Q;
114 rho*A*der(z) = BQ;
115
116 /* Bilan d'énergie */
117 /* le port thermique n'est pas utilisé ici "+ Cth.W" (on a W=0)*/
118 BH = Ce1.Q*(Ce1.H - Hm) + Ce2.Q*(Ce2.H - Hm) - Cs1.Q*(Cs1.H - Hm) - Cs2.Q*(Cs2.H - Hm);
119
120 der(Hm) = if (z > zmin) then BH/(rho*A*z) else 0.0;
121
122 Ce1.Hm = Hm;
123 Ce2.Hm = Hm;
124 Cs1.Hm = Hm;
125 Cs2.Hm = Hm;
126
127// Cth.T = Tm; /* le port thermique n'est pas utilisé ici*/
128
129 /* Capteur de niveau */
130 yNiveau = z;
131
132 /* Calcul des propriétés thermodynamiques */
133 Pm = Patm + rho*g*z/2;
134
135 Tm = Hm/4187 + 273.15;
136 region = 1.0;
137
138 rho = 998.0;
139
140end Bache;
diff --git a/scilab/modules/scicos_blocks/macros/Hydraulics/Hydraulics.mo b/scilab/modules/scicos_blocks/macros/Hydraulics/Hydraulics.mo
new file mode 100644
index 0000000..4ad11fc
--- /dev/null
+++ b/scilab/modules/scicos_blocks/macros/Hydraulics/Hydraulics.mo
@@ -0,0 +1,321 @@
1connector PortPHQ1
2// extends ThermoLib.Connecteurs.PortPHQ;
3 Real P "Pression du fluide";
4 Real H "Enthalpie spécifique du fluide";
5 Real Q "Débit massique du fluide";
6 Real Hm "Enthalpie spécifique de mélange";
7
8// input Boolean a=true "Pseudo-variable pour la vérification du sens des connexions";
9// output Boolean b "Pseudo-variable pour la vérification du sens des connexions";
10end PortPHQ1;
11connector PortPHQ2
12// extends ThermoLib.Connecteurs.PortPHQ;
13 Real P "Pression du fluide";
14 Real H "Enthalpie spécifique du fluide";
15 Real Q "Débit massique du fluide";
16 Real Hm "Enthalpie spécifique de mélange";
17
18// input Boolean a "Pseudo-variable pour la vérification du sens des connexions";
19// output Boolean b=true "Pseudo-variable pour la vérification du sens des connexions";
20
21end PortPHQ2;
22model Source
23 parameter Real P0=300000 "Pression de la source";
24 parameter Real T0=290 "Température de la source";
25 parameter Real H0=100000 "Enthalpie spécifique de la source";
26 parameter Real option_temperature=1 "1:température fixée - 2:enthalpie fixée";
27
28 Real Pm "Pression moyenne";
29 Real Q "Débit";
30 Real Tm "Température moyenne";
31 Real Hm "Enthalpie spécifique moyenne";
32
33public
34 PortPHQ2 C ;
35equation
36
37 C.P = Pm;
38 C.Q = Q;
39 C.Hm = Hm;
40
41 Pm = P0;
42
43 Hm = H0;
44
45 Tm = if (option_temperature <= 1) then T0 else Hm/4187 + 273.15;
46
47end Source;
48model Puits
49 parameter Real P0=100000 "Pression du puits";
50 parameter Real T0=290"Température du puits";
51 parameter Real H0=100000 "Enthalpie spécifique du puits";
52 parameter Real option_temperature=1 "1:température fixée - 2:enthalpie fixée";
53
54 Real Pm "Pression moyenne";
55 Real Q "Débit";
56 Real Tm "Température moyenne";
57 Real Hm "Enthalpie spécifique moyenne";
58
59public
60 PortPHQ1 C ;
61equation
62
63 C.P = Pm;
64 C.Q = Q;
65 C.Hm = Hm;
66
67 Pm = P0;
68 Hm= H0;
69
70
71 Tm = if (option_temperature <= 1) then T0 else Hm/4187 + 273.15;
72
73end Puits;
74model PerteDP
75 parameter Real L "Longueur du tube";
76 parameter Real D "Diametre interne du tube";
77 parameter Real lambda "Coefficient de perte de charge-frottement (s.u.)";
78 parameter Real z1 "Altitude entree tuyauterie";
79 parameter Real z2 "Altitude sortie tuyauterie";
80 parameter Real p_rho "Si > 0, masse volumique imposée du fluide";
81// parameter Integer mode "Région IF97. 1:liquide - 2:vapeur - 4:saturation - 0:calcul automatique";
82
83 parameter Real g = 9.80665 "Accélération de la pesanteur";
84 parameter Real pi = 3.1415927;
85 parameter Real eps = 1.e-0 "Limite inf. de la fonction carrée";
86 Real khi "Coefficient de perte de charge hydraulique";
87 Real deltaPf "Perte de charge par frottement";
88 Real deltaP "Perte de charge totale";
89 Real Q (start=500) "Débit massique";
90 Real rho (start=998) "Masse volumique";
91 Real Tm (start=290) "Température moyenne";
92 Real Pm (start=1.e5) "Pression moyenne";
93 Real Hm (start=100000) "Enthalpie spécifique moyenne";
94 Real region (start=1) "Numéro de région IF97";
95 Real ThermoCar;
96
97public
98 PortPHQ1 C1 ;
99 PortPHQ2 C2 ;
100
101equation
102
103 C1.P - C2.P = deltaP;
104 C2.Q = C1.Q;
105 C2.H = C1.H;
106
107 Q = C1.Q;
108
109 /* Inversions de débit */
110 0 = if (Q > 0.0) then (C1.H - C1.Hm) else (C2.H - C2.Hm);
111
112 /* Calcul des pertes de charges */
113 deltaP = deltaPf + rho*g*(z2 - z1);
114
115 ThermoCar = if (abs(Q) > eps) then Q*abs(Q) else Q*eps;
116 deltaPf = 8*khi*ThermoCar/(pi^2.0*D^4.0*rho);
117
118
119 /* Formule de Darcy-Weisbach (Idel'cik p. 55). On suppose qu'on est en régime quadratique. */
120 khi = lambda*L/D;
121
122 /* Calcul des propriétés thermodynamiques */
123 Pm = (C1.P + C2.P)/2;
124 Hm = (C1.H + C2.H)/2;
125
126
127 Tm = Hm/4187 + 273.15;
128 region = 1;
129
130 rho = 998;
131
132end PerteDP;
133model Bache
134 parameter Real Patm "Pression dans le ciel de la bache";
135 parameter Real A "Section de la bache";
136 parameter Real ze1 "Altitude du piquage d'entrée 1";
137 parameter Real ze2 "Altitude du piquage d'entrée 2";
138 parameter Real zs1 "Altitude du piquage de sortie 1";
139 parameter Real zs2 "Altitude du piquage de sortie 2";
140 parameter Real z0 "Altitude initiale du fluide";
141 parameter Real T0 "Temperature initiale du fluide";
142 parameter Real p_rho "Si > 0, masse volumique imposée du fluide";
143 // parameter Integer mode "Région IF97. 1:liquide - 2:vapeur - 4:saturation - 0:calcul automatique";
144 parameter Real g=9.80665 "Accélération de la pesanteur";
145 parameter Real e=0.25 "Ouverture des piquages";
146 parameter Real k=1 "Coefficient de perte de charge des piquages";
147 parameter Real eps=1.e-0 "Limite inf. de la fonction carrée";
148 parameter Real zmin=1.e-6 "Hauteur minimum d'eau pour l'équation de l'énergie";
149
150 Real z(start=z0) "Hauteur du fluide";
151 Real Tm(start=T0) "Température moyenne";
152 Real Pm(start=1.e5) "Pression moyenne";
153 Real Hm(start=100000) "Enthalpie spécifique moyenne";
154 Real rho(start=998) "Masse volumique";
155 Real BQ "Bilan de masse";
156 Real BH "Bilan d'énergie";
157 Real Oe1;
158 Real Oe2;
159 Real Os1;
160 Real Os2;
161 Real region(start=1) "Numéro de région IF97";
162 Real Max_e1;
163 Real Max_e2;
164 Real Max_s1;
165 Real Max_s2;
166 Real ThermoCar1;
167 Real ThermoCar2;
168
169 Real yNiveau ;
170
171public
172// SortieReelle yNiveau ;
173 PortPHQ1 Ce1 ;
174 PortPHQ2 Cs2 ;
175// PortTher Cth ; /* Port non utilisé dans le modèle désiré, non implanté sur le bloc SCICOS */
176 PortPHQ1 Ce2 ;
177 PortPHQ2 Cs1 ;
178
179//initial equation
180
181// Hm = 100000;
182
183equation
184
185 Ce2.Q = 0;
186 Ce2.H = 1.e5;
187
188 Cs1.Q = 0;
189 Cs1.H = 1.e5;
190
191 Max_e1 = if (z - ze1 < 0.0) then 0.0 else (z - ze1);
192 ThermoCar1 = if (abs(Ce1.Q) > eps) then Ce1.Q*abs(Ce1.Q) else Ce1.Q*eps;
193 (Patm + rho*g*Max_e1 - Ce1.P)*Oe1 = k*ThermoCar1/2/rho;
194
195 Oe1 = if (Ce1.Q >= 0.0) then 1.0
196 elseif (z > ze1 + e) then 1.0
197 elseif (z < ze1) then 0.0
198 else (z - ze1)/e;
199
200
201 Max_e2 = if (z - ze2 < 0.0) then 0.0 else (z - ze2);
202
203 Ce2.P = Patm + rho*g*Max_e2;
204 Oe2 = 0;
205
206 Max_s1 = if (z - zs1 < 0.0) then 0.0 else (z - zs1);
207 Cs1.P = Patm + rho*g*Max_s1;
208 Os1 = 0;
209
210 Max_s2 = if (z - zs2 < 0.0) then 0.0 else (z - zs2);
211 ThermoCar2 =if (abs(Cs2.Q) > eps) then Cs2.Q*abs(Cs2.Q) else Cs2.Q*eps;
212 (Patm + rho*g*Max_s2 - Cs2.P)*Os2 = k*ThermoCar2/2/rho;
213
214 Os2 = if (Cs2.Q <= 0.0) then 1.0
215 elseif (z > zs2 + e) then 1.0
216 elseif (z < zs2) then 0.0
217 else (z - zs2)/e;
218
219
220 /* Bilan de masse */
221 BQ = Ce1.Q + Ce2.Q - Cs1.Q - Cs2.Q;
222 rho*A*der(z) = BQ;
223
224 /* Bilan d'énergie */
225 /* le port thermique n'est pas utilisé ici "+ Cth.W" (on a W=0)*/
226 BH = Ce1.Q*(Ce1.H - Hm) + Ce2.Q*(Ce2.H - Hm) - Cs1.Q*(Cs1.H - Hm) - Cs2.Q*(Cs2.H - Hm);
227
228 der(Hm) = if (z > zmin) then BH/(rho*A*z) else 0.0;
229
230 Ce1.Hm = Hm;
231 Ce2.Hm = Hm;
232 Cs1.Hm = Hm;
233 Cs2.Hm = Hm;
234
235// Cth.T = Tm; /* le port thermique n'est pas utilisé ici*/
236
237 /* Capteur de niveau */
238 yNiveau = z;
239
240 /* Calcul des propriétés thermodynamiques */
241 Pm = Patm + rho*g*z/2;
242
243 Tm = Hm/4187 + 273.15;
244 region = 1.0;
245
246 rho = 998.0;
247
248end Bache;
249model VanneReglante
250 parameter Real Cvmax "CV max";
251 parameter Real p_rho "Si > 0, masse volumique imposée du fluide";
252// parameter Integer mode=0 "Région IF97. 1:liquide - 2:vapeur - 4:saturation - 0:calcul automatique";
253
254 parameter Real eps=1.e-0 "Limite inf. de la fonction carrée";
255 Real Cv "Cv";
256 Real Q(start=500) "Débit massique";
257 Real deltaP "Perte de charge singulière";
258 Real rho(start=998) "Masse volumique";
259 Real Tm(start=290) "Température moyenne";
260 Real Pm(start=1.e5) "Pression moyenne";
261 Real Hm(start=100000) "Enthalpie spécifique moyenne";
262 Real region(start=1) "Numéro de région IF97";
263 Real ThermoCar;
264
265 Real Ouv ;
266
267public
268// EntreeReelle Ouv ;
269 PortPHQ1 C1 ;
270 PortPHQ2 C2 ;
271
272equation
273
274 C1.H = C2.H;
275 C1.Q = C2.Q;
276
277 Q = C1.Q;
278 deltaP = C1.P - C2.P;
279
280 /* Inversions de débit */
281 0 = if (Q > 0.0) then C1.H - C1.Hm else C2.H - C2.Hm;
282
283 /* Calcul de la perte de charge */
284
285 ThermoCar = if (abs(Q) > eps) then Q*abs(Q) else Q*eps;
286 deltaP*Cv*abs(Cv) = 1.733e12*ThermoCar/rho^2;
287
288 /* Calcul du Cv en fonction de l'ouverture */
289 Cv = Ouv*Cvmax;
290
291 /* Calcul des propriétés thermodynamiques */
292 Pm = (C1.P + C2.P)/2;
293 Hm = (C1.H + C2.H)/2;
294
295 Tm = Hm/4187 + 273.15;
296 region = 1;
297
298 rho = 998;
299
300end VanneReglante;
301
302model Flowmeter "Capteur de débit"
303 parameter Real Qini=1 ;
304
305 Real Q (start=10) "Débit massique";
306 Real Mesure;
307
308 PortPHQ1 C1;
309 PortPHQ2 C2;
310
311equation
312 Mesure = Q;
313
314 C1.P = C2.P;
315 C1.H = C2.H;
316 C1.Q = C2.Q;
317
318 Q = C1.Q;
319 0 = if (Q > 0) then C1.H - C1.Hm else C2.H - C2.Hm;
320
321end Flowmeter;
diff --git a/scilab/modules/scicos_blocks/macros/Hydraulics/PerteDP.mo b/scilab/modules/scicos_blocks/macros/Hydraulics/PerteDP.mo
deleted file mode 100644
index 8c9fc5d..0000000
--- a/scilab/modules/scicos_blocks/macros/Hydraulics/PerteDP.mo
+++ /dev/null
@@ -1,80 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22class PerteDP
23 parameter Real L "Longueur du tube";
24 parameter Real D "Diametre interne du tube";
25 parameter Real lambda "Coefficient de perte de charge-frottement (s.u.)";
26 parameter Real z1 "Altitude entree tuyauterie";
27 parameter Real z2 "Altitude sortie tuyauterie";
28 parameter Real p_rho "Si > 0, masse volumique imposée du fluide";
29// parameter Integer mode "Région IF97. 1:liquide - 2:vapeur - 4:saturation - 0:calcul automatique";
30
31 parameter Real g = 9.80665 "Accélération de la pesanteur";
32 parameter Real pi = 3.1415927;
33 parameter Real eps = 1.e-0 "Limite inf. de la fonction carrée";
34 Real khi "Coefficient de perte de charge hydraulique";
35 Real deltaPf "Perte de charge par frottement";
36 Real deltaP "Perte de charge totale";
37 Real Q (start=500) "Débit massique";
38 Real rho (start=998) "Masse volumique";
39 Real Tm (start=290) "Température moyenne";
40 Real Pm (start=1.e5) "Pression moyenne";
41 Real Hm (start=100000) "Enthalpie spécifique moyenne";
42 Real region (start=1) "Numéro de région IF97";
43 Real ThermoCar;
44
45public
46 PortPHQ1 C1 ;
47 PortPHQ2 C2 ;
48
49equation
50
51 C1.P - C2.P = deltaP;
52 C2.Q = C1.Q;
53 C2.H = C1.H;
54
55 Q = C1.Q;
56
57 /* Inversions de débit */
58 0 = if (Q > 0.0) then (C1.H - C1.Hm) else (C2.H - C2.Hm);
59
60 /* Calcul des pertes de charges */
61 deltaP = deltaPf + rho*g*(z2 - z1);
62
63 ThermoCar = if (abs(Q) > eps) then Q*abs(Q) else Q*eps;
64 deltaPf = 8*khi*ThermoCar/(pi^2.0*D^4.0*rho);
65
66
67 /* Formule de Darcy-Weisbach (Idel'cik p. 55). On suppose qu'on est en régime quadratique. */
68 khi = lambda*L/D;
69
70 /* Calcul des propriétés thermodynamiques */
71 Pm = (C1.P + C2.P)/2;
72 Hm = (C1.H + C2.H)/2;
73
74
75 Tm = Hm/4187 + 273.15;
76 region = 1;
77
78 rho = 998;
79
80end PerteDP;
diff --git a/scilab/modules/scicos_blocks/macros/Hydraulics/PortPHQ1.mo b/scilab/modules/scicos_blocks/macros/Hydraulics/PortPHQ1.mo
deleted file mode 100644
index 9bead9f..0000000
--- a/scilab/modules/scicos_blocks/macros/Hydraulics/PortPHQ1.mo
+++ /dev/null
@@ -1,31 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22class PortPHQ1
23// extends ThermoLib.Connecteurs.PortPHQ;
24 Real P "Pression du fluide";
25 Real H "Enthalpie spécifique du fluide";
26 Real Q "Débit massique du fluide";
27 Real Hm "Enthalpie spécifique de mélange";
28
29// input Boolean a=true "Pseudo-variable pour la vérification du sens des connexions";
30// output Boolean b "Pseudo-variable pour la vérification du sens des connexions";
31end PortPHQ1;
diff --git a/scilab/modules/scicos_blocks/macros/Hydraulics/PortPHQ2.mo b/scilab/modules/scicos_blocks/macros/Hydraulics/PortPHQ2.mo
deleted file mode 100644
index a4b6c5b..0000000
--- a/scilab/modules/scicos_blocks/macros/Hydraulics/PortPHQ2.mo
+++ /dev/null
@@ -1,32 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22class PortPHQ2
23// extends ThermoLib.Connecteurs.PortPHQ;
24 Real P "Pression du fluide";
25 Real H "Enthalpie spécifique du fluide";
26 Real Q "Débit massique du fluide";
27 Real Hm "Enthalpie spécifique de mélange";
28
29// input Boolean a "Pseudo-variable pour la vérification du sens des connexions";
30// output Boolean b=true "Pseudo-variable pour la vérification du sens des connexions";
31
32end PortPHQ2;
diff --git a/scilab/modules/scicos_blocks/macros/Hydraulics/Puits.mo b/scilab/modules/scicos_blocks/macros/Hydraulics/Puits.mo
deleted file mode 100644
index d228eb3..0000000
--- a/scilab/modules/scicos_blocks/macros/Hydraulics/Puits.mo
+++ /dev/null
@@ -1,47 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22class Puits
23 parameter Real P0=100000 "Pression du puits";
24 parameter Real T0=290"Température du puits";
25 parameter Real H0=100000 "Enthalpie spécifique du puits";
26 parameter Real option_temperature=1 "1:température fixée - 2:enthalpie fixée";
27
28 Real Pm "Pression moyenne";
29 Real Q "Débit";
30 Real Tm "Température moyenne";
31 Real Hm "Enthalpie spécifique moyenne";
32
33public
34 PortPHQ1 C ;
35equation
36
37 C.P = Pm;
38 C.Q = Q;
39 C.Hm = Hm;
40
41 Pm = P0;
42 Hm= H0;
43
44
45 Tm = if (option_temperature <= 1) then T0 else Hm/4187 + 273.15;
46
47end Puits;
diff --git a/scilab/modules/scicos_blocks/macros/Hydraulics/Source.mo b/scilab/modules/scicos_blocks/macros/Hydraulics/Source.mo
deleted file mode 100644
index aa82e7e..0000000
--- a/scilab/modules/scicos_blocks/macros/Hydraulics/Source.mo
+++ /dev/null
@@ -1,47 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22class Source
23 parameter Real P0=300000 "Pression de la source";
24 parameter Real T0=290 "Température de la source";
25 parameter Real H0=100000 "Enthalpie spécifique de la source";
26 parameter Real option_temperature=1 "1:température fixée - 2:enthalpie fixée";
27
28 Real Pm "Pression moyenne";
29 Real Q "Débit";
30 Real Tm "Température moyenne";
31 Real Hm "Enthalpie spécifique moyenne";
32
33public
34 PortPHQ2 C ;
35equation
36
37 C.P = Pm;
38 C.Q = Q;
39 C.Hm = Hm;
40
41 Pm = P0;
42
43 Hm = H0;
44
45 Tm = if (option_temperature <= 1) then T0 else Hm/4187 + 273.15;
46
47end Source;
diff --git a/scilab/modules/scicos_blocks/macros/Hydraulics/ThermoCarre.mo b/scilab/modules/scicos_blocks/macros/Hydraulics/ThermoCarre.mo
deleted file mode 100644
index 0de6057..0000000
--- a/scilab/modules/scicos_blocks/macros/Hydraulics/ThermoCarre.mo
+++ /dev/null
@@ -1,35 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22class ThermoCarre
23 // input Real x;
24
25 // input Real dx;
26 // output Real y;
27
28// The key words input and ouput are not recognized by the last version of translator
29 Real x;
30
31 Real dx;
32 Real y;
33
34external;
35end ThermoCarre;
diff --git a/scilab/modules/scicos_blocks/macros/Hydraulics/VanneReglante.mo b/scilab/modules/scicos_blocks/macros/Hydraulics/VanneReglante.mo
deleted file mode 100644
index 21d8331..0000000
--- a/scilab/modules/scicos_blocks/macros/Hydraulics/VanneReglante.mo
+++ /dev/null
@@ -1,73 +0,0 @@
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., 675 Mass Ave, Cambridge, MA 02139, USA.
18 *
19 * See the file ../license.txt
20*/
21
22class VanneReglante
23 parameter Real Cvmax "CV max";
24 parameter Real p_rho "Si > 0, masse volumique imposée du fluide";
25// parameter Integer mode=0 "Région IF97. 1:liquide - 2:vapeur - 4:saturation - 0:calcul automatique";
26
27 parameter Real eps=1.e-0 "Limite inf. de la fonction carrée";
28 Real Cv "Cv";
29 Real Q(start=500) "Débit massique";
30 Real deltaP "Perte de charge singulière";
31 Real rho(start=998) "Masse volumique";
32 Real Tm(start=290) "Température moyenne";
33 Real Pm(start=1.e5) "Pression moyenne";
34 Real Hm(start=100000) "Enthalpie spécifique moyenne";
35 Real region(start=1) "Numéro de région IF97";
36 Real ThermoCar;
37
38 Real Ouv ;
39
40public
41// EntreeReelle Ouv ;
42 PortPHQ1 C1 ;
43 PortPHQ2 C2 ;
44
45equation
46
47 C1.H = C2.H;
48 C1.Q = C2.Q;
49
50 Q = C1.Q;
51 deltaP = C1.P - C2.P;
52
53 /* Inversions de débit */
54 0 = if (Q > 0.0) then C1.H - C1.Hm else C2.H - C2.Hm;
55
56 /* Calcul de la perte de charge */
57
58 ThermoCar = if (abs(Q) > eps) then Q*abs(Q) else Q*eps;
59 deltaP*Cv*abs(Cv) = 1.733e12*ThermoCar/rho^2;
60
61 /* Calcul du Cv en fonction de l'ouverture */
62 Cv = Ouv*Cvmax;
63
64 /* Calcul des propriétés thermodynamiques */
65 Pm = (C1.P + C2.P)/2;
66 Hm = (C1.H + C2.H)/2;
67
68 Tm = Hm/4187 + 273.15;
69 region = 1;
70
71 rho = 998;
72
73end VanneReglante;