Spaces:
Sleeping
Sleeping
Update app.py
Browse filesHopefully, it will work.
app.py
CHANGED
|
@@ -4,7 +4,7 @@ import requests
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
-
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
@@ -34,6 +34,66 @@ def get_current_time_in_timezone(timezone: str) -> str:
|
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
| 36 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 37 |
final_answer = FinalAnswerTool()
|
| 38 |
|
| 39 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|
|
|
|
| 4 |
import pytz
|
| 5 |
import yaml
|
| 6 |
from tools.final_answer import FinalAnswerTool
|
| 7 |
+
from math import sqrt
|
| 8 |
from Gradio_UI import GradioUI
|
| 9 |
|
| 10 |
# Below is an example of a tool that does nothing. Amaze us with your creativity !
|
|
|
|
| 34 |
return f"Error fetching time for timezone '{timezone}': {str(e)}"
|
| 35 |
|
| 36 |
|
| 37 |
+
@tool
|
| 38 |
+
def evaluate_hydraulic_aggregate(dp: float, dh: float, dt: float, P_in: float, n: float,
|
| 39 |
+
E_dp: float, E_dh: float, E_dt: float, E_P_in: float, E_n: float) -> str:
|
| 40 |
+
"""Evaluates a hydraulic aggregate measurement based on given parameters.
|
| 41 |
+
|
| 42 |
+
This tool calculates key performance indicators such as:
|
| 43 |
+
- Volumetric efficiency
|
| 44 |
+
- Volume flow rate
|
| 45 |
+
- Useful power output
|
| 46 |
+
- Total efficiency
|
| 47 |
+
It also determines the associated measurement errors using error propagation formulas.
|
| 48 |
+
|
| 49 |
+
This function is specifically designed for hydraulic aggregate measurements.
|
| 50 |
+
|
| 51 |
+
Args:
|
| 52 |
+
dp (float): Pressure difference in bar.
|
| 53 |
+
dh (float): Height difference in mm.
|
| 54 |
+
dt (float): Time difference in seconds.
|
| 55 |
+
P_in (float): Input power in kW.
|
| 56 |
+
n (float): Rotational speed in RPM.
|
| 57 |
+
E_dp (float): Error in pressure measurement.
|
| 58 |
+
E_dh (float): Error in height measurement.
|
| 59 |
+
E_dt (float): Error in time measurement.
|
| 60 |
+
E_P_in (float): Error in input power measurement.
|
| 61 |
+
E_n (float): Error in rotational speed measurement.
|
| 62 |
+
|
| 63 |
+
Returns:
|
| 64 |
+
str: A formatted summary of the computed performance metrics and associated absolute errors.
|
| 65 |
+
"""
|
| 66 |
+
|
| 67 |
+
# Constants
|
| 68 |
+
Vg = 8.25 / 1000 # Specific volume [m^3]
|
| 69 |
+
alpha = 5.227e-2 # Flow coefficient
|
| 70 |
+
|
| 71 |
+
# Calculations
|
| 72 |
+
Q_g = Vg * n
|
| 73 |
+
Q_p = alpha * dh / dt * 60
|
| 74 |
+
eta_vol = (Q_p / Q_g) * 100
|
| 75 |
+
P_u = (Q_p / 60) * dp * 100
|
| 76 |
+
eta_tot = (P_u / (P_in * 1000)) * 100
|
| 77 |
+
|
| 78 |
+
# Error calculations
|
| 79 |
+
E_Q_g = Vg * E_n
|
| 80 |
+
E_Q_p = sqrt((alpha * E_dh / dt) ** 2 + (alpha * dh / dt ** 2 * E_dt) ** 2) * 60
|
| 81 |
+
E_eta_vol = sqrt((E_Q_p / Q_g) ** 2 + (Q_p * E_Q_g / Q_g ** 2) ** 2) * 100
|
| 82 |
+
E_P_u = sqrt((E_Q_p * dp * 100 / 60) ** 2 + (Q_p * E_dp * 100 / 60) ** 2)
|
| 83 |
+
E_eta_tot = sqrt((E_P_u * 1e-3 / P_in) ** 2 + (E_P_in * P_u * 1e-3 / P_in ** 2) ** 2) * 100
|
| 84 |
+
|
| 85 |
+
# Formatted output
|
| 86 |
+
result = f"""
|
| 87 |
+
--- Hydraulic Aggregate Measurement Evaluation ---
|
| 88 |
+
Geometric Volume Flow Rate (Q_g): {Q_g:.3f} dm³/min ± {E_Q_g:.3f}
|
| 89 |
+
Volume Flow Rate (Q_p): {Q_p:.3f} dm³/min ± {E_Q_p:.3f}
|
| 90 |
+
Volumetric Efficiency (η_vol): {eta_vol:.3f}% ± {E_eta_vol:.3f}%
|
| 91 |
+
Useful Power Output (P_u): {P_u:.2f} W ± {E_P_u:.2f} W
|
| 92 |
+
Total Efficiency (η_tot): {eta_tot:.3f}% ± {E_eta_tot:.3f}%
|
| 93 |
+
"""
|
| 94 |
+
|
| 95 |
+
return result.strip()
|
| 96 |
+
|
| 97 |
final_answer = FinalAnswerTool()
|
| 98 |
|
| 99 |
# If the agent does not answer, the model is overloaded, please use another model or the following Hugging Face Endpoint that also contains qwen2.5 coder:
|