I just don't understand how it would know where "zero" or start is...
There are a few ways that this is done but I will only cover the most common. When I say most, I mean the one that I personally have seen, used in person and research. AKA Youtube. LOL.
The use of a reset switch/sensor. It can be a limit switch or proximity sensor or laser (through beam or defused/bounceback). I would prefer a hard contact switch. Depending on the quality of sensor, they can be "thrown off" by how fast the motor speed is set at. It may react but at different distances and times. Basically the calibration needs to be checked often. Weather also can affect those sensors. A basic limit switch is best.
Whatever you choose can be set anywhere alone side door's path. Fully open end, fully closed end, or even anywhere in the middle. Best to be placed at either end. The key is that you know how far the distance is or how much travel it takes to get to either side. Which corresponds to how many rotations or window counts on that wheel. It get logged into a counter.
Lets say,,,
When the motor/door reaches the fully closed position, the limit switch is triggered and the counter is reset.
When it is time to open, the programing needs to be done so that the limit switch is checked to see if it is open or closed.
If closed (as it should be in this point) it starts to open the door and counting the windows starts.
Once it reaches the set amount of windows it stops.
At closing time all that is needed is to run the motor to close and once the limit switch is triggered it stops.
Limit switch open/closed should be tested every 10 min or so, after closing time, just in case of a power outage or something went wrong. It be a good idea to send you a text if the switch is not reading closed, during night time hours.
For testing and other reasons, the door open cycle should be to close the door and trigger the limit switch to reset the counter, then the door opens.
I hope I didn't overcomplicate it.