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

26 statements  

« prev     ^ index     » next       coverage.py v7.10.7, created at 2026-05-13 02:47 +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.CustomPropertyPackage import CustomCompound, CustomPropertyPackage, Kappa, CustomPropertyPackageProperty, CompoundProperty 

26from core.auxiliary.models.PropertyValue import PropertyValue 

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

28from core.auxiliary.models.DataColumn import DataColumn 

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 

35 

36from flowsheetInternals.graphicData.models.graphicObjectModel import GraphicObject 

37from flowsheetInternals.graphicData.models.groupingModel import Grouping 

38 

39from flowsheetInternals.unitops.models.Port import Port 

40from flowsheetInternals.unitops.models.SimulationObject import SimulationObject 

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

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

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

44 

45 

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

47custom_module_linked_model_types = [ 

48 Flowsheet, 

49 SimulationObject, 

50 PropertySet, 

51 Scenario, 

52 Grouping, 

53 PropertyInfo, 

54 IndexedItem, 

55 PropertyValue, 

56 DataColumn, 

57 Port, 

58 MLModel, 

59 ControlValue, 

60 ProcessPathProperty, 

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

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

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

64 OptimizationDegreesOfFreedom, 

65 MLColumnMapping, 

66 Note, 

67 ProcessPath, 

68 RecycleData, 

69 RecycleProperty, 

70 Plot, 

71 Series, 

72 GraphicObject, 

73 CustomCompound, 

74 CompoundProperty, 

75 CustomPropertyPackage, 

76 Kappa, 

77 CustomPropertyPackageProperty 

78] 

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

80linked_model_types = custom_module_linked_model_types + [ 

81 StreamDataEntry, 

82 StreamDataProject, 

83 PinchInputs, 

84 Segment, 

85 PinchUtility, 

86 TurbineOptions, 

87 MainOptions, 

88 PinchOutputs, 

89 PinchTemp, 

90 TargetSummary, 

91 HeatSupplierUtilitySummary, 

92 HeatReceiverUtilitySummary, 

93 PinchGraphSet, 

94 PinchGraph, 

95 PinchCurve, 

96 GraphDataPoint, 

97 HenNode, 

98] 

99 

100