Damped response: Difference between revisions

From ASCEND
Jump to navigation Jump to search
Restored page from Google Cache, uploaded by John Pye
 
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 1: Line 1:
<div class="pageexperimental">''This page documents an '''experimental''' feature. You can help out by '''testing it''' and <span class="plainlinks">[http://ascendwiki.cheme.cmu.edu/index.php?title=Damped_response&action=edit recording]</span> your experiences.''</div>
{{missingimages}}
{{experimental}}


In classical control theory, a second-order system has a transfer function like
In classical control theory, a second-order system has a transfer function like
Line 9: Line 10:
We can model a system like this fairly easily with ASCEND. First we need to reduce the model to first order differential equations:
We can model a system like this fairly easily with ASCEND. First we need to reduce the model to first order differential equations:


<span class="texhtml">''s''<sup>2</sup>''Y'' + 2''s''''Y'' + 2''Y'' = ''A''''X''</span>
<math>s^2 Y + 2 s Y + 2 Y = A X</math>


Now, let <span class="texhtml">''s''''Y'' = ''Z''</span> so that we have a pair of equations
Now, let <math>s Y = Z</math> so that we have a pair of equations


<math>
<math>
Line 33: Line 34:
Here is the output from the above system, with A = 2, x(t) = 1, plotted using OpenOffice. Different values of the coefficients in the  <math>\dot{z}</math> equation give different levels of damping, resonant frequency, etc.
Here is the output from the above system, with A = 2, x(t) = 1, plotted using OpenOffice. Different values of the coefficients in the  <math>\dot{z}</math> equation give different levels of damping, resonant frequency, etc.


<div class="thumb tnone"><div class="thumbinner" style="width:402px;">[[Image:Dampedresponse.png]] <div class="thumbcaption"><div class="magnify">[[File:Dampedresponse.png|<img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" />]]</div></div></div></div>
[[Image:Dampedresponse.png|thumb|420px|none]]


This plot shows that the above transfer function has roots at <math> -1 \pm j </math> as expected:
This plot shows that the above transfer function has roots at <math> -1 \pm j </math> as expected:


<div class="thumb tnone"><div class="thumbinner" style="width:402px;">
[[Image:Simpleroots.png|thumb|420px|none]]
{| class="wikitable"
|-
| Error creating thumbnail: convert: unable to open image `/var/www/wiki/images/2/25/Simpleroots.png': No such file or directory.<br /> convert: unable to open file `/var/www/wiki/images/2/25/Simpleroots.png'.<br /> convert: missing an image filename `/var/www/wiki/images/thumb/2/25/Simpleroots.png/400px-Simpleroots.png'.<br /> |} <div class="thumbcaption"><div class="magnify">[[File:Simpleroots.png|<img src="/skins/common/images/magnify-clip.png" width="15" height="11" alt="" />]]</div></div></div></div>


Here is the model that was used to produce these solutions:
Here is the model that was used to produce these solutions:


<source lang="a4c">REQUIRE &quot;ivpsystem.a4l&quot;;
<source lang="a4c">REQUIRE "ivpsystem.a4l";


  REQUIRE &quot;atoms.a4l&quot;;
  REQUIRE "atoms.a4l";
  IMPORT &quot;johnpye/extpy/extpy&quot;;
  IMPORT "johnpye/extpy/extpy";


  IMPORT &quot;johnpye/roots&quot;;
  IMPORT "johnpye/roots";


  (*
  (*
Line 73: Line 71:
  METHODS
  METHODS
     METHOD values;
     METHOD values;
         x[7]&nbsp;:= 0;
         x[7] := 0;


         x[8]&nbsp;:= 0;
         x[8] := 0;
     END values;
     END values;


Line 112: Line 110:
See also [[IDA]]
See also [[IDA]]


[[Category:Experimental]]
[[Category:Documentation]]
[[Category:Documentation]]
[[Category:Examples]]
[[Category:Examples]]

Latest revision as of 08:19, 29 March 2011

Some images have been lost from this page during a recent server failure. We are working to restore the missing content.
This page documents an experimental feature. Please tell us if you experience any problems.

In classical control theory, a second-order system has a transfer function like

<math> G(s) = \frac{Y(s)}{X(s)} = \frac{A}{s^2+2s+2} </math>

We can model a system like this fairly easily with ASCEND. First we need to reduce the model to first order differential equations:

<math>s^2 Y + 2 s Y + 2 Y = A X</math>

Now, let <math>s Y = Z</math> so that we have a pair of equations

<math> \begin{matrix} sZ + 2Z +2Y = AX \\ sY = Z \end{matrix} </math>

Taking the inverse Laplace transform and rearranging,

<math> \begin{matrix} \dot{z} &=& Ax-2z -2y \\ \dot{y} &=& z \end{matrix} </math>

This can be coded into ASCEND in the usual syntax (see below).

Here is the output from the above system, with A = 2, x(t) = 1, plotted using OpenOffice. Different values of the coefficients in the <math>\dot{z}</math> equation give different levels of damping, resonant frequency, etc.

Error creating thumbnail: File missing

This plot shows that the above transfer function has roots at <math> -1 \pm j </math> as expected:

File:Simpleroots.png

Here is the model that was used to produce these solutions:

REQUIRE "ivpsystem.a4l";

 REQUIRE "atoms.a4l";
 IMPORT "johnpye/extpy/extpy";

 IMPORT "johnpye/roots";

 (*
    'Test problem'
    We create a set of models with artificially-selected roots

    and then check that the roots plot is as expected.
 *)
 MODEL simpleroots;

    range IS_A set OF integer_constant;

    range :== [7..8];
    x[range], dx_dt[range] IS_A solver_var;

    (* roots at -1 +/i j *)
    dx_dt[7] = 2.0 * 1.0 - 2.0 * x[7] - 2.0 * x[8];

    dx_dt[8] = x[7];

    t IS_A time;

 METHODS
    METHOD values;
        x[7] := 0;

        x[8] := 0;
    END values;

    METHOD ode_init;
        FOR i IN [range] DO

            x[i].ode_type := 1;
            dx_dt[i].ode_type := 2;

            x[i].ode_id := i;
            dx_dt[i].ode_id := i;

            x[i].obs_id := i;
        END FOR;

        t.ode_type := -1;
        t := 0 {s};

    END ode_init;

    METHOD on_load;
        RUN default_self;

        RUN reset; RUN values;
        RUN ode_init;

        RUN roots;
    END on_load;

    METHOD roots;

        EXTERNAL roots(SELF);
    END roots;
 END simpleroots;

See also IDA