  A simulation of an atomic force microscope operating in the constant
amplitude dynamic mode is described. The implementation mimics the electronics
of a real setup including a digital phase-locked loop (PLL). The PLL is not
only used as a very sensitive frequency detector, but also to generate the
time-dependent phase shifted signal driving the cantilever. The optimum
adjustments of individual functional blocks and their joint performance in
typical experiments are determined in detail. Prior to testing the complete
setup, the performances of the numerical PLL and of the amplitude controller
were ascertained to be satisfactory compared to those of the real components.
Attention is also focused on the issue of apparent dissipation, that is, of
spurious variations in the driving amplitude caused by the nonlinear
interaction occurring between the tip and the surface and by the finite
response times of the various controllers. To do so, an estimate of the minimum
dissipated energy that is detectable by the instrument upon operating
conditions is given. This allows us to discuss the relevance of apparent
dissipation that can be conditionally generated with the simulator in
comparison to values reported experimentally. The analysis emphasizes that
apparent dissipation can contribute to the measured dissipation up to 15% of
the intrinsic dissipated energy of the cantilever interacting with the surface,
but can be made negligible when properly adjusting the controllers, the PLL
gains and the scan speed. It is inferred that the experimental values of
dissipation usually reported in the literature cannot only originate in
apparent dissipation, which favors the hypothesis of "physical" channels of
dissipation.
