My question is what are the ideas behind the complicated historical water clocks. According to wikipedia, modern versions of the historical water clock rely on the principle of the syphon. So I ask how to translate it to the mechanical language. In particular, as is evident from my question, I'm very interested in knowing the inner-workings of al-jazary's "castle clock", which is an early example of programmable analog computer.
There is an excellent description of the castle clock in this article on muslimheritage.com. It describes the full workings of the clock, including all of the mechanisms for things such as doors opening and closing and for the sun moving across the clock.
The most interesting part, for me at least, is how he used water to make a relatively accurate timing device. As with all timing devices, the key is to find a physical process with a very consistent rate. Al-jazary used the outflow of water through a small hole to achieve this. The difficulty of using the outflow of water from a reservoir is that; as the height of the water decreases, the pressure at the bottom changes, and the rate of outflow decreases. Al-jazary had a rather ingenious solution though.
In the image above the main reservoir would be filled with water, and, as the water was released, the main float would sink and transmit the motion to the clock. In order to deal with the problem of decreasing pressure (and outflow rate), Al-jazary added another smaller reservoir at the output of the main reservoir. The small reservoir had a floating stopper at the top; as the smaller reservoir drained the stopper would release more water, and as it filled the stopper would release less water (an example of a mechanical feedback loop). This maintained the pressure in the secondary reservoir at a constant level. The flow regulator could then be adjusted to give a precise rate of water release.