Giter Site home page Giter Site logo

vsimcon's Introduction

vsimcon

A library to simulate and control dynamical systems of coupled vessels.

Install

pip install git+https://github.com/tsmcalister/vsimcon.git

Example

import numpy as np
import vsimcon; vsimcon.reset()

from vsimcon.vessels import Vessel, SourceVessel
from vsimcon.controllers import PIDController, FixedController

# Init proportional controller
pid = PIDController(p=1,
                    target_value=20,
                    inverse=True)

# Create vessel graph
source_vessel = SourceVessel(flow_t=lambda t: np.sin(t) * 50 + 100)
main_vessel = Vessel(source=source_vessel,
                     drain_control=pid,
                     name='Main')
drain_vessel = Vessel(source=main_vessel,
                      drain_control=FixedController.constant_controller(output=0),
                      name='Drain')

# connect PID "sensor" with a delay of 35*dt
pid.connect(lambda: main_vessel.get_height(delay=35))

# Simulate system to time 100 with dt=0.01
vsimcon.simulate(100, dt=0.01)

# plot results
fig, axs = vsimcon.plot(time_range=(50, 60))
fig.show()

Output

output of the example code

vsimcon's People

Contributors

tsmcalister avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.