Skip to main content

Library for dynamic optimization/simulation

Project description

Cacao framework

A library for dynamic simulation/ optimization.

Installation

pip install cacao

Get started

Simulation of gravity drained tank, initially filed with water 10 meters high. The tank has constant cross-section (16 m^2) and an orifice at the bottom with 5 cm^2 area. Example extracted from:

Himmelblau, D. M., & Riggs, J. B. (2006). Basic principles and calculations in chemical engineering. FT press.

# imports
import numpy as np
import matplotlib.pyplot as plt

from cacao import Composite, SimulationProblem
from cacao.components import Tank, Orifice, Material, Content

model = Composite()
model.time = np.linspace(0, 8e4, 50)

# tank
water = Material(rho=1000)
area = 16 # m^2
initial_volume = 10*area
content_tank = Content(water, volume=initial_volume)  
tank = Tank( model.time, area, content_tank)

# orifice
A_orifice = 5e-4 # m2
c = 0.62 # orifice flow coefficient
orifice = Orifice(model.time, A_orifice, c)

model.tank = tank
model.orifice = orifice
model.connect(tank, orifice)

sim = SimulationProblem(model)

result = sim.run()
model.change_inputs(result.x)


plt.plot(model.time, model.tank1.height())
plt.show()

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

cacao-0.0.5.tar.gz (467.1 kB view details)

Uploaded Source

Built Distribution

cacao-0.0.5-py3-none-any.whl (24.5 kB view details)

Uploaded Python 3

File details

Details for the file cacao-0.0.5.tar.gz.

File metadata

  • Download URL: cacao-0.0.5.tar.gz
  • Upload date:
  • Size: 467.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for cacao-0.0.5.tar.gz
Algorithm Hash digest
SHA256 ac3b2910dee0ba60ed44473bc93ebaec7eef1a9df44820d29e43b1f30cc7e967
MD5 a1a887387adc0da08ed6ec7731391aff
BLAKE2b-256 a918eba1402370d2cd2a263ee2b44621a8ee248b184a9c79d51464610eee7271

See more details on using hashes here.

File details

Details for the file cacao-0.0.5-py3-none-any.whl.

File metadata

  • Download URL: cacao-0.0.5-py3-none-any.whl
  • Upload date:
  • Size: 24.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/4.8.2 pkginfo/1.8.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.8.10

File hashes

Hashes for cacao-0.0.5-py3-none-any.whl
Algorithm Hash digest
SHA256 ea9f9e8a0d98c79c8bbff6632dc0d014b0968621f4fb68c484eabbebe8e23fba
MD5 a5652e642ee2db2ef8b15d8b8dcbf6c2
BLAKE2b-256 f2993991517ce2a2fbcc8b2f28f6e6456e2589553cc1d5f07315c4622502e845

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page