juice-simphony 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. juice_simphony/CompositionEngine/Scenario/__init__.py +10 -0
  2. juice_simphony/CompositionEngine/Scenario/attitude/__init__.py +10 -0
  3. juice_simphony/CompositionEngine/Scenario/attitude/attitude.py +42 -0
  4. juice_simphony/CompositionEngine/Scenario/attitude/xml_attitude.py +157 -0
  5. juice_simphony/CompositionEngine/Scenario/common/__init__.py +10 -0
  6. juice_simphony/CompositionEngine/Scenario/common/fileHandle.py +69 -0
  7. juice_simphony/CompositionEngine/Scenario/common/fileHandleEps.py +43 -0
  8. juice_simphony/CompositionEngine/Scenario/common/fileHandleEps1.py +40 -0
  9. juice_simphony/CompositionEngine/Scenario/common/fileHandleTml.py +87 -0
  10. juice_simphony/CompositionEngine/Scenario/common/fileHandleXML.py +69 -0
  11. juice_simphony/CompositionEngine/Scenario/common/fileName.py +68 -0
  12. juice_simphony/CompositionEngine/Scenario/common/fileTemplate.py +67 -0
  13. juice_simphony/CompositionEngine/Scenario/common/utils.py +56 -0
  14. juice_simphony/CompositionEngine/Scenario/config/__init__.py +10 -0
  15. juice_simphony/CompositionEngine/Scenario/config/agmCfgFiles.py +30 -0
  16. juice_simphony/CompositionEngine/Scenario/config/agmIniFile.py +29 -0
  17. juice_simphony/CompositionEngine/Scenario/config/configuration.py +380 -0
  18. juice_simphony/CompositionEngine/Scenario/config/epsEvtDefFile.py +45 -0
  19. juice_simphony/CompositionEngine/Scenario/config/epsFile.py +29 -0
  20. juice_simphony/CompositionEngine/Scenario/config/mappsIniFile.py +29 -0
  21. juice_simphony/CompositionEngine/Scenario/definitions/__init__.py +10 -0
  22. juice_simphony/CompositionEngine/Scenario/definitions/definitions.py +110 -0
  23. juice_simphony/CompositionEngine/Scenario/definitions/toplevelObsDef.py +28 -0
  24. juice_simphony/CompositionEngine/Scenario/environment/__init__.py +10 -0
  25. juice_simphony/CompositionEngine/Scenario/environment/environment.py +310 -0
  26. juice_simphony/CompositionEngine/Scenario/environment/trajectory.py +206 -0
  27. juice_simphony/CompositionEngine/Scenario/graphicalPath.py +86 -0
  28. juice_simphony/CompositionEngine/Scenario/main.py +130 -0
  29. juice_simphony/CompositionEngine/Scenario/modelling/__init__.py +10 -0
  30. juice_simphony/CompositionEngine/Scenario/modelling/experiment/experiment.py +44 -0
  31. juice_simphony/CompositionEngine/Scenario/modelling/experiment/topLevelExpEdf.py +60 -0
  32. juice_simphony/CompositionEngine/Scenario/modelling/modelling.py +66 -0
  33. juice_simphony/CompositionEngine/Scenario/modelling/toplevelEdf.py +28 -0
  34. juice_simphony/CompositionEngine/Scenario/root/__init__.py +10 -0
  35. juice_simphony/CompositionEngine/Scenario/root/seg_conf.py +262 -0
  36. juice_simphony/CompositionEngine/Scenario/root/toplevelEvt.py +69 -0
  37. juice_simphony/CompositionEngine/Scenario/root/toplevelItl.py +75 -0
  38. juice_simphony/CompositionEngine/Scenario/scenario.py +281 -0
  39. juice_simphony/CompositionEngine/Scenario/timeline/__init__.py +10 -0
  40. juice_simphony/CompositionEngine/Scenario/timeline/inst_timeline.py +54 -0
  41. juice_simphony/CompositionEngine/Scenario/timeline/inst_top_timeline.py +45 -0
  42. juice_simphony/CompositionEngine/Scenario/timeline/juice_comms.py +89 -0
  43. juice_simphony/CompositionEngine/Scenario/timeline/plat_prof_timeline.py +66 -0
  44. juice_simphony/CompositionEngine/Scenario/timeline/segmentation.py +89 -0
  45. juice_simphony/CompositionEngine/Scenario/timeline/timeline.py +78 -0
  46. juice_simphony/CompositionEngine/Scenario/timeline/timelineFile.py +51 -0
  47. juice_simphony/CompositionEngine/SegmentationImporter/SegmentationImporter.py +1469 -0
  48. juice_simphony/CompositionEngine/SegmentationImporter/__init__.py +10 -0
  49. juice_simphony/CompositionEngine/SegmentationImporter/mapps_io/__init__.py +11 -0
  50. juice_simphony/CompositionEngine/SegmentationImporter/mapps_io/common/fileHandle.py +69 -0
  51. juice_simphony/CompositionEngine/SegmentationImporter/mapps_io/common/fileHandleEps.py +55 -0
  52. juice_simphony/CompositionEngine/SegmentationImporter/mapps_io/common/fileName.py +56 -0
  53. juice_simphony/CompositionEngine/SegmentationImporter/mapps_io/instToplevelObsDef.py +41 -0
  54. juice_simphony/CompositionEngine/SegmentationImporter/mapps_io/obsDefinition.py +95 -0
  55. juice_simphony/CompositionEngine/SegmentationImporter/mapps_io/obsDefinitions.py +71 -0
  56. juice_simphony/CompositionEngine/SegmentationImporter/mapps_io/profileCsv.py +52 -0
  57. juice_simphony/CompositionEngine/SegmentationImporter/mapps_io/segDefinition.py +80 -0
  58. juice_simphony/CompositionEngine/SegmentationImporter/mapps_io/timeline.py +100 -0
  59. juice_simphony/CompositionEngine/SegmentationImporter/mapps_io/toplevelDefs.py +40 -0
  60. juice_simphony/CompositionEngine/SegmentationImporter/mapps_io/toplevelObsDef.py +41 -0
  61. juice_simphony/CompositionEngine/SegmentationImporter/restApiPlan.py +59 -0
  62. juice_simphony/CompositionEngine/SegmentationImporter/segmentation_profiles.py +851 -0
  63. juice_simphony/CompositionEngine/SegmentationImporter/shtRestClient.py +576 -0
  64. juice_simphony/CompositionEngine/__init__.py +10 -0
  65. juice_simphony/CompositionEngine/trajectory_engine/.gitignore +10 -0
  66. juice_simphony/CompositionEngine/trajectory_engine/CMakeLists.txt +34 -0
  67. juice_simphony/CompositionEngine/trajectory_engine/FileGeneration/CMakeLists.txt +48 -0
  68. juice_simphony/CompositionEngine/trajectory_engine/FileGeneration/EventsFile.cpp +139 -0
  69. juice_simphony/CompositionEngine/trajectory_engine/FileGeneration/EventsFile.hpp +17 -0
  70. juice_simphony/CompositionEngine/trajectory_engine/FileGeneration/OrbitDataFile.cpp +190 -0
  71. juice_simphony/CompositionEngine/trajectory_engine/FileGeneration/OrbitDataFile.hpp +57 -0
  72. juice_simphony/CompositionEngine/trajectory_engine/FileGeneration/OrbitDefFile.cpp +199 -0
  73. juice_simphony/CompositionEngine/trajectory_engine/FileGeneration/OrbitDefFile.hpp +58 -0
  74. juice_simphony/CompositionEngine/trajectory_engine/FileGeneration/TrajectoryEngine.cpp +142 -0
  75. juice_simphony/CompositionEngine/trajectory_engine/FileGeneration/TrajectoryEngine.hpp +59 -0
  76. juice_simphony/CompositionEngine/trajectory_engine/README.md +26 -0
  77. juice_simphony/CompositionEngine/trajectory_engine/Utils/CMakeLists.txt +15 -0
  78. juice_simphony/CompositionEngine/trajectory_engine/Utils/CommonTypes.hpp +37 -0
  79. juice_simphony/CompositionEngine/trajectory_engine/Utils/Conversions.hpp +36 -0
  80. juice_simphony/CompositionEngine/trajectory_engine/Utils/TimeUtils.cpp +1160 -0
  81. juice_simphony/CompositionEngine/trajectory_engine/Utils/TimeUtils.hpp +196 -0
  82. juice_simphony/CompositionEngine/trajectory_engine/Utils/rapidcsv.hpp +1431 -0
  83. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceCK.h +155 -0
  84. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceCel.h +441 -0
  85. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceDLA.h +260 -0
  86. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceDSK.h +903 -0
  87. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceDtl.h +251 -0
  88. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceEK.h +448 -0
  89. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceEll.h +115 -0
  90. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceErr.h +141 -0
  91. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceFrm.h +202 -0
  92. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceGF.h +345 -0
  93. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceOccult.h +147 -0
  94. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceOsc.h +86 -0
  95. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpicePln.h +106 -0
  96. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceSPK.h +128 -0
  97. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceSrf.h +94 -0
  98. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceUsr.h +278 -0
  99. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceZad.h +209 -0
  100. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceZdf.h +260 -0
  101. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceZfc.h +13803 -0
  102. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceZim.h +1677 -0
  103. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceZmc.h +989 -0
  104. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceZpl.h +117 -0
  105. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceZpr.h +4725 -0
  106. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceZrnm.h +82 -0
  107. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/SpiceZst.h +199 -0
  108. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/f2c.h +683 -0
  109. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/f2cMang.h +390 -0
  110. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/fio.h +107 -0
  111. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/fmt.h +100 -0
  112. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/fp.h +28 -0
  113. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/lio.h +74 -0
  114. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/rawio.h +41 -0
  115. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/signal1.h +118 -0
  116. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/zzalloc.h +133 -0
  117. juice_simphony/CompositionEngine/trajectory_engine/cspice/include/zzerror.h +86 -0
  118. juice_simphony/CompositionEngine/trajectory_engine/cspice/lib/linux/cspice.a +0 -0
  119. juice_simphony/CompositionEngine/trajectory_engine/cspice/lib/mac/cspice.a +0 -0
  120. juice_simphony/CompositionEngine/trajectory_engine/testStub.cpp +37 -0
  121. juice_simphony/__init__.py +10 -0
  122. juice_simphony/cli.py +46 -0
  123. juice_simphony/commons/__init__.py +10 -0
  124. juice_simphony/commons/commons.py +65 -0
  125. juice_simphony/data/config_scenario.json +13 -0
  126. juice_simphony/data/templates/MAPPS_CONF/AGM/CFG_TPL0001A_AGM_CALLISTO.ini +292 -0
  127. juice_simphony/data/templates/MAPPS_CONF/AGM/CFG_TPL0001A_AGM_EUROPA.ini +292 -0
  128. juice_simphony/data/templates/MAPPS_CONF/AGM/CFG_TPL0001A_AGM_GANYMEDE.ini +292 -0
  129. juice_simphony/data/templates/MAPPS_CONF/AGM/CFG_TPL0001A_AGM_JUPITER.ini +309 -0
  130. juice_simphony/data/templates/MAPPS_CONF/EPS/planning_mtp_mapping.def +92 -0
  131. juice_simphony/data/templates/MAPPS_CONF/EPS/planning_period_def.xml +239 -0
  132. juice_simphony/data/templates/MAPPS_CONF/MAPPS/CFG_TPL0001A_CALLISTO_MAPPS.ini +7926 -0
  133. juice_simphony/data/templates/MAPPS_CONF/MAPPS/CFG_TPL0001A_EUROPA_MAPPS.ini +7926 -0
  134. juice_simphony/data/templates/MAPPS_CONF/MAPPS/CFG_TPL0001A_GANYMEDE_MAPPS.ini +7944 -0
  135. juice_simphony/data/templates/MAPPS_CONF/MAPPS/CFG_TPL0001A_JUPITER_MAPPS.ini +7895 -0
  136. juice_simphony/data/templates/MAPPS_CONF/MAPPS/CFG_TPL0001A_MAPPS.ini +8554 -0
  137. juice_simphony/data/templates/OBSERVATIONS/JUI/SCENARIO/ODF_JUI_COMMS_template_SXXPYY.def +152 -0
  138. juice_simphony/data/templates/OBSERVATIONS/JUI/SCENARIO/ODF_NAV_OPNAV_BLOCK_template_SXXPYY.def +21 -0
  139. juice_simphony/data/templates/OBSERVATIONS/JUI/SCENARIO/ODF_RAD_ON_template_SXXPYY.def +9 -0
  140. juice_simphony/data/templates/OBSERVATIONS/JUI/SCENARIO/ODF_SCENARIO_JUI_template.def +10 -0
  141. juice_simphony/data/templates/README.md +2 -0
  142. juice_simphony/juice_simphony.py +98 -0
  143. juice_simphony/libs/TrajectoryEngine.dll +0 -0
  144. juice_simphony/libs/libTrajectoryEngine.dylib +0 -0
  145. juice_simphony/libs/libTrajectoryEngine.so +0 -0
  146. juice_simphony/poetry.lock +131 -0
  147. juice_simphony/spice_interface/__init__.py +10 -0
  148. juice_simphony/spice_interface/spice_interface.py +204 -0
  149. juice_simphony-0.1.0.dist-info/LICENSE.txt +212 -0
  150. juice_simphony-0.1.0.dist-info/METADATA +90 -0
  151. juice_simphony-0.1.0.dist-info/RECORD +153 -0
  152. juice_simphony-0.1.0.dist-info/WHEEL +4 -0
  153. juice_simphony-0.1.0.dist-info/entry_points.txt +3 -0
