semvec/pypi-packages huggingface dataset:
pyf16 0.1.1
A Python package for F-16 aircraft simulation.
Requires Python: >=3.10

# pyf16

`pyf16` 是一个用于模拟 F-16 飞机动力学的 Python 库。

The aerodynamics included in this model come from the NASA Technical Report 1538, Simulator Study of Stall/Post-Stall Characteristics of a Fighter Airplane with Relaxed Longitudinal Static Stability, by Nguyen, Ogburn, Gilbert, Kibler, Brown, and Deal, Dec 1979. The model is based on Aircraft Control and Simulations, by Brian Stevens and Frank Lewis, Wiley Inter-Science, New York, 1992.

[原始的 MATLAB/Simulink 模型](https://dept.aem.umn.edu/~balas/darpa_sec/SEC.Software.html)


## 安装

### 从源码构建

确保你已经安装了 Rust, CMake 和 Python 3.10 及以上版本。

#### 使用 [uv](https://docs.astral.sh/uv/) 进行构建

1. 克隆仓库：
    ```sh
    git clone https://github.com/WindLX/pyf16.git
    cd pyf16
    ```

2. 运行测试用例：
    ```sh
    uv run examples/example1.py
    ```

#### 不使用 [uv](https://docs.astral.sh/uv/) 进行构建

1. 克隆仓库：
    ```sh
    git clone https://github.com/WindLX/pyf16.git
    cd pyf16
    ```

2. 使用 `maturin` 构建并安装：
    ```sh
    python -m venv .venv
    source ./.venv/bin/activate
    pip install maturin
    maturin develop
    ```

3. (可选)手动构建 *f16_model*：
    这一过程会由 cargo 的构建脚本 `build.rs` 自动完成，你也可以尝试手动编译气动模型。
    ```sh
    rm -rf build
    cd f16_model
    mkdir build
    cd build
    cmake ..
    make install
    ```
    在 *f16_model* 目录下会生成一个 *install* 文件夹，其中的 *f16_model* 文件夹为后续加载模型所需的目录。例如：`pyf16.AerodynamicModel(path: str)` 的 `path` 参数需要指向该目录，即 `/path/to/f16_model`，`AerodynamicModel` 的 `install` 方法的 `path` 参数需要指向该目录下的 `data` 目录，即 `/path/to/f16_model/data`。


## 使用示例

以下是一个简单的使用示例，展示了如何加载气动模型、安装模型、加载控制限制、进行配平计算并创建飞机对象：

```python
import pyf16

aero_model = pyf16.AerodynamicModel("/path/to/f16_model")
aero_model.install("/path/to/f16_model/data")
control_limits = aero_model.load_ctrl_limits()

trim_target = pyf16.TrimTarget(15000, 500, None, None)
trim_init = None
trim_result = pyf16.trim(aero_model, trim_target, control_limits, trim_init).to_core_init()

f16 = pyf16.PlaneBlock(
    pyf16.SolverType.RK4,
    0.01,
    aero_model,
    trim_result.to_core_init(),
    [0, 0, 0],
    control_limits,
)
core_output = f16.update(
    pyf16.Control(thrust=100, elevator=0, aileron=0, rudder=0), 0.1
)
print(core_output.state.to_list())

f16.delete_model()
aero_model.uninstall()
```


## API

见 [API](API.md) 文档


## TODO

- [ ] 更详细的文档
- [x] 可变的 ODE 求解器


## LICENSE

[许可证](LICENSE)
MPFile 0.1.0
A Python module for file analysis and statistics.
Requires Python: >=3.6

# MPFile

**MPFile** is a Python module designed to work with files in a simple and efficient way. It provides various methods to analyze and process text files, such as counting lines, characters, spaces, words, and non-space/non-newline characters.

## Features

1. **LineC("Your_File_Address")**: Counts the number of lines in a file.
2. **CharC("Your_File_Address")**: Counts the total number of characters in a file.
3. **SpaceC("Your_File_Address")**: Counts the number of spaces in a file.
4. **AbsoluteC("Your_File_Address")**: Counts non-space and non-newline characters in a file.
5. **WordC("Your_File_Address")**: Counts the total number of words in a file.

## Installation

You can install **MPFile** using pip:

```bash
pip install MPFile
```

## Usage Example
```python
from Countile import Count

# Create an instance of the Count class with a file path
file = Count('path_to_your_file.txt')

# Example usage of different functions
print(file.LineC())        # Print the number of lines
print(file.CharC())        # Print the total number of characters
print(file.SpaceC())       # Print the number of spaces
print(file.AbsoluteC())    # Print non-space and non-newline characters
print(file.WordC())        # Print the total number of words
```

## Name Explanation
The name MPFile is inspired by popular multimedia formats like MP3 for audio and MP4 for video, reflecting its functionality in handling various file operations in a simple and efficient way.

## License
This project is licensed under the terms of the GNU General Public License v3.0. See the LICENSE file for details.

## Contributing
If you'd like to contribute to MPFile, feel free to open issues or pull requests. Please follow the coding standards and write tests for new features.

## Contact
For any questions or feedback, you can reach the author at [Aliakbarkhoei@gmail.com](mailto:Aliakbarkhoei@gmail.com).