<?xml version="1.0" encoding="UTF-8"?>
<!--
 * Scilab ( https://www.scilab.org/ ) - This file is part of Scilab
 * Copyright (C) INRIA -
 * Copyright (C) 2012 - 2016 - Scilab Enterprises
 *
 * This file is hereby licensed under the terms of the GNU GPL v2.0,
 * pursuant to article 5.3.4 of the CeCILL v.2.1.
 * This file was originally licensed under the terms of the CeCILL v2.1,
 * and continues to be available under such terms.
 * For more information, see the COPYING file which you should have received
 * along with this program.
 *
 -->
<refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink"
          xmlns:svg="http://www.w3.org/2000/svg" xmlns:mml="http://www.w3.org/1998/Math/MathML"
          xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org"
          xml:lang="en" xml:id="gfrancis">
    <refnamediv>
        <refname>gfrancis</refname>
        <refpurpose>Francis equations for tracking</refpurpose>
    </refnamediv>
    <refsynopsisdiv>
        <title>Syntax</title>
        <synopsis>[L, M, T] = gfrancis(Plant, Model)</synopsis>
    </refsynopsisdiv>
    <refsection>
        <title>Arguments</title>
        <variablelist>
            <varlistentry>
                <term>Plant</term>
                <listitem>
                    <para> a continuous time dynamical system in state-space representation.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>Model</term>
                <listitem>
                    <para> a continuous time dynamical system in state-space representation.</para>
                </listitem>
            </varlistentry>
            <varlistentry>
                <term>L,M,T</term>
                <listitem>
                    <para>real matrices</para>
                </listitem>
            </varlistentry>
        </variablelist>
    </refsection>
    <refsection>
        <title>Description</title>
        <para>
            Given the linear plant:
        </para>
        <programlisting role=""><![CDATA[
x'= F*x + G*u
y = H*x + J*u
 ]]></programlisting>
        <para>
            and the linear model
        </para>
        <programlisting role=""><![CDATA[
xm'= A*xm + B*um
ym = C*xm + D*um
 ]]></programlisting>
        <para>
            the goal is for the plant to track the model i.e. <literal>e = y - ym ---&gt; 0</literal>
            while keeping stable the state x(t) of the plant.
            <literal>u</literal> is given by feedforward and feedback
        </para>
        <programlisting role=""><![CDATA[
u = L*xm + M*um + K*(x-T*xm) = [K , L-K*T] *(x,xm) + M*um
 ]]></programlisting>
        <para>
            The matrices T,L,M satisfy generalized Francis equations
        </para>
        <programlisting role=""><![CDATA[
F*T + G*L = T*A
H*T + J*L = C
      G*M = T*B
      J*M = D
 ]]></programlisting>
        <para>
            The matrix <literal>K</literal> must be chosen as stabilizing the pair <literal>(F,G)</literal>
            See example of use in directory <literal>demos/tracking</literal>.
        </para>
    </refsection>
    <refsection>
        <title>Examples</title>
        <programlisting role="example"><![CDATA[
Plant=ssrand(1,3,5);
[F,G,H,J]=abcd(Plant);
nw=4;nuu=2;A=rand(nw,nw);
st=max(real(spec(A)));A=A-st*eye(A);
B=rand(nw,nuu);C=2*rand(1,nw);D=0*rand(C*B);
Model=syslin('c',A,B,C,D);
[L,M,T]=gfrancis(Plant,Model);
norm(F*T+G*L-T*A,1)
norm(H*T+J*L-C,1)
norm(G*M-T*B,1)
norm(J*M-D,1)
 ]]></programlisting>
    </refsection>
    <refsection role="see also">
        <title>See also</title>
        <simplelist type="inline">
            <member>
                <link linkend="lqg">lqg</link>
            </member>
            <member>
                <link linkend="ppol">ppol</link>
            </member>
        </simplelist>
    </refsection>
    <refsection>
        <title>History</title>
        <revhistory>
            <revision>
                <revnumber>5.4.0</revnumber>
                <revremark>
                    <literal>Sl</literal> is now checked for
                    continuous time linear dynamical system.  This modification
                    has been introduced by this <ulink url="https://gitlab.com/scilab/scilab/-/commit/3d7083daae3339813ba747c8adcda1f9599bb80d">commit</ulink>
                </revremark>
            </revision>
        </revhistory>
    </refsection>
</refentry>
