# Causal Block Diagram Assignment

## General Information

• The due date is Friday 14 October 2005, before 23:55.

• Submissions must be done via WebCT. Beware that WebCT's clock may differ slightly from yours. As described on the Assignments page, all results must be uploaded to WebCT and accessible from links in the index.html file. There is no need to upload AToM3.

• The assignment must be made in groups of maximum 2 people. It is understood that all partners will understand the complete assignment (and will be able to answer questions about it). Clearly identify who did what.

• Grading will be done based on correctness and completeness of the solution. Do not forget to document your requirements, assumptions, design, implementation and modelling and simulation results in detail !

• Extensions, if given, will involve extending not only the alotted time, but also the assignment !

## The assignment

1. [11%] Implement the algorithms for Causal Block Diagrams (CBD) in AToM3:
1. [8%] Implement the missing functions of the simulator (CausalBlockDiagram/ST_CBD/ST_Simulator.py) to accomplish the following requirements:
1. [2%] The construction of the dependency graph;
2. [2%] Given an algebraic loop, detection of whether it is linear;
3. [2%] Given a linear algebraic loop, construct input for a linear solver; the format of the input should be:
/////////////////////////////////////////////////////////
// Input for the solver is of the form: [M1, M2], where
// M1 =
//      B1   B2   B3
// B1 | a    b    c |
// B2 | d    e    f |
// B3 | g    h    i |
//
// M2 =
//      B1   B2   B3
//    | X    Y    Z |
// represents the following linear equation system:
// {
//   a*B1 + b*B2 + c*B3 = X
//   d*B1 + e*B2 + f*B3 = Y
//   g*B1 + h*B2 + i*B3 = Z
// }
// where B1, B2, and B3 are blocks inside a strong component.

4. [2%] For each of the blocks, write the computation they need to perform.
2. [3%] Implement an algorithm to print out the LaTeX form of a model: Both the "naieve" and the "sophisticated" format are possible. In the "naieve" format, for each block in the model, the relationship between all connected signals is given. Note that this will only give a meaningful result if all signals have a non-empty-string name. (Since the CBD formalism you are using for this assignment doesn't allow no-name block and will assign a unique name for any newly added block, you should name a block with an underscore as prefix to make it act as a no-name block.) In the "sophisticated" format (as a human modeller would write it), some signals may have an empty name (actually, a name starting with an underscore, as explained early) as they will not be written explicitly. In this format, all constant equations are written separately and there is one equation for each Integrator, Derivative, or Delay block.