The purpose of this exercise is to define all functions underlying the continuous simulation of the system.
Step 1: download the following simulation functions:
system and module residue functions
system and module Jacobian functions
system and module event functions
parameter initialisation template and support function
Step 2: complete the simulation functions. You may have noticed while downloading the function that some are missing. Indeed they are. You will have to complete the derivative, Jacobian, and event functions for the subsystems (the subsystem equation you will find in your lecture notes and you may use the supplied files as a template):
- Network - create functions dNetwork.m, eNetwork.m, jNetwork.m
- Load - create functions dLoad.m, jLoad.m
Step 3: complete the template file getNetworkPars_v1.m. Open up the file getNetworkPars_v1.m. You will find a description of all the state variables and parameters. Most of the file you will leave as is. All that you are asked is to scroll down to the very bottom and enter the arguments in correct format to the following functions:
- odefun
- jfun
- efun
- ode15i
- deval
These function require the initial state and state derivative values. You will find these values, along with my results for your verification, in the following data file:
Once you complete these functions, getNetworkPars.m should execute and the values xsol, dsol, r, Jx, Jd, val, ter, dir should all match the values in the above data file.