Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🔧 Fix electrical elements declarations #110

Merged
merged 2 commits into from
Jul 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion piel/experimental/models/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from .cables import rg164
from .cables import rg164, generic_sma, generic_banana
from .multimeter import DMM6500
from .rf_passives import create_power_splitter_1to2
from .rf_calibration import (
Expand Down
79 changes: 77 additions & 2 deletions piel/experimental/models/cables.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,89 @@
from ...types import CoaxialCable, CoaxialCableGeometryType
from ...types import CoaxialCable, CoaxialCableGeometryType, PhysicalPort, DCCable


def generic_banana(
name: str,
length_m: float,
**kwargs,
) -> DCCable:
ports = [
PhysicalPort(
name="IN",
domain="DC",
connector="Male",
),
PhysicalPort(
name="OUT",
domain="DC",
connector="Male",
)
]

return DCCable(
name=name,
ports=ports,
**kwargs,
)



def rg164(
length_m: float,
**kwargs,
) -> CoaxialCable:
geometry = CoaxialCableGeometryType(
length_m=length_m,
)

ports = [
PhysicalPort(
name="IN",
domain="RF",
connector="SMA",
),
PhysicalPort(
name="OUT",
domain="RF",
connector="SMA",
)
]

return CoaxialCable(
name="RG164",
geometry=geometry,
ports=ports,
**kwargs,
)


def generic_sma(
name: str,
length_m: float,
**kwargs,
) -> CoaxialCable:
geometry = CoaxialCableGeometryType(
length_m=length_m,
)

return CoaxialCable(name="RG164", geometry=geometry)
ports = [
PhysicalPort(
name="IN",
domain="RF",
connector="SMA",
),
PhysicalPort(
name="OUT",
domain="RF",
connector="SMA",
)
]

return CoaxialCable(
name=name,
geometry=geometry,
ports=ports,
**kwargs,
)


def cryo_cable(
Expand Down
10 changes: 8 additions & 2 deletions piel/experimental/models/sourcemeter.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
from typing import Optional
from ...types import PhysicalPort
from ..types import Sourcemeter


def SMU2450(**kwargs) -> Sourcemeter:
def SMU2450(name: Optional[str] = None,
**kwargs) -> Sourcemeter:

if name is None:
name = "SMU2450"

ports = [
PhysicalPort(
name="FORCEHI",
Expand Down Expand Up @@ -31,4 +37,4 @@ def SMU2450(**kwargs) -> Sourcemeter:
),
]

return Sourcemeter(name="SMU2450", manufacturer="Keithley", ports=ports, **kwargs)
return Sourcemeter(name=name, manufacturer="Keithley", ports=ports, **kwargs)
3 changes: 2 additions & 1 deletion piel/experimental/types/dc.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
from typing import Optional
from .device import Device, DeviceConfiguration


Expand All @@ -16,7 +17,7 @@ class Sourcemeter(Device):
Represents a sourcemeter.
"""

configuration: SourcemeterConfiguration
configuration: Optional[SourcemeterConfiguration] = None


class MultimeterConfiguration(DeviceConfiguration):
Expand Down
34 changes: 17 additions & 17 deletions piel/types/electrical/cables.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

# TODO This shouldn't be a quantity
class CoaxialCableGeometryType(QuantityType):
core_cross_sectional_area_m2: Optional[float]
core_cross_sectional_area_m2: Optional[float] = None
"""
The cross-sectional area of the core in meters squared.
"""
Expand All @@ -16,12 +16,12 @@ class CoaxialCableGeometryType(QuantityType):
The length of the cable in meters.
"""

sheath_cross_sectional_area_m2: Optional[float]
sheath_cross_sectional_area_m2: Optional[float] = None
"""
The cross-sectional area of the sheath in meters squared.
"""

total_cross_sectional_area_m2: Optional[float]
total_cross_sectional_area_m2: Optional[float] = None
"""
The total cross-sectional area of the cable in meters squared.
"""
Expand All @@ -32,17 +32,17 @@ class CoaxialCableHeatTransferType(QuantityType):
All units are in watts.
"""

core: Optional[float]
core: Optional[float] = None
"""
The computed heat transfer in watts for the core of the cable.
"""

sheath: Optional[float]
sheath: Optional[float] = None
"""
The computed heat transfer in watts for the sheath of the cable.
"""

dielectric: Optional[float]
dielectric: Optional[float] = None
"""
The computed heat transfer in watts for the dielectric of the cable.
"""
Expand All @@ -56,17 +56,17 @@ class CoaxialCableHeatTransferType(QuantityType):


class CoaxialCableMaterialSpecificationType(QuantityType):
core: Optional[MaterialReferenceType]
core: Optional[MaterialReferenceType] = None
"""
The material of the core.
"""

sheath: Optional[MaterialReferenceType]
sheath: Optional[MaterialReferenceType] = None
"""
The material of the sheath.
"""

dielectric: Optional[MaterialReferenceType]
dielectric: Optional[MaterialReferenceType] = None
"""
The material of the dielectric.
"""
Expand Down Expand Up @@ -94,7 +94,7 @@ class DCCableHeatTransferType(QuantityType):
All units are in watts.
"""

core: Optional[float]
core: Optional[float] = None
"""
The computed heat transfer in watts for the core of the cable.
"""
Expand All @@ -108,7 +108,7 @@ class DCCableHeatTransferType(QuantityType):


class DCCableMaterialSpecificationType(QuantityType):
core: Optional[MaterialReferenceType]
core: Optional[MaterialReferenceType] = None
"""
The material of the core.
"""
Expand All @@ -122,19 +122,19 @@ class DCCable(Cable):
"""
A DC cable is a single core cable that is used to transmit direct current.
"""
geometry: DCCableGeometryType
heat_transfer: DCCableHeatTransferType
material_specification: DCCableMaterialSpecificationType
geometry: Optional[DCCableGeometryType] = None
heat_transfer: Optional[DCCableHeatTransferType] = None
material_specification: Optional[DCCableMaterialSpecificationType] = None


class CoaxialCable(Cable):
"""
A coaxial cable is a type of electrical cable that has an inner conductor surrounded by a tubular insulating layer,
surrounded by a tubular conducting shield.
"""
geometry: CoaxialCableGeometryType
heat_transfer: CoaxialCableHeatTransferType
material_specification: CoaxialCableMaterialSpecificationType
geometry: Optional[CoaxialCableGeometryType] = None
heat_transfer: Optional[CoaxialCableHeatTransferType] = None
material_specification: Optional[CoaxialCableMaterialSpecificationType] = None


CableHeatTransferTypes = Union[CoaxialCableHeatTransferType, DCCableHeatTransferType]
Expand Down
Loading