godesim Simulate complex systems with a simple API.

Go Report Card go.dev reference

godesim

Simulate complex systems with a simple API.

Wrangle non-linear differential equations while writing maintainable, simple code.

Why Godesim?

ODE solvers seem to fill the niche of simple system solvers in your numerical packages such as scipy's odeint/solve_ivp.

Among these integrators there seems to be room for a solver that offers simulation interactivity such as modifying the differential equations during simulation based on events such as a rocket stage separation.

Installation

Requires Go.

go get github.com/soypat/godesim

Progress

Godesim is in early development and will naturally change as it is used more. The chart below shows some features that are planned or already part of godesim.

Status legend Planned Started Prototype Stable Mature
Legend symbol ✖️ 🏗️ 🐞️ 🚦️ ✅️
Features Status Notes
Non-linear solvers 🚦️ Suite of ODE solvers available.
Non-autonomous support 🚦️ U vector which need not a defined differential equation like X does.
Event driver 🚦️ Eventer interface implemented.
Stiff solver 🏗️ Working on Newton implementation of Euler-Backward.

Examples

To run an example, navigate to it's directory (under examples) then type go run . in console.

There are three simple examples which have been cooked up and left in _examples directory. I've been having problems running Pixel on my machine so the simulation animations are still under work.

Imports

The import signature for a godesim simulation usually looks like this:

import (
    "github.com/soypat/godesim"
    "github.com/soypat/godesim/state" // uses gonum's `floats` subpackage
)
ODE solver example Code is in test file
// Declare your rate-of-change functions using state-space symbols
Dtheta := func(s state.State) float64 {
	return s.X("theta-dot")
}

DDtheta := func(s state.State) float64 {
    return 1
}
// Set the Simulation's differential equations and initial values and hit Begin!
sim := godesim.New() // Configurable with Simulation.SetConfig(godesim.Config{...})
sim.SetDiffFromMap(map[state.Symbol]state.Diff {
    "theta":  Dtheta,
    "theta-dot": DDtheta,
})
sim.SetX0FromMap(map[state.Symbol]float64{
    "theta":  0,
    "theta-dot": 0,
})
sim.SetTimespan(0.0, 1.0, 10) // One second simulated
sim.Begin()

The above code solves the following system:

for the domain t=0 to t=1.0 in 10 steps where theta and theta-dot are the X variables. The resulting curve is quadratic as the solution for this equation (for theta and theta-dot equal to zero) is

How to obtain results

// one can then obtain simulation results as float slices 
t := sim.Results("time")
theta := sim.Results("theta")

Contributing

Pull requests welcome!

This is my first library written for any programming language ever. I'll try to be fast on replying to pull-requests and issues.

Owner
Patricio Whittingslow
Mechanical Engineering student @ ITBA.
Patricio Whittingslow
Similar Resources

Simple Golang API to demonstrate file upload to fireabase storage and retrieving url of uploaded file.

go-firebase-storage -Work in progress 🛠️ Simple Golang API that uses Firebase as its backend to demonstrate various firebase services using Go such a

Oct 4, 2021

Person is a simple CRUD application written in go which exposes API endpoint to create the person.

Person Person is a simple CRUD application written in go which exposes API endpoint to create the person. Installation Install docker in your local sy

Oct 18, 2021

Simple API that returns JSON of statically defined

GOLANG API This is a simple example of a Go API using: Docker Docker-compose Built in go packages How to run using Docker-compose (Easiest) Clone repo

Nov 2, 2021

Simple URL Shortener API

url-shortener POST a URL to /v1/shorturl endpoint and get a JSON response with short_url properties. Example JSON Reponse: {short_url : 'a'} If you pa

Mar 1, 2022

A dead simple Go wrapper around the hidden moonarch.app API.

moonarch A dead simple Go wrapper around the hidden moonarch.app API. How-To First, get the repository: go get github.com/lazdotdigital/moonarch. moon

Nov 27, 2021

