<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
    <title>Leonardo Pinero-Perez - Writing</title>
    <subtitle>Essays and notes by Leonardo Pinero-Perez. No LLM wrote any of these.</subtitle>
    <link rel="self" type="application/atom+xml" href="https://leopinero.com/writing/atom.xml"/>
    <link rel="alternate" type="text/html" href="https://leopinero.com/writing/"/>
    <generator uri="https://www.getzola.org/">Zola</generator>
    <updated>2026-11-08T00:00:00+00:00</updated>
    <id>https://leopinero.com/writing/atom.xml</id>
    <entry xml:lang="en">
        <title>Implementing Logic in a Variable Displacement Pump to Maintain Resonance to Maximize Flow Gain in Unknown Time-Variant Systems</title>
        <published>2018-05-05T00:00:00+00:00</published>
        <updated>2026-11-08T00:00:00+00:00</updated>
        <author>
          <name>Leonardo Pinero-Perez</name>
        </author>
        <link rel="alternate" type="text/html" href="https://leopinero.com/writing/variable-displacement-pump/"/>
        <id>https://leopinero.com/writing/variable-displacement-pump/</id>
        
        <content type="html" xml:base="https://leopinero.com/writing/variable-displacement-pump/">&lt;div class=&quot;abstract&quot;&gt;The goal of this design was to implement logic-control on a variable displacement pump to maintain resonance to a changing system. It was designed and built around a sample static 4th-order system to test methods and was then simulated on a changing 2nd-order system. The logic implementation was successful, as the controlled pump was able to track the changing resonance frequencies and adapted its pulse train to maximize flow gains.&lt;/div&gt;
