Early explorations of calculation primitives

This commit is contained in:
2026-06-08 13:54:45 +02:00
commit 68b6084150
2 changed files with 65 additions and 0 deletions
+44
View File
@@ -0,0 +1,44 @@
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