Refactor DUTModel from Protocol to ABC for explicit interface implementation
This commit is contained in:
@@ -1,15 +1,14 @@
|
||||
"""Base protocol for Device Under Test (DUT) models.
|
||||
"""Base interface for Device Under Test (DUT) models.
|
||||
|
||||
Defines the interface that all DUT models must implement to integrate
|
||||
with the physics engine.
|
||||
"""
|
||||
|
||||
from typing import Protocol, runtime_checkable
|
||||
from abc import ABC, abstractmethod
|
||||
|
||||
|
||||
@runtime_checkable
|
||||
class DUTModel(Protocol):
|
||||
"""Protocol for DUT electrical/thermal models.
|
||||
class DUTModel(ABC):
|
||||
"""Abstract base class for DUT electrical/thermal models.
|
||||
|
||||
DUT models encapsulate the temperature-dependent electrical behaviour
|
||||
of a device, enabling realistic simulation of thermal-electrical coupling.
|
||||
@@ -18,8 +17,12 @@ class DUTModel(Protocol):
|
||||
All voltage parameters are in volts.
|
||||
All current parameters are in amps.
|
||||
All power parameters are in watts.
|
||||
|
||||
Implementations must inherit from this class and implement all abstract
|
||||
methods.
|
||||
"""
|
||||
|
||||
@abstractmethod
|
||||
def calculate_output_voltage(self, junction_temperature: float) -> float:
|
||||
"""Calculate the output voltage at the given junction temperature.
|
||||
|
||||
@@ -29,8 +32,9 @@ class DUTModel(Protocol):
|
||||
Returns:
|
||||
Output voltage in volts.
|
||||
"""
|
||||
...
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def calculate_quiescent_current(self, junction_temperature: float) -> float:
|
||||
"""Calculate the quiescent current at the given junction temperature.
|
||||
|
||||
@@ -40,8 +44,9 @@ class DUTModel(Protocol):
|
||||
Returns:
|
||||
Quiescent current in amps.
|
||||
"""
|
||||
...
|
||||
pass
|
||||
|
||||
@abstractmethod
|
||||
def calculate_power_dissipation(
|
||||
self,
|
||||
input_voltage: float,
|
||||
@@ -58,4 +63,4 @@ class DUTModel(Protocol):
|
||||
Returns:
|
||||
Power dissipation in watts.
|
||||
"""
|
||||
...
|
||||
pass
|
||||
|
||||
@@ -7,6 +7,8 @@ and power dissipation calculations.
|
||||
|
||||
from dataclasses import dataclass
|
||||
|
||||
from py_dvt_ate.simulation.physics.models.base import DUTModel
|
||||
|
||||
|
||||
@dataclass(frozen=True)
|
||||
class LDOParameters:
|
||||
@@ -35,7 +37,7 @@ class LDOParameters:
|
||||
REFERENCE_TEMPERATURE_C = 25.0
|
||||
|
||||
|
||||
class LDOModel:
|
||||
class LDOModel(DUTModel):
|
||||
"""Temperature-dependent LDO voltage regulator model.
|
||||
|
||||
Models the electrical behaviour of a linear voltage regulator with:
|
||||
@@ -44,7 +46,7 @@ class LDOModel:
|
||||
- Dropout voltage that increases with temperature
|
||||
- Power dissipation from (Vin - Vout) × Iload + Vin × Iq
|
||||
|
||||
This class implements the DUTModel protocol.
|
||||
This class implements the DUTModel interface.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
||||
Reference in New Issue
Block a user