OpenSMC¶
OpenSMC is the first open-source, dual-platform Sliding Mode Control (SMC) toolbox, supporting both MATLAB and Python. It provides a comprehensive suite of modern and classical SMC algorithms, sliding surfaces, reaching laws, and plant models, all within a unified modular framework designed for both academic research and industrial applications.
The toolbox aims to bridge the gap between theoretical SMC developments and practical implementation. By offering a consistent API across Python and MATLAB, OpenSMC allows researchers to prototype in their preferred environment and seamlessly transition between them. With built-in support for Reinforcement Learning (RL) and automated performance metrics, it is the most complete SMC toolkit available today.
Key Features¶
- Modular Design: Mix and match any Surface, Reaching Law, Controller, Plant, and Estimator.
- Extensive Library: Includes 11 sliding surfaces, 5 reaching laws, 17 controllers, and 9 plant models.
- Dual-Platform: Full parity between MATLAB and Python implementations.
- Gymnasium Support: Standard Gymnasium environments for RL-SMC integration.
- Performance Metrics: 12 built-in metrics (ISE, IAE, ITAE, chattering index, etc.) for rigorous evaluation.
- Robust Estimators: Advanced observers like ESO, HGO, and Levant differentiators for disturbance rejection.
Quick Installation¶
You can install the Python package via pip:
Minimal Example¶
Simulating a classical SMC on a Double Integrator system is as simple as:
from opensmc.surfaces import LinearSurface
from opensmc.reaching import ConstantRate
from opensmc.controllers import ClassicalSMC
from opensmc.plants import DoubleIntegrator
from opensmc.simulator import Simulator
from opensmc import metrics
import numpy as np
# Compose the control system
surface = LinearSurface(c=2.0)
reaching = ConstantRate(k=5.0)
controller = ClassicalSMC(surface, reaching)
plant = DoubleIntegrator()
# Simulate
sim = Simulator(dt=0.001, T=5.0, method='rk4')
result = sim.run(controller, plant, ref_fn=lambda t: np.array([1.0, 0.0]))
# Evaluate performance
print(f"ISE = {metrics.ise(result):.4f}")
Explore OpenSMC¶
- Getting Started: Installation and quick start tutorials.
- Concepts: Understand the modular architecture and SMC theory.
- API Reference: Detailed documentation for all modules.
- Examples: Real-world control examples and notebooks.