# Twine

⚠️ **Disclaimer**: Twine is in early development and subject to frequent breaking changes.

## What is Twine?

Twine is an open-source Rust framework for functional and composable system modeling.
It enables engineers and researchers to build complex system models from simple, reusable building blocks.
By emphasizing functional purity and strong typing, Twine makes models more reliable, testable, and easier to understand.

## A Functional Approach to System Modeling

Twine models systems as compositions of functions with strongly typed inputs and outputs that are deterministic, always returning the same output for the same input.
This functional approach allows users to build and understand larger systems from simple, reusable parts by ensuring:

- **Testability:** Deterministic functions are easier to test in isolation since they have no hidden state or side effects.
- **Parallelism:** Independent functions can be executed concurrently without race conditions.
- **Composability:** System models can be built hierarchically from simple, reusable parts.
- **Reliability:** Pure functions eliminate side effects and make models more predictable.

## Models and Simulations

Component functions can be combined into a `Model` that represents a complete system's behavior.
Twine provides built-in numerical integration to evolve a `Model` over time through a `Simulation`,
enabling seamless simulation of dynamic systems while preserving functional purity.

## Built-in Components

Though still early in development, Twine’s component library is designed to support a broad range of common system modeling needs, including:

- **Controllers:** Thermostats, PID controllers, etc.
- **Schedules:** Weekly and daily schedules, time-based control, etc.  
- **Thermal:** Storage tanks, heat exchangers, mixing valves, etc.

Twine also provides a consistent API for thermodynamic and fluid property modeling, designed to integrate with libraries such as REFPROP, CoolProp, and FIT.
Support for these integrations is coming soon.
