Skip to main content

Automatic simulation system powered by neural networks

Project description

Automatic simulation system powered by neural networks

Installation

pip install asim

What is asim

  • Physical field modeling with automatic constraint enforcement
  • Flexible data grouping and normalization
  • Built-in support for recurrent architectures
  • Export/import of trained models

Using asim

import matplotlib.pyplot as plt
import pandas as pd
from asim.dataset import PhysicalDataManage, Vt, Vu, Vx, DummyDatasets
from asim.model import PhysicalFieldModel
from asim.optimizer import ContinuousOptimizer
from asim.simulator import PhysicalSimulator

# 1. Define data and structure
df = DummyDatasets.boiler_minimum(size=2000)  # pd.read_csv("demo.csv")
cols = [
    Vt(label="ts"),
    Vx(group="boiler", label="heat_temp", minmax=(0.0, None), unit="kj", enable=True),
    Vu(group="boiler", label="heat_power1", minmax=(0.0, None), unit="kw", enable=True),
    Vu(group="boiler", label="heat_power2", minmax=(0.0, None), unit="kw", enable=True),
]
dm = PhysicalDataManage(df, columns=cols, batch_size=64)

# 2A. Select the model, define the parameters, train and save
fm = PhysicalFieldModel(dm, lr=0.003)
fm.fit(epochs=100)
fm.export("demo.sim.onnx")

# 2B. Use a simulator to simulate the operation
sim = PhysicalSimulator("demo.sim.onnx", dm=dm)
sim_df = df[0:1440].copy()
sim_df.index = pd.to_datetime(sim_df["ts"], unit="s", utc=True).dt.tz_convert("Etc/GMT-8")
sim_df = sim.steps(sim_df, x0={"heat_temp": 150.0})
sim_df.plot(
    y=sum(sim.get_group_names(), []),
    subplots=sim.get_group_names(),
    sharex=True,
    figsize=(10, 3),
    ylim=(0, None),
    grid=True,
)
plt.tight_layout()
plt.show()

# 3A. RL
opt = ContinuousOptimizer(sim=sim, dm=dm)
opt.fit(epochs=100)
opt.export("demo.opt.onnx")

# 3B. Use the simulator to reinforce the test

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.

asim-25.12.3-cp313-cp313-win_amd64.whl (204.7 kB view details)

Uploaded CPython 3.13Windows x86-64

asim-25.12.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.13manylinux: glibc 2.17+ x86-64

asim-25.12.3-cp312-cp312-win_amd64.whl (206.6 kB view details)

Uploaded CPython 3.12Windows x86-64

asim-25.12.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.12manylinux: glibc 2.17+ x86-64

File details

Details for the file asim-25.12.3-cp313-cp313-win_amd64.whl.

File metadata

  • Download URL: asim-25.12.3-cp313-cp313-win_amd64.whl
  • Upload date:
  • Size: 204.7 kB
  • Tags: CPython 3.13, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for asim-25.12.3-cp313-cp313-win_amd64.whl
Algorithm Hash digest
SHA256 5ef4df9111136021a1feb259c4beace54e2df0df11a67edd0dde35f41c414f58
MD5 7425a84cc45be72b8388b1b5f3b8aaaf
BLAKE2b-256 e132e0e0ac610d2842526dee4fffd1485318ad1cbdfe3b2937d065332894529c

See more details on using hashes here.

File details

Details for the file asim-25.12.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for asim-25.12.3-cp313-cp313-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 9f9113402b94dd79cd52ea825f4519cb12353514a1b65e2db5b5d51393e4d0af
MD5 ec08ee3d9fd46284dfaf3eb7044d48ea
BLAKE2b-256 01a660a4aae2d8c37f24de1b5edfab95e259d84ed90bca8cd6b955c582f80532

See more details on using hashes here.

File details

Details for the file asim-25.12.3-cp312-cp312-win_amd64.whl.

File metadata

  • Download URL: asim-25.12.3-cp312-cp312-win_amd64.whl
  • Upload date:
  • Size: 206.6 kB
  • Tags: CPython 3.12, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for asim-25.12.3-cp312-cp312-win_amd64.whl
Algorithm Hash digest
SHA256 9c346ffd2d03017e28abaf08bb80f18a87e712b2075b5852c375dc7bc0c401d1
MD5 fb64add907f9052548dcc10ff07096d5
BLAKE2b-256 656182ccb7c5b7ba7604344eff55246fe4cf3df7879d6602fc8d26a23b4f045e

See more details on using hashes here.

File details

Details for the file asim-25.12.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl.

File metadata

File hashes

Hashes for asim-25.12.3-cp312-cp312-manylinux2014_x86_64.manylinux_2_17_x86_64.whl
Algorithm Hash digest
SHA256 581a74137d7be734b90699242469185b55f2b9b2ed59d2175184a9c015addf51
MD5 03fac93f3ddce81df4ffc700b535fe08
BLAKE2b-256 9923c73dcbeafbda7b2ceecaf5a522c8070a267cdd41d4511c9681a6c9979439

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