CPD320 Simulation Project

From Chemical Engineering @ UP wiki
Revision as of 10:03, 22 September 2009 by 137.215.122.240 (Talk) (Common mistakes)

Jump to: navigation, search

This page contains common problems concerning the CPD simulation project. I will update this page as new problems present themselves - so have a look at this page before contacting me or Carl, the answer to your question/error might just be here.

If this page has not helped you, and you still require help, feel free to make an appointment with me. I'm usually on campus between 09:00 and 14:00, and till about 18:00 on Wednesdays and Fridays. But if you don't have an appointment, I can't promise that I'll have time to help you at that moment.

eMail: ahcampher@tuks.co.za

André

Mistakes specific to CPD project

Integration

Remember that you're working with one system. The states of the system affect each other - you will therefore need to integrate all the states at once. Splitting the differential equations and integrating them one at a time, will create problems as you'll assuming certain set profiles for variables (the pre-integrated states) and not allowing them to change according to the equations.

Diverging (unstable) differentials

If you notice that your system seems to be unstable (after integration) just check that you've not created a system which is inherently unstable. A few things to check include:

  • Check that your balances hold - are you removing mass/energy?
  • Check parameters - bad parameter choices can make the system seem unstable (due a very slow nature or steady-state being at very high values).
  • Are your equations working as you expect?
  • Is the control valve open? (x > 0)

Test your functions

Make sure that your functions return the values you expect them to by giving them known values and checking the output.

Be consistent

If you decide to use different functions for each differential equation, be consistent when specifying the order of the arguments to those functions. Its easy to make mistakes when you need to pass the arguments in a different order each time.

Variable names

Make sure that you don't use the same name for variables and functions, this will cause Octave to handle calls to your function/variable differently than you might expect. It will only call the function if the variable (which has the same name) does not exist.

Time

Take note that lsode does not make a number of integration steps equal to the size of the timespan you defined. Therefore, if you want to use time in any of your equations, you can not count on the n'th time step to correspond to the n'th element in your timespan vector (this will almost always be the case).

= Common Octave errors

There is a separate page for Common Matlab/Octave errors.