@@ -0,0 +1,10 @@
1
+ # *************************************************************************** #
2
+ # This file is subject to the terms and conditions defined in the #
3
+ # file 'LICENSE.txt', which is part of this source code package. #
4
+ # #
5
+ # No part of the package, including this file, may be copied, modified, #
6
+ # propagated, or distributed except according to the terms contained in #
7
+ # the file 'LICENSE.txt'. #
8
+ # #
9
+ # (C) Copyright European Space Agency, 2025 #
10
+ # *************************************************************************** #
@@ -0,0 +1,10 @@
1
+ # *************************************************************************** #
2
+ # This file is subject to the terms and conditions defined in the #
3
+ # file 'LICENSE.txt', which is part of this source code package. #
4
+ # #
5
+ # No part of the package, including this file, may be copied, modified, #
6
+ # propagated, or distributed except according to the terms contained in #
7
+ # the file 'LICENSE.txt'. #
8
+ # #
9
+ # (C) Copyright European Space Agency, 2025 #
10
+ # *************************************************************************** #
@@ -0,0 +1,42 @@
1
+ # *************************************************************************** #
2
+ # This file is subject to the terms and conditions defined in the #
3
+ # file 'LICENSE.txt', which is part of this source code package. #
4
+ # #
5
+ # No part of the package, including this file, may be copied, modified, #
6
+ # propagated, or distributed except according to the terms contained in #
7
+ # the file 'LICENSE.txt'. #
8
+ # #
9
+ # (C) Copyright European Space Agency, 2025 #
10
+ # *************************************************************************** #
11
+ import juice_simphony.CompositionEngine.Scenario.common.utils as utils
12
+ from juice_simphony.CompositionEngine.Scenario.definitions.toplevelObsDef import toplevelObsDef
13
+ from juice_simphony.CompositionEngine.SegmentationImporter.SegmentationImporter import segmentationTimeline
14
+ from juice_simphony.CompositionEngine.Scenario.attitude import xml_attitude as xml_att
15
+
16
+
17
+ import os
18
+
19
+ class attitude:
20
+
21
+ def __init__(self, segmentationTimelineInst, root_path, parameters=0):
22
+ self.root_path = root_path
23
+ self.segTimeline = segmentationTimelineInst
24
+ self.parameters = parameters
25
+ self.mainFolderPath = ""
26
+ self.structure = {}
27
+
28
+ def build(self):
29
+ self.createMainFolder('POINTING')
30
+ self.structure["path"] = self.mainFolderPath;
31
+ self.structure["xmlAttitudeFile"] = self.addRootContent()
32
+ return self.structure
33
+
34
+ def createMainFolder(self, folderName):
35
+ self.mainFolderPath = utils.createFolder(self.root_path, folderName)
36
+
37
+ def addRootContent(self):
38
+ xml_seg_attitude = self.segTimeline.getXmlAttitude()
39
+ if xml_seg_attitude["valid"]:
40
+ xml_att_file = xml_att.xml_attitude(self.mainFolderPath, xml_seg_attitude["xml_tree"], self.parameters)
41
+ return xml_att_file.genFile()
42
+ return ""
@@ -0,0 +1,157 @@
1
+ # *************************************************************************** #
2
+ # This file is subject to the terms and conditions defined in the #
3
+ # file 'LICENSE.txt', which is part of this source code package. #
4
+ # #
5
+ # No part of the package, including this file, may be copied, modified, #
6
+ # propagated, or distributed except according to the terms contained in #
7
+ # the file 'LICENSE.txt'. #
8
+ # #
9
+ # (C) Copyright European Space Agency, 2025 #
10
+ # *************************************************************************** #
11
+ from jinja2 import Template
12
+ import os
13
+ from datetime import datetime
14
+ from xml.etree import ElementTree as et
15
+ import xml.etree.cElementTree as etree
16
+ from xml.dom import minidom
17
+ from copy import deepcopy
18
+
19
+ from juice_simphony.CompositionEngine.Scenario.common.fileHandleEps1 import fileHandleEps1
20
+ from juice_simphony.CompositionEngine.Scenario.common.fileName import fileName
21
+ from juice_simphony.CompositionEngine.Scenario.common.fileHandleXML import fileHandleXML
22
+
23
+ class xml_attitude(fileHandleXML):
24
+
25
+ def __init__(self, path, xml_att_struct, params = 0):
26
+ self.params = {}
27
+ if params!=0:
28
+ self.params.update(params)
29
+ self.path = path
30
+ self.rootPath = path
31
+ self.xml_att_struct = xml_att_struct
32
+ self.params["prefix"] = "PTR"
33
+ self.params["type"] = "SOC"
34
+ self.params["desc"] = ""
35
+ self.params["version"] = "SXXPYY"
36
+ self.params["ext"] = "ptx"
37
+ self.fileName = ""
38
+ self.template = 0
39
+ self.startTime = self.params["startTime"]
40
+ self.endTime = self.params["endTime"]
41
+ self.time_format = "%Y-%m-%dT%H:%M:%S"
42
+ fileName.__init__(self, self.params)
43
+
44
+ def indent(self, elem, level=0):
45
+ i = "\n" + level*" "
46
+ j = "\n" + (level-1)*" "
47
+ if len(elem):
48
+ if not elem.text or not elem.text.strip():
49
+ elem.text = i + " "
50
+ if not elem.tail or not elem.tail.strip():
51
+ elem.tail = i
52
+ for subelem in elem:
53
+ self.indent(subelem, level+1)
54
+ if not elem.tail or not elem.tail.strip():
55
+ elem.tail = j
56
+ else:
57
+ if level and (not elem.tail or not elem.tail.strip()):
58
+ elem.tail = j
59
+ return elem
60
+
61
+ def writeTimelineHeader(self):
62
+ self.writeHeader(self.params["scenarioID"], "JUICE SEGMENTATION ATTITUDE")
63
+ #comment = etree.Comment(' === Some Comment === ')
64
+ #root.insert(1, comment) # 1 is the index where comment is inserted
65
+ self.insertEmptyLine()
66
+
67
+ def write_xml_body(self):
68
+ #print (etree.tostring(self.xml_filtered_att, encoding='utf8', method='xml'))
69
+ #self.indent(self.xml_filtered_att)
70
+ xmlstr = minidom.parseString(etree.tostring(self.xml_filtered_att,encoding="unicode")).toprettyxml(indent = " ")
71
+ line_list = [s for s in xmlstr.splitlines() if s.strip("\r\n").strip()]
72
+ xmlstr = os.linesep.join(line_list)
73
+ # COMMENTED by PE
74
+ #print(xmlstr)
75
+ self.fileHdl.write(xmlstr)
76
+ # et.indent(self.xml_filtered_att, space=' ', level=0)
77
+ # self.fileHdl.write(et.tostring(self.xml_filtered_att,encoding="unicode"))
78
+
79
+ def writeContent(self):
80
+ self.writeTimelineHeader()
81
+ self.xml_filtered_att = self.filterPtr(self.xml_att_struct, self.startTime, self.endTime)
82
+ self.write_xml_body()
83
+
84
+ def filterPtr(self, xml_struct_att, start_time, end_time, cut_block = True):
85
+ start_time_dt = datetime.strptime(start_time, self.time_format)
86
+ end_time_dt = datetime.strptime(end_time, self.time_format)
87
+
88
+ # Get timeline node
89
+ timeline = next(xml_struct_att.iter("timeline"))
90
+ xml_block_list = list(xml_struct_att.iter("block"))
91
+ xml_block_list_out = []
92
+ #xml_block_list_len = len(xml_block_list)
93
+ num_of_filtered_blocks = 0
94
+ for index,xml_block in enumerate(xml_block_list):
95
+ if (xml_block.attrib["ref"] == "SLEW"): continue
96
+ # xml_seg = next(xml_block.iter("segmentation"), None)
97
+ # if not xml_seg == None:
98
+ xml_seg_start_time_dt = datetime.strptime(xml_block.find('startTime').text.strip(), self.time_format)
99
+ xml_seg_end_time_dt = datetime.strptime(xml_block.find('endTime').text.strip(), self.time_format)
100
+ intersect, cutted_block, xml_cut_start_time_dt, xml_cut_end_time_dt = self.intersectTimeRange(start_time_dt, end_time_dt, xml_seg_start_time_dt, xml_seg_end_time_dt, cut_block)
101
+ if intersect:
102
+ if num_of_filtered_blocks >= 1:
103
+ if xml_block_list[index-1].attrib["ref"] == "SLEW":
104
+ xml_block_list_out.append(xml_block_list[index-1])
105
+ num_of_filtered_blocks = num_of_filtered_blocks + 1
106
+ if cutted_block:
107
+ xml_block_start_time = next(xml_block.iter("startTime"), None)
108
+ if not xml_block_start_time == None:
109
+ xml_block_start_time.text = datetime.strftime(xml_cut_start_time_dt, "%Y-%m-%dT%H:%M:%S")
110
+ xml_block_end_time = next(xml_block.iter("endTime"), None)
111
+ if not xml_block_end_time == None:
112
+ xml_block_end_time.text = datetime.strftime(xml_cut_end_time_dt, "%Y-%m-%dT%H:%M:%S")
113
+ xml_block_list_out.append(xml_block)
114
+ last_block_end_time = xml_cut_end_time_dt
115
+ last_block = xml_block_list_out[-1]
116
+ xml_block_end_time = next(last_block.iter("endTime"), None)
117
+ if not xml_block_end_time == None:
118
+ xml_block_end_time.text = datetime.strftime(last_block_end_time, "%Y-%m-%dT%H:%M:%S")
119
+ else:
120
+ end_time_el = et.Element("endTime")
121
+ end_time_el.text = datetime.strftime(last_block_end_time, "%Y-%m-%dT%H:%M:%S")
122
+ last_block.append(end_time_el)
123
+ timeline.clear()
124
+ timeline.attrib["frame"] = "SC";
125
+ timeline.extend(xml_block_list_out)
126
+
127
+ return xml_struct_att
128
+
129
+ def intersectTimeRange(self, startTime, endTime, xml_seg_start_time, xml_seg_end_time, cut_block = True):
130
+ cutted_block = False
131
+ if endTime <= xml_seg_start_time: # st et xml_st xml_et
132
+ return (False, cutted_block, xml_seg_start_time, xml_seg_end_time)
133
+ else:
134
+ if xml_seg_end_time <= startTime: # xml_st xml_et st et
135
+ return (False, cutted_block, xml_seg_start_time, xml_seg_end_time)
136
+ else:
137
+ if cut_block:
138
+ if endTime < xml_seg_end_time: # xml_st et xml_et
139
+ # Cut block end time
140
+ xml_seg_end_time = endTime
141
+ cutted_block = True
142
+ if startTime > xml_seg_start_time: # xml_st st xml_et
143
+ # Cut block start time
144
+ xml_seg_start_time = startTime
145
+ cutted_block = True
146
+ return (True, cutted_block, xml_seg_start_time, xml_seg_end_time)
147
+
148
+ if __name__ == "__main__":
149
+ xml_doc = et.parse(R"Z:\VALIDATION\simphony\pcm\phs_pcm_test_004\input\TMP\CREMA_5_0.xml")
150
+ root = xml_doc.getroot()
151
+
152
+ params = {}
153
+ params["scenarioID"] = "SJS0003C30A"
154
+ params["startTime"] = "2032-09-01T01:00:00"
155
+ params["endTime"] = "2032-09-28T08:00:00"
156
+ #xml_att_file = xml_attitude(path="Z:\VALIDATION\simphony\pcm\phs_pcm_test_001\scenario_generator\output", xml_att_struct=xml_doc.getroot(), params=params)
157
+ #xml_att_file.genFile()
@@ -0,0 +1,10 @@
1
+ # *************************************************************************** #
2
+ # This file is subject to the terms and conditions defined in the #
3
+ # file 'LICENSE.txt', which is part of this source code package. #
4
+ # #
5
+ # No part of the package, including this file, may be copied, modified, #
6
+ # propagated, or distributed except according to the terms contained in #
7
+ # the file 'LICENSE.txt'. #
8
+ # #
9
+ # (C) Copyright European Space Agency, 2025 #
10
+ # *************************************************************************** #
@@ -0,0 +1,69 @@
1
+ # *************************************************************************** #
2
+ # This file is subject to the terms and conditions defined in the #
3
+ # file 'LICENSE.txt', which is part of this source code package. #
4
+ # #
5
+ # No part of the package, including this file, may be copied, modified, #
6
+ # propagated, or distributed except according to the terms contained in #
7
+ # the file 'LICENSE.txt'. #
8
+ # #
9
+ # (C) Copyright European Space Agency, 2025 #
10
+ # *************************************************************************** #
11
+ import configparser
12
+ from jinja2 import Template
13
+ import os
14
+ from juice_simphony.CompositionEngine.Scenario.common.fileName import fileName
15
+
16
+ class fileHandle(fileName):
17
+
18
+ def __init__(self, path, params=0):
19
+ if params!= 0: self.params.update(params)
20
+ self.path = path
21
+ self.fileName = ""
22
+ fileName.__init__(self)
23
+
24
+ def genFile(self):
25
+
26
+ # Generate file name
27
+ self.fileName = self.genBaseFileName() + "." + self.params["ext"]
28
+ destFilePath = os.path.join(self.path, self.fileName)
29
+ #destFilePath = self.path
30
+
31
+ # Open File
32
+ self.fileHdl = open(destFilePath, "w")
33
+
34
+ # Write Content
35
+ self.writeContent()
36
+
37
+ # Close File
38
+ self.fileHdl.close()
39
+
40
+ return destFilePath
41
+
42
+ def loadRefFile(self, filePath):
43
+ with open(filePath) as tplFile:
44
+ self.template = Template(tplFile.read())
45
+
46
+ def writeContent(self):
47
+ a=1
48
+
49
+ def writeHeader(self, title, shortDesc, description=""):
50
+ self.fileHdl.write( "#----------------------------------------------------------------------------------------------------#\n")
51
+ self.fileHdl.write( "# #\n")
52
+ self.fileHdl.write('#{:^100s}#\n'.format(title))
53
+ self.fileHdl.write('#{:^100s}#\n'.format(shortDesc))
54
+ self.fileHdl.write( "# #\n")
55
+ self.fileHdl.write( "#----------------------------------------------------------------------------------------------------#\n")
56
+
57
+ if description != "":
58
+ self.fileHdl.write ("\n")
59
+
60
+ self.fileHdl.write ("#----------------------------------------------------------------------------------------------------#\n")
61
+ self.fileHdl.write ("# DESCRIPTION:\n")
62
+ self.fileHdl.write (description + "\n")
63
+ self.fileHdl.write ("#----------------------------------------------------------------------------------------------------#\n")
64
+
65
+ def insertEmptyLine(self):
66
+ self.fileHdl.write("\n")
67
+
68
+ def insertComment(self,text):
69
+ self.fileHdl.write("# " + text + "\n")
@@ -0,0 +1,43 @@
1
+ # *************************************************************************** #
2
+ # This file is subject to the terms and conditions defined in the #
3
+ # file 'LICENSE.txt', which is part of this source code package. #
4
+ # #
5
+ # No part of the package, including this file, may be copied, modified, #
6
+ # propagated, or distributed except according to the terms contained in #
7
+ # the file 'LICENSE.txt'. #
8
+ # #
9
+ # (C) Copyright European Space Agency, 2025 #
10
+ # *************************************************************************** #
11
+
12
+ import os
13
+ from juice_simphony.CompositionEngine.Scenario.common.fileHandle import fileHandle
14
+
15
+ class fileHandleEps(fileHandle):
16
+ def __init__(self, path, params=0):
17
+ if params!= 0: self.params.update(params)
18
+ self.path = path
19
+ fileHandle.__init__(self, path)
20
+
21
+ def insertVersion (self, version = 1):
22
+ self.fileHdl.write("# Timeline version" + "\n")
23
+ self.fileHdl.write("Version: 1" + "\n")
24
+
25
+ def insertTimeWindow (self, startTime, endTime):
26
+ self.fileHdl.write("# Time Window" + "\n")
27
+ self.fileHdl.write("Start_time: " + startTime + "\n")
28
+ self.fileHdl.write("End_time: " + endTime + "\n")
29
+
30
+ def insertInclude(self,params):
31
+ fileNameRel = os.path.relpath(params["filePath"], self.rootPath).replace("\\","/")
32
+ if "fileDescription" in params:
33
+ self.insertEmptyLine()
34
+ self.fileHdl.write("# " + params["fileDescription"] + "\n")
35
+ self.fileHdl.write("Include: " + fileNameRel + "\n")
36
+
37
+ def insertIncludeFile(self,params):
38
+ fileNameRel = os.path.relpath(params["filePath"], self.rootPath).replace("\\","/")
39
+ if "fileDescription" in params:
40
+ self.insertEmptyLine()
41
+ self.fileHdl.write("# " + params["fileDescription"] + "\n")
42
+ self.fileHdl.write("Include_file: " + "\"" + fileNameRel + "\"" + "\n")
43
+
@@ -0,0 +1,40 @@
1
+ # *************************************************************************** #
2
+ # This file is subject to the terms and conditions defined in the #
3
+ # file 'LICENSE.txt', which is part of this source code package. #
4
+ # #
5
+ # No part of the package, including this file, may be copied, modified, #
6
+ # propagated, or distributed except according to the terms contained in #
7
+ # the file 'LICENSE.txt'. #
8
+ # #
9
+ # (C) Copyright European Space Agency, 2025 #
10
+ # *************************************************************************** #
11
+ import os
12
+ from .fileHandle import fileHandle
13
+
14
+ class fileHandleEps1(fileHandle):
15
+ def __init__(self):
16
+ fileHandle.__init__(self,self.path)
17
+
18
+ def insertVersion (self, version = 1):
19
+ self.fileHdl.write("# Timeline version" + "\n")
20
+ self.fileHdl.write("Version: 1" + "\n")
21
+
22
+ def insertTimeWindow (self, startTime, endTime):
23
+ self.fileHdl.write("# Time Window" + "\n")
24
+ self.fileHdl.write("Start_time: " + startTime + "\n")
25
+ self.fileHdl.write("End_time: " + endTime + "\n")
26
+
27
+ def insertInclude(self,params):
28
+ fileNameRel = os.path.relpath(params["filePath"], self.rootPath).replace("\\","/")
29
+ if "fileDescription" in params:
30
+ self.insertEmptyLine()
31
+ self.fileHdl.write("# " + params["fileDescription"] + "\n")
32
+ self.fileHdl.write("Include: " + fileNameRel + "\n")
33
+
34
+ def insertIncludeFile(self,params):
35
+ fileNameRel = os.path.relpath(params["filePath"], self.rootPath).replace("\\","/")
36
+ if "fileDescription" in params:
37
+ self.insertEmptyLine()
38
+ self.fileHdl.write("# " + params["fileDescription"] + "\n")
39
+ self.fileHdl.write("Include_file: " + "\"" + fileNameRel + "\"" + "\n")
40
+
@@ -0,0 +1,87 @@
1
+ # *************************************************************************** #
2
+ # This file is subject to the terms and conditions defined in the #
3
+ # file 'LICENSE.txt', which is part of this source code package. #
4
+ # #
5
+ # No part of the package, including this file, may be copied, modified, #
6
+ # propagated, or distributed except according to the terms contained in #
7
+ # the file 'LICENSE.txt'. #
8
+ # #
9
+ # (C) Copyright European Space Agency, 2025 #
10
+ # *************************************************************************** #
11
+ import os
12
+ from juice_simphony.CompositionEngine.Scenario.common.fileHandleEps import fileHandleEps
13
+
14
+ class fileHandleTml(fileHandleEps):
15
+ def __init__(self, path, params=0):
16
+ if params!= 0: self.params.update(params)
17
+ self.path = path
18
+ self.fileName = ""
19
+ fileHandleEps.__init__(self, self.path, self.params)
20
+
21
+ def insertInitPM (self, param, par_pad, value, value_pad, comment):
22
+ self.fileHdl.write(f'Init_PM: { param : <{par_pad}} {value:<{value_pad}.2f} # {comment}\n')
23
+
24
+ def insertInitMS (self, exp, exp_pad, module, module_pad, mode, mode_pad, comment):
25
+ self.fileHdl.write(f'Init_MS: { exp : <{exp_pad}}{ module : <{module_pad}}{ mode : <{mode_pad}} # {comment}\n')
26
+
27
+ def insertRequestEntry(self,date, exp, mode, action, par_label, par_value, comment):
28
+ comment_lines = comment.splitlines()
29
+ for comment_line in comment_lines:
30
+ if comment_line != "": self.fileHdl.write(f'# {comment_line}\n')
31
+ if 'Z' in date:
32
+ self.fileHdl.write(f'{date} {exp} {mode} {action} ({par_label} = {par_value:12.7f})\n')
33
+ else:
34
+ self.fileHdl.write(f'{date}Z {exp} {mode} {action} ({par_label} = {par_value:12.7f})\n')
35
+
36
+ def insertLine(self,text):
37
+ self.fileHdl.write(text + "\n")
38
+ ''''
39
+ # Spacecrat platform initialization
40
+ # ------------------------------------
41
+
42
+ Init_PM: BATTERY_DOD 0.0 # Battery DoD
43
+ Init_MS: JUICE DST_X_R NOM # Antena Receiver always ON
44
+ Init_MS: JUICE PLATFORM ON # Platform ON to enable platform power consumption
45
+
46
+
47
+ # Set platform profile
48
+ # ---------------------
49
+ 2032-01-09T16:44:04Z JUICE * SET_POWER (VALUE=572.9135779720983)
50
+ '''''
51
+ if __name__ == '__main__':
52
+
53
+ param = "BATTERY_DOD"
54
+ par_pad = 8
55
+ value = 0.0
56
+ value_pad = 8
57
+ comment = "Antena Receiver always ON"
58
+ print(f'Init_PM: { param : <{par_pad}} {value:<{value_pad}.2f} # {comment}')
59
+
60
+ exp = "JUICE"
61
+ exp_pad = 8
62
+ module = "DST_X_R"
63
+ module_pad = 9
64
+ mode = "NOM"
65
+ mode_pad = 5
66
+ comment = "Antena Receiver always ON"
67
+ print(f'Init_PM: { exp : <{exp_pad}} { module : <{module_pad}} { mode : <{mode_pad}} # {comment}')
68
+
69
+ exp = "JUICE"
70
+ exp_pad = 8
71
+ module = "PLATFORM"
72
+ module_pad = 9
73
+ mode = "ON"
74
+ mode_pad = 5
75
+ comment = "Platform ON to enable platform power consumption"
76
+ print(f'Init_PM: { exp : <{exp_pad}} { module : <{module_pad}} { mode : <{mode_pad}} # {comment}')
77
+
78
+ date = "2032-01-09T16:44:04Z"
79
+ exp = "JUICE"
80
+ mode = " * "
81
+ action = "SET_POWER"
82
+ par_label = "VALUE"
83
+ par_value = 572.9135779720983
84
+ comment = "This is coming from R[001]"
85
+ print(f'Comment: {comment}')
86
+ # 2032-01-09T16:44:04Z JUICE * SET_POWER (VALUE=572.9135779720983)
87
+ print(f'{date} {exp} {mode} {action} ({par_label} = {par_value:18.13f})')
@@ -0,0 +1,69 @@
1
+ # *************************************************************************** #
2
+ # This file is subject to the terms and conditions defined in the #
3
+ # file 'LICENSE.txt', which is part of this source code package. #
4
+ # #
5
+ # No part of the package, including this file, may be copied, modified, #
6
+ # propagated, or distributed except according to the terms contained in #
7
+ # the file 'LICENSE.txt'. #
8
+ # #
9
+ # (C) Copyright European Space Agency, 2025 #
10
+ # *************************************************************************** #
11
+ import configparser
12
+ from jinja2 import Template
13
+ import os
14
+ #from common.fileName import fileName
15
+ from juice_simphony.CompositionEngine.Scenario.common.fileName import fileName
16
+
17
+ class fileHandleXML(fileName):
18
+
19
+ def __init__(self, path, params=0):
20
+ if params!= 0: self.params.append(params)
21
+ self.path = path
22
+ self.fileName = ""
23
+ fileName.__init__(self)
24
+
25
+ def genFile(self):
26
+
27
+ # Generate file name
28
+ self.fileName = self.genBaseFileName() + "." + self.params["ext"]
29
+ destFilePath = os.path.join(self.path, self.fileName)
30
+
31
+ # Open File
32
+ self.fileHdl = open(destFilePath, "w")
33
+
34
+ # Write Content
35
+ self.writeContent()
36
+
37
+ # Close File
38
+ self.fileHdl.close()
39
+
40
+ return destFilePath
41
+
42
+ def loadRefFile(self, filePath):
43
+ with open(filePath) as tplFile:
44
+ self.template = Template(tplFile.read())
45
+
46
+ def writeContent(self):
47
+ a=1
48
+
49
+ def writeHeader(self, title, shortDesc, description=""):
50
+ self.fileHdl.write( "<!-- \n")
51
+ self.fileHdl.write( "#----------------------------------------------------------------------------------------------------#\n")
52
+ self.fileHdl.write( "# #\n")
53
+ self.fileHdl.write('#{:^100s}#\n'.format(title))
54
+ self.fileHdl.write('#{:^100s}#\n'.format(shortDesc))
55
+ self.fileHdl.write( "# #\n")
56
+ self.fileHdl.write( "#----------------------------------------------------------------------------------------------------#\n")
57
+
58
+ if description != "":
59
+ self.fileHdl.write ("\n")
60
+
61
+ self.fileHdl.write ("#----------------------------------------------------------------------------------------------------#\n")
62
+ self.fileHdl.write ("# DESCRIPTION:\n")
63
+ self.fileHdl.write (description + "\n")
64
+ self.fileHdl.write ("#----------------------------------------------------------------------------------------------------#\n")
65
+
66
+ self.fileHdl.write( "--> \n")
67
+
68
+ def insertEmptyLine(self):
69
+ self.fileHdl.write("\n")
@@ -0,0 +1,68 @@
1
+ # *************************************************************************** #
2
+ # This file is subject to the terms and conditions defined in the #
3
+ # file 'LICENSE.txt', which is part of this source code package. #
4
+ # #
5
+ # No part of the package, including this file, may be copied, modified, #
6
+ # propagated, or distributed except according to the terms contained in #
7
+ # the file 'LICENSE.txt'. #
8
+ # #
9
+ # (C) Copyright European Space Agency, 2025 #
10
+ # *************************************************************************** #
11
+
12
+ class fileName():
13
+
14
+ def __init__(self, params=0):
15
+ if params!= 0: self.params.update(params)
16
+ if "addScenarioID" not in self.params: self.params["addScenarioID"] = True
17
+
18
+ # Base File Name Generator
19
+ # ------------------------
20
+ def genBaseFileName(self):
21
+ # General scenario file name structure
22
+ # {prefix}_{type}_{scenarioID}_{desc}_{version}
23
+ type = ""
24
+ desc = ""
25
+ version = ""
26
+ sceID = ""
27
+ if self.params["type"] != "": type = "_" + self.params["type"].upper()
28
+ if self.params["desc"] != "": desc = "_" + self.params["desc"]
29
+ if self.params["version"] != "": version = "_" + str(self.params["version"])
30
+ if self.params["addScenarioID"]: sceID = "_" + self.params["scenarioID"]
31
+ return "{}{}{}{}{}".format(self.params["prefix"],
32
+ type,
33
+ desc,
34
+ sceID,
35
+ version)
36
+
37
+ # Base File Name Without version Generator
38
+ # ----------------------------------------
39
+ def genBaseFileNameNoV(self):
40
+ # General scenario file name structure
41
+ # {prefix}_{type}_{scenarioID}_{desc}_{version}
42
+ type = ""
43
+ desc = ""
44
+ if self.params["type"] != "": type = "_" + self.params["type"].upper()
45
+ if self.params["desc"] != "": desc = "_" + self.params["desc"]
46
+ return "{}{}{}".format(self.params["prefix"],
47
+ type,
48
+ desc)
49
+
50
+
51
+ # Reference File Name Generator
52
+ # -----------------------------
53
+ def genRefFileName(self):
54
+ # General scenario file name structure
55
+ # {prefix}_{type}_{desc}_{refScenarioID}_{version}
56
+ type = ""
57
+ desc = ""
58
+ version = ""
59
+ sceID = ""
60
+ if self.params["type"] != "": type = "_" + self.params["type"].upper()
61
+ if self.params["desc"] != "": desc = "_" + self.params["desc"]
62
+ if self.params["version"] != "": version = "_" + self.params["version"]
63
+ if self.params["addScenarioID"]: sceID = "_" + self.params["refScenarioID"]
64
+ return "{}{}{}{}{}".format(self.params["prefix"],
65
+ type,
66
+ desc,
67
+ sceID,
68
+ version)