Start by writing a User Specification, giving details of what determines the up and the down. Then give the Spec to a Controls Engineer.
__________________
"Did you get my e-mail?" - "The biggest problem in communication is the illusion that it has taken place" - George Bernard Shaw, 1856
Many of the manufactures have cylinders that have encoders that can position the cylinder exactly where you want it to be. But in automation you may only want to know whether the cylinder extended or retracted. This is done with external switches that sense the position of the swab which has been modified with magnetic ring.
__________________
Life is not a journey to the grave with the intention of arriving in a pretty, pristine body but rather to come sliding in sideways, all used up and exclaiming, "Wow, what a ride!"