Files
heatloss/interfaces.py
T

45 lines
798 B
Python

from abc import ABC, abstractmethod
from dataclasses import dataclass
@dataclass
class Layer:
thermal_coefficient: float
thickness: float
@property
def R(self):
return self.thickness / self.thermal_coefficient
@dataclass
class Interface(ABC):
name: str
area: float
@property
@abstractmethod
def U(self) -> float: ...
@dataclass
class LayeredInterface(Interface):
layers: list[Layer]
r_surface_1: float
r_surface_2: float
@property
def U(self) -> float:
R_layers = sum(layer.R for layer in self.layers)
R = self.r_surface_1 + R_layers + self.r_surface_2
return 1 / R
@dataclass
class FixedUInterface(Interface):
u_value: float
@property
def U(self) -> float:
return self.u_value