Add FixedRLayer and move the existing Layer into a hierarchy
This commit is contained in:
+20
-6
@@ -1,17 +1,31 @@
|
|||||||
from abc import ABC, abstractmethod
|
from abc import ABC, abstractmethod
|
||||||
from dataclasses import dataclass
|
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
class Layer(ABC):
|
||||||
class Layer:
|
@property
|
||||||
thermal_coefficient: float
|
@abstractmethod
|
||||||
thickness: float
|
def R(self) -> float: ...
|
||||||
|
|
||||||
|
|
||||||
|
class MaterialLayer(Layer):
|
||||||
|
def __init__(self, thermal_coefficient: float, thickness: float):
|
||||||
|
self.thermal_coefficient = thermal_coefficient
|
||||||
|
self.thickness = thickness
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def R(self):
|
def R(self) -> float:
|
||||||
return self.thickness / self.thermal_coefficient
|
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):
|
class Interface(ABC):
|
||||||
@property
|
@property
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
|
|||||||
Reference in New Issue
Block a user