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 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
|
||||
|
||||
Reference in New Issue
Block a user