Change the dataclass Interface into a regular class Surface.
Done for all subclasses of Interface too. This is a preparation for later abstraction.
This commit is contained in:
+25
-12
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user