API Reference

Application Layer

class pid_controllers.pidTool.app.PIDDesignerApp(out_dir=None)[source]

High-level orchestrator for PID design runs.

Parameters:

out_dir (str | None)

run(*, Gp, structure, req, grids, objective, weights, tfinal, dt, backend, plot_top, save_prefix, export_json, export_csv)[source]
Parameters:
  • Gp (TransferFunction)

  • structure (str)

  • req (Requirements)

  • grids (Dict[str, List[float]])

  • objective (str)

  • weights (Tuple[float, float, float, float])

  • tfinal (float | None)

  • dt (float | None)

  • backend (str)

  • plot_top (int)

  • save_prefix (str)

  • export_json (bool)

  • export_csv (bool)

Core Models and Utilities

class pid_controllers.pidTool.core.Candidate(params: 'Dict[str, float]', metrics: 'Metrics', obj: 'float', stable: 'bool', controller_str: 'str')[source]
Parameters:
  • params (Dict[str, float])

  • metrics (Metrics)

  • obj (float)

  • stable (bool)

  • controller_str (str)

controller_str: str
metrics: Metrics
obj: float
params: Dict[str, float]
stable: bool
class pid_controllers.pidTool.core.Metrics(overshoot: 'float', settling_time: 'float', rise_time: 'float', ess: 'float', itae: 'float', ise: 'float', tfinal_used: 'float')[source]
Parameters:
  • overshoot (float)

  • settling_time (float)

  • rise_time (float)

  • ess (float)

  • itae (float)

  • ise (float)

  • tfinal_used (float)

ess: float
ise: float
itae: float
overshoot: float
rise_time: float
settling_time: float
tfinal_used: float
class pid_controllers.pidTool.core.Requirements(max_overshoot: 'Optional[float]' = None, max_settling: 'Optional[float]' = None, max_rise: 'Optional[float]' = None, max_ess: 'Optional[float]' = None, settle_tol: 'float' = 0.02)[source]
Parameters:
  • max_overshoot (float | None)

  • max_settling (float | None)

  • max_rise (float | None)

  • max_ess (float | None)

  • settle_tol (float)

max_ess: float | None
max_overshoot: float | None
max_rise: float | None
max_settling: float | None
settle_tol: float
pid_controllers.pidTool.core.compute_metrics(sys_cl, tfinal=None, dt=None, settle_tol=0.02)[source]
Parameters:
  • sys_cl (TransferFunction)

  • tfinal (float | None)

  • dt (float | None)

  • settle_tol (float)

Return type:

Metrics

pid_controllers.pidTool.core.controller_tf(structure, pars)[source]
Parameters:
  • structure (str)

  • pars (Dict[str, float])

Return type:

TransferFunction

pid_controllers.pidTool.core.margins_report(L)[source]
Parameters:

L (TransferFunction)

Return type:

str

pid_controllers.pidTool.core.meets_requirements(m, r)[source]
Parameters:
Return type:

bool

pid_controllers.pidTool.core.objective_value(m, name, w_ts=1.0, w_mp=1.0, w_itae=1.0, w_ise=1.0)[source]
Parameters:
  • m (Metrics)

  • name (str)

  • w_ts (float)

  • w_mp (float)

  • w_itae (float)

  • w_ise (float)

Return type:

float

pid_controllers.pidTool.core.poles_stable(sys)[source]
Parameters:

sys (TransferFunction)

Return type:

bool

pid_controllers.pidTool.core.poly_from_string(expr, s_symbol)[source]
Parameters:
  • expr (str)

  • s_symbol (Symbol)

Return type:

List[float]

pid_controllers.pidTool.core.pretty_tf(name, G)[source]
Parameters:
  • name (str)

  • G (TransferFunction)

Return type:

str

pid_controllers.pidTool.core.tf_from_args(args)[source]
Return type:

TransferFunction

Design Engine

pid_controllers.pidTool.design.make_grid(vals, rng, n)[source]
Parameters:
  • vals (List[float])

  • rng (List[float] | None)

  • n (int | None)

Return type:

List[float]

pid_controllers.pidTool.design.make_grids(args)[source]
Return type:

Dict[str, List[float]]

pid_controllers.pidTool.design.search_candidates(Gp, structure, grids, req, tfinal, dt, objective, wts, max_eval_warn=250000)[source]
Parameters:
  • Gp (TransferFunction)

  • structure (str)

  • grids (Dict[str, List[float]])

  • req (Requirements)

  • tfinal (float | None)

  • dt (float | None)

  • objective (str)

  • wts (Tuple[float, float, float, float])

  • max_eval_warn (int)

Return type:

List[Candidate]

Input and Output Helpers

pid_controllers.pidTool.io.export_results(prefix, Gp, structure, cands, top, want_json, want_csv, out_dir=None)[source]
Parameters:
  • prefix (str)

  • Gp (TransferFunction)

  • structure (str)

  • cands (List[Candidate])

  • top (int)

  • want_json (bool)

  • want_csv (bool)

  • out_dir (str | None)

Return type:

None

Command-Line Interface

pid_controllers.pidTool.cli.build_parser()[source]
Return type:

ArgumentParser

pid_controllers.pidTool.cli.main(argv=None)[source]
Parameters:

argv (list[str] | None)

Return type:

int