Latest update: Monday 23 September 2002 !
See the updates section at the bottom of this document.
You will use the meta-modelling environment AToM3 AToM3.asgn.tgz to interactively construct two Causal Block Diagram models:
The assignment consists of four parts, some of which are optional.
|
\documentclass[12pt]{article} \begin{document} \[ \left\{ \begin{array}{ll} \frac{dx}{dt} = y & x(0) = 0\\ \frac{dy}{dt} = -Kx & y(0) = 1, K=1 \end{array} \right. \] \end{document}
function xdot=f(x,t) xdot=zeros(2,1); xdot(1)=x(2); xdot(2)=-x(1); endfunction x0=[0;1];To obtain a solution and plot it in Octave:
t=linspace(0,50,1000); y=lsode("f", x0, t); plot (t,y); plot (y(:,1), y(:,2))A similar syntax is used by Matlab. Demonstrate the working of your exporter by applying it at least to the circle and ballistic tests.
The following derives the equations of motion for the ballistic problem above. You have to convert these into a Causal Block Diagram.
One of our assumption states that the ball's motion is abstracted to that of
its centre of mass. Hence we start from Newton's Second Law of motion:
|
| (1) |
| (2) |
Recall that the acceleration is the second derivative of the position with
respect to time: hence ax = [x\ddot], ay = [y\ddot]
(a dot denotes a derivative with respect to time).
We now have a system of two second-order equations.
Since most ODE solvers (including our Time Slicing simulator)
operate on a system of first-order equations,
we use the standard technique of introducing extra variables:
we let vx = [x\dot], and vy = [y\dot]
(respectively, the horizontal and vertical velocities).
We then have the following system to solve:
| (3) |
The above model describes a class of behaviours. To specify a unique solution trajectory (our Time Slicing simulator is not capable of producing a class of solutions as a symbolic solver is), we need to specify initial conditions. The initial conditions for each of the variables in equation 3 should be easy to determine from the problem specification (recall that the given v0 is the magnitude of a velocity vector v0.
Download AToM3.asgn.tgz archive.
Expand it locally (for example with the command tar -ungzip -xvof AToM3.asgn.tgz if you're working on a UNIX machine. This will create a directory AToM3.asgn.
To start the AToM3 environment, python ATOM3.py. python should be at least version 2.2 of Python (this is installed in the SOCS labs). On UNIX, the script atom3 is a shortcut for the above command. On windows, you can just click on the ATOM3 icon to launch it.
AToM3 will be started with the CausalBlockDiagram formalism loaded. You can either build your own model (and File/Save it) or File/open an existing one. In the directory ModelExpCircletest you will find the example model circle_CausalBlockDiagram_mdl.py.
A directory ModelExpBallistic has been set up for your ballistic model and experiments.
When AToM3 starts with the CausalBlockDiagram formalism, it will use a number of files in the CausalBlockDiagram directory:
Note how we implicitly assume the termination condition for the simulator is t > tfinal. You may want to use another termination condition.
A pretty-printed version of these files (with enscript -color -E -Whtml -toc -p pretty_print.html *.py) is here.
AToM3.asgn.tgz has been updated. It is still compatible with the models you have built upto now and the code you may have written.
The archive now contains:
A clarification: the block_out_value attribute of a block must contain the output signal value at the ``current'' time. It must thus be updated by your Time Slicing simulator. As described in the CBD notes, you need temporary storage for these values while processing Delay/Integrator/Derivative blocks. This is provided for in the form of the block_out_value attribute (note how you could also just create a new attribute on the fly in Python).