Listing 1.
1 | public class MyProcess { |
2 | // Initializes the process |
3 | public MyProcess ( ) { |
4 | . . . |
5 | } |
6 | // Steps the process for an increment of time |
7 | public void step (double dt) { |
8 | . . . |
9 | } |
10 | // Simulate the process |
11 | static public void main (String [] args) { |
12 | double time = 0, tFinal = 1.0, dt = 0.001; |
13 | MyProcess process = new MyProcess ( ); |
14 | while (time <tFinal) { |
15 | process . step (dt); |
16 | time += dt; |
17 | // output process variables |
18 | . . . |
19 | } |
20 | } // end of class |