Coverage for backend/core/auxiliary/methods/copy_flowsheet/models_to_copy.py: 100%
27 statements
« prev ^ index » next coverage.py v7.10.7, created at 2025-11-06 23:27 +0000
« prev ^ index » next coverage.py v7.10.7, created at 2025-11-06 23:27 +0000
1from PinchAnalysis.models.StreamDataProject import StreamDataProject
2from PinchAnalysis.models.InputModels import PinchInputs, PinchUtility, Segment, StreamDataEntry
3from PinchAnalysis.models.OutputModels import (
4 PinchOutputs,
5 PinchTemp,
6 TargetSummary,
7 HeatSupplierUtilitySummary,
8 HeatReceiverUtilitySummary,
9 PinchGraphSet,
10 PinchGraph,
11 PinchCurve,
12 GraphDataPoint,
13)
14from PinchAnalysis.models.OptionModels import TurbineOptions, MainOptions
15from core.auxiliary.models.ControlValue import ControlValue
16from core.auxiliary.models.Flowsheet import Flowsheet
17from core.auxiliary.models.IndexedItem import IndexedItem
18from core.auxiliary.models.MLModel import MLModel
19from core.auxiliary.models.PropertyInfo import (
20 PropertyInfo,
21 ProcessPathProperty,
22 HistoricalValue,
23)
24from core.auxiliary.models.PropertyValue import PropertyValue
25from core.auxiliary.models.SolveState import SolveState, SolveValue
26from core.auxiliary.models.Solution import Solution
27from core.auxiliary.models.Scenario import Scenario, OptimizationDegreesOfFreedom
28from core.auxiliary.models.Expression import Expression
29from core.auxiliary.models.MLColumnMapping import MLColumnMapping
30from core.auxiliary.models.Note import Note
31from core.auxiliary.models.ProcessPath import ProcessPath
32from core.auxiliary.models.PropertySet import PropertySet
33from core.auxiliary.models.RecycleData import RecycleData, RecycleProperty
34from core.plots.Plot import Plot, Series
36from flowsheetInternals.graphicData.models.graphicObjectModel import GraphicObject
37from flowsheetInternals.graphicData.models.groupingModel import Grouping
39from flowsheetInternals.propertyPackages.models.SimulationObjectPropertyPackages import SimulationObjectPropertyPackages
40from flowsheetInternals.unitops.models.Port import Port
41from flowsheetInternals.unitops.models.SimulationObject import SimulationObject
42# Note: the order of the models in this list matters,
43# as it determines the order in which they are copied.
44# The models that are copied first should not have any foreign keys to models that are copied later.
47# Custom modules don't need the pinch analysis stuff copied, only the core flowsheet stuff.
48custom_module_linked_model_types = [
49 Flowsheet,
50 SimulationObject,
51 PropertySet,
52 Scenario,
53 #SolveState,
54 Expression, # commenting out this involves moving the Expression reference from PropertyInfo to Expression.py as the ownear of that relationship/FK.
55 Grouping,
56 PropertyInfo,
57 IndexedItem,
58 PropertyValue,
59 Port,
60 MLModel,
61 ControlValue,
62 ProcessPathProperty,
63 # HistoricalValue, # Don't think these are used any more.
64 #SolveValue, # We probably should copy, but for now we can just re-create them.
65 #Solution, # Don't need to copy, can just regenerate
66 OptimizationDegreesOfFreedom,
67 MLColumnMapping,
68 Note,
69 ProcessPath,
70 RecycleData,
71 RecycleProperty,
72 Plot,
73 Series,
74 GraphicObject,
75 SimulationObjectPropertyPackages,
76]
77# When you're copying a flowsheet, you need to copy everything. This includes pinch analysis models.
78linked_model_types = custom_module_linked_model_types + [
79 StreamDataEntry,
80 StreamDataProject,
81 PinchInputs,
82 Segment,
83 PinchUtility,
84 TurbineOptions,
85 MainOptions,
86 PinchOutputs,
87 PinchTemp,
88 TargetSummary,
89 HeatSupplierUtilitySummary,
90 HeatReceiverUtilitySummary,
91 PinchGraphSet,
92 PinchGraph,
93 PinchCurve,
94 GraphDataPoint,
95]