Source code for viiapackage.supports.pile_foundation.pile_properties.plot_force_elongation_diagram

### ===================================================================================================================
###   Connect the coordinates for the foundation to the foundation strip
### ===================================================================================================================
# Copyright ©VIIA 2024

### ===================================================================================================================
###   1. Import modules
### ===================================================================================================================

# General imports
from __future__ import annotations
from pathlib import Path
from typing import TYPE_CHECKING, List

# References for functions and classes in the rhdhv_fem package
from rhdhv_fem.fem_config import Config

# References for functions and classes in the viiaPackage
if TYPE_CHECKING:
    from viiapackage.viiaStatus import ViiaProject


### ===================================================================================================================
###   2. Function to create plot of the pile force-elongation diagram applied in the model
### ===================================================================================================================

[docs]def viia_plot_force_elongation_diagram( project: ViiaProject, pile_group: str, x_backbone: List[float], y_backbone: List[float], x_elastic: List[float], y_elastic: List[float], x_plastic: List[float], y_plastic: List[float]) -> Path: """ This function creates a plot of the force elongation diagram provided by the geotechnical advisor, including the unloading stiffness diagram and derived plastic diagram used in the subroutine. Plot is saved in pile-properties folder in the workfolder. """ # Switch to a non-interactive backend to properly import matplotlib.pyplot import matplotlib matplotlib.use(Config.MPL_NONINTERACTIVE(notify=False)) import matplotlib.pyplot as plt # Initiate plot plt.close() # Apply VIIA graph style style_file = Path(project.viia_settings.project_specific_package_location) / 'viiaGraph.mplstyle' plt.style.use(style_file.as_posix()) # Plot the values fig, ax = plt.subplots(figsize=(15, 15)) ax.plot(x_backbone, y_backbone, marker='o', alpha=0.7, label='Backbone force-elongation diagram geo') ax.plot(x_plastic, y_plastic, marker='o', alpha=0.7, label='Plastic force-elongation diagram') ax.plot(x_elastic, y_elastic, marker='o', alpha=0.7, label='Elastic unloading diagram') # Set the axes labels ax.set_xlabel('Elongation [m]') ax.set_ylabel('Force [N]') fig.suptitle( f"Force elongation diagram pile-group {pile_group} of {project.name}, " f"{project.project_information['objectdeel']}") # Add a legend ax.legend(markerscale=4) # Limit the diagram to the interesting part ax.set_xlim([min(x_plastic + x_backbone), min(0.1, max(x_plastic + x_backbone))]) ax.set_ylim([min(y_plastic + y_backbone), max(y_plastic + y_backbone)]) # Set the location where to save the graphs save_folder = project.workfolder_location / 'Pile properties' save_folder.mkdir(parents=True, exist_ok=True) # Create the graphs image = save_folder / f"{project.name}_{project.project_information['objectdeel']}_pilegroup_{pile_group}.png" fig.savefig(image, format='png') return image
### =================================================================================================================== ### 3. End of script ### ===================================================================================================================