Giter VIP home page Giter VIP logo

bondgraphtools's Introduction

PyPI version [Build Status] Test Coverage

BondGraphTools - A Toolkit for modelling multi-physics systems.

Summary

This toolkit is for rapid modelling and design of networked phsyical systems. It is conceptually based upon the Bond Graph modelling methodology.

Documentation

https://bondgraphtools.readthedocs.io/

Installation

Dependencies

BondGraphTools requires:

  • python 3.7 or greater,
  • LaTeX,
  • gFortran, BLAS, LAPACK and SUNDIALS (for the numerical solvers).

Python dependencies:

  • sympy
  • numpy
  • scipy
  • matplotlib
  • scikits.odes

Instructions:

Recommended installation using Conda

  1. Install Anaconda (or miniconda).
  2. Install dependencies from conda-forge: liblas, liblapack, sundials using conda install -c conda-forge libblas liblapack sundials fortran-compiler
  3. Install LaTeX via conda install -c conda-forge miktex (windows) or conda install -c conda-forge texlive-core (osx/linux)
  4. Install the package using pip install bondgraphtools

bondgraphtools's People

Contributors

hsorby avatar likerobotics avatar mic-pan avatar peter-cudmore avatar pierre-haessig avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

bondgraphtools's Issues

Implement simulation class

The simulation class should be generated from a bond graph.

As input it should:

  • Require you to specify the initial conditions.
  • Require you to specify parameter values (constant only)
  • Require a time window

The class should then derive the system equations from the bond graph and pass them to numpy or scipy to integrate.

The output for now should be a tuple of arrays (t,x).

Test Suite - Algebra

Develop test suite for RLC model.

Tests should:

  • verify that a bond graph can be turned into a system of the form Ay +Bx + F(x, y, t; u) = 0

Swap Components

Add feature to bond graph model that allows users to swap components of the same type in.
For example; replacing a Ce with a Se

Coupled control variables to protected variables.

When building biochemical reactions, there are particular parameters (such as volume) that we'd like to be shared across the entire compartment.

Once this issue is closed, we should be able to connect a components parameter to a reference value stored at the enclosing model.

1 Component

In order to be consistent with the literature; we need to change the base implementation of the 1 component such that is has two distinct sets of ports; 'power in' and 'power out' ports.

Chemostat and flowstat tests

The reaction_builder requires tests to verify that the chemostat and flowstat components are building correctly.

Tests should verify that adding chemostats and flowstats:

  • Don't lose reactions.
  • Anchor species correction.
  • Pass on parameters to the network model correctly.

Add directionality aware default connections

In order to cater to the traditional bond graphers, some components need to be aware of directionality.

We should have some kind of non-intrusive legacy mappping between connection order and ports.

In particular
connect(C, 1) should be isomorphic to connect(C, 1.input)
and connect(1, C) should be isomorphic to connect(1.output, C)

Add Source Sensor (SS) compomnent

This task involves adding the Source-Sensor (SS) component to component library.

Associated tests should verify that:
SS has been added and new external port has been added to the model.

BondGraphTools v0.4

  • Control/modulation network.
  • Measurement (effort/flow to control variable) functionality.
  • Proper logging functionality.
  • User-made libraries.
  • Tutorials:
    • Using control and modulation to implement an Op-Amp (ala Metamodelling - P. Gawthrop)
    • Making a new component: Suspended ball (ala pH - van Der Schaft et al).

BondGraphTools v0.3

  • Save and Load Functionality.
  • External power ports.
  • Modular models.
  • Posix-like model hierarchy.
  • Tutorials on modular model building.
  • Discussion on mathematics of Bond Graph composition.
  • How-to guides:
    • Installation.
    • Building and simulating a simple Bond Graph.

Setup Documentation Website

It doesn't look like the GitHUb wiki will suffice as a project website. There are clearly better solutions.

Find one, and migrate what little docs there are across

Link Gitchangelog

Link gitchangelog so that we can automatically build changelogs from the git log.

Implement Modulated Signals

To do:

  • Add modulated components mRe, mTf
  • Add 'activated bonds'
  • Allow connection to control variables (new or existing)

Implement Analysis Tools

Particularly;

  • Symbolic linearisation of nonlinear components
  • Bode plots for single port compound components

Save to file

We must be able to save to file.
This should match the schema specified in #51

We expect that the internal model is more complex than it needs to be, so we should also flag unnecessary parts for refactoring

Posix-like model structure

A Bond Graph is a hierarchically organised set of components, with network interconnections at each level of the hierarchy.

Hence, the internal location of each component should obey a posix tree-like structure.

For this task we should change how the CompoundBondGraph class represents the sub-components, and make sure the API is consistent.

This will also involve cleaning up the different ways of referencing a component-in-bondgraph issues.

Load from file

Build file loading infrastructure:

We require:
[ ] A versioned file structure (implemented in .yaml)
[ ] A file reader that is aware of the model file version, and can pass the data across the the appropriate data model.
[ ] Mechanisms to build the model from file data.

Implement user-defined library management.

Users should be able to construct their own basic models and store them in a local library.
This task involves implementing the loading of user defined libraries.

Must be able to handle malformed libraries.
Might be necessary to migrate library management away from .json files (job for later if so)

Create YAML Schema for .bg

Since we're saving files in .yaml, we should probably have a nice schema defined for reference.

We should probably let people poke around with it before setting it in ...'clay'.

Defer to v0.4

Test build relations

Write test scripts for build relations.

Should test all currently implemented node types, as well as junk and antagonistic data

Modularisation of Bond Graphs

Here we implement the functionality that makes users able to use a bond graph with a port(or many) as a component inside yet another bond graph

Implement co-oridnate changes from DAE book

@peter-cudmore commented on Tue Feb 20 2018

See chapter's 2 and 3 of DAE book.
Specifically we need to:

  1. Re-work how co-ordinates are constructed; particularly with respect to sockets
  2. Re-work how the relations are used to generate a differential algebraic system.
  3. Re-work how the reduced equations are generated; using
Ap = A.col_join(J)
Q = Ap.inv()
P = sp.eye(m).row_join(-B*Q[:,m:n]).col_join(sp.zeros(n-m, m).row_join(sp.eye(n-m)))
Ax = A.col_join(sp.zeros(*J.shape))
Bx = B.col_join(J)

Ad = P*Ax*Q
Bd = P*Bx*Q
Gd = P*G

y = Ap*x

Designa and implement human friendly inverse system map

The bond graph algebra sub-package should generate a set of differential algebraic equations.
However, we should always be able to map the reduced co-ordinate and parameter spaces used in the DAE's back to the actual parameter and local co-ordinate space for the bond graph.

To make this happen, we should think about how how simulation data is to be used.

Fix Sympy warnings

Sympy has deprecated matrix.dot in some situations.
We should fix these warnings.

Remove 'Y' component

With the corrected implementation of the 1 junction, we should remove the 'Y' junction from the reaction builder addon and instead the 1 junction and transformers instead.

Implement intra-model connections

One would like to connect two composite models together, and have everything work.
Most of the infrastructure should already be there, with the exception being the Source Sensor component.

Tests should involve:

  • building a passive 2nd order filter out of two coupled 1st order reactions.
  • coupling two enzyme catalyzed reactions in a chain.

Multithread the julia bootup

Julia and diffeq.py take ages to start.
Its rare that a user needs them immediately, so we should use a worker thread to load them in the background.

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.