A challenge in Go. A simple backend responding to API calls reading/writing data from to PostgreSQL db.

Go Challenge The challenge has been executed in two different steps. Steps 1 Hour tag: 1 hour: As the challenge required, the tag is a snapshot of wha

Dec 4, 2021

A simple OneText Api powered by Golang

OneTextAPI-Go A simple OneText Api powered by Golang. 使用方法 在 Vercel 调用 example: package api import ( onetext "github.com/XiaoMengXinX/OneTextAPI-

May 3, 2022

bf.go - A dead simple brainfuck interpreter Slow and simple

bf.go - A dead simple brainfuck interpreter Slow and simple. Can execute pretty much all tested Brainfuck scripts. Installation If you have Go install

Oct 15, 2021

go-simple-geo is a library for simple geo calculations.

go-simple-geo is a library for simple geo calculations. Installation go get github.com/EpicStep/go-simple-geo Example package main import ( "github.

Dec 4, 2022
Comments
  • Timespan struct

    Timespan struct

    Since it's inception, the Timespan struct has been a patch to a bigger problem in godesim. There really is not much control over the domain in which the equations are integrated. Steps are a fixed size unless using an adaptive timestep method, and even then the method will choose the domain division. One can get around this by using events, which is OK for the most part, except for all the extra code.

    Timespan really does not do much, it just suggests a timestep and a end time. If there is a more elegant solution, and there most certainly is, the difficulty would probably be adapting present day godesim's Timespan API usage to a new API.

    The name is also a source of bother to me, I wish I had named it Domain, since there is no reason godesim only solves time-domain problems.

A simple tool to send binary data over a serial port. Designed for use with my retro computer systems.

Colin's Transfer Tool This is a really basic tool to transfer firmware files to my retro computer systems over a serial port. This removes the need fo

Dec 21, 2021
F' - A flight software and embedded systems framework

F´ (F Prime) is a component-driven framework that enables rapid development and deployment of spaceflight and other embedded software applications.

Jan 4, 2023
Moby Project - a collaborative project for the container ecosystem to assemble container-based systems
Moby Project - a collaborative project for the container ecosystem to assemble container-based systems

The Moby Project Moby is an open-source project created by Docker to enable and accelerate software containerization. It provides a "Lego set" of tool

Jan 2, 2023
IBus Engine for GoVarnam. An easy way to type Indian languages on GNU/Linux systems.

IBus Engine For GoVarnam An easy way to type Indian languages on GNU/Linux systems. goibus - golang implementation of libibus Thanks to sarim and haun

Feb 10, 2022
Distributed Systems 2021 -- Miniproject 3

Mini_Project3 == A Distributed Auction System == You must implement a distributed auction system using replication: a distributed component which hand

Dec 1, 2021
Ghdl - A much more convenient way to download GitHub release binaries on the command line, works on Win & Unix-like systems

ghdl Memorize ghdl as github download ghdl is a fast and simple program (and als

Oct 12, 2022
MIT 6.824: Distributed Systems (Spring 2020)

MIT6.824 MIT 6.824: Distributed Systems (Spring 2020) Lab 1 Lab 2 Lab 2A Lab 2B Lab 2C Lab 2D Lab 3 Lab 3A Lab 3B Lab 4 Lab 4A Lab 4B Lab 4 Challenge

Dec 26, 2022
Basic-api-with-go - A basic api with golang

I am creating my first API with GO. Install go get -u github.com/Yefhem/basic-ap

Jan 3, 2022
Go API wrapper for Greenhouse.io API

Greenhouse IO A Go interface to Greenhouse.io's API Useage Creating the Client NewClient accepts: A context; used for any HTTP requests made using the

Jan 14, 2022
Fast conversions across various Go types with a simple API.

Go Package: conv Get: go get -u github.com/cstockton/go-conv Example: // Basic types if got, err := conv.Bool(`TRUE`); err == nil { fmt.Printf("conv.

Nov 29, 2022