Coverage for backend/common/src/common/config_utils.py: 100%
10 statements
« prev ^ index » next coverage.py v7.10.7, created at 2026-05-13 02:47 +0000
« prev ^ index » next coverage.py v7.10.7, created at 2026-05-13 02:47 +0000
1"""
2utility functions for defining the configuration schema
3"""
5from typing import Dict
6from .config_types import *
9def default_property_package_ports() -> Dict[str,List[PortKey]]:
10 """
11 The default property package slots for a unit operation (1 property package, no name).
12 """
13 return {
14 "": [PortKey("inlet"), PortKey("outlet")],
15 }
18def default_ports() -> Dict[str, PortType]:
19 """
20 The default ports for a unit operation (1 inlet, 1 outlet).
21 """
22 return {
23 "inlet": PortType(
24 displayName="Inlet",
25 type=ConType.Inlet,
26 streamType="stream",
27 streamName="S",
28 ),
29 "outlet": PortType(
30 displayName="Outlet",
31 type=ConType.Outlet,
32 streamType="stream",
33 streamName="S",
34 ),
35 }
38def unitop_graphic() -> GraphicObjectType:
39 """
40 The default graphic object for a unit operation.
41 """
42 return GraphicObjectType(width=100, height=100)
45def stream_graphic() -> GraphicObjectType:
46 """
47 The default graphic object for a stream.
48 """
49 return GraphicObjectType(width=25, height=25)
51#Must only be used when the P-graph constraints are on default.
52# #Do not use if there are specific pgraph properties for constraints
53# def general_constraints() -> PropertySetType:
54# return {
55# "type": "constraints",
56# "displayName": "Constraints",
57# "containedProperties": {
58# "CmLowerBound": {
59# "displayName": "Capacity Multiplier - lower bound",
60# "type": "numeric",
61# "unitType": "currency",
62# "value": 0.0,
63# },
64# "CmUpperBound": {
65# "displayName": "Capacity Multiplier - upper bound",
66# "type": "numeric",
67# "unitType": "currency",
68# "value": 0.0,
69# },
70# "OcFix": {
71# "displayName": "Operating Cost - fix",
72# "type": "numeric",
73# "unitType": "currency",
74# "value": 0.0,
76# },
77# "OcProportional": {
78# "displayName": "Operating Cost - proportional",
79# "type": "numeric",
80# "unitType": "currency",
81# "value": 0.0,
82# },
83# "IcFix": {
84# "displayName": "Investment Cost - fix",
85# "type": "numeric",
86# "unitType": "currency",
87# "value": 0.0,
88# },
89# "IcProportional": {
90# "displayName": "Investment Cost - proportional",
91# "type": "numeric",
92# "unitType": "currency",
93# "value": 0.0,
94# },
95# },
96# }