Causal Block Diagram (alg+discrete-time)

## General Information

• The due date is Monday 4 November 2013, before 23:55.

• Submissions must be done via BlackBoard. Beware that BlackBoard's clock may differ slightly from yours. All results must be uploaded to BlackBoard and accessible from links in the main (index.html) file.

• 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!

## The assignment

You will implement the operational semantics of (i.e., a simulator for) the Causal Block Diagram (CBD) formalism for (a) un-timed semantics and (b) discrete-time semantics.

You will use the following as a starting point for your solution.

You will need Python 2.x (not 3.x).

Implement the missing functions (marked with # TO IMPLEMENT) of the simulator (ST_Simulator.py) to realize the following:

1. [5%] The construction of the dependency graph;
2. [10%] Given an algebraic loop, detection of whether it is linear;
3. [10%] 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
//
//      [[ C11, C12, C13 ],
// M1 =  [ C21, C22, C23 ],
//       [ C31, C32, C33 ]]
//
// M2 =  [ C1,  C2,  C3 ]
//
// represents the following linear equation system:
// {
//   C11*x + C12*y + C13*z = C1
//   C21*x + C22*y + C23*z = C2
//   C31*x + C32*y + C33*z = C3
// }
// where x, y, and x are signals (block outputs) inside a strong component.
///////////////////////////////////////////////////////////////////////////
```
4. [10%] For each of the blocks, write the computation they need to perform. In this assignment, you only need to implement the algebraic blocks and the delay block (not Integrator and Derivative blocks).

[50% -- 10% per item] Provide test models and their results to demonstrate the correctness of your solution (add testcases to CBDtest.py):

1. Simple algebraic models without loop, one for each implemented block;
2. A non-trivial algebraic model without loop to test sorting;
3. An algebraic model with a non-linear loop;
4. An algebraic model with a linear loop ;
5. An algebraic model with at least two linear loops, and computation in between; 