Metadata-Version: 2.4
Name: rtc-tools
Version: 2.8.0rc1
Summary: Toolbox for control and optimization of water systems.
Project-URL: Homepage, https://oss.deltares.nl/web/rtc-tools/home
Project-URL: Download, https://github.com/rtc-tools/rtc-tools/
Author: Deltares
Maintainer: Deltares
License:                    GNU LESSER GENERAL PUBLIC LICENSE
                               Version 3, 29 June 2007
        
         Copyright (C) 2007 Free Software Foundation, Inc. <https://fsf.org/>
         Everyone is permitted to copy and distribute verbatim copies
         of this license document, but changing it is not allowed.
        
        
          This version of the GNU Lesser General Public License incorporates
        the terms and conditions of version 3 of the GNU General Public
        License, supplemented by the additional permissions listed below.
        
          0. Additional Definitions.
        
          As used herein, "this License" refers to version 3 of the GNU Lesser
        General Public License, and the "GNU GPL" refers to version 3 of the GNU
        General Public License.
        
          "The Library" refers to a covered work governed by this License,
        other than an Application or a Combined Work as defined below.
        
          An "Application" is any work that makes use of an interface provided
        by the Library, but which is not otherwise based on the Library.
        Defining a subclass of a class defined by the Library is deemed a mode
        of using an interface provided by the Library.
        
          A "Combined Work" is a work produced by combining or linking an
        Application with the Library.  The particular version of the Library
        with which the Combined Work was made is also called the "Linked
        Version".
        
          The "Minimal Corresponding Source" for a Combined Work means the
        Corresponding Source for the Combined Work, excluding any source code
        for portions of the Combined Work that, considered in isolation, are
        based on the Application, and not on the Linked Version.
        
          The "Corresponding Application Code" for a Combined Work means the
        object code and/or source code for the Application, including any data
        and utility programs needed for reproducing the Combined Work from the
        Application, but excluding the System Libraries of the Combined Work.
        
          1. Exception to Section 3 of the GNU GPL.
        
          You may convey a covered work under sections 3 and 4 of this License
        without being bound by section 3 of the GNU GPL.
        
          2. Conveying Modified Versions.
        
          If you modify a copy of the Library, and, in your modifications, a
        facility refers to a function or data to be supplied by an Application
        that uses the facility (other than as an argument passed when the
        facility is invoked), then you may convey a copy of the modified
        version:
        
           a) under this License, provided that you make a good faith effort to
           ensure that, in the event an Application does not supply the
           function or data, the facility still operates, and performs
           whatever part of its purpose remains meaningful, or
        
           b) under the GNU GPL, with none of the additional permissions of
           this License applicable to that copy.
        
          3. Object Code Incorporating Material from Library Header Files.
        
          The object code form of an Application may incorporate material from
        a header file that is part of the Library.  You may convey such object
        code under terms of your choice, provided that, if the incorporated
        material is not limited to numerical parameters, data structure
        layouts and accessors, or small macros, inline functions and templates
        (ten or fewer lines in length), you do both of the following:
        
           a) Give prominent notice with each copy of the object code that the
           Library is used in it and that the Library and its use are
           covered by this License.
        
           b) Accompany the object code with a copy of the GNU GPL and this license
           document.
        
          4. Combined Works.
        
          You may convey a Combined Work under terms of your choice that,
        taken together, effectively do not restrict modification of the
        portions of the Library contained in the Combined Work and reverse
        engineering for debugging such modifications, if you also do each of
        the following:
        
           a) Give prominent notice with each copy of the Combined Work that
           the Library is used in it and that the Library and its use are
           covered by this License.
        
           b) Accompany the Combined Work with a copy of the GNU GPL and this license
           document.
        
           c) For a Combined Work that displays copyright notices during
           execution, include the copyright notice for the Library among
           these notices, as well as a reference directing the user to the
           copies of the GNU GPL and this license document.
        
           d) Do one of the following:
        
               0) Convey the Minimal Corresponding Source under the terms of this
               License, and the Corresponding Application Code in a form
               suitable for, and under terms that permit, the user to
               recombine or relink the Application with a modified version of
               the Linked Version to produce a modified Combined Work, in the
               manner specified by section 6 of the GNU GPL for conveying
               Corresponding Source.
        
               1) Use a suitable shared library mechanism for linking with the
               Library.  A suitable mechanism is one that (a) uses at run time
               a copy of the Library already present on the user's computer
               system, and (b) will operate properly with a modified version
               of the Library that is interface-compatible with the Linked
               Version.
        
           e) Provide Installation Information, but only if you would otherwise
           be required to provide such information under section 6 of the
           GNU GPL, and only to the extent that such information is
           necessary to install and execute a modified version of the
           Combined Work produced by recombining or relinking the
           Application with a modified version of the Linked Version. (If
           you use option 4d0, the Installation Information must accompany
           the Minimal Corresponding Source and Corresponding Application
           Code. If you use option 4d1, you must provide the Installation
           Information in the manner specified by section 6 of the GNU GPL
           for conveying Corresponding Source.)
        
          5. Combined Libraries.
        
          You may place library facilities that are a work based on the
        Library side by side in a single library together with other library
        facilities that are not Applications and are not covered by this
        License, and convey such a combined library under terms of your
        choice, if you do both of the following:
        
           a) Accompany the combined library with a copy of the same work based
           on the Library, uncombined with any other library facilities,
           conveyed under the terms of this License.
        
           b) Give prominent notice with the combined library that part of it
           is a work based on the Library, and explaining where to find the
           accompanying uncombined form of the same work.
        
          6. Revised Versions of the GNU Lesser General Public License.
        
          The Free Software Foundation may publish revised and/or new versions
        of the GNU Lesser General Public License from time to time. Such new
        versions will be similar in spirit to the present version, but may
        differ in detail to address new problems or concerns.
        
          Each version is given a distinguishing version number. If the
        Library as you received it specifies that a certain numbered version
        of the GNU Lesser General Public License "or any later version"
        applies to it, you have the option of following the terms and
        conditions either of that published version or of any later version
        published by the Free Software Foundation. If the Library as you
        received it does not specify a version number of the GNU Lesser
        General Public License, you may choose any version of the GNU Lesser
        General Public License ever published by the Free Software Foundation.
        
          If the Library as you received it specifies that a proxy can decide
        whether future versions of the GNU Lesser General Public License shall
        apply, that proxy's public statement of acceptance of any version is
        permanent authorization for you to choose that version for the
        Library.
License-File: AUTHORS
License-File: COPYING
License-File: COPYING.LESSER
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Information Technology
Classifier: Intended Audience :: Science/Research
Classifier: License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
Classifier: Operating System :: MacOS
Classifier: Operating System :: Microsoft :: Windows
Classifier: Operating System :: POSIX
Classifier: Operating System :: Unix
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Scientific/Engineering :: GIS
Classifier: Topic :: Scientific/Engineering :: Mathematics
Classifier: Topic :: Scientific/Engineering :: Physics
Requires-Python: >=3.10
Requires-Dist: casadi!=3.6.6,<3.8,>=3.6.3
Requires-Dist: defusedxml>=0.7.0
Requires-Dist: numpy>=1.21.2
Requires-Dist: pymoca==0.9.*,>=0.9.1
Requires-Dist: rtc-tools-channel-flow>=1.2.0
Requires-Dist: rtc-tools-standard-library>=0.1.2
Requires-Dist: scipy>=1.7.2
Provides-Extra: all
Requires-Dist: netcdf4; extra == 'all'
Provides-Extra: netcdf
Requires-Dist: netcdf4; extra == 'netcdf'
Description-Content-Type: text/markdown

<p align="center">
  <img src="doc/images/rtc-tools-horizontal-color.svg" alt="RTC-Tools logo" width="70%">
</p>

[![Pipeline](https://github.com/rtc-tools/rtc-tools/actions/workflows/ci.yml/badge.svg)](https://github.com/rtc-tools/rtc-tools/actions/workflows/ci.yml)
[![TeamCity](https://dpcbuild.deltares.nl/app/rest/builds/buildType:RTCT_RtcTools2_RtcToolsFullModelTests/statusIcon.svg)](https://dpcbuild.deltares.nl/buildConfiguration/RTCT_RtcTools2_RtcToolsFullModelTests)
[![SonarCloud Alert Status](https://sonarcloud.io/api/project_badges/measure?project=rtc-tools_rtc-tools&metric=alert_status)](https://sonarcloud.io/summary/new_code?id=rtc-tools_rtc-tools)
[![Coverage](https://sonarcloud.io/api/project_badges/measure?project=rtc-tools_rtc-tools&metric=coverage)](https://sonarcloud.io/summary/new_code?id=rtc-tools_rtc-tools)
[![PyPI](https://img.shields.io/pypi/v/rtc-tools)](https://pypi.org/project/rtc-tools/)
[![PyPI Downloads](https://static.pepy.tech/badge/rtc-tools/month)](https://pepy.tech/project/rtc-tools)
[![Python](https://img.shields.io/pypi/pyversions/rtc-tools)](https://pypi.org/project/rtc-tools/)
[![License: LGPL v3](https://img.shields.io/badge/License-LGPL_v3-blue.svg)](https://www.gnu.org/licenses/lgpl-3.0)
[![LFX Health Score](https://insights.linuxfoundation.org/api/badge/health-score?project=rtc-tools)](https://insights.linuxfoundation.org/project/rtc-tools)

> **NOTE** The RTC-Tools repository has been migrated from GitLab to here;
see [Migration from GitLab](#migration-from-gitlab).

## Project Overview

RTC-Tools is an open-source Python package designed to model, simulate, and optimize networks or portfolios of assets, such as reservoirs, pumps, renewables, and batteries. It is part of [LF Energy](https://lfenergy.org/projects/rtc-tools/).

## Project Description

RTC-Tools provides a modular and extensible framework for operational optimization and control of complex systems across multiple domains, with a primary focus on water management and energy systems. Originally initiated at [Deltares](https://www.deltares.nl/) in 2015, RTC-Tools is deployed for water and power trading applications globally, with active implementations in North and South America, Europe, Asia, and Australia.

### Application Domains

- **Water Management**: Model-predictive control of canals, polders, reservoirs, hydropower scheduling, and pumped storage systems, including turbines, pumps, weirs, and other hydraulic structures.
- **Energy Systems**: Battery Energy Storage System (BESS) optimization, power trading, heat network design, and multi-energy system planning.

### Multi-Domain Modeling Libraries

RTC-Tools offers extensible libraries for building complex system models using model components. Implement custom model components, linear or nonlinear, using the [Modelica](https://modelica.org/language/) systems modeling language or directly using the Python API.

The following modeling libraries are available (this list is non-exhaustive):

- [RTC-Tools Channel Flow](https://github.com/Deltares/rtc-tools-channel-flow): Hydraulic channel flow and water level dynamics
- [RTC-Tools Hydraulic Structures](https://rtc-tools-hydraulic-structures.readthedocs.io/en/latest/): Hydraulic assets such as weirs, pumps, and other control structures
- [RTC-Tools Simulation](https://rtc-tools-simulation.readthedocs.io/en/latest/): Reservoir and system simulation workflows
- [Mesido](https://github.com/Multi-Energy-Systems-Optimization/mesido): Heat network design and multi-energy system optimization
- [BESS Trading Examples](https://portfolioenergy-bess-demo.readthedocs.io/en/latest/): Battery energy storage trading formulations for NEM (Australia), ERCOT (Texas), and EU-style markets

### Core Capabilities

- **Simulation**: Simulate a given model to analyze system behavior over time.

- **Optimization**: Define optimization goals, constraints, and decision variables to specify optimization models for a given problem. RTC-Tools is solver-agnostic and supports both open-source solvers (CBC, HiGHS, Ipopt) and commercial solvers (Gurobi, CPLEX, Knitro) for solving several types of optimization problems:

    - **Linear and non-linear**: RTC-Tools supports both linear and non-linear optimization problems.

    - **Continuous and discrete**: RTC-Tools can handle both continuous and discrete decision variables. This makes it suitable for optimizing systems with a mix of continuous controls (such as pump speeds or gate positions) and discrete decisions (such as on/off states of equipment).

- **Multi-Objective Optimization**: When multiple, and perhaps conflicting, objectives need to be considered (e.g., minimize operational costs while minimizing deviations of water levels from a given range), RTC-Tools offers two approaches:
    - **Weighting method**: Assigns weights to each objective and optimizes them simultaneously.
    - **Lexicographic goal programming**: Optimizes different objectives sequentially according to a user-defined priority ordering.

- **Optimization Under Uncertainty**: RTC-Tools supports multi-stage stochastic optimization that uses ensemble forecasts to compute solutions that are robust under uncertainty. Features include control tree generation and aggregation. Optional risk constraints such as Conditional Value at Risk (CVaR) can be implemented depending on the user's specific formulation.

### Integration

To streamline integration with user interfaces and data management systems (such as Delft-FEWS), RTC-Tools supports CSV and XML file formats for reading/writing timeseries and other model parameters. Support for other formats can be implemented using Python mixins.

RTC-Tools uses [CasADi](https://web.casadi.org/) as a symbolic framework for algorithmic differentiation, as well as for interfacing with numerical optimization solvers.


## Install

```bash
pip install rtc-tools
```

## Documentation

Documentation and examples are available at:
- [Stable documentation](https://rtc-tools.readthedocs.io/en/stable/)
- [Latest documentation](https://rtc-tools.readthedocs.io/en/latest/)

## Contributing

We welcome contributions to RTC-Tools! Please see our [Contributing Guidelines](CONTRIBUTING.md) for details on how to get started, coding standards, and our development process.

The project is governed according to our [Technical Charter](CHARTER.md) and [Governance Model](GOVERNANCE.md).


## Migration from GitLab

The RTC-Tools repository has been migrated from GitLab (https://gitlab.com/rtc-tools/rtc-tools)
to here.
To change the Git remote URL, run

`git remote set-url origin https://github.com/rtc-tools/rtc-tools.git`

and

`git remote set-url --push origin https://github.com/rtc-tools/rtc-tools.git`.


## License
RTC-Tools is licensed under the **[GNU Lesser General Public License v3.0](COPYING)**,
and can be used free of charge.


## Support

### Community Support

For questions, issues, and discussions, please use:
- [GitHub Issues](https://github.com/rtc-tools/rtc-tools/issues) for bug reports and feature requests
- [GitHub Discussions](https://github.com/rtc-tools/rtc-tools/discussions) for questions and community discussions

### Commercial Support

For applications in water management and hydropower, [Deltares](https://www.deltares.nl/) offers commercial support.

For applications in power trading and Battery Energy Storage Systems (BESS), [PortfolioEnergy](https://www.portfolioenergy.com/) offers commercial support.


## Governance & Roadmap

RTC-Tools development follows an open governance model as defined in our [Technical Charter](CHARTER.md) and [Governance](GOVERNANCE.md) documents.

To learn more about the project roadmap:

- Review the [roadmap discussion](https://github.com/rtc-tools/rtc-tools/discussions/1725)
- Check [project milestones](https://github.com/rtc-tools/rtc-tools/milestones)


## Ecosystem & Collaboration

RTC-Tools is part of the LF Energy ecosystem and actively welcomes collaboration from researchers, practitioners, and organizations working on optimization—whether in general or in specialized fields—and on applied domains such as water and energy system planning and control. We encourage contributions that extend the framework’s capabilities—such as new modeling libraries, integrations, and advanced extensions—to broaden its reach and impact.


## Acknowledgment

If you use RTC-Tools in your work, please acknowledge it in any resulting publications. You can do this by citing the RTC-Tools software and providing a link to our [GitHub repository](https://github.com/rtc-tools/rtc-tools).
