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