Metadata-Version: 2.1
Name: qfmu
Version: 0.2.9
Summary: Quickly generate an FMU from command line
Home-page: https://github.com/hyumo/qfmu
Author: Hang Yu
Author-email: yuhang.neu@gmail.com
License: BSD license
Keywords: qfmu
Classifier: Natural Language :: English
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Topic :: Software Development :: Libraries
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: annotated-types ==0.6.0
Requires-Dist: Jinja2 ==3.1.2
Requires-Dist: numpy ==1.24.4
Requires-Dist: scipy ==1.10.1
Requires-Dist: click ==8.1.7
Requires-Dist: typing-extensions ==4.8.0
Provides-Extra: dev
Requires-Dist: wheel ; extra == 'dev'
Requires-Dist: pip ; extra == 'dev'
Requires-Dist: setuptools ; extra == 'dev'
Requires-Dist: pytest ; extra == 'dev'
Requires-Dist: ruff ; extra == 'dev'
Requires-Dist: coverage ; extra == 'dev'
Requires-Dist: pytest-cov ; extra == 'dev'
Requires-Dist: black ; extra == 'dev'
Requires-Dist: isort ; extra == 'dev'
Requires-Dist: twine ; extra == 'dev'
Requires-Dist: build ; extra == 'dev'
Requires-Dist: bump2version ; extra == 'dev'
Requires-Dist: mypy ; extra == 'dev'
Requires-Dist: pipreqs ; extra == 'dev'
Requires-Dist: pandas ; extra == 'dev'
Requires-Dist: fmpy ==0.3.16 ; extra == 'dev'

<p align="center">
  <img src="./docs/images/title.png">
</p>

---

**qfmu** is a python package to generate `continuous-time`, `LTI` system FMUs from command line.

![](./docs/images/demo.gif)

## Installation
Install `qfmu` through PyPI

```
pip install qfmu
```

*Noted* that a C compiler is required

- `msvc` for Windows
- `gcc` for Linux
- `clang` for MacOS

## Features

Currently, qfmu is able to generate fmus that are compliant with **FMI2** standard. 

The following models are supported:

| Model              	     | ME  | CS  |
|--------------------------|-----|-----|
| State Space (`ss`)   	   | ✔️  | ✔️ |
| Transfer Function (`tf`) | ✔️  | ✔️ |
| ZeroPoleGain (`zpk`)     | ✔️  | ✔️ |
| PID (`pid`)        	     | ✔️  | ✔️ |

*Noted* that only continuous-time models are supported currently.

## Examples

Generate a continuous-time state space FMU

```bash
qfmu ss -A "[[1,2],[3,4]]" -B "[[1],[2]]" -C "[[1,0],[0,1]]" -x0 "[3.14, 6]" -o ./example_ss.fmu
```

If `qfmu` is installed properly, you should see a `example_ss.fmu` file generated in your current working directory.

If you have `fmpy` installed, you can run `fmpy info example_ss.fmu` to see detailed model information.

```
Model Info

  FMI Version        2.0
  FMI Type           Model Exchange, Co-Simulation
  Model Name         q
  Description        None
  Platforms          c-code, linux64
  Continuous States  2
  Event Indicators   0
  Variables          10
  Generation Tool    qfmu
  Generation Date    2023-10-08 21:24:32.733857

Default Experiment

  Stop Time          1.0
  Tolerance          0.0001

Variables (input, output)

  Name               Causality              Start Value  Unit     Description
  u1                 input                          0.0           Model input 1
  y1                 output                                       Model output 1
  y2                 output                                       Model output 2
```

Generate a continuous-time transfer function FMU using the `numerator`, `denominator` representation: $\frac{s}{s+1}$

```bash
qfmu tf --num "[1]" --den "[1,1]" -o ./example_tf.fmu
```

Generate a continuous-time transfer function FMU using the `zero-pole-gain` representation: $\frac{0.5(s-1)}{(s+1)(s+2)}$

```bash
qfmu zpk -z "[1]" -p "[-1, -2]" -k 0.5 -o ./example_zpk.fmu
```

Generate a continuous-time PI controller FMU: $3 + \frac{0.1}{s}$

```bash
qfmu pid --kp=3.0 --ki=0.1 -o ./example_pid.fmu
```
