Skip to content

Commit

Permalink
Bump version: 0.2.1
Browse files Browse the repository at this point in the history
  • Loading branch information
hyumo committed Oct 9, 2023
1 parent 1df75c4 commit a51c2cb
Show file tree
Hide file tree
Showing 8 changed files with 35 additions and 66 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: qfmu_ci
name: ci

on:
push:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: qfmu_ci
name: release

on:
workflow_dispatch:
Expand Down
90 changes: 30 additions & 60 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

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

TODO: Insert ttygif here
![](./docs/images/demo.gif)

## Installation
Install `qfmu` through PyPI
Expand All @@ -21,31 +21,45 @@ pip install qfmu
- `gcc` for Linux
- `clang` for MacOS

## Example
## Features

Generate an LTI system in state space form using the following command:
Currently, qfmu is able to generate fmus that are compliant with **FMI2** standard.

```
qfmu --name helloWorld ss -A="1,2;3,4" -B="1;2" -C="1,0;0,1" -D="0;0"
The following models are supported:

| Model | ME | CS |
|-------------------- |---- |---- |
| State Space | ✔️ | ✔️ |
| Transfer Function | ✔️ | ✔️ |
| 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 ./q.fmu
```

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

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

```
Model Info
FMI Version 2.0
FMI Type Model Exchange, Co-Simulation
Model Name helloWorld
Model Name q
Description None
Platforms c-code, linux64
Continuous States 2
Event Indicators 0
Variables 10
Generation Tool qfmu
Generation Date 2021-10-23 16:36:22.700250
Generation Date 2023-10-08 21:24:32.733857
Default Experiment
Expand All @@ -60,58 +74,14 @@ Variables (input, output)
y2 output Model output 2
```

## Usage

```
usage: qfmu [-h] [--name NAME] [--dir DIR] [-v] [-n] {ss} ...
Generate standard form system FMUs through commandline
optional arguments:
-h, --help show this help message and exit
--name NAME Target FMU identifier
--dir DIR Target FMU path
-v, --verbose Verbose output
-n, --dry-run Only print system information without generating an FMU.
System form:
{ss}
ss State space model: A, B, C, D
```

## Knwon issues

- No Windows support yet (WIP)

## For developers
Generate a continuous-time transfer function FMU

Install required packages

```
pip install -e ".[dev]" -U
```

Dry run bumpversion

```
make major/minor/patch
```

Make a test release to testpipy

```
make testrelease
```

Make a release manually (until gitaction works)

```
bumpversion major/minor/patch
make release
```bash
qfmu tf --num "[1]" --den "[1,1]" -o ./q.fmu
```

## Acknowledgement
- [fmusdk](https://github.com/qtronic/fmusdk)
- [fmpy](https://github.com/CATIA-Systems/FMPy)
Generate a continuous-time PID controller FMU

`qfmu`'s code template is modified based on `fmusdk`. Some functions of `qfmu` is borrowed from fmpy.
```bash
qfmu pid --kp=3.0 --ki=1 -o ./q.fmu
```
Binary file added docs/images/demo.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.1.5
current_version = 0.2.1
commit = False
tag = False

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,6 @@
install_requires=install_requires,
extras_require={"dev": dev_requires},
url="https://github.com/hyumo/qfmu",
version="0.1.5",
version="0.2.1",
zip_safe=False,
)
2 changes: 1 addition & 1 deletion src/qfmu/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

__author__ = """Hang Yu"""
__email__ = "yuhang.neu@gmail.com"
__version__ = "0.1.5"
__version__ = "0.2.1"

__module_path__ = pathlib.Path(__file__).parent
__template_path__ = __module_path__ / "codegen" / "templates"
Expand Down
1 change: 0 additions & 1 deletion src/qfmu/model/pid.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ def __init__(
signal.TransferFunction([kd, 0.0], [T, 1.0]) if has_D else None
)

logging.info([has_P, has_I, has_D])
if sum([has_P, has_I, has_D]) == 0:
raise ValueError("At least one of kp, ki, kd must be non-zero")
elif sum([has_P, has_I, has_D]) == 1:
Expand Down

0 comments on commit a51c2cb

Please sign in to comment.