1 <?xml version="1.0" encoding="UTF-8"?>
5 * Copyright (C) INRIA - METALAU Project <scicos@inria.fr> (HTML version)
6 * Copyright (C) DIGITEO - Scilab Consortium (XML Docbook version)
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
18 * You should have received a copy of the GNU General Public License
19 * along with this program; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
22 * See the file ./license.txt
24 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns5="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" xml:id="CLSS">
26 <refname>CLSS</refname>
27 <refpurpose>Continuous state-space system</refpurpose>
30 <title>Block Screenshot</title>
34 <imagedata align="center" fileref="../../../../images/palettes/CLSS.png" valign="middle"/>
39 <refsection id="Contents_CLSS">
40 <title>Contents</title>
44 <link linkend="CLSS">Continuous state-space system</link>
51 <xref linkend="Palette_CLSS">Palette</xref>
56 <xref linkend="Description_CLSS">Description</xref>
61 <xref linkend="Dialogbox_CLSS">Dialog box</xref>
66 <xref linkend="Defaultproperties_CLSS">Default
73 <xref linkend="Interfacingfunction_CLSS">Interfacing
80 <xref linkend="Computationalfunction_CLSS">Computational
87 <xref linkend="Example_CLSS">Example</xref>
94 <refsection id="Palette_CLSS">
95 <title>Palette</title>
99 <link linkend="Continuous_pal">Continuous time systems
106 <refsection id="Description_CLSS">
107 <title>Description</title>
108 <para>This block realizes a continuous-time linear state-space
114 \dot{x} = A \cdot x + B \cdot u \\
115 y = C \cdot x + D \cdot u
120 where <emphasis role="bold">x</emphasis> is the vector of state
121 variables, <emphasis role="bold">u</emphasis> is the vector of input
122 functions and <emphasis role="bold">y</emphasis> is the vector of output
126 The system is defined by the <emphasis role="bold">(A, B, C, D)</emphasis> matrices and the initial state <emphasis role="bold">X0</emphasis>.
127 The dimensions must be compatible.
130 <refsection id="Dialogbox_CLSS">
131 <title>Dialog box</title>
135 <imagedata align="center" fileref="../../../../images/gui/CLSS_gui.gif" valign="middle"/>
142 <emphasis role="bold">A matrix</emphasis>
144 <para>A square matrix.</para>
145 <para>Properties : Type 'mat' of size [-1,-1].</para>
149 <emphasis role="bold">B matrix</emphasis>
152 The <emphasis role="bold">B</emphasis> matrix, [] if system has no input.
154 <para>Properties : Type 'mat' of size ["size(%1,2)","-1"].</para>
158 <emphasis role="bold">C matrix</emphasis>
161 The <emphasis role="bold">C</emphasis> matrix , [] if system has no output.
163 <para>Properties : Type 'mat' of size ["-1","size(%1,2)"].</para>
167 <emphasis role="bold">D matrix</emphasis>
170 The <emphasis role="bold">D</emphasis> matrix, [] if system has no D term.
172 <para>Properties : Type 'mat' of size [-1,-1].</para>
176 <emphasis role="bold">Initial state</emphasis>
178 <para>A vector/scalar initial state of the system.</para>
179 <para>Properties : Type 'vec' of size "size(%1,2)".</para>
183 <refsection id="Defaultproperties_CLSS">
184 <title>Default properties</title>
188 <emphasis role="bold">always active:</emphasis> yes
193 <emphasis role="bold">direct-feedthrough:</emphasis> no
198 <emphasis role="bold">zero-crossing:</emphasis> no
203 <emphasis role="bold">mode:</emphasis> no
208 <emphasis role="bold">regular inputs:</emphasis>
211 <emphasis role="bold">- port 1 : size [1,1] / type
218 <emphasis role="bold">regular outputs:</emphasis>
221 <emphasis role="bold">- port 1 : size [1,1] / type
228 <emphasis role="bold">number/sizes of activation
236 <emphasis role="bold">number/sizes of activation
244 <emphasis role="bold">continuous-time state:</emphasis>
250 <emphasis role="bold">discrete-time state:</emphasis> no
255 <emphasis role="bold">object discrete-time state:</emphasis>
261 <emphasis role="bold">name of computational function:</emphasis>
262 <emphasis role="italic">csslti4</emphasis>
267 <refsection id="Example_CLSS">
268 <title>Example</title>
269 <para>This sample example illustrates how to use CLSS block to simulate
270 and display the output waveform <emphasis role="bold">y(t)=Vc(t)</emphasis> of the RLC circuit shown below.
275 <imagedata align="center" fileref="../../../examples/clss_d1.png" valign="middle"/>
279 <para>The equations for an RLC circuit are the following. They result from
280 Kirchhoff's voltage law and Newton's law.
285 i = i_L = i_C = C \frac{\mathrm{d} v_C }{\mathrm{d} t} \\
286 Ri_L + L \frac{\mathrm{d} i_L }{\mathrm{d} t} + v_C = u_0(t)
290 <para>The R, L and C are the system's resistance, inductance and
294 We define the capacitor voltage <literal>Vc</literal> and the
295 inductance current <literal>iL</literal> as the state variables
296 <literal>X1</literal> and <literal>X2.</literal>
308 \mbox{$\dot{x_1} = \frac{\mathrm{d} i_L }{\mathrm{d} t}$}\\
309 \mbox{$\dot{x_2} = \frac{\mathrm{d} v_C }{\mathrm{d} t}$}
315 <latex>x_1 = i_L = C\frac{\mathrm{d} v_C }{\mathrm{d} t} = C\dot{x_2}</latex>
317 <para>Rearranging these equations we get:</para>
321 \dot{x_1} = -\frac{R}{L} x_1 - \frac{1}{L} x_2 + \frac{1}{L} u_0(t) \\
322 \dot{x_2} = \frac{1}{C} x_2
326 <para>These equations can be put into matrix form as follows,</para>
329 \begin{bmatrix}\dot{x_1}\\\dot{x_2}\end{bmatrix}
332 -\frac{R}{L} & -\frac{1}{L}\\
335 \begin{bmatrix}x_1\\x_2\end{bmatrix}
337 \begin{bmatrix}\frac{1}{L}\\0\end{bmatrix}
341 <para>The required output equation is</para>
344 y(t) = \begin{bmatrix} 1 & 0 \end{bmatrix} \cdot \begin{bmatrix} x_{1} \\ x_{2} \end{bmatrix} + \begin{bmatrix} 0 \end{bmatrix} \cdot u
347 <para>The following diagram shows these equations modeled in Xcos where
348 R=10Ω, L=5 mΗ and C=0.1µF; the initial states are x1=0 and x2=0.5.
350 <para>To obtain the output Vc(t) we use CLSS block from Continuous time
354 <link type="scilab" linkend="scilab.zcos/xcos/examples/continuous_pal/CLSS_Example.zcos">
357 <imagedata align="center" fileref="../../../../examples/continuous_pal/CLSS_Example.zcos" valign="middle"/>
361 <scilab:image><![CDATA[
362 importXcosDiagram(SCI + "/modules/xcos/examples/continuous_pal/CLSS_Example.zcos");
363 xcos_simulate(scs_m, 4);
367 <refsection id="Interfacingfunction_CLSS">
368 <title>Interfacing function</title>
371 <para>SCI/modules/scicos_blocks/macros/Linear/CLSS.sci</para>
375 <refsection id="Computationalfunction_CLSS">
376 <title>Computational function</title>
379 <para>SCI/modules/scicos_blocks/src/c/csslti4.c (Type 4)</para>