From db0dc7c6e97c7385a29d4733ac07feb4546b7195 Mon Sep 17 00:00:00 2001 From: omicron Date: Mon, 8 Jun 2026 21:58:40 +0200 Subject: [PATCH] Add FixedRLayer and move the existing Layer into a hierarchy --- interfaces.py | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/interfaces.py b/interfaces.py index e251378..d7a9c2d 100644 --- a/interfaces.py +++ b/interfaces.py @@ -1,17 +1,31 @@ from abc import ABC, abstractmethod -from dataclasses import dataclass -@dataclass -class Layer: - thermal_coefficient: float - thickness: float +class Layer(ABC): + @property + @abstractmethod + def R(self) -> float: ... + + +class MaterialLayer(Layer): + def __init__(self, thermal_coefficient: float, thickness: float): + self.thermal_coefficient = thermal_coefficient + self.thickness = thickness @property - def R(self): + def R(self) -> float: return self.thickness / self.thermal_coefficient +class FixedRLayer(Layer): + def __init__(self, r_value: float): + self.r_value = r_value + + @property + def R(self) -> float: + return self.r_value + + class Interface(ABC): @property @abstractmethod