Skip to main content

A library for interfacing with the kspice API for the Yggdrasil project

Project description

YggSimLib

YggSimLib is a Python framework for orchestrating and automating simulation workflows in the Yggdrasil Engineering Simulator. It allows for modular control of simulated equipment such as valves, motors, heaters, PID controllers, and choke valves, and supports stepwise and parallel sequence execution with inhibit logic and transition conditions.

Features

  • Object-oriented wrappers for:
    • On/off valves
    • Electric motors and heaters
    • PID controllers
    • Choke valves
    • Transmitters
  • Flexible step-based sequencer (Step, Sequence)
  • Inhibit logic for conditional execution
  • Dependency-managed sequence orchestration via Admin
  • GUI support for selecting models, timelines, and data files
  • Parallel execution support using threads

File Structure

  • YggSimLib.py: Core library with class definitions and sequence execution engine
  • muninUtilities.py: Example configuration for a multi-system simulation setup
  • main.py: Startup script to initialize and run the sequences

Quick Start

python main.py

GUI Prompts

You’ll be prompted to select:

  1. Simulation model directory
  2. Timeline
  3. Model, parameter, and initial condition files

Once loaded, the simulation sequences will begin executing according to defined dependencies.

Example: Defining a Step

step = Step({
    "number": 10,
    "actions": [valve.open],
    "transitions": [valve.is_open],
    "tmax": 30,
    "next": lambda: "S020"
})

Sequence Logic

steps = {"S010": step1, "S020": step2}
sequence = Sequence("pump_start", steps, sim)
sequence.add_steps(steps.values())
sequence.start()

Admin Graph

Use Admin to define a full system of sequences with dependencies:

a = Admin("startup_controller", [seq1, seq2, seq3], edges, sim)
a.start()

Documentation Style

Docstrings follow the Google Python style guide and describe:

  • Arguments
  • Behavior
  • Return values (where applicable)

Requirements

  • Python 3.12
  • Yggdrasil Engineering Simulator (with kspice Python bindings)
  • networkx for dependency graphs

Author

Built by Håkon – Process Data Scientist, passionate about simulation, optimization.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

yggsimlib-0.97.tar.gz (22.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

yggsimlib-0.97-py3-none-any.whl (21.3 kB view details)

Uploaded Python 3

File details

Details for the file yggsimlib-0.97.tar.gz.

File metadata

  • Download URL: yggsimlib-0.97.tar.gz
  • Upload date:
  • Size: 22.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for yggsimlib-0.97.tar.gz
Algorithm Hash digest
SHA256 d67efae3f6ba2e453cb2741232cf46fbc89dc41a81e3a10e9b503a57c47175a1
MD5 63397ad622757a6d768469a20d53b65b
BLAKE2b-256 e3a5869566202b8371ec0505e575bc5e506b51f34aa2f78db1d31a25df32df90

See more details on using hashes here.

File details

Details for the file yggsimlib-0.97-py3-none-any.whl.

File metadata

  • Download URL: yggsimlib-0.97-py3-none-any.whl
  • Upload date:
  • Size: 21.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.9.23

File hashes

Hashes for yggsimlib-0.97-py3-none-any.whl
Algorithm Hash digest
SHA256 b518fda2d4dded5bcdf533fa7e28ae60e637a489efeb51f67fc46b48f99963ff
MD5 d8f6726d08fb9b698574c86ba4812c1a
BLAKE2b-256 6dd8312b347e802111ad32c35d54044ddaa3b571834532e92002e1ae11c86d72

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