Skip to main content

无模型自适应控制(MFAC)工具包。

Project description

mfac-toolkit

面向 SISO/MIMO 离散时间系统的无模型自适应控制 Python 工具包

Python 3.12+ License: MIT

安装

PyPI(推荐)

pip install mfac-toolkit

GitHub Release 下载 wheel

Releases 下载对应平台的 .whl 后安装:

pip install ./<下载的 whl 文件>

直接克隆使用

仓库内已包含预编译扩展,克隆后即可安装使用:

git clone https://github.com/Zhaojq2003/mfac_toolkit.git
cd mfac_toolkit
pip install -e .

快速开始

from mfac_toolkit import MFACConfig, create_controller

config = MFACConfig.from_yaml("mfac_toolkit/examples/siso_config.yaml")
controller = create_controller(config)

u = controller.update(y=0.0, yd=1.0)  # 当前输出、期望输出 → 下一时刻控制输入

运行内置示例:

python -m mfac_toolkit.examples.basic_example

配置字段说明

MFACConfig 支持从 YAML 加载,所有字段均有默认值。下表列出常用字段及其含义:

字段 默认值 说明
controller "CFDL" 控制器格式:CFDL / PFDL / FFDL
dim 1 系统维度,1 为 SISO,>=2 为 MIMO
eta 1.0 PPD 投影算法学习率 η,需满足 0 < eta <= 2
mu 1.0 投影算法分母正则化项 μ,必须为正
rho 0.1 控制律步长因子 ρ,需满足 0 < rho <= 1
lambda_ 0.02 控制增量加权系数 λ,必须为正
eps 1e-5 PPD 估计值与控制增量重置阈值 ε
L_y 0 输出历史长度(FFDL 伪阶数),CFDL/PFDL 必须为 0
L_u 1 输入历史长度(伪阶数),必须 >= 1
initial_phi 0.5 PPD/PJM 估计初始值;标量广播,也支持数组
u0 0.0 初始控制输入
u_min null 控制输入下限(可选)
u_max null 控制输入上限(可选);若同时设置须满足 u_min <= u_max
m_upper 1.0e6 MIMO PJM 范数上界
m_lower 1.0e-6 MIMO PJM 范数下界
enable_logging false 是否记录每步运行数据
log_dir "log" 日志保存根目录

完整字段说明、使用示例与 phi 形状参考见 TUTORIAL.md

功能

  • 支持 CFDL / PFDL / FFDL 三种动态线性化格式
  • 支持 SISO 与 MIMO 系统,统一接口:controller.update(y, yd)
  • YAML 配置与参数校验
  • 可选的仿真数据记录

示例

  • mfac_toolkit.examples.basic_example:SISO 闭环仿真,对应 mfac_toolkit/examples/siso_config.yaml
  • mfac_toolkit.examples.mimo_example:MIMO 闭环仿真,对应 mfac_toolkit/examples/mimo_config.yaml
  • mfac_toolkit.examples.mimo_coupled_example:MIMO 耦合系统解耦仿真,对应 mfac_toolkit/examples/mimo_config.yaml
  • mfac_toolkit.examples.plants:示例被控对象

文档

许可证

本项目采用 MIT 许可证 开源。

MIT License
Copyright (c) 2026 北方工业大学 RobotX 实验室 (RobotX Lab, North China University of Technology)
Author: Jiqian Zhao zhaojq2003@163.com

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

mfac_toolkit-1.1.2-cp312-abi3-win_amd64.whl (348.9 kB view details)

Uploaded CPython 3.12+Windows x86-64

mfac_toolkit-1.1.2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (490.9 kB view details)

Uploaded CPython 3.12+manylinux: glibc 2.17+ x86-64

File details

Details for the file mfac_toolkit-1.1.2-cp312-abi3-win_amd64.whl.

File metadata

  • Download URL: mfac_toolkit-1.1.2-cp312-abi3-win_amd64.whl
  • Upload date:
  • Size: 348.9 kB
  • Tags: CPython 3.12+, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for mfac_toolkit-1.1.2-cp312-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 e898381b00b4d9e6813109d27d732ecf857d497f534679fce17879a368ce52b6
MD5 2b4ccb74359bae1982202e9a58b50654
BLAKE2b-256 bd06d823497ce60f2e545790eb8e556526dde3f3501c42f1c492bceb34ee6370

See more details on using hashes here.

File details

Details for the file mfac_toolkit-1.1.2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mfac_toolkit-1.1.2-cp312-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 b2b52c29bc176d62cffab6dd916c93690618e5c721f7ac1d0468b9e8fd8bdffe
MD5 5ef3aef6239d7aeb231973b0a04ced7d
BLAKE2b-256 65618ece166f0c06a477fff8afcdab923db92b8c1cca14537b07cba9db010cf4

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page