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.96.tar.gz (21.8 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.96-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for yggsimlib-0.96.tar.gz
Algorithm Hash digest
SHA256 2a07a5b88c212f867dd8601d14a177a396ae84ff281e93a5b7632524ed3e895a
MD5 eee6ba901d0d55b7cca4ac97e48f4cc5
BLAKE2b-256 45667cf7c91e4a0ea67297f180e5a4cf7e8551fd9fd40924988c97bdffa3bf4b

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for yggsimlib-0.96-py3-none-any.whl
Algorithm Hash digest
SHA256 69dbe1014764b9acc000fdb262c7d5d278a10e5d9cd58c73ddbb92b8dc1aee23
MD5 f473517f46f932cb6ac5e8cd4054db3b
BLAKE2b-256 a615dc9851bf49b9934749881ba4ea4de66e37bfe296ae2ab50578ef5634768f

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