From 2bda91327092ed1431ef48fe32a01142a656034c Mon Sep 17 00:00:00 2001 From: omicron Date: Mon, 8 Jun 2026 14:22:33 +0200 Subject: [PATCH] Change the dataclass Interface into a regular class Surface. Done for all subclasses of Interface too. This is a preparation for later abstraction. --- interfaces.py | 37 +++++++++++++++++++++++++------------ 1 file changed, 25 insertions(+), 12 deletions(-) diff --git a/interfaces.py b/interfaces.py index 23b7716..94d44e9 100644 --- a/interfaces.py +++ b/interfaces.py @@ -12,21 +12,33 @@ class Layer: return self.thickness / self.thermal_coefficient -@dataclass -class Interface(ABC): - name: str - area: float +class Surface(ABC): + def __init__(self, name: str, area: float): + self.name = name + self.area = area @property @abstractmethod def U(self) -> float: ... + @property + def HT(self) -> float: + return self.U * self.area -@dataclass -class LayeredInterface(Interface): - layers: list[Layer] - r_surface_1: float - r_surface_2: float + +class LayeredSurface(Surface): + def __init__( + self, + name: str, + area: float, + layers: list[Layer], + r_surface_1: float, + r_surface_2: float, + ): + super().__init__(name, area) + self.layers = layers + self.r_surface_1 = r_surface_1 + self.r_surface_2 = r_surface_2 @property def U(self) -> float: @@ -35,9 +47,10 @@ class LayeredInterface(Interface): return 1 / R -@dataclass -class FixedUInterface(Interface): - u_value: float +class FixedUSurface(Surface): + def __init__(self, name: str, area: float, u_value: float): + super().__init__(name, area) + self.u_value = u_value @property def U(self) -> float: