03.08.2013 Views

Edwin Jan Klein - Universiteit Twente

Edwin Jan Klein - Universiteit Twente

Edwin Jan Klein - Universiteit Twente

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

89<br />

Simulation and analysis<br />

executes all the calls of equal time simultaneously and calls the calculation<br />

functions of the proper primitives.<br />

Primitive<br />

Callback<br />

request<br />

Calculate()<br />

Primitive<br />

Execution<br />

engine<br />

Call list<br />

t<br />

t+dT1<br />

t+dT2<br />

t+dTn<br />

tMax<br />

Figure 4.12. Diagram of the dataflow within the scheduler. A primitive asks the execution<br />

engine to place call in the call list. After a certain time has elapsed (equivalent to the<br />

propagation time of the light through the primitive) the execution engine places this call in the<br />

next primitive and calls its calculate() function.<br />

• Timekeeping.<br />

The primitives intentionally do not store the current time data but only notify<br />

the execution engine of the delay in the signal they cause. It is therefore up to<br />

the execution engine to calculate the actual execution time of the call from this<br />

delay. In addition to this task the current time is also continuously checked<br />

against a maximum execution time at which the simulation needs to end. For<br />

the same reason that the simulation requires an initial change to start the<br />

simulation process it is also, under certain circumstances, unable to stop by<br />

itself. Since each primitive calls (directly or indirectly) the calculation<br />

function of a primitive it is connected to, feedback loops can be created for<br />

certain components such as the micro-resonator in which initial signal changes<br />

can be forwarded infinitely. This is in a way an integral part of the simulation<br />

method as it allows the simulation of optical components that contain many<br />

feedback loops. As was mentioned in Chapter 4.2.1, however, the output<br />

values of a resonant system are usually stable after a certain time TMax. The<br />

execution engine therefore allows the simulation to end at that time (this has to<br />

be determined by the user).<br />

In Listing 4.4 a highly simplified version of the execution engine is given in pseudo<br />

code. The algorithms shown in this code consists of two functions. The first,<br />

AddCall() is used by the primitives to place a call into the call list. The second,<br />

Simulate() is the actual simulation algorithm.<br />

When a simulation is started all the primitives are first initialized. This initialization is<br />

important as the flow of signals within the simulation originates here through the use<br />

of source primitives. These primitives do not operate differently from the other<br />

primitives except that they already create a call (with time delay zero) in the call list<br />

when their initialization functions are executed. As can be seen in the core loop of the<br />

algorithm these first calls are crucial as the simulation would simply end without<br />

them.

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!