Table of contents
From Industry to Web3: The Role of PID Controllers in Cryptocurrency Stability and Automation
In the article, we’ll show you how we used the PID controller to achieve:
Dynamic Vesting Optimization, which enabled a 50% increase in token price by precisely adjusting variable values for dynamic vesting—achieving results that would be nearly impossible to reach manually.
Balanced Token Distribution, where we maintained creators at 10% of the user base by fine-tuning parameters to effectively meet the project’s distribution goals.
Article Overview
This article provides an overview of the PID controller’s functionality and explores its potential applications in the Web3 and cryptocurrency space. In our daily work with client simulations, our team leveraged its technical expertise to unlock entirely new potentials for this well-known tool. The result is an innovative approach to PID controllers. We adapted their classic functionality to address the unique challenges in decentralized systems.
We’ll begin by explaining what a PID controller is and highlighting its classic applications. As a longstanding tool in industrial automation, the PID controller has earned broad applicability. It is especially valued for its precise management of target values in dynamic systems. Designed with three key components—proportional, integral, and derivative—the PID controller responds to real-time changes. It specializes in stabilizing parameters such as temperature, pressure, and speed. This versatility has made it essential in industries requiring fine-tuned control over production and regulatory processes.
Next, we’ll explore how this tool can be adapted for Web3 environments, especially within decentralized systems and cryptocurrencies. We will look at sector-specific applications of a PID controller. It can automate regulation of parameters like liquidity, interest rates, token prices, or reward distribution in simulations or live projects.
Finally, we’ll present practical applications of the PID controller from our experience. In simulations conducted for our clients, we successfully leveraged the PID controller to achieve measurable results. We use it primarily in cryptocurrency ecosystems and decentralized autonomous organizations (DAOs).
Dynamic Vesting:
By utilizing a PID controller, we identified optimal variable values for dynamic vesting. The result was a 50% increase in the token price. Given the vast number of variables, this process would have been highly challenging to execute manually. However, the PID controller accurately pinpointed the parameters needed to reach the desired increase.
Token Distribution Balance:
Our task was to ensure that creators consistently reached 10% of the total user base. The PID controller helped establish optimal token distribution values across all analyzed scenarios. This use of PID allowed for iterative parameter adjustments across different cases, ensuring a balanced ratio of creators to other users that aligned with the project’s objectives.
Both cases will be explained in more detail below once you understand the full principles of the PID controller’s operation.
Introduction to the PID Controller and Its Classic Applications
The PID controller is one of the most commonly used tools in automation, valued for its ability to precisely control a wide range of process parameters. Its design enables real-time adjustments to system settings, ensuring that desired values are consistently maintained.
What is a PID controller?
A PID controller is a device that helps maintain specific values, such as temperature or speed. It keeps them at a predetermined target, or “setpoint.” It operates by continuously gathering data from sensors that measure the current state of these values. The controller then compares this measurement with the target value, calculating the difference—referred to as the “error.” Based on this error, the PID controller makes calculated adjustments to the system’s parameters, working dynamically to bring the value closer to the target.
An example:
In precise temperature management, like in industrial furnaces or boilers, the PID controller monitors the temperature. It compares the current temperature to the target setpoint required for the process. If there’s a deviation, the PID adjusts the energy supplied to the furnace. This allows the desired temperature to be reached quickly without causing oscillations.
Preliminary concepts
To understand how a PID system works and regulates a process, it’s essential to become familiar with some basic concepts central to its operation. Terms like rise time, final value, setpoint, and steady-state error are fundamental in analyzing how a PID controller responds to deviations and works to stabilize the system. Familiarity with these terms allows for a clearer assessment of the PID’s effectiveness and its capacity to accurately reach target values.
Rise time – the amount of time the system needs to go from 10% to 90% of the steady or final value.
In the Web3 sphere, rise time could refer to the speed at which liquidity levels in a DeFi protocol stabilize after a sudden market shift.
Final value – the ultimate value of the PID controller’s output signal that the system reaches after completing the regulatory processes.
In the Web3 sphere, the final value can represent the returns in staking protocols.
Setpoint – the target value that the system aims to achieve and maintain.
In the Web3 sphere, the setpoint can represent the desired liquidity level in a pool on a decentralized exchange.
Steady-state error is the difference between the actual value and the setpoint. It indicates how much the system deviates from the desired level.
In the Web3 sphere, the error can reflect the difference between the current and target token price.
Components of the PID controller
The PID controller derives its name from its three fundamental components: Proportional (P), Integral (I), and Derivative (D). Each component contributes a unique corrective action, working together to provide an “optimal” response to system deviations. By combining these elements, the PID controller achieves a balanced response, as each component addresses a different aspect of error correction.
Proportional component (P)
The proportional component (P) responds to the current error—the difference between the actual and target values. The larger the error, the stronger the proportional response, making this component effective for rapid adjustments to changes. However, the proportional component alone may not fully eliminate the error, as it only responds to the immediate discrepancy.
The chart below illustrates the differences between various values of the P component.
Source: https://www.azooptics.com/Article.aspx?ArticleID=2454
Integral component (I)
The integral component (I) accounts for the accumulated effect of past errors. It gradually increases or decreases the correction until the difference between the actual and target values is minimized. This helps eliminate steady-state error, allowing the system to reach the target value precisely. However, it can also introduce overshoot if not properly balanced with the other components.
The chart below illustrates the differences between various values of the I component.
Source: https://www.azooptics.com/Article.aspx?ArticleID=2454
Derivative component (D)
The derivative component (D) anticipates future deviations by responding to the rate of change in error, helping to smoothen the approach to the setpoint. By dampening rapid changes, the derivative action stabilizes the system and prevents excessive oscillations, enhancing the system’s ability to reach the target smoothly.
The chart below illustrates the differences between various values of the D component.
Source: https://www.azooptics.com/Article.aspx?ArticleID=2454
Summary of the properties of P-I-D parameters:
Parameter | Rise time | Overshoot | Settling time | Steady-state error | Stability |
P (Proportional) | decrease | increase | low impact | decrease | deterioration |
I (Integral) | decrease | increase | increase | significant decrease | deterioration |
D (Derivative) | low decrease | low decrease | low decrease | ineffectively | improve |
Each component is crucial in how the PID controller fine-tunes system performance. It balances quick responses with stability and accuracy.
Other useful controllers
Apart from the classic PID controller, there are other widely-used variants based on the P, I, and D components. It also includes the PI and PD controllers, as well as the fuzzy controller.
- PI Controller: The PI controller combines the proportional (P) and integral (I) components. The proportional part quickly responds to the current deviation from the target. The integral part addresses accumulated past errors. Together, they help reduce long-term error and reach the target more accurately. This makes the PI controller ideal for systems needing stability and minimal sustained deviations.
- PD Controller: The PD controller includes the proportional (P) and derivative (D) components. The proportional part responds to the current error. The derivative part reacts to the rate of change in error, predicting future deviations. This setup provides a quick response with enhanced stability, limiting abrupt changes. The PD controller is ideal for systems needing precise regulation in dynamic conditions.
- Fuzzy Controller: Based on fuzzy logic, the fuzzy controller doesn’t rely on exact error values. Instead, it operates using general rules, such as “if the error is large, apply a stronger correction.” This flexibility makes the fuzzy controller well-suited for systems where defining regulatory rules mathematically is challenging or where conditions are highly variable.
Source: https://www.researchgate.net/figure/Membership-functions-for-s_fig1_275241197
Example appearance of a fuzzy controller. As the error increases, we enter zones with larger regulatory settings.
Two approaches to tuning the PID Controller
Tuning the PID controller is essential for customizing its response to a system’s specific requirements. This process ensures the controller reaches the setpoint quickly with minimal deviation, avoiding excessive oscillations. By carefully adjusting the proportional (P), integral (I), and derivative (D) settings, the controller can operate stably and efficiently. It enhances both precision and stability of the process.
Classical PID tuning methods – Ziegler-Nichols
The Ziegler-Nichols method is a popular PID tuning technique that allows for quickly setting initial parameter values. The tuning process involves:
- Setting the I and D parameters to zero, so the controller operates as a simple proportional (P) controller,
- Gradually increasing the proportional setting (P) until the system begins to oscillate continuously, reaching the so-called critical point (where oscillations are stable but not dampened),
- Recording the critical gain (Kp) and the critical oscillation period (Tu) – the time between successive peaks of oscillation,
- Using the recorded Kp and Tu values to set the PID parameters with the Ziegler-Nichols table, which suggests values for each setting (P, I, and D) based on the controller type (P, PI, PID).
This method provides quick initial settings, though it may lead to oscillations, making it often a starting point for further adjustments.
Controller | Kp | Ti | Td |
P | 0.5Ku | ||
PI | 0.4Ku | 0.8Tu | |
PID | 0.6Ku | 0.5Tu | 0.12Tu |
Table Zieglera-Nicholsa
Automatic tuning algorithms
Automatic PID tuning methods streamline the selection of optimal controller parameters, eliminating the need for manual adjustments. Autotuning tools in MATLAB and Python libraries, which we commonly use, are especially important in complex systems with numerous variables. These tools automatically test and compare parameter combinations to find the most effective settings. It makes tuning faster, more efficient, and highly precise. This approach is extremely helpful when manual testing would be too time-consuming or impractical due to system complexity.
Depending on the intended application, tuning priorities may vary. For example, in a DeFi context, PID tuning might focus on optimizing liquidity to maintain stable market conditions, minimizing risk and transaction costs. In DAOs, tuning might aim to balance extreme values, such as the maximum votes per user, to prevent centralization and ensure fair decision-making.
Application of PID in Web3
While the PID controller is commonly used in traditional automation systems, its principles extend well beyond industrial applications. In fact, the basic rules governing PID controllers—such as iterative adjustments to approach target values—are essential in building and validating tokenomics frameworks. Recognizing the power of these established mechanisms, we’ve adapted the same principles to optimize economic models within the Web3 space.
In simulation systems, the PID controller helps reach target values accurately, even in complex and changing environments. Its step-by-step adjustments make it especially useful for improving control in decentralized finance projects, like managing liquidity or organizing governance in DAOs. By applying these familiar principles to Web3, we can bring greater precision and stability to economic models in decentralized systems.
Iterative optimization in simulated crypto systems
In cryptocurrency, the PID controller is a powerful simulation tool. It enables adaptive, iterative adjustments. These adjustments help stabilize and optimize key processes. Examples include liquidity management, token price stabilization, and yield optimization.The PID controller continuously analyzes the gap between actual and target values. Examples include a stablecoin’s price or pool liquidity. It calculates precise adjustments in each simulation cycle. This structured process reduces deviations across the system. Gradually, it brings the simulation closer to stability and the desired outcome.
The adaptive design of the PID controller allows it to meet the unique demands of various cryptocurrency scenarios within simulations. For instance, stabilizing a volatile token may call for rapid adjustments, while managing liquidity in a large pool may require a more gradual approach. This flexibility lets the PID controller adapt effectively to the specific requirements of each simulation, regardless of changing market variables or protocol characteristics. With its iterative approach, the PID controller can continuously fine-tune parameters, resulting in precise and stable outcomes in dynamic, simulated cryptocurrency ecosystems.
Example of the iterative process in a PID-controlled simulation
In the displayed GIF, the system iteratively adjusts a variable, `poaps_rewards_per_user. The first line shows the current variable value, and the second line illustrates the system’s response to it. The PID controller then calculates the difference between the target (set point) and the obtained value, generating a new variable value based on this error, shown in the third line. This updated value becomes the input for the next iteration, and the cycle repeats until the target is achieved.
Added values achieved through the use of the PID controller in simulations
Enhanced Stability and Precise Control:
By maintaining parameters consistently at set levels, the PID controller ensures stability and control accuracy, even in highly dynamic simulation environments.
Improved Simulation Performance:
Quick corrective actions help maintain a smooth and uninterrupted simulation flow, reducing delays and optimizing resource use.
Optimized Decision-Making Processes:
Automated, data-driven adjustments support real-time decision-making, allowing simulations to adapt swiftly to changes in input or system conditions.
Versatile Application Across Simulations:
With its adaptable design, the PID controller is applicable to a wide range of simulation types and environmental conditions, making it highly flexible for various use cases.
Minimized Errors and Reduced Deviations:
The PID controller’s continuous adjustments help to limit significant deviations, maintaining the simulation’s accuracy and reducing error margins.
Ease of Implementation and Simple Tuning:
Known for its straightforward setup and tuning, the PID controller is relatively easy to implement. This makes it an accessible choice for managing complex systems.
Precise Management of Critical Parameters:
Key parameters are managed with high precision, allowing for optimal control and adjustment within the simulation.
Reliable Analysis and Reporting:
Consistent and stable results from PID-controlled simulations support accurate analysis and reporting, making data insights more trustworthy.
Automated Response to Real-Time Changes:
By adjusting system parameters automatically in response to changing conditions, the PID controller maintains stability without manual intervention.
Effective Support for Large-Scale, Complex Systems:
With its robust handling of multiple variables, the PID controller is well-suited to manage and stabilize complex, large-scale environments.
Accelerated Testing Across Scenarios:
The controller’s adaptability allows for rapid testing of various scenarios, enhancing the speed and efficiency of the testing process.
PID and the high-volume, dynamic data in live Web3 projects
The PID controller excels at handling large amounts of quickly changing data. This makes it ideal for optimizing live projects in the fast-moving cryptocurrency world. In Web3, complex systems like DeFi platforms or decentralized exchanges have many interconnected variables that affect stability and efficiency. The PID controller reaches target values accurately by adjusting parameters based on system-wide results. For example, in stabilizing protocol fees, PID compares current and target values, then adjusts variables like the minimum or maximum number of transactions at specific fee levels.
This allows PID to maintain stability even when market variables are constantly changing and interacting. This is common in crypto systems. PID’s iterative adjustments enable a continuous approach toward target parameters, despite complex dependencies within the system. This approach not only enhances regulatory precision but also allows for greater flexibility. It is extremely crucial for building resilient and volatility-resistant cryptocurrency protocols.
Because of this dynamic control, PID is not only useful in simulations but also highly effective in real-world applications. Its real-time parameter tuning helps mitigate sudden market changes, enabling the system to respond quickly and maintain stability. In a constantly shifting crypto environment, this adaptability builds user trust and reinforces the platform’s reliability.
An example chart illustrating the precise achievement of the setpoint value.
Applications of PID controllers in the cryptocurrency industry
The PID controller is widely used in the cryptocurrency sector. It plays a crucial role in stabilizing and optimizing key parameters in dynamic systems like DAOs, DeFi, insurance, and lending platforms. Its mechanisms allow precise control over liquidity, rewards, interest rates, and token distribution. This ultimately enhances the efficiency and security of these solutions.
DAO Applications
- PID controllers can help maintain consistent member activity levels by monitoring engagement and adjusting incentives or requirements based on community participation.
- For voting processes, PID can dynamically adjust the voting power of DAO members, taking into account factors like activity, reputation, or length of involvement within the organization.
- In compensation management, PID can automatically adjust salaries or bonuses for DAO members according to the organization’s financial performance and available budget.
- PID controllers can regulate reward and token distribution rates by adjusting bonuses, tokens, or commissions based on current market conditions and participant engagement levels.
- To manage financial reserves, PID controllers can ensure optimal reserve levels, adjusting them to meet present and future needs, thereby providing a safeguard against unforeseen events.
DeFi Applications
- In liquidity management, PID controllers can dynamically adjust the capital in liquidity pools to respond to market demand and liquidity levels, which helps maintain adequate capital levels and minimize slippage.
- For stablecoin price stabilization, PID controllers can regulate the supply of stablecoins to maintain their value close to a target rate, such as 1 USD, in response to fluctuations in market demand and supply.
- PID controllers can stabilize staking returns by adjusting reward rates in staking protocols, responding to changes in the number of participants and the demand for staking.
- In transaction fee management, PID controllers can adjust fees on DeFi platforms according to network capacity and user demand, optimizing costs for users and revenue for the platform.
Insurance Applications
- PID controllers can support collateral management by dynamically adjusting required collateral levels based on market volatility, which helps minimize insolvency risks and ensures platform stability.
Lending Applications
- In lending protocols, PID controllers can optimize interest rates by automatically adjusting them according to loan supply and demand, balancing borrower and lender needs and maximizing capital efficiency.
- For liquidation mechanisms, PID controllers can automate asset liquidation thresholds based on current collateral value and market volatility, preventing unnecessary liquidations and protecting users from sudden losses.
Limitations of PID in Nonlinear Control Systems
In complex cryptocurrency systems characterized by nonlinearity, control structures pose a significant challenge in achieving precise setpoint values. In such nonlinear systems, even minor parameter adjustments can lead to disproportionately large shifts in outcomes, making it difficult to reach target values accurately. As a result, the system may oscillate around the desired outcome rather than steadily converging toward it, thereby limiting both accuracy and control over the process.
The more complex and dynamic a crypto system becomes, the greater the risk of oscillations that can affect protocol stability or token values. These oscillations can be particularly challenging to eliminate when different system variables interact in unpredictable ways. In such cases, the PID controller may continue oscillating indefinitely without reaching a stable outcome, especially in highly nonlinear or unstable environments. This makes controlling result consistency essential, as nonlinearity can lead to operational instability and deviations from expected values.
An example chart illustrating the oscillatory nature of PID control.
Due to the specific nature of such systems, achieving precise values would also be impossible with other computational methods. In these situations, reaching an exact value may not be feasible. However, using PID controllers allows us to estimate a range of values that still hold significant value for the project.
Practical examples of PID Controller applications in Tokenomics validation
As specialists in tokenomics design and validation through simulation, we have extensive experience in parameter optimization. Using the PID controller has significantly streamlined this process, allowing us to more efficiently determine whether a specific parameter can be set to a desired target value or to identify optimal values for key variables. The precise control provided by PID enables targeted adjustments, making it easier to confirm that the system can achieve the expected parameters.
Increase in Token Price by an Average of 50% Using PID-Controlled Dynamic Vesting
In one system, we implemented two vesting methods: static and dynamic. Vesting is the process of gradually releasing tokens over time. In the dynamic vesting approach, the rate of token release depended on the volume generated on the platform. This volume was tied to a “release rate” parameter, which represented a multiple of the base value in the simulation (e.g., if a release rate of 1 corresponded to a volume of $120 million, a release rate of 2 indicated a volume of $240 million).
The PID controller’s task was to adjust the release rate to ensure that, in the dynamic vesting simulation, the token price met or exceeded the average price of all scenarios for that particular case. For key scenarios, we successfully identified a single global release rate value that met the requirements across all simulations.
In this way, we obtained the following “release_rate” values for the examined scenarios:
Scenarios | The value for release_rate | Cumulative volume to release all tokens |
12018 | 1.1493 | $137 916 000 |
12033 | 1.8845 | $226 140 000 |
12046 | 2.9417 | $353 004 000 |
12051 | 0.7588 | $91 056 000 |
12127 | 1.5275 | $183 300 000 |
12135 | 5.1791 | $621 492 000 |
Based on the results, a “release_rate” parameter value of 5.1791 was selected. After setting the new value, re-simulations were conducted, yielding updated token price values. Below is a chart showing the average percentage difference in token price between static and dynamic vesting with the release_rate set to 5.1791.
The chart shows that the average token price over the entire period for dynamic vesting was 50.54% higher than for static vesting.
In this way, the PID controller, using scenario 12046 as an example, determined the target value of the release_rate variable to be 2.9417.
Regulation Process – Scenario 1xx127 | |
Release Rate during regulation | Average Token Price during regulation |
Through the use of the PID controller, we successfully identified optimal variable values for dynamic vesting that resulted in a 50% increase in token price. In this scenario, the token release rate depended on platform-generated volume, a parameter that fluctuated based on user activity. With vast amounts of data to process, manual calculation would have been impractical and error-prone. The PID controller, however, efficiently analyzed real-time data, adjusting the release rate in each cycle to keep the token price aligned with target values. By iterating through simulations, PID identified release rate values that met all scenario requirements. This resulted in a significant boost in token price without the need for manual intervention.
Achieving a Creator-to-User Ratio of 10% in a DAO Project
In another project, a critical goal was to reach a Creator participation level of 10% relative to all users. Users could attain “Creator” status upon surpassing a specific token allocation threshold in the system. Our aim was for Creators to constitute 10% of the user base by the end of 100 simulation steps (equivalent to 100 months). To achieve this, we needed to determine the optimal token distribution strategy.
Below are the results we obtained using the PID controller:
Due to a highly sensitive and unstable system, the result oscillates around the target value, as you will learn more about in the section “Limitations due to the nonlinearity of control systems”.
Thanks to the PID controller, we were able to accurately set token distribution parameters across multiple scenarios to maintain a consistent ratio of Creators within the DAO community. With so many scenarios and variables in play, manually adjusting parameters to achieve this balance would have been highly challenging, but the PID controller handled it efficiently, automating the process and ensuring precision.
Conclusion
The PID controller, widely known for industrial applications, is also a powerful tool in the Web3 environment. Precise control and stable parameters are crucial for Web3 systems to operate effectively. In the cryptocurrency ecosystem, PID helps manage liquidity, stabilize prices, and automate processes. This leads to faster and more accurate achievement of target values, even in complex and shifting conditions. With PID, platforms like DeFi, DAOs, and lending systems can be managed with higher precision. They also become more resilient to disruptions, ensuring smoother and more reliable performance.
The application of PID mechanisms enables us to find optimal parameters more quickly and accurately, which would often be impossible with manual adjustments. Bringing proven solutions from other industries to Web3 adds value for clients and users, making systems more stable, secure, and efficient. Thanks to PID, cryptocurrency systems cope better with dynamic market changes, offering greater reliability and higher operational quality.
Let's Collaborate
Whether you have questions, collaboration ideas, or just want to say hello, we're here and ready to connect. Your inquiries are important to us, and we look forward to engaging in meaningful conversations.