A variable displacement reciprocating piston unit for generating a signal indicating a piston stroke speed and a stroke length of at least one piston, the variable displacement reciprocating piston unit comprising at least one processing unit, at least one sensor probe, the at least one piston, and at least one target, the piston having a top dead centre position and a bottom dead centre position and the processing unit configured to: receive a signal from the sensor probe, the sensor probe indicating a presence and an absence of the target as the target moves relative to the sensor probe, the signal allows first timestamps to be measured when the target moves from being present at the sensor probe to being absent from the sensor probe, and the signal allows second timestamps to be measured when the target moves from being absent from the sensor probe to being present at the sensor probe; determine a periodicity of the piston by applying a first function to at least two timestamps of the first timestamps or at least two timestamps of the second timestamps; determine a target duty cycle ratio by comparing a target pulse duration generated from at least one timestamp of the first timestamps and at least one timestamp of the second timestamps with the periodicity; and generate the signal indicating the stroke speed and the stroke length from the periodicity and the target duty cycle ratio, wherein the sensor probe, the target, and the piston are located in relation to each other, so that the target is moved from being absent from the sensor probe to being present at the sensor probe when the piston travels towards the top dead centre position, and so that the target is moved from being present at the sensor probe to being absent from the sensor probe when the piston travels towards the bottom dead centre position; characterized in that the variable displacement reciprocating piston unit further comprises a calibration target, the sensor probe indicating a presence and an absence of the calibration target as the calibration target moves relative to the sensor probe; and wherein the processing unit is further configured to calibrate the generated stroke length of the piston using the indication of the presence of the calibration target 150. receive a signal from the sensor probe, the sensor probe indicating a presence and an absence of the target as the target moves relative to the sensor probe, the signal allows first timestamps to be measured when the target moves from being present at the sensor probe to being absent from the sensor probe, and the signal allows second timestamps to be measured when the target moves from being absent from the sensor probe to being present at the sensor probe; determine a periodicity of the piston by applying a first function to at least two timestamps of the first timestamps or at least two timestamps of the second timestamps; determine a target duty cycle ratio by comparing a target pulse duration generated from at least one timestamp of the first timestamps and at least one timestamp of the second timestamps with the periodicity; and generate the signal indicating the stroke speed and the stroke length from the periodicity and the target duty cycle ratio, wherein the sensor probe, the target, and the piston are located in relation to each other, so that the target is moved from being absent from the sensor probe to being present at the sensor probe when the piston travels towards the top dead centre position, and so that the target is moved from being present at the sensor probe to being absent from the sensor probe when the piston travels towards the bottom dead centre position; characterized in that the variable displacement reciprocating piston unit further comprises a calibration target, the sensor probe indicating a presence and an absence of the calibration target as the calibration target moves relative to the sensor probe; and wherein the processing unit is further configured to calibrate the generated stroke length of the piston using the indication of the presence of the calibration target 150.