&lt;h2 id=&quot;nomenclature&quot;&gt;Nomenclature&lt;/h2&gt;
&lt;dl class=&quot;nomenclature&quot;&gt;
&lt;dt&gt;fQa&lt;/dt&gt;&lt;dd&gt;Pump Pulse Train Frequency Setting&lt;/dd&gt;
&lt;dt&gt;Kw&lt;/dt&gt;&lt;dd&gt;Pump Pulse Train Width Setting&lt;/dd&gt;
&lt;dt&gt;&lt;!-- latex: Q_a --&gt;&lt;math display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mi&gt;Q&lt;/mi&gt;&lt;mi&gt;a&lt;/mi&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;/math&gt;&lt;/dt&gt;&lt;dd&gt;Input Flow from Pump&lt;/dd&gt;
&lt;dt&gt;&lt;!-- latex: Q_e --&gt;&lt;math display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;msub&gt;&lt;mi&gt;Q&lt;/mi&gt;&lt;mi&gt;e&lt;/mi&gt;&lt;/msub&gt;&lt;/mrow&gt;&lt;/math&gt;&lt;/dt&gt;&lt;dd&gt;Measured Output Flow&lt;/dd&gt;
&lt;dt&gt;sys&lt;/dt&gt;&lt;dd&gt;Unknown Time-variant System&lt;/dd&gt;
&lt;dt&gt;t&lt;/dt&gt;&lt;dd&gt;Time [s]&lt;/dd&gt;
&lt;dt&gt;&lt;!-- latex: \mathrm{\varphi} --&gt;&lt;math display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;φ&lt;/mi&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/math&gt;&lt;/dt&gt;&lt;dd&gt;Swash Plate Angle&lt;/dd&gt;
&lt;dt&gt;&lt;!-- latex: \mathrm{\omega} --&gt;&lt;math display=&quot;inline&quot;&gt;&lt;mrow&gt;&lt;mrow&gt;&lt;mi mathvariant=&quot;normal&quot;&gt;ω&lt;/mi&gt;&lt;/mrow&gt;&lt;/mrow&gt;&lt;/math&gt;&lt;/dt&gt;&lt;dd&gt;Axial Rotation of Pump&lt;/dd&gt;
&lt;/dl&gt;
&lt;h2 id=&quot;1-introduction&quot;&gt;1 Introduction&lt;/h2&gt;
&lt;figure class=&quot;fig&quot;&gt;&lt;div class=&quot;fig-mat&quot;&gt;&lt;a class=&quot;fig-full&quot; href=&quot;/writing/variable-displacement-pump/fig-01.png&quot;&gt;&lt;img src=&quot;https://leopinero.com/processed_images/fig-01.c6e2bd72df054d62.png&quot; srcset=&quot;https://leopinero.com/processed_images/fig-01.1ece185f21771c13.png 480w, https://leopinero.com/processed_images/fig-01.c6e2bd72df054d62.png 960w&quot; sizes=&quot;(min-width: 40em) 36rem, 100vw&quot; width=&quot;960&quot; height=&quot;560&quot; alt=&quot;Hand-drawn sketch of the pump in a box: a swash plate tilted at angle φ turns about a horizontal axis with rotation ω; on the compression side a piston pushes flow Qa out to the right, and on the expansion side a piston draws fluid in from the inlet.&quot; loading=&quot;lazy&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;figcaption&gt;&lt;span class=&quot;fig-label&quot;&gt;Figure 1&lt;/span&gt;Pump Schematic&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;The purpose of this project was to design control logic for a variable displacement pump such that the peak output flow was at the greatest magnitude relative to the input flow. One practical application of such a control system can be found in hydraulic fracturing wells, where the pump forces the output fluid through rock fissures to release the shale oil trapped inside. Increasing the peak fluid flow using small input flows reduces the pump requirements and water needed to break open the rock formations. This makes hydraulic fracturing cheaper and less mechanically intensive. The best way to maximize the flow gains is to maintain the system at resonance with the system. However, like the vast majority of practical applications, the equations which model a hydraulic fracturing pipe are unknown, changing, and nonlinear. This is where logic is needed to automatically follow the changing model according to measurements made by instrumentation such as a flow meter. The variable displacement pump generates pulse train inputs. It does this by rotating a series of pistons very quickly, bringing in the fluid through an inlet section where the pistons are expanding. Half a revolution later, the pistons generate an output flow by compressing the piston, as shown in the sketch above.&lt;/p&gt;
&lt;h2 id=&quot;2-model&quot;&gt;2 Model&lt;/h2&gt;
&lt;p&gt;The sample model used for flow output as a function of flow input was linearized in Dr. Hullenders FPMC2017-4202 Paper &lt;a class=&quot;cite&quot; href=&quot;#ref-1&quot;&gt;[1]&lt;/a&gt;. This was a 26th-order linear transfer function approximating six bode peaks until a frequency of 2630 rad/s. The output of this transfer function gives the output flow normalized by the input flow. The flow gains of this model would be defined by the maximum output flow divided by the input flow of the pulses.&lt;/p&gt;
&lt;figure class=&quot;fig&quot;&gt;&lt;div class=&quot;fig-mat&quot;&gt;&lt;a class=&quot;fig-full&quot; href=&quot;/writing/variable-displacement-pump/fig-02.png&quot;&gt;&lt;img src=&quot;https://leopinero.com/processed_images/fig-02.2c17e0dd47eae9bb.png&quot; srcset=&quot;https://leopinero.com/processed_images/fig-02.4c01da137ab368de.png 480w, https://leopinero.com/processed_images/fig-02.2c17e0dd47eae9bb.png 960w&quot; sizes=&quot;(min-width: 40em) 36rem, 100vw&quot; width=&quot;960&quot; height=&quot;306&quot; alt=&quot;Hand-drawn block diagram in a box: input flow Qa enters a pipe, passes through a dashed box labelled sys(t), and leaves as output flow Qe.&quot; loading=&quot;lazy&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;figcaption&gt;&lt;span class=&quot;fig-label&quot;&gt;Figure 2&lt;/span&gt;Pipe Schematic&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;To make the system response easier to simulate, a reduced-order was generated using the balred() MATLAB function, where a reduced, 4th-order approximation model was created from the 26th-order model. The 4th-order model is a good approximation only if the user specifies the frequency range of interest. To demonstrate the logic of the system, only the first two largest peaks were of interest. It is a better demonstration to include two bode peaks as an example, so that there is an opportunity for the logic to select the better of the two bode peaks. In this case, a range of 0 to 800 rad/s was selected to approximate. Again, it is important to note that the human or non-human operator of this pump does not know the bode response of the system on that particular day or site. The model is only described here to show an example of such an unknown system. The bode response of the high-order and 4th-order sample models are shown below.&lt;/p&gt;
&lt;figure class=&quot;fig&quot;&gt;&lt;div class=&quot;fig-mat&quot;&gt;&lt;a class=&quot;fig-full&quot; href=&quot;/writing/variable-displacement-pump/fig-03.png&quot;&gt;&lt;img src=&quot;https://leopinero.com/processed_images/fig-03.9ef0c7607a13bb01.png&quot; srcset=&quot;https://leopinero.com/processed_images/fig-03.3f1f50daeea12d97.png 480w, https://leopinero.com/processed_images/fig-03.9ef0c7607a13bb01.png 960w&quot; sizes=&quot;(min-width: 40em) 36rem, 100vw&quot; width=&quot;960&quot; height=&quot;683&quot; alt=&quot;MATLAB Bode diagram, magnitude in dB and phase in degrees against frequency from about 10 to 10^10 rad/s, comparing the 26th-order model (dashed) with the 4th-order model (solid red). Both share two small peaks between 10^2 and 10^3 rad/s; the 26th-order model then has a tall spike between 10^3 and 10^4 rad/s, while the 4th-order magnitude falls away in a straight line.&quot; loading=&quot;lazy&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;figcaption&gt;&lt;span class=&quot;fig-label&quot;&gt;Figure 3&lt;/span&gt;Bode Plot of Reduced-Order Sample Model&lt;/figcaption&gt;&lt;/figure&gt;
&lt;h2 id=&quot;3-logic-description&quot;&gt;3 Logic Description&lt;/h2&gt;
&lt;p&gt;The goal of this script is to simulate the logic-controlled pump to follow the resonance peak of a changing system. To do this, there first needs to be a function which simulates the arbitrarily-placed systems response to a specified pulse train input. The function will also simulate the instrument finding the normalized peak flow for each pulse after a steady state pulse train pattern has been reached. The MATLAB function lsim() was utilized here, as well as some data reduction. To use an example, say an operator working on the 4th-order system ran the pump at a fixed pulse train setting, such as 30% pulse width and 30 Hz. The input would look like the following (this is done within the function, calling MATLAB function pulstran() ):&lt;/p&gt;
&lt;figure class=&quot;fig&quot;&gt;&lt;div class=&quot;fig-mat&quot;&gt;&lt;a class=&quot;fig-full&quot; href=&quot;/writing/variable-displacement-pump/fig-04.png&quot;&gt;&lt;img src=&quot;https://leopinero.com/processed_images/fig-04.f4b8f7c9cfe5bfd4.png&quot; srcset=&quot;https://leopinero.com/processed_images/fig-04.9ec4b0ad0ad4d208.png 480w, https://leopinero.com/processed_images/fig-04.f4b8f7c9cfe5bfd4.png 960w&quot; sizes=&quot;(min-width: 40em) 36rem, 100vw&quot; width=&quot;960&quot; height=&quot;378&quot; alt=&quot;MATLAB plot titled “Water Hammer Input over Time”: normalized input flow (Qa) against time from 0 to 1 second, a train of rectangular pulses between 0 and 1.&quot; loading=&quot;lazy&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;figcaption&gt;&lt;span class=&quot;fig-label&quot;&gt;Figure 4&lt;/span&gt;Pump Input (30% Pulse at 30 Hz)&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;And running this input across our system yields the response:&lt;/p&gt;
&lt;figure class=&quot;fig&quot;&gt;&lt;div class=&quot;fig-mat&quot;&gt;&lt;a class=&quot;fig-full&quot; href=&quot;/writing/variable-displacement-pump/fig-05.png&quot;&gt;&lt;img src=&quot;https://leopinero.com/processed_images/fig-05.5da865afe8ddf9d0.png&quot; srcset=&quot;https://leopinero.com/processed_images/fig-05.e02709632d0521da.png 480w, https://leopinero.com/processed_images/fig-05.5da865afe8ddf9d0.png 960w&quot; sizes=&quot;(min-width: 40em) 36rem, 100vw&quot; width=&quot;960&quot; height=&quot;458&quot; alt=&quot;MATLAB plot titled “Linear Simulation Results”: amplitude against time from 0 to 1 second, a steady oscillation whose peaks settle at about 2.4 after the first tenth of a second, with troughs near −1.&quot; loading=&quot;lazy&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;figcaption&gt;&lt;span class=&quot;fig-label&quot;&gt;Figure 5&lt;/span&gt;Sample Model Response to Pump Input (30% Pulse at 30 Hz)&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;At this flow gain setting, it is apparent that after about a tenth of a second, the peak flow gains stabilize to around 2.4. Lets try a different setting with equal flow (10% pulse width at 90 Hz):&lt;/p&gt;
&lt;figure class=&quot;fig&quot;&gt;&lt;div class=&quot;fig-mat&quot;&gt;&lt;a class=&quot;fig-full&quot; href=&quot;/writing/variable-displacement-pump/fig-06.png&quot;&gt;&lt;img src=&quot;https://leopinero.com/processed_images/fig-06.13f98dcc08b0cc7d.png&quot; srcset=&quot;https://leopinero.com/processed_images/fig-06.0228d8636f49f2d7.png 480w, https://leopinero.com/processed_images/fig-06.13f98dcc08b0cc7d.png 960w&quot; sizes=&quot;(min-width: 40em) 36rem, 100vw&quot; width=&quot;960&quot; height=&quot;458&quot; alt=&quot;MATLAB plot titled “Linear Simulation Results”: amplitude against time from 0 to 1 second, a dense oscillation peaking at about 0.5 and dipping to about −0.3, in front of the grey pulse train that reaches 1.&quot; loading=&quot;lazy&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;figcaption&gt;&lt;span class=&quot;fig-label&quot;&gt;Figure 6&lt;/span&gt;Sample Model Response to Pump Input (10% Pulse at 90 Hz)&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;The flow settings have an effect on flow gains. In fact, here we have a flow gain of less than one, which is not optimal. As mentioned, after data from lsim() is taken, a data reduction script determines the peak flow gain. In this way, the function takes the unknown system response to pulse train settings as an input, and outputs the peak response. This process is the main function used in the logic script, called as ControlledPulse(fQa, Kw, sys). Clearly, it would be best to experimentally determine the steady-state flow gain for a range of pulse train settings. This is the first step for the proposed logic. This is analogous to an operator learning about the unknown system by checking a variety of pump-generated pulse train widths and frequencies. The data for such a test is shown below, quickly utilizing the simulation function described above. A frequency range of 0–200 Hz is selected, with up to 50% pulse width in steps of 10%.&lt;/p&gt;
&lt;figure class=&quot;fig&quot;&gt;&lt;div class=&quot;fig-mat&quot;&gt;&lt;a class=&quot;fig-full&quot; href=&quot;/writing/variable-displacement-pump/fig-07.png&quot;&gt;&lt;img src=&quot;https://leopinero.com/processed_images/fig-07.5e3b27f2d810ee93.png&quot; srcset=&quot;https://leopinero.com/processed_images/fig-07.7d969fea8b3181c2.png 480w, https://leopinero.com/processed_images/fig-07.5e3b27f2d810ee93.png 960w&quot; sizes=&quot;(min-width: 40em) 36rem, 100vw&quot; width=&quot;960&quot; height=&quot;477&quot; alt=&quot;MATLAB plot titled “Frequency Response of Flow Gain for Various Pulse Widths”: peak flow gain (Qe/Qa) against pulse train frequency from 0 to 200 Hz, one curve each for pulse widths of 10% to 50% of the pulse period. Every curve peaks near 32 Hz and again near 98 Hz; the 50% curve is highest, at about 2.6 and 2.25.&quot; loading=&quot;lazy&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;figcaption&gt;&lt;span class=&quot;fig-label&quot;&gt;Figure 7&lt;/span&gt;System Response to Different Pulse Train Settings&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;These results are validated by the comments in Dr. Hullenders paper, which mentioned that increasing pulse width to 50% will increase flow gains by 25% to about 2.5. Of course, an automated control system will run through all these pump settings quickly and determine the global maxima. This is an important first step so that the logic knows where to go from the collected data. The settings with the largest flow gains are selected, and the response is measured at this optimal setting with two other values slightly above and below the optimal frequency. Measuring these three values is necessary so that the logic can adapt to a changing system. Since the peak value was selected, at first, the two surrounding frequency flow gain values should be below that of the middle optimal frequency. However, if a changing system were to make one of the outer frequencies larger, that frequency becomes the new optimal frequency setting, with its own two surrounding probing frequencies. This physically translates to the pump oscillating slightly around the optimal frequency, with the ability to have a sense of which direction it needs to go because of this consistent probing. In this way, the pump is automatically able to follow a moving resonant peak.&lt;/p&gt;
&lt;h2 id=&quot;4-simulating-a-changing-system&quot;&gt;4 Simulating a Changing System&lt;/h2&gt;
&lt;p&gt;The logic will be demonstrated by introducing a 2nd-order system with a clear resonant peak changing with time. The unknown frequency response plot of the system as it changes is plotted.&lt;/p&gt;
&lt;figure class=&quot;fig&quot;&gt;&lt;div class=&quot;fig-mat&quot;&gt;&lt;a class=&quot;fig-full&quot; href=&quot;/writing/variable-displacement-pump/fig-08.png&quot;&gt;&lt;img src=&quot;https://leopinero.com/processed_images/fig-08.597cb2b8748af8e1.png&quot; srcset=&quot;https://leopinero.com/processed_images/fig-08.b796ac9330699a87.png 480w, https://leopinero.com/processed_images/fig-08.597cb2b8748af8e1.png 960w&quot; sizes=&quot;(min-width: 40em) 36rem, 100vw&quot; width=&quot;960&quot; height=&quot;720&quot; alt=&quot;MATLAB Bode diagram of the changing system at t = 0, 10 and 20 seconds, magnitude and phase against frequency from 1 to 100 rad/s. Each curve has one resonant peak near −15 dB, which moves from about 6 to about 11 rad/s as time goes on.&quot; loading=&quot;lazy&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;figcaption&gt;&lt;span class=&quot;fig-label&quot;&gt;Figure 8&lt;/span&gt;Bode Plot of Unknown Time-Variant System&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;For simplicity of visualization, the pulse width setting will be fixed at 50% based on an assumption from previous testing that this will yield the highest flow gains. To show how each system will respond to different pulse frequencies, the response plots for each system state are shown.&lt;/p&gt;
&lt;figure class=&quot;fig&quot;&gt;&lt;div class=&quot;fig-mat&quot;&gt;&lt;a class=&quot;fig-full&quot; href=&quot;/writing/variable-displacement-pump/fig-09.png&quot;&gt;&lt;img src=&quot;https://leopinero.com/processed_images/fig-09.39a8d944e4eae953.png&quot; srcset=&quot;https://leopinero.com/processed_images/fig-09.e8b865ceb1fb9caf.png 480w, https://leopinero.com/processed_images/fig-09.39a8d944e4eae953.png 960w&quot; sizes=&quot;(min-width: 40em) 36rem, 100vw&quot; width=&quot;960&quot; height=&quot;364&quot; alt=&quot;MATLAB plot titled “Pulse Frequency Response of Flow Gain with a Changing System”: peak flow gain (Qe/Qa) against pulse train frequency from 0 to 10 Hz for the system at t = 0, 10 and 20 seconds. Each curve has a sharp peak of about 0.11, at about 1.0, 1.4 and 1.7 Hz respectively.&quot; loading=&quot;lazy&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;figcaption&gt;&lt;span class=&quot;fig-label&quot;&gt;Figure 9&lt;/span&gt;Unknown Time-Variant System Response to Different Pulse Train Settings&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;From this plot, it is shown that the resonant frequency for this system is increasing. Now the logic should follow this change. For the simulation, a history vector of the optimal frequency will be taken.&lt;/p&gt;
&lt;figure class=&quot;fig&quot;&gt;&lt;div class=&quot;fig-mat&quot;&gt;&lt;a class=&quot;fig-full&quot; href=&quot;/writing/variable-displacement-pump/fig-10.png&quot;&gt;&lt;img src=&quot;https://leopinero.com/processed_images/fig-10.d09d411c49596490.png&quot; srcset=&quot;https://leopinero.com/processed_images/fig-10.80f702b4ad04fd9a.png 480w, https://leopinero.com/processed_images/fig-10.d09d411c49596490.png 960w&quot; sizes=&quot;(min-width: 40em) 36rem, 100vw&quot; width=&quot;960&quot; height=&quot;720&quot; alt=&quot;MATLAB plot titled “Determined Optimal Frequency for Evolving System”: determined optimal frequency in Hz against time normalized with sample rate from 0 to 300. The line is a staircase: 1.0 Hz until about 100, then about 1.4 Hz, then about 1.7 Hz from about 200.&quot; loading=&quot;lazy&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;figcaption&gt;&lt;span class=&quot;fig-label&quot;&gt;Figure 10&lt;/span&gt;Pump Frequencies Adapting to Match Resonant Peak of Time-Variant System&lt;/figcaption&gt;&lt;/figure&gt;
&lt;p&gt;As expected, the change in determined optimal frequencies match the unknown resonant frequencies of the changing system. While the system is constant, the best frequency holds steady because both of the probes cannot find a better flow gain response, so the best frequency holds its status. Notice how there is a slight time delay for the logic to reach this steady state. This is dependent on how aggressive the probes are set to be. That is, how far away from the current frequency are they willing to check? This time should be assumed negligible if the changes are gradual instead of abrupt, as shown in this simulation.&lt;/p&gt;
&lt;h2 id=&quot;5-conclusion&quot;&gt;5 Conclusion&lt;/h2&gt;
&lt;p&gt;The goal of this design was to implement logic-control on a variable displacement pump to maintain resonance to a changing system. It was designed and built around a sample static 4th-order system to test methods and was then simulated on a changing 2nd-order system. The logic implementation was successful, as the controlled pump was able to track the changing resonance frequencies and adapted its pulse train to maximize flow gains. Performance of this system can be improved by updating the scanning range as a function of the magnitude of the difference between the optimal and probe frequency. In this way, the logic-controlled pump can adapt more cautiously or aggressively depending on the severity of the temporary error of input frequency and true optimal frequency.&lt;/p&gt;
&lt;h2 id=&quot;6-references&quot;&gt;6 References&lt;/h2&gt;
&lt;ol class=&quot;references&quot;&gt;
&lt;li id=&quot;ref-1&quot;&gt;&lt;span class=&quot;n&quot;&gt;[1]&lt;/span&gt;&lt;span&gt;Hullender, David A.; Snyder, Natalie N.; Gans, Jan C. Application of a Linear Model for Simulating Hydraulic Systems Containing Internal Lines with Turbulent Flow. 2017, Oct. 16 -17. ASME Symposium on Fluid Power and Motion Control, FPMC2017–4202.&lt;/span&gt;&lt;/li&gt;
&lt;/ol&gt;
</content>
        
    </entry>
</feed>
