qfmu


Nameqfmu JSON
Version 0.2.9 PyPI version JSON
download
home_pagehttps://github.com/hyumo/qfmu
SummaryQuickly generate an FMU from command line
upload_time2023-10-26 05:08:29
maintainer
docs_urlNone
authorHang Yu
requires_python>=3.8
licenseBSD license
keywords qfmu
VCS
bugtrack_url
requirements annotated_types Jinja2 numpy scipy click typing_extensions
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <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
```

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/hyumo/qfmu",
    "name": "qfmu",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "qfmu",
    "author": "Hang Yu",
    "author_email": "yuhang.neu@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/e5/8a/071119b35a02f66a894d6f382dbbee4b6996df04d9287edcd351f0a3a77d/qfmu-0.2.9.tar.gz",
    "platform": null,
    "description": "<p align=\"center\">\n  <img src=\"./docs/images/title.png\">\n</p>\n\n---\n\n**qfmu** is a python package to generate `continuous-time`, `LTI` system FMUs from command line.\n\n![](./docs/images/demo.gif)\n\n## Installation\nInstall `qfmu` through PyPI\n\n```\npip install qfmu\n```\n\n*Noted* that a C compiler is required\n\n- `msvc` for Windows\n- `gcc` for Linux\n- `clang` for MacOS\n\n## Features\n\nCurrently, qfmu is able to generate fmus that are compliant with **FMI2** standard. \n\nThe following models are supported:\n\n| Model              \t     | ME  | CS  |\n|--------------------------|-----|-----|\n| State Space (`ss`)   \t   | \u2714\ufe0f  | \u2714\ufe0f |\n| Transfer Function (`tf`) | \u2714\ufe0f  | \u2714\ufe0f |\n| ZeroPoleGain (`zpk`)     | \u2714\ufe0f  | \u2714\ufe0f |\n| PID (`pid`)        \t     | \u2714\ufe0f  | \u2714\ufe0f |\n\n*Noted* that only continuous-time models are supported currently.\n\n## Examples\n\nGenerate a continuous-time state space FMU\n\n```bash\nqfmu ss -A \"[[1,2],[3,4]]\" -B \"[[1],[2]]\" -C \"[[1,0],[0,1]]\" -x0 \"[3.14, 6]\" -o ./example_ss.fmu\n```\n\nIf `qfmu` is installed properly, you should see a `example_ss.fmu` file generated in your current working directory.\n\nIf you have `fmpy` installed, you can run `fmpy info example_ss.fmu` to see detailed model information.\n\n```\nModel Info\n\n  FMI Version        2.0\n  FMI Type           Model Exchange, Co-Simulation\n  Model Name         q\n  Description        None\n  Platforms          c-code, linux64\n  Continuous States  2\n  Event Indicators   0\n  Variables          10\n  Generation Tool    qfmu\n  Generation Date    2023-10-08 21:24:32.733857\n\nDefault Experiment\n\n  Stop Time          1.0\n  Tolerance          0.0001\n\nVariables (input, output)\n\n  Name               Causality              Start Value  Unit     Description\n  u1                 input                          0.0           Model input 1\n  y1                 output                                       Model output 1\n  y2                 output                                       Model output 2\n```\n\nGenerate a continuous-time transfer function FMU using the `numerator`, `denominator` representation: $\\frac{s}{s+1}$\n\n```bash\nqfmu tf --num \"[1]\" --den \"[1,1]\" -o ./example_tf.fmu\n```\n\nGenerate a continuous-time transfer function FMU using the `zero-pole-gain` representation: $\\frac{0.5(s-1)}{(s+1)(s+2)}$\n\n```bash\nqfmu zpk -z \"[1]\" -p \"[-1, -2]\" -k 0.5 -o ./example_zpk.fmu\n```\n\nGenerate a continuous-time PI controller FMU: $3 + \\frac{0.1}{s}$\n\n```bash\nqfmu pid --kp=3.0 --ki=0.1 -o ./example_pid.fmu\n```\n",
    "bugtrack_url": null,
    "license": "BSD license",
    "summary": "Quickly generate an FMU from command line",
    "version": "0.2.9",
    "project_urls": {
        "Homepage": "https://github.com/hyumo/qfmu"
    },
    "split_keywords": [
        "qfmu"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "75b89884effbb2e719202aef01b87f8411c7512c34dabced49c84aabb5d21124",
                "md5": "b4d4787c69f543277c4a2d02b9b19fcd",
                "sha256": "8d55201207417d4082655dcc68915706410cc1be96b44a86a9969b9709c27fb3"
            },
            "downloads": -1,
            "filename": "qfmu-0.2.9-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "b4d4787c69f543277c4a2d02b9b19fcd",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 32693,
            "upload_time": "2023-10-26T05:08:27",
            "upload_time_iso_8601": "2023-10-26T05:08:27.615224Z",
            "url": "https://files.pythonhosted.org/packages/75/b8/9884effbb2e719202aef01b87f8411c7512c34dabced49c84aabb5d21124/qfmu-0.2.9-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "e58a071119b35a02f66a894d6f382dbbee4b6996df04d9287edcd351f0a3a77d",
                "md5": "4dca7d61a5ed0fd8b58d5613a7f2ac64",
                "sha256": "2d4f61c8fab44035cc12f17a747fc54eedb7d03d4c98dd30622200308f2a1b75"
            },
            "downloads": -1,
            "filename": "qfmu-0.2.9.tar.gz",
            "has_sig": false,
            "md5_digest": "4dca7d61a5ed0fd8b58d5613a7f2ac64",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 29809,
            "upload_time": "2023-10-26T05:08:29",
            "upload_time_iso_8601": "2023-10-26T05:08:29.393790Z",
            "url": "https://files.pythonhosted.org/packages/e5/8a/071119b35a02f66a894d6f382dbbee4b6996df04d9287edcd351f0a3a77d/qfmu-0.2.9.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-10-26 05:08:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "hyumo",
    "github_project": "qfmu",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "annotated_types",
            "specs": [
                [
                    "==",
                    "0.6.0"
                ]
            ]
        },
        {
            "name": "Jinja2",
            "specs": [
                [
                    "==",
                    "3.1.2"
                ]
            ]
        },
        {
            "name": "numpy",
            "specs": [
                [
                    "==",
                    "1.24.4"
                ]
            ]
        },
        {
            "name": "scipy",
            "specs": [
                [
                    "==",
                    "1.10.1"
                ]
            ]
        },
        {
            "name": "click",
            "specs": [
                [
                    "==",
                    "8.1.7"
                ]
            ]
        },
        {
            "name": "typing_extensions",
            "specs": [
                [
                    "==",
                    "4.8.0"
                ]
            ]
        }
    ],
    "lcname": "qfmu"
}
        
Elapsed time: 0.13675s