Skip to content

Commit

Permalink
first state of migration done
Browse files Browse the repository at this point in the history
  • Loading branch information
daquintero committed Jun 8, 2024
1 parent 0103aa8 commit 9a70a0e
Show file tree
Hide file tree
Showing 6 changed files with 75 additions and 61 deletions.
2 changes: 2 additions & 0 deletions piel/models/physical/electrical/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
from .types import *
from .cable import *
11 changes: 8 additions & 3 deletions piel/models/physical/electrical/cable.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,14 @@
from ..thermal import heat_transfer_1d_W
from ....materials.thermal_conductivity.types import MaterialReferenceType
from piel.materials.thermal_conductivity.utils import get_thermal_conductivity_fit
from .types import *
from .types import (
CoaxialCableGeometryType,
CoaxialCableHeatTransferType,
CoaxialCableMaterialSpecificationType,
DCCableGeometryType,
DCCableHeatTransferType,
DCCableMaterialSpecificationType,
)
from ..types import TemperatureRangeTypes


Expand Down Expand Up @@ -166,8 +173,6 @@ def calculate_dc_cable_geometry(
length_m=length_m,
core_cross_sectional_area_m2=core_cross_sectional_area_m2,
total_cross_sectional_area_m2=total_cross_sectional_area_m2,
*args,
**kwargs,
)


Expand Down
5 changes: 5 additions & 0 deletions piel/models/physical/electrical/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
]


# TODO This shouldn't be a quantity
class CoaxialCableGeometryType(QuantityType):
core_cross_sectional_area_m2: Optional[float]
"""
Expand Down Expand Up @@ -62,6 +63,8 @@ class CoaxialCableHeatTransferType(QuantityType):
The total computed heat transfer in watts for the cable.
"""

units: str = "W"


class CoaxialCableMaterialSpecificationType(QuantityType):
core: Optional[MaterialReferenceType]
Expand Down Expand Up @@ -112,6 +115,8 @@ class DCCableHeatTransferType(QuantityType):
The total computed heat transfer in watts for the cable.
"""

units: str = "W"


class DCCableMaterialSpecificationType(QuantityType):
core: Optional[MaterialReferenceType]
Expand Down
4 changes: 3 additions & 1 deletion piel/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import types
import numpy as np
import jax.numpy as jnp
from typing import Optional

__all__ = [
"ArrayTypes",
Expand All @@ -20,6 +21,7 @@
ArrayTypes = np.ndarray | jnp.ndarray
NumericalTypes = int | float | np.dtype | jnp.dtype


class PielBaseModel(pydantic.BaseModel):
class Config:
arbitrary_types_allowed = True
Expand All @@ -34,7 +36,7 @@ class QuantityType(PielBaseModel):
The base class for all cable types.
"""

units: str
units: Optional[str] = None
"""
The units of the type.
"""
112 changes: 56 additions & 56 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ pydantic = "^2.0"
pydata-sphinx-theme = {version = ">=0.13.3", optional = true}
pytest = {version = ">=3.0", optional = true}
python = ">=3.10,<3.12"
qutip = "^4.7.3"
qutip = "^4.7"
sax = "0.12.2" # Pinned for pydantic <v2 compatibility.
scipy = "^1.11.4"
simple_copied_design = {path = "docs/examples/designs/simple_copied_design", develop = true, optional = true}
Expand Down

0 comments on commit 9a70a0e

Please sign in to comment.