PhaseLocked Loop Library
During my Diploma Thesis (in German) I had to simulate phaselocked loops (PLLs) mith Matlab/Simulink. But it was even a problem in adjusting the freuquency of a sinusoidal waveform generator so I started a Simulink library for the components, necessary for simulating analog and digital PLLs.
The Simulink PLL Library can be downloaded here
There are some example projects that uses the PLL lib:
Example for a time continous PLL
Example for a time discrete PLL
Here is a short description of the library components:
Analog voltage controlled oscillator (VCO): Frequency and phase can be adjusted during runtime with the two inputs freq and phase. The sin output produces a 90 degree shifted signal in respect to the cos output. 

Direct Digital Synthesizer (DDS): Frequency and phase tuning words can be adjusted during runtime with the two inputs FTW and PTW. The output freuquency is f=FTW/2^M*fs, where M is the wordsize of the FTW (can be set as property) and fs is the sampling frequency of the component. The output phase can be set by φ=PTW/2^M*2*π. 

Ideal phase detector: Detects the phase difference from two analytic (complex) signals and compensates phase overflows. 

Phase difference: Calculates the difference from two phase signals (range π...&pi) and compensates phase overflows. 

Phase sum: Calculates the sum of two phase signals (range π...&pi) and compensates phase overflows. 

Detects the frequency of a phase signal with the discrete differentiation. 

Phase unwrapp: Extends the range of a phase signal from π...&pi to Nπ...N&pi. The integer N can be set as property. 

Automatic Gain Control (AGC): Implementation of a simple AGC for compensating amplitude differences inside a PLL. 