{
  "id": "bang-bang-control",
  "title": "Bang–Bang Control",
  "lang": "en",
  "source_lang": "en",
  "summary": "Bang–bang control switches a control input between its extreme values, providing simple on–off regulation and, under suitable conditions, time-optimal motion.",
  "category": "technology",
  "subcategory": "engineering",
  "type": "concept",
  "aliases": [
    "Bang-bang control",
    "On–off control",
    "Two-position control",
    "Relay control"
  ],
  "generated_at": "2026-11-05",
  "model": "pro/gpt-6.1-sol",
  "url": "https://aiwiki.page/en/bang-bang-control/",
  "translations": {
    "zh-Hans": {
      "url": "https://aiwiki.page/zh/bang-bang-control/",
      "json": "https://aiwiki.page/zh/bang-bang-control.json"
    }
  },
  "sections": [
    {
      "heading": "",
      "text": "Bang–bang control is a method in control theory in which a control input switches between two extreme values rather than varying continuously over an intermediate range. A heater that is either fully on or off is a familiar example; a motor commanded to apply either maximum positive or maximum negative torque is another. The term covers both simple switching regulators and certain solutions to optimal control problems. These uses share a two-level input structure, but a practical on–off controller is not necessarily optimal."
    },
    {
      "heading": "Operating principle",
      "text": "A controller selects one of two input values according to a measured error, a switching rule, or a precomputed schedule. For a regulated quantity \\(y(t)\\) with desired value \\(r(t)\\), define the error as\n\n\\[e(t)=r(t)-y(t).\\]\n\nFor a system in which increasing the input increases the regulated quantity, an ideal two-position rule is\n\n\\[u(t)= \\begin{cases} u_{\\max}, & e(t)>0,\\\\ u_{\\min}, & e(t)<0. \\end{cases}\\]\n\nThe behavior at \\(e=0\\) must be specified separately, for example by retaining the previous command. The two values need not be equal and opposite: a heater may use \\(u_{\\min}=0\\) and \\(u_{\\max}=P\\), whereas a reversible drive may use \\(-U\\) and \\(+U\\).\n\nIn a feedback implementation, a sensor measures the output, a switching element selects the command, and an actuator applies it. Although the command has only two values, the controlled quantity usually changes continuously because the physical system stores heat, momentum, electrical energy, or material.\n\nThe switching decision need not depend only on output error. It may depend on several state variables, such as position and velocity, or on elapsed time. Consequently, bang–bang control can be a simple form of negative feedback, a more elaborate state-feedback law, or an open-loop sequence."
    },
    {
      "heading": "On–off regulation and hysteresis",
      "text": "A thermostat illustrates practical on–off regulation. A heater turns on when the temperature falls sufficiently below the setpoint and turns off when it rises sufficiently above it. Separate thresholds introduce hysteresis: the command between the thresholds depends on the previous switching state.\n\nFor lower and upper thresholds \\(T_{\\mathrm{low}}\\) and \\(T_{\\mathrm{high}}\\),\n\n\\[u(t)= \\begin{cases} u_{\\max}, & T(t)\\leq T_{\\mathrm{low}},\\\\ u_{\\min}, & T(t)\\geq T_{\\mathrm{high}},\\\\ u(t^-), & T_{\\mathrm{low}}<T(t)<T_{\\mathrm{high}}, \\end{cases}\\]\n\nwhere \\(u(t^-)\\) denotes the command immediately before the current instant.\n\nThe hysteresis width is\n\n\\[\\Delta T=T_{\\mathrm{high}}-T_{\\mathrm{low}}.\\]\n\nThis band prevents small measurement fluctuations near a single threshold from repeatedly reversing the command. A wider band generally permits greater variation in the controlled quantity while reducing switching frequency, although the actual cycle also depends on the system dynamics and disturbances.\n\nA hysteresis band is not the same as a dead zone. Within a hysteresis band, the controller retains its previous state; within a dead zone, a controller may instead prescribe a neutral or zero output.\n\nWith persistent heat loss, a thermostatically controlled heater often produces a repeating cycle rather than exact convergence to one temperature. Such behavior can form a limit cycle. Thermal inertia and transport delay may cause the temperature to continue rising after the heater switches off or falling after it switches on, so the actual temperature range can extend beyond the switching thresholds."
    },
    {
      "heading": "Bang–bang control in optimization",
      "text": "Bang–bang control also arises when an objective favors using the greatest available control authority. The best-known example is minimum-time motion: an actuator accelerates as strongly as possible, then reverses as strongly as possible to meet a terminal condition.\n\nThe mathematical basis is associated with Pontryagin’s maximum principle, developed in the mid-twentieth century. Consider a control-affine system,\n\n\\[\\dot{x}=f(x,t)+g(x,t)u, \\qquad u_{\\min}\\leq u\\leq u_{\\max}.\\]\n\nUsing a convention in which the Hamiltonian is minimized, suppose it has the form\n\n\\[H=H_0(x,\\lambda,t)+\\phi(x,\\lambda,t)u,\\]\n\nwhere \\(\\lambda\\) is the costate and \\(\\phi\\) is the switching function. Minimizing this expression over the permitted interval gives\n\n\\[u^*= \\begin{cases} u_{\\max}, & \\phi<0,\\\\ u_{\\min}, & \\phi>0. \\end{cases}\\]\n\nThus, when the Hamiltonian is affine in the input and the switching function is nonzero, the minimizing input lies at a bound.\n\nThis is not a universal proof that maximum effort is optimal. The maximum principle supplies necessary conditions under its assumptions; it does not by itself establish global optimality. Moreover:\n\n- If the switching function vanishes throughout an interval, a singular arc may occur, and additional conditions are needed to determine the input.\n- State constraints may require a boundary-following segment rather than a simple extreme-input segment.\n- Penalizing control effort, for example with a quadratic input cost, can produce intermediate optimal commands.\n- Actuator dynamics or limits on the rate of input change can prevent instantaneous switching.\n\nThe objective and constraints therefore determine whether a bang–bang solution exists and whether it is appropriate."
    },
    {
      "heading": "Example: minimum-time positioning",
      "text": "Consider an ideal point mass moving along a line with bounded acceleration:\n\n\\[\\dot{x}=v,\\qquad \\dot{v}=u,\\qquad |u|\\leq a,\\]\n\nwhere \\(a>0\\). The goal is to move from rest at \\(x=0\\) to rest at \\(x=d\\), with \\(d>0\\), in minimum time.\n\nThe optimal input is maximum positive acceleration followed by maximum negative acceleration:\n\n\\[u(t)= \\begin{cases} +a, & 0\\leq t<t_s,\\\\ -a, & t_s<t\\leq t_f. \\end{cases}\\]\n\nBecause the initial and final velocities are zero, the acceleration and braking intervals have equal duration. Therefore,\n\n\\[t_s=\\sqrt{\\frac{d}{a}}, \\qquad t_f=2\\sqrt{\\frac{d}{a}}, \\qquad v_{\\mathrm{peak}}=\\sqrt{ad}.\\]\n\nSwitching occurs halfway through the distance. This result assumes no velocity limit, no drag, instantaneous changes in acceleration, and exact knowledge of the motion. A velocity bound can introduce a constant-speed interval, producing a three-segment profile rather than a strictly two-level acceleration history.\n\nFor a target at \\(x=0,\\ v=0\\), the corresponding braking curve in the position–velocity plane is\n\n\\[x+\\frac{v|v|}{2a}=0.\\]\n\nAway from that curve, the ideal time-optimal feedback command is\n\n\\[u=-a\\,\\operatorname{sgn}\\!\\left(x+\\frac{v|v|}{2a}\\right).\\]\n\nOn the curve, the actuator brakes against the direction of motion until the target is reached. This example shows why switching only when position error changes sign is inadequate for fast positioning: braking must begin before arrival."
    },
    {
      "heading": "Applications and implementation",
      "text": "Two-position regulation is widely used where intermediate actuator settings are unavailable, costly, or unnecessary. Applications include heaters, simple refrigeration systems, pumps controlled by tank level, and pressure-maintaining equipment. In process control, the method is attractive when modest fluctuations around a target are acceptable.\n\nIn robotics and positioning systems, bang–bang trajectories provide idealized models for rapid movement under acceleration or torque bounds. Practical trajectories often smooth their transitions to accommodate structural flexibility, transmission loads, and limits on jerk, the rate of change of acceleration.\n\nSwitching methods also appear in power electronics. Hysteretic current control, for example, changes a converter’s switching state when current crosses prescribed bounds. However, a device being physically switched on and off does not automatically make its supervisory control law bang–bang.\n\nImplementations range from mechanical thermostats and electronic comparators to software in a programmable logic controller. Minimum on-times, minimum off-times, filtering, and interlocks often modify the ideal switching rule."
    },
    {
      "heading": "Relationship to other control methods",
      "text": "A PID controller normally computes a continuously varying command from proportional, integral, and derivative terms. Its output may reach an actuator limit during a large transient, temporarily resembling bang–bang action, but saturation does not make the underlying controller a two-position controller.\n\nPulse-width modulation switches hardware between discrete states while varying the fraction of each switching period spent in each state. This permits a continuously adjustable average input. In ordinary on–off regulation, switching events are instead directly triggered by thresholds. The methods can be combined, but they describe different aspects of control.\n\nSliding-mode control also commonly uses discontinuous commands. Its defining aim is to drive the state onto a selected surface and maintain motion along it. Bang–bang control describes the extreme-valued input structure and need not involve such a surface or the robustness properties associated with sliding-mode design."
    },
    {
      "heading": "Limitations and practical trade-offs",
      "text": "Switching wear and losses. Frequent operation wears mechanical contacts, valves, and compressors. Semiconductor switches avoid mechanical wear but incur switching losses and may generate electromagnetic interference.\n\nChattering. Noise, delays, and unmodeled dynamics can cause rapid repeated switching near a decision boundary. Hysteresis and timing restrictions can reduce this behavior, but they also alter tracking accuracy and response time.\n\nOvershoot and oscillation. Two-level commands do not inherently compensate for momentum or process delay. A switching rule based only on output error can produce substantial overshoot, especially in systems with multiple energy-storage elements.\n\nModel sensitivity. An open-loop time-optimal switching schedule depends on the assumed initial state and dynamics. Changes in load, friction, or available actuator force can shift the required braking point. Feedback can correct deviations, but it remains subject to measurement and actuation limits.\n\nObjective dependence. Minimum time, minimum energy consumption, low noise, smooth motion, and long component life are different objectives. Full actuation may minimize travel time in an ideal model while increasing losses, vibration, or wear in the real system."
    }
  ],
  "links": [
    "control-theory",
    "optimal-control",
    "sensor",
    "actuator",
    "negative-feedback",
    "temperature",
    "refrigeration",
    "process-control",
    "robotics",
    "power-electronics",
    "programmable-logic-controller",
    "pid-controller"
  ],
  "sources": [],
  "license": "https://creativecommons.org/licenses/by/4.0/"
}