Thread: How to model a system?

  1. #1
    Registered User
    Join Date
    Feb 2010

    How to model a system?

    Hello, everyone.
    I have a question about how to use programming to model a system which contain time for mation or something like that.
    To be more specific, the system is like Railway system、weather forecast system.
    Basically, system change over time and may have some interaction function to customers.
    I have very limited implementation skills.
    I do know basic datastructures and knows how to build a library system which have simple functions like search, delete, add, and borrow ... etc.
    Though I still have no idea if I want to add time information to modeling the library system. Like borrow the book depends on the time system have.

    The question is what is the basic idea to model a system with "time" information?
    Time infomation means the system change over time. <== It doesn't mean to equal to "real time" change, but the point is it changes..

    Hopefully, with my poor English description. Someone might catch it..

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Somewhere in your model, you have some abstract time, say

    int now;
    and a function to tick, say
    void tick ( void ) {

    In your library book object say, you may have
    int returnBy;
    which you initialise with something like this when the book is borrowed;
    book->returnBy = now + 7;  // return within a week

    So once a day, you call tick() to bump time along (if you're doing it in real-time), or at whatever rate you want if you just want to 'model' what would happen.

    Also once a day, your 'overdue' function would do something like
    if ( now > book->returnBy ) {
      // OVERDUE!
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 14
    Last Post: 06-28-2006, 01:58 AM
  2. Linux database system needed
    By BobS0327 in forum Tech Board
    Replies: 7
    Last Post: 06-11-2006, 03:56 PM
  3. Dev-C++ Compatible Model Loading(OpenGL)
    By jmd15 in forum Game Programming
    Replies: 2
    Last Post: 05-22-2006, 08:08 PM
  4. measuring system resources used by a function
    By Aran in forum C Programming
    Replies: 1
    Last Post: 03-13-2006, 05:35 PM