Coolprop-oop

Latest version: v2.0.0

Safety actively analyzes 722460 Python packages for vulnerabilities to keep your Python projects secure.

Scan your dependencies

Page 1 of 2

2.0.0

python
from coolprop_oop import StateHA

Create a state
state = StateHA('T', 298.15, 'P', 101325, 'R', 0.5)

Access properties
humidity_ratio = state.get('W')
wet_bulb = state.get('B')
enthalpy = state.get('H')

Get multiple properties in one call
w, b, h = state.get('W', 'B', 'H')


Acknowledgments

We would like to thank all contributors and users who provided feedback and suggestions for this major update. Special thanks to the CoolProp team for maintaining the excellent thermodynamic property library that powers this wrapper.

Future Plans

- Additional helper methods for common calculations
- More specialized fluid property access
- Enhanced visualization tools
- Performance optimizations

---

For more information, please see the [documentation](https://github.com/ryancoxrbc/coolprop_oop) and [examples](https://github.com/ryancoxrbc/coolprop_oop/tree/main/examples).

1.3.0

Overview
Version 1.3.0 introduces significant improvements to the API consistency, removes deprecated features, and enhances the object-oriented interface. This release focuses on stabilizing the API and improving the developer experience.

Major Changes

Class Renaming
- Renamed `StatePROPS` class to `StateProps` for better API consistency
- Updated all references throughout the codebase, documentation, and examples

API Improvements
- Changed constructor parameter order in `StateProps` class for better intuitiveness
- Removed deprecation warning for the `props` parameter in `StateHA` and `StateProps` constructors
- Removed deprecation warning from the `.set()` method (will no longer be removed in version 2.0.0)
- Added full property validation to the `vol` setter in both classes

Property Additions and Fixes
- Implemented proper `vol` property and setter for the `StateProps` class
- Fixed internal handling of volume and density properties
- Enhanced validation logic for all settable properties

Bug Fixes
- Fixed test cases for two-phase region calculations
- Corrected test cases to match the actual behavior of CoolProp
- Fixed property calculation logic in both `StateHA` and `StateProps` classes
- Corrected implementation of class hierarchies in test files

Minor Improvements
- Updated documentation to use `StateProps` consistently
- Enhanced example code with more informative comments
- Improved docstrings for better IDE integration
- Updated all tutorial code to use the newest API conventions

Upgrading
When upgrading from version 1.2.0, users should:
1. Replace all instances of `StatePROPS` with `StateProps` in their code
2. Update constructor calls to use the new parameter order
3. Take advantage of the new property validation in the `vol` setter

Example of New Usage

python
from coolprop_oop import StateProps

Create a state for water at 100°C, 1 atm
water = StateProps(fluid='Water') Fluid name now comes first
water.tempc = 100 Temperature in °C
water.press = 101325 Pressure in Pa

Access properties
print(f"Temperature: {water.tempc:.1f}°C")
print(f"Pressure: {water.press/1e5:.2f} bar")
print(f"Density: {water.dens:.1f} kg/m³")
print(f"Volume: {water.vol:.4f} m³/kg")


Contributors
Thanks to all contributors who helped make this release possible.

1.2.0

Overview

Version 1.2.0 introduces direct setter capability for all thermodynamic properties in the `StateHA` and `StatePROPS` classes, making the library more flexible and intuitive for users. This update allows you to set any derived property (such as enthalpy or entropy) directly and have CoolProp handle the state validation and calculation of dependent properties.

New Features

- **All properties are now directly settable**:
- Added setter methods for previously calculated-only properties in both `StateHA` and `StatePROPS` classes
- New settable properties include:
- `enthalpy`
- `entropy`
- `cp` (specific heat capacity)
- `viscosity`
- `conductivity`
- `prandtl`
- CoolProp automatically handles state validation and calculates dependent properties

- **Enhanced input validation**:
- Added validation for all new settable properties to ensure physically reasonable values
- Prevents setting impossible thermodynamic states
- Provides clear error messages when invalid values are detected

- **Added `__version__` attribute**:
- Package now exposes the version via `coolprop_oop.__version__`

Bug Fixes

- Fixed `dewpoint` property not calculating correctly when it wasn't one of the constraints
- Improved error handling for edge cases in setter methods
- Fixed validation issues for properties with physical constraints

Documentation Updates

- Updated `README.md` to reflect the new ability to set all thermodynamic properties
- Added examples demonstrating how to set derived properties like enthalpy and entropy
- Updated class documentation to include all newly settable properties
- Added new usage examples showing how to use derived properties as constraints

Examples

- Added `example_using_derived_properties()` function to demonstrate:
- Setting humid air states using enthalpy, entropy, and relative humidity
- Setting pure fluid states using enthalpy and entropy
- Working with specific heat capacity as a constraint

Compatibility

- The library continues to depend on CoolProp ≥ 6.7.0
- Requires Python ≥ 3.8

Deprecated Features

- Initializing with property lists (e.g., `StateHA(['P', 101325, 'T', 293.15, 'R', 0.6])`) remains supported but is deprecated and will be removed in version 2.0.0
- The `set()` method remains supported but is deprecated in favor of direct property setters

Upgrade Instructions

To upgrade to the latest version:

bash
pip install --upgrade coolprop-oop


No code changes are required to utilize existing functionality, but users are encouraged to take advantage of the new setter capabilities for derived properties.

1.1.0

Overview

We're excited to announce the release of CoolProp-OOP v1.1.0! This version introduces a major enhancement to the API with a fully object-oriented property-based interface, improved error handling, and better state management.

Key Features

- **New Object-Oriented API**: Fully Pythonic property-based getters and setters replace the previous list-based initialization
- **Comprehensive Property Validation**: Automatic validation of inputs prevents physically impossible states
- **State Constraint Management**: Built-in tracking and management of thermodynamic constraints
- **Advanced Error Handling**: Detailed error messages explain why a state configuration is invalid
- **Improved Performance**: Enhanced property caching reduces calculation overhead
- **New State Information Methods**: Access detailed state information through the `constraints` property

Deprecated Features

- The list-based initialization method (e.g., `StateHA(['P', 101325, 'T', 293.15, 'R', 0.5])`) is now deprecated and will be removed in version 2.0.0
- The `set()` method is deprecated in favor of direct property assignment

Migration Guide

Previous API (Deprecated)

python
Humid Air - Deprecated style
state = StateHA(['P', 101325, 'T', 293.15, 'R', 0.5])

Pure Fluid - Deprecated style
state = StatePROPS(['P', 101325, 'T', 373.15, 'water'])


New API (Recommended)

python
Humid Air - New style
state = StateHA()
state.press = 101325
state.tempc = 20

1.0.0

**Release Date:** 27 Feb 2025

Overview
This release marks the first stable version (1.0.0) of the CoolProp OOP library, providing an object-oriented interface for calculating thermodynamic properties of humid air and pure fluids. This version includes significant improvements, new features, and various bug fixes.

New Features
- **StateHA Class**: Introduced a class for representing the thermodynamic state of humid air, allowing users to easily calculate properties such as temperature, pressure, humidity ratio, and more.
- **StatePROPS Class**: Added a class for representing the thermodynamic state of pure fluids, enabling calculations for properties like density, enthalpy, and entropy.
- **Property Validation**: Implemented decorators for validating input properties, ensuring that values are within physically reasonable ranges before being set.
- **Caching Mechanism**: Introduced a caching mechanism for property getters to improve performance by avoiding redundant calculations.
- **Deprecation Warnings**: Added warnings for deprecated methods to guide users towards preferred practices for setting properties.

Improvements
- Enhanced error handling and informative messages for users when properties are not fully constrained.
- Improved documentation and examples for better usability and understanding of the library's functionality.
- Optimized internal methods for better performance and reliability.

Bug Fixes
- Resolved issues related to property calculations when the state is not fully defined.
- Fixed various minor bugs and improved overall stability of the library.

Breaking Changes
- The `set` method in both `StateHA` and `StatePROPS` classes is now deprecated and will be removed in future versions. Users are encouraged to set properties directly instead.
- The handling of certain properties has been refined, which may affect existing implementations that rely on previous behavior.

Installation
To install the CoolProp OOP library, use the following command:

bash
pip install coolprop-oop


Acknowledgments
We would like to thank all contributors and users for their feedback and support in making this release possible.

0.5

print(state.constraints) ['press', 'relhum', 'tempc']

For pure fluids
state = StatePROPS(fluid='Water')
state.tempc = 100
state.press = 101325
constraints = state.constraints
print(f"Fluid state: {constraints['status']}")
print(f"Set properties: {', '.join(constraints['properties'])}")


Input Validation

The library now validates inputs to prevent physically impossible states:

python
try:
state = StateHA()
state.tempc = -300 Below absolute zero
except ValueError as e:
print(f"Error: {e}") "Error: Temperature cannot be below absolute zero"


Quality of Life Improvements

- Better handling of temperature units (Kelvin and Celsius)
- Improved error messages with suggestions
- Prevention of overconstraining the system
- Comprehensive property validation

Bug Fixes

- Fixed issues with state validation edge cases
- Improved error handling when setting invalid combinations of properties
- Better handling of out-of-range inputs

Documentation

- Updated all documentation to reflect the new API style
- Added comprehensive examples for different property combinations
- Expanded examples for error handling

Coming in Future Versions

- Additional thermodynamic properties and calculation methods
- Further performance optimizations
- Implementation of more complex thermodynamic processes

---

We hope you enjoy using the improved CoolProp-OOP library! As always, we welcome your feedback and contributions.

Page 1 of 2

© 2025 Safety CLI Cybersecurity Inc. All Rights Reserved.