Causal Block Diagram (alg+discrete-time) 

General Information

  • The due date is Sunday 26 October 2014, before 23:55.

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

  • Each team submits only one full solution. our submission must be in the form of a simple HTML file (index.html) with explicit references to all submitted files as well as inline inclusion of images. Use the index.html template. Use exactly this format to specify names and IDs of the team members. The other team member must submit a single index.html file containing only the coordinates of both team members. This will allow us to put in grades for both team members in BlackBoard. Beware: after the submission deadline there is no way of adding the other team member's index.html file and thus no way of entering a grade !

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

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

  • Contact: Joachim Denil.

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).


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

  1. The construction of the dependency graph;
  2. Given an algebraic loop, detection of whether it is linear;
  3. 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).

Take note that the simulation kernel supports hierarchy. We expect that the hierarchy works.

B. Use the supplied unit tests to test your implementation. Finally, create different CBD models to further test your implementation with and without hierarchy. Plot the results for your report:

  1. A non-trivial algebraic model without loop to test sorting;
  2. An algebraic model with a non-linear loop;
  3. An algebraic model with a linear loop ;
  4. An algebraic model with at least two linear loops, and computation in between;
In total you will have 8 test models (one without and one with hierarchy each)! To plot your results you can use the matplotlib python library: http://matplotlib.org/1.4.0/faq/installing_faq.html. Here you can find an example how to plot you results together in a single window. Alternatively, you can dump the results of your simulation and copy-paste them into a spreadsheet program.

C. Model Compilation:

  1. Create a model compiler for CBD models. The compiler takes a CBD model as input and outputs a C-program that calculates the signal values. Here is an example C-file of a very simple CBD model with four blocks. The code can be used as a template to create your own code with the compiler.
  2. Use the models created in part B. of the assignment to test your model compiler. Because linear algebraic loops need to be solved, you can immediately integrate a solver into your code: http://rosettacode.org/wiki/Gaussian_elimination#C.
Compilation of the code can be done with the GCC compiler: gcc test.c -o test
Execute: ./test

D. Proper documentation, both of your code, and of your report. In particular, provide a visual representation of your models, as well as of your output signals (as plots).

Maintained by Hans Vangheluwe. Last Modified: 2014/10/16 18:58:53.