I modified the c1gfd.mdl simulink model. I made a backup as c1gfd_20110325.mdl.
The first change was to use a top_names block to put everything in. The block is labeled ALS. So all the channels will now be C1:ALS-GFD_SOMETHING. This means medm channel names will need to be updated. Also, the filter modules need to be updated in foton because of this.
I then proceeded to add the suggested changes made by Matt. To avoid a divide by zero case, I added a saturation part which saturates at 1e-9 (note this is positive) and 1e9.
Today we tried the Schmitt trigger DFD, and while it works it does not improve the noise performance. At least part of our problem is coming from the discrete nature of our DFD algorithm, so I would propose that an industrious day job person codes up a new DFD which avoids switching. We can probably do this by mixing the input signal (after high-passing) with a time-delayed copy of itself... as we do now, but without the comparator. This has the disadvantage of giving an amplitude dependent output, but since we are working in the digital land we can DIVIDE. If we mix the signal with itself (without delay) to get a rectified version, and low-pass it a little, we can use this for normalization. The net result should be something like:
output = LP2[ s(t) * s(t - dt) / LP1[ s(t) * s(t) ]],
where s(t) is the high-passed input and LP is a low-pass filter. Remember not to divide by zero.