-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdiscrete_time_engine.py
22 lines (19 loc) · 993 Bytes
/
discrete_time_engine.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# Discrete Time Simulation Engine
def run(application):
'''Runs the specified application until its maximum time
application -- a Python module that completely specifies the application of
the simulation. The module must contain the following:
- settings: submodule containing an int called maxIter
- output(): function which returns any relevant outputs
- initialize(): function which performs any necessary
setup
- Now: global variable for tracking current simulation
time
- iter(): a function which performs all necessary
operations for each discrete time step
'''
application.initialize()
for i in range(application.settings.maxIter):
application.iter()
application.Now += 1
return application.output()