Skip to content

Commit

Permalink
adding default values for optional attributes. Need to decide best type
Browse files Browse the repository at this point in the history
  • Loading branch information
tareknrel committed Dec 9, 2023
1 parent 45176a7 commit 2026814
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions ditto/models/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ class DiTToBaseModel(BaseModel):
substation_name: Annotated[Optional[str], Field(
description="Name of the substation the element is under",
title="substation_name",
default = "",
json_schema_extra = {"cim_value":"EquipmentContainer.Substation.name"}
)]

feeder_name: Annotated[Optional[str],Field(
description="Name of the feeder the element is on",
title="feeder_name",
default = "",
json_schema_extra = {"cim_value":"EquipmentContainer.name"}
)]

3 changes: 3 additions & 0 deletions ditto/models/node.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,14 @@ class Node(DiTToBaseModel):
nominal_voltage: Annotated[Optional[Voltage], Field(
description = "The nominal voltage at the node",
title = "Nominal voltage",
default = None,
json_schema_extra = {"cim_value":"nomU"}
)]

phases: Annotated[Optional[List[Phase]], Field(
description="Phases at the node",
title="phases",
default = [],
json_schema_extra = {"cim_value":"phases"}
)]

Expand All @@ -34,5 +36,6 @@ class Node(DiTToBaseModel):
setpoint: Annotated[Optional[Voltage], Field(
description="Value that the node must be set to. This is typically used for feeder head points",
title="setpoint",
default = None,
json_schema_extra={"cim_value": "NA"},
)]
3 changes: 2 additions & 1 deletion ditto/models/position.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,11 @@ class Position(DiTToBaseModel):
alias="lat",
json_schema_extra = {"cim_value":"Location.PositionPoint.yPosition", "projection": "latitude"}
)]
z_position: Annotated[Distance, Field(
z_position: Annotated[Optional[Distance], Field(
description="Z coordinate in distance units. Default is meters",
title="z_position",
alias="elevation",
default = Distance(0,"m"),
json_schema_extra = {"cim_value":"Location.PositionPoint.zPosition"}
)]

Expand Down

0 comments on commit 2026814

Please sign in to comment.