-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
67 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,38 @@ | ||
# -*- coding: utf-8 -*- | ||
from __future__ import absolute_import, division, print_function | ||
from builtins import super, range, zip, round, map | ||
from pydantic import BaseModel, Field | ||
|
||
from .base import DiTToBaseModel | ||
from .units import Voltage, VoltageUnit, Phase | ||
from .units import Voltage, Phase, Distance | ||
from .position import Position | ||
from typing_extensions import Annotated | ||
from typing import Optional, List | ||
|
||
|
||
class Node(DiTToHasTraits): | ||
class Node(DiTToBaseModel): | ||
|
||
nominal_voltage: Optional[Voltage] = Field( | ||
nominal_voltage: Annotated[Optional[Voltage], Field( | ||
description = "The nominal voltage at the node", | ||
title = "Nominal voltage", | ||
cim_value="nomU" | ||
) | ||
json_schema_extra = {"cim_value":"nomU"} | ||
)] | ||
|
||
phases: Optional[List[Phase]] = Field( | ||
phases: Annotated[Optional[List[Phase]], Field( | ||
description="Phases at the node", | ||
title="phases" | ||
cim_value="phases" | ||
) | ||
title="phases", | ||
json_schema_extra = {"cim_value":"phases"} | ||
)] | ||
|
||
is_substation_connection: Optional[bool] = Field( | ||
is_substation_connection: Annotated[Optional[bool], Field( | ||
description="1 if the node connects from inside a substation to outside, 0 otherwise. These indicate if a node connects a substation to a feeder or high voltage source", | ||
title="is_substation_connection", | ||
default=False, | ||
cim_value="NA" | ||
) | ||
json_schema_extra = {"cim_value":"NA"} | ||
)] | ||
|
||
setpoint: Optional[Voltage] = Field( | ||
setpoint: Annotated[Optional[Voltage], Field( | ||
description="Value that the node must be set to. This is typically used for feeder head points", | ||
title="setpoint", | ||
cim_value="NA" | ||
) | ||
json_schema_extra={"cim_value": "NA"}, | ||
)] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,33 @@ | ||
from __future__ import absolute_import, division, print_function | ||
from builtins import super, range, zip, round, map | ||
from pydantic import BaseModel, Field | ||
from .base import DiTToBaseModel | ||
from .units import Voltage, Phase, Distance | ||
import pint | ||
import logging | ||
from typing_extensions import Annotated | ||
from typing import Optional, List | ||
|
||
from .base import DiTToHasTraits, Float, Unicode, Any, Int, List, observe, Instance | ||
class Position(DiTToBaseModel): | ||
x_position: Annotated[float, Field( | ||
description="X coordinate with raw float. Projection is defined in the json_schema_extra. Default is longitude value", | ||
title="x_position", | ||
alias="long", | ||
json_schema_extra = {"cim_value":"Location.PositionPoint.xPosition", "projection": "longitude"} | ||
)] | ||
y_position: Annotated[float, Field( | ||
description="Y coordinate with raw float. Projection is defined in the json_schema_extra. Default is latitude value", | ||
title="y_position", | ||
alias="lat", | ||
json_schema_extra = {"cim_value":"Location.PositionPoint.yPosition", "projection": "latitude"} | ||
)] | ||
z_position: Annotated[Distance, Field( | ||
description="Z coordinate in distance units. Default is meters", | ||
title="z_position", | ||
alias="elevation", | ||
json_schema_extra = {"cim_value":"Location.PositionPoint.zPosition"} | ||
)] | ||
|
||
|
||
class Position(DiTToHasTraits): | ||
long = Float(help="""Decimal Longitude""") | ||
lat = Float(help="""Decimal Latitude""") | ||
elevation = Float(help="""Decimal elevation (meters)""") | ||
|
||
def build(self, model): | ||
self._model = model |