Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
RickDGO committed Oct 16, 2024
2 parents cdd3b71 + be84fc6 commit 2e31e61
Show file tree
Hide file tree
Showing 7 changed files with 231 additions and 26 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,13 @@ instance/

# Sphinx documentation
docs/_build/
docs/source/gen/*

# PyBuilder
.pybuilder/
target/


# Jupyter Notebook
.ipynb_checkpoints

Expand Down
69 changes: 55 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,54 @@
<img alt="blueprints banner" src="docs/source/_static/blueprints_banner.png">
</picture>

Can someone explain to me why Eurocode is not publicly available in code and that all of us are coding Eurocode with massive maintenance costs
and shortages in technical personnel? Well, no longer!
Welcome to `Blueprints`, the go-to repository for civil engineering professionals and enthusiasts!

Welcome to Blueprints, the cornerstone repository for civil engineering professionals and enthusiasts alike!
It includes programmable engineering standards, formulas, tables, and checks across a variety of structural and geotechnical disciplines. We offer
tools for materials, geometry, and section checks, as well as a foundation of essential use cases designed to meet all key engineering needs.

Blueprints is a collaboration of several engineering companies which contains programmable Eurocode information such as tables, figures and
formulas. It also provides materials, geometry and even section checks. The basis as well as the implemented use cases provide all key
necessities for the civil engineer.
Blueprints is a collaborative effort between several engineering companies to streamline code, documentation, and knowledge sharing—helping you focus on the work that matters most.

Blueprints is more than just a tool, it's a growing community of engineers working together to solve real-world challenges. We believe that by
sharing knowledge and collaborating, we can eliminate inefficiencies like re-inventing the wheel or relying on cumbersome tools like Excel for complex calculations.

Join us in this effort to build a future where engineering standards are programmable, accessible, and shared. Whether you're an industry expert or a curious enthusiast, your contributions can help drive innovation and reduce the technical overhead we all face.

Stop coding civil engineering logic from scratch, ditch Excel, and start collaborating to shape the future of civil engineering! 🚀

## Mission

Our mission is to:
Our mission is to reduce the cost and time associated with civil engineering calculations by:

- Offering a robust suite of tools that encapsulate both basic and advanced engineering tasks.
- Providing an open-source alternative to expensive proprietary tools, with a high level of accuracy and full transparency.
- Standardizing programmable civil engineering implementations, minimizing redundancy and eliminating knowledge silos.
- Fostering a community where sharing knowledge and best practices is the norm, not the exception.
- Ensuring 100% code coverage and high-quality documentation for a seamless user experience.

## (Upcoming) Features

* Eurocode formulas:
* NEN-EN 1992-1-1+C2:2011 :construction:
* NEN-EN 1993-1-1+C2+A1:2016 :construction:
* NEN-EN 1993-1-9+C2:2012 :construction:
* NEN-EN 1993-5:2008 :construction:
* NEN 9997-1+C2:2017 :construction:

- Offer a robust suite of tools and libraries that encapsulate common and advanced engineering tasks.
- Foster a community where sharing knowledge and best practices is the norm, not the exception.
- Provide a solid foundation of code and documentation that adheres to the highest quality standards (100% code coverage).
* Reinforced Concrete Section :construction:
* Rectangular section :heavy_check_mark:
* Circular section :x:

* Strain-stress analysis for reinforced concrete sections:
* Rectangular section :construction:
* Circular section :x:

* Concrete checks:
* Nominal concrete cover (NEN-EN 1992-1-1: Chapter 4) :construction:

* Common calculations:
* L-walls :x:
* Spring constants calculations for piles :x:
* Sheet-pile checks (strength, stability, deflection, local buckling, etc.) :x:

## Installation

Expand Down Expand Up @@ -62,7 +94,15 @@ figures for streamlined access and reference.

## Contributing

Contributions are very welcome. To learn more, see the [Contributor Guide](CONTRIBUTING.md).
We welcome contributions from developers and engineers of all skill levels! Here’s how you can contribute:

- Fork the Repository: Create your own fork of the project.
- Create a Branch: Make a feature branch (git checkout -b feature/new-feature).
- Make Your Changes: Write clear, concise code and ensure it’s fully covered with tests.
- Run Tests: Use pytest to ensure all tests pass.
- Submit a Pull Request: Push your branch and open a pull request against main.

To learn more, see the [Contributor Guide](CONTRIBUTING.md).

## License

Expand All @@ -86,10 +126,11 @@ By using the Blueprints package, you are agreeing to the following:

2. **Adherence to Laws and Regulations**: At all times, the user is fully responsible for the adherence to (local) laws and regulations. It is the user's responsibility to ensure that their use of Blueprints complies with all relevant legal and regulatory requirements.

3. **Outdated Results**: Results may be outdated due to circumstances, changes in rules and regulations, and/or changes in the Eurocodes and/or national annexes. Users should always verify the results and not solely rely on the output from the Blueprints package.
3. **Outdated Results**: Results may be outdated due to circumstances, changes in rules and regulations, and/or changes in the codes and/or national
annexes. Users should always verify the results and not solely rely on the output from Blueprints.

4. **Agreement to Terms**: When using Blueprints, you agree to the terms and conditions of the [license](LICENSE) and this disclaimer. If you do not agree with these terms, please do not use the Blueprints package.
4. **Agreement to Terms**: When using Blueprints, you agree to the terms and conditions of the [license](LICENSE) and this disclaimer.

5. **Warrenties**: The Blueprins package is provided as is without any warrenties of any kind, either expressed or implied.
5. **Warranties**: Blueprints is provided as is without any warranties of any kind, either expressed or implied.

Please note that this disclaimer is intended to be as broad and inclusive as permitted by the law of the jurisdiction in which you reside. If any portion of this disclaimer is held invalid, the remainder shall continue in full legal force and effect.
1 change: 0 additions & 1 deletion blueprints/codes/cur/__init__.py

This file was deleted.

1 change: 0 additions & 1 deletion blueprints/codes/cur/cur_166/__init__.py

This file was deleted.

23 changes: 13 additions & 10 deletions blueprints/codes/latex_formula.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
@dataclass(frozen=True)
class LatexFormula:
"""Latex formula representation.
Depending on the context this could include the unit, the formula, the result, etc.
Attributes
Expand All @@ -28,6 +29,7 @@ class LatexFormula:
equation: str = ""
numeric_equation: str = ""
comparison_operator_label: str = "="
unit: str = ""

@property
def complete(self) -> str:
Expand All @@ -39,13 +41,9 @@ def complete(self) -> str:
Return symbol = equation = numeric_equation = result
"""
all_sub_equations = [
self.return_symbol,
self.equation,
self.numeric_equation,
self.result,
]
return f" {self.comparison_operator_label} ".join([eq for eq in all_sub_equations if eq != ""])
all_sub_equations = [self.return_symbol, self.equation, self.numeric_equation, f"{self.result}"]
long_formula = f" {self.comparison_operator_label} ".join([eq for eq in all_sub_equations if eq != ""])
return long_formula + f" {self.unit}" if self.unit else long_formula

@property
def short(self) -> str:
Expand All @@ -57,7 +55,8 @@ def short(self) -> str:
Return symbol = result
"""
return f"{self.return_symbol} {self.comparison_operator_label} {self.result}"
short_formula = f"{self.return_symbol} {self.comparison_operator_label} {self.result}"
return short_formula + f" {self.unit}" if self.unit else short_formula

def __str__(self) -> str:
"""String representation of the formula."""
Expand Down Expand Up @@ -88,7 +87,9 @@ def latex_fraction(numerator: str | float, denominator: str | float) -> str:
return f"\\frac{{{numerator}}}{{{denominator}}}"

def latex_min_curly_brackets(*args: str | float) -> str:
r"""Return a string which will output: min{arg_1; arg_2; ...; arg_N} in latex and it will also automatically ensure floats are converted to latex
r"""Return a string which will output: min{arg_1; arg_2; ...; arg_N} in latex.
It will also automatically ensure floats are converted to latex
text.
Examples
Expand All @@ -111,7 +112,9 @@ def latex_min_curly_brackets(*args: str | float) -> str:


def latex_max_curly_brackets(*args: str | float) -> str:
r"""Return a string which will output: max{arg_1; arg_2; ...; arg_N} in latex and it will also automatically ensure floats are converted to latex
r"""Return a string which will output: max{arg_1; arg_2; ...; arg_N} in latex.
It will also automatically ensure floats are converted to latex
text.
Examples
Expand Down
96 changes: 96 additions & 0 deletions blueprints/materials/soil.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,96 @@
"""Module containing definitions of soil types and soil materials."""

from dataclasses import dataclass
from enum import Enum


class SoilMainTypes(Enum):
"""Soil types based on grain size, representing the main portion of the soil mix."""

GRAVEL = "Gravel"
SAND = "Sand"
SILT = "Silt"
LOAM = "Loam"
CLAY = "Clay"
PEAT = "Peat"


class SoilMinorCompositions(Enum):
"""Soil minor compositions, representing the minor portion of the soil mix."""

CLEAN = "Clean"

SLITGHTLY_SILTY = "Slightly silty"
VERY_SILTY = "Very silty"

SLIGHTLY_CLAYEY = "Slightly clayey"
VERY_CLAYEY = "Very clayey"

SLIGHTLY_SANDY = "Slightly sandy"
VERY_SANDY = "Very sandy"

ORGANIC = "Organic"


class SoilConsolidationStates(Enum):
"""Consolidation states of the soil."""

UNCONSOLIDATED = "Unconsolidated"
NORMALLY_CONSOLIDATED = "Normally consolidated"
SLIGHTLY_OVERCONSOLIDATED = "Slightly consolidated"
MODERATELY_OVERCONSOLIDATED = "Moderately overconsolidated"
HIGHLY_OVERCONSOLIDATED = "Highly consolidated"


class SoilConsistencies(Enum):
"""Consistencies of the soil."""

# Clay-like consistencies
VERY_SOFT = "Very soft"
SOFT = "Soft"
MEDIUM_STIFF = "Medium stiff"
STIFF = "Stiff"
HARD = "Hard"

# Sand-like consistencies
VERY_LOOSE = "Very loose"
LOOSE = "Loose"
MEDIUM_DENSE = "Medium dense"
DENSE = "Dense"
VERY_DENSE = "Very dense"


@dataclass
class SoilType:
"""Class representing a soil type.
Parameters
----------
main_type : SoilMainTypes
The soil type of the main portion of the soil mix.
minor_composition : SoilMinorCompositions, optional
The composition of the minor portion of the soil mix, by default None.
consolidation_state : SoilConsolidationStates, optional
The consolidation state of the soil, by default None.
consistency : SoilConsistencies, optional
The consistency of the soil, by default None.
description : str, optional
The custom description of the soil, by default None.
"""

main_type: SoilMainTypes
minor_composition: SoilMinorCompositions | None = None
consolidation_state: SoilConsolidationStates | None = None
consistency: SoilConsistencies | None = None
description: str | None = None

@property
def default_description(self) -> str:
"""The default description of the soil type based on the `main_type`, `minor_composition`, `consolidation_state`, and `consistency`."""
default_description = self.main_type.value

for prop in [self.minor_composition, self.consolidation_state, self.consistency]:
if prop is not None:
assert isinstance(prop, Enum)
default_description += ", " + prop.value
return default_description
65 changes: 65 additions & 0 deletions tests/materials/test_soil.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
"""Tests of the materials soil module."""

import pytest

from blueprints.materials.soil import SoilConsistencies, SoilConsolidationStates, SoilMainTypes, SoilMinorCompositions, SoilType


class TestSoilType:
"""Tests for the SoilType class."""

@pytest.mark.parametrize(
("main_type", "minor_composition", "consolidation_state", "consistency", "description"),
[
(SoilMainTypes.SAND, SoilMinorCompositions.CLEAN, None, SoilConsistencies.LOOSE, None),
(SoilMainTypes.LOAM, SoilMinorCompositions.VERY_SANDY, None, None, None),
(SoilMainTypes.PEAT, None, SoilConsolidationStates.NORMALLY_CONSOLIDATED, None, None),
(SoilMainTypes.PEAT, None, SoilConsolidationStates.NORMALLY_CONSOLIDATED, None, "Veen, nvt"),
],
)
def test_soil_type_init_valid_input(
self,
main_type: SoilMainTypes,
minor_composition: SoilMinorCompositions,
consolidation_state: SoilConsolidationStates | None,
consistency: SoilConsistencies | None,
description: str | None,
) -> None:
"""Tests initialization of SoilType for valid input."""
# Giving None as input
soil_type = SoilType(
main_type=main_type,
minor_composition=minor_composition,
consolidation_state=consolidation_state,
consistency=consistency,
description=description,
)

assert soil_type

@pytest.mark.parametrize(
("main_type", "minor_composition", "consolidation_state", "consistency", "expected_default_description"),
[
(SoilMainTypes.CLAY, None, None, None, "Clay"),
(SoilMainTypes.LOAM, SoilMinorCompositions.VERY_SANDY, None, None, "Loam, Very sandy"),
(SoilMainTypes.SAND, SoilMinorCompositions.CLEAN, None, SoilConsistencies.LOOSE, "Sand, Clean, Loose"),
(SoilMainTypes.PEAT, None, SoilConsolidationStates.NORMALLY_CONSOLIDATED, None, "Peat, Normally consolidated"),
],
)
def test_soil_type_default_description(
self,
main_type: SoilMainTypes,
minor_composition: SoilMinorCompositions,
consolidation_state: SoilConsolidationStates | None,
consistency: SoilConsistencies | None,
expected_default_description: str,
) -> None:
"""Tests the property method `default_description` of SoilType."""
soil_type = SoilType(
main_type=main_type,
minor_composition=minor_composition,
consolidation_state=consolidation_state,
consistency=consistency,
)

assert soil_type.default_description == expected_default_description

0 comments on commit 2e31e61

Please sign in to comment.