Coverage for backend/django/core/auxiliary/methods/copy_flowsheet/models_to_copy.py: 100%

28 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2025-12-18 04:00 +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 PinchAnalysis.models.HenNode import HenNode 

16from core.auxiliary.models.ControlValue import ControlValue 

17from core.auxiliary.models.Flowsheet import Flowsheet 

18from core.auxiliary.models.IndexedItem import IndexedItem 

19from core.auxiliary.models.MLModel import MLModel 

20from core.auxiliary.models.PropertyInfo import ( 

21 PropertyInfo, 

22 ProcessPathProperty, 

23 HistoricalValue, 

24) 

25from core.auxiliary.models.PropertyValue import PropertyValue 

26from core.auxiliary.models.SolveState import SolveState, SolveValue 

27from core.auxiliary.models.Solution import Solution 

28from core.auxiliary.models.Scenario import Scenario, OptimizationDegreesOfFreedom 

29from core.auxiliary.models.Expression import Expression 

30from core.auxiliary.models.MLColumnMapping import MLColumnMapping 

31from core.auxiliary.models.Note import Note 

32from core.auxiliary.models.ProcessPath import ProcessPath 

33from core.auxiliary.models.PropertySet import PropertySet 

34from core.auxiliary.models.RecycleData import RecycleData, RecycleProperty 

35from core.plots.Plot import Plot, Series 

36 

37from flowsheetInternals.graphicData.models.graphicObjectModel import GraphicObject 

38from flowsheetInternals.graphicData.models.groupingModel import Grouping 

39 

40from flowsheetInternals.propertyPackages.models.SimulationObjectPropertyPackages import SimulationObjectPropertyPackages 

41from flowsheetInternals.unitops.models.Port import Port 

42from flowsheetInternals.unitops.models.SimulationObject import SimulationObject 

43# Note: the order of the models in this list matters, 

44# as it determines the order in which they are copied. 

45# The models that are copied first should not have any foreign keys to models that are copied later. 

46 

47 

48# Custom modules don't need the pinch analysis stuff copied, only the core flowsheet stuff. 

49custom_module_linked_model_types = [ 

50 Flowsheet, 

51 SimulationObject, 

52 PropertySet, 

53 Scenario, 

54 #SolveState, 

55 Expression, # commenting out this involves moving the Expression reference from PropertyInfo to Expression.py as the ownear of that relationship/FK. 

56 Grouping, 

57 PropertyInfo, 

58 IndexedItem, 

59 PropertyValue, 

60 Port, 

61 MLModel, 

62 ControlValue, 

63 ProcessPathProperty, 

64 # HistoricalValue, # Don't think these are used any more. 

65 #SolveValue, # We probably should copy, but for now we can just re-create them. 

66 #Solution, # Don't need to copy, can just regenerate 

67 OptimizationDegreesOfFreedom, 

68 MLColumnMapping, 

69 Note, 

70 ProcessPath, 

71 RecycleData, 

72 RecycleProperty, 

73 Plot, 

74 Series, 

75 GraphicObject, 

76 SimulationObjectPropertyPackages, 

77] 

78# When you're copying a flowsheet, you need to copy everything. This includes pinch analysis models. 

79linked_model_types = custom_module_linked_model_types + [ 

80 StreamDataEntry, 

81 StreamDataProject, 

82 PinchInputs, 

83 Segment, 

84 PinchUtility, 

85 TurbineOptions, 

86 MainOptions, 

87 PinchOutputs, 

88 PinchTemp, 

89 TargetSummary, 

90 HeatSupplierUtilitySummary, 

91 HeatReceiverUtilitySummary, 

92 PinchGraphSet, 

93 PinchGraph, 

94 PinchCurve, 

95 GraphDataPoint, 

96 HenNode, 

97] 

98 

99