Sunday, February 26, 2012

On the sensitivity of hybrid models to sampling rate

The way Adam had chosen to evaluate the breaking ball signal function turned out to be the source of the strange behavior described in his paragraph from a week ago. The culprit is the Yampa function reactimate which allows interleaving I/O actions – in this case, rendering – with the sampling of a pure signal function. Such a construct is necessary when implementing an interactive application, but in this case (a deterministic simulation) it was doing more harm than good. Interactive applications (e.g. games) need to adjust the sampling rate with regard to the performance of the system they are executed on (affected by hardware and other applications running on the system) so that simulation time always progresses at the same rate compared to real time. The effects of this dynamic adjustment of the sampling rate can be seen in the figure below.


Above, the breaking ball model was modified not to add a new ball on each impact (reducing it to a bouncing ball simulation), to increase the number of bounces per unit of time the gravity constant was also increased, and the COR of the ball was set to 1. To emulate the effect of handling an exponentially increasing collection of signal functions, which was causing the sampling rate to decrease, Adam added a computationally intensive calculation to the list of actions performed in reactimate's input/sense argument, and toggled this on integer boundaries. The effects of this load on the system are apparent, and they manifest themselves in two ways. Firstly, the number of samples is clearly reduced as can be seen by the sparse distribution of data points along the plot in these intervals. Secondly, though the ball has a COR of 1, the ball also gains in elevation on each bounce in these intervals. The second effect is a consequence of the first, and is caused by the fact that when the sampling rate goes down, the accumulated effect of gravity on the position of the ball also decreases.

To evaluate a signal function with a pre-specified sampling rate, Yampa's embed function can be used. In this case the simulation ground to a halt (in contrast with last week's result) at around t = 4.5, the Zeno point of the sub-system of balls with lower COR.