alpine-racing-sysmatools-01 0.1.0__tar.gz

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.
@@ -0,0 +1,8 @@
1
+ Metadata-Version: 2.4
2
+ Name: alpine_racing_sysmatools_01
3
+ Version: 0.1.0
4
+ Summary: Python wrapper for Sysma automation
5
+ Author-email: Paul Ramirez <paul.ramirez-fiallos-ext@fr.alpineracing.com>
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: pywin32
@@ -0,0 +1,20 @@
1
+ [build-system]
2
+ requires = ["setuptools>=61.0"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "alpine_racing_sysmatools_01"
7
+ version = "0.1.0"
8
+ description = "Python wrapper for Sysma automation"
9
+ authors = [
10
+ { name="Paul Ramirez", email="paul.ramirez-fiallos-ext@fr.alpineracing.com" }
11
+ ]
12
+ readme = "README.md"
13
+ requires-python = ">=3.8"
14
+
15
+ dependencies = [
16
+ "pywin32"
17
+ ]
18
+
19
+ [tool.setuptools.packages.find]
20
+ where = ["src"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,8 @@
1
+ Metadata-Version: 2.4
2
+ Name: alpine_racing_sysmatools_01
3
+ Version: 0.1.0
4
+ Summary: Python wrapper for Sysma automation
5
+ Author-email: Paul Ramirez <paul.ramirez-fiallos-ext@fr.alpineracing.com>
6
+ Requires-Python: >=3.8
7
+ Description-Content-Type: text/markdown
8
+ Requires-Dist: pywin32
@@ -0,0 +1,8 @@
1
+ pyproject.toml
2
+ src/alpine_racing_sysmatools_01.egg-info/PKG-INFO
3
+ src/alpine_racing_sysmatools_01.egg-info/SOURCES.txt
4
+ src/alpine_racing_sysmatools_01.egg-info/dependency_links.txt
5
+ src/alpine_racing_sysmatools_01.egg-info/requires.txt
6
+ src/alpine_racing_sysmatools_01.egg-info/top_level.txt
7
+ src/sysmatools/__init__.py
8
+ src/sysmatools/controller.py
@@ -0,0 +1,3 @@
1
+ from .controller import SysmaController
2
+
3
+ __all__ = ["SysmaController"]
@@ -0,0 +1,145 @@
1
+ """
2
+ Library: SysmaTools
3
+ Author: Paul Ramirez
4
+ Company: Alpine Racing
5
+ Created: 2026-03-24
6
+ Last Modified: 2026-03-24
7
+ Version: 1.0.0
8
+
9
+
10
+ Description:
11
+ This library has functions to control the software Sysma
12
+
13
+ SysmaOpen
14
+ SysmaLoadCLX
15
+ SysmaReadCal
16
+ SysmaDisplay
17
+ SysmaReadMeas
18
+ SysmaWriteCal
19
+ SysmaSave
20
+ SysmaClose
21
+
22
+ """
23
+ import win32com.client
24
+ import os
25
+
26
+ class SysmaController:
27
+
28
+ def __init__(self, path, project_name):
29
+ self.project_path = os.path.join(path, project_name)
30
+ self.SYSMA = win32com.client.Dispatch('Sysma.Application')
31
+
32
+ def SysmaOpen(self):
33
+ self.SYSMA.ShowApplication()
34
+ self.SYSMA.LoadProject(self.project_path)
35
+ self.SYSMA.MaximizeApplication()
36
+ self.SYSMA.Devices.Refresh()
37
+ print(f"\nLoading Project: {self.project_path}")
38
+ self.SYSMA.Devices.Refresh()
39
+ c = self.SYSMA.SessionActivate(0)
40
+ print(f"Session: {c}")
41
+
42
+ def SysmaConnect(self):
43
+ self.SYSMA.Project.ECUCommunication.StartLink(0)
44
+
45
+ def SysmaLoadCLX(self):
46
+ clx_count = self.SYSMA.Project.ECUCLXCount
47
+ print(f"Number of active CLX: {clx_count}")
48
+ clx_dict = {} # empty dictionary
49
+ for i in range(clx_count):
50
+ path = self.SYSMA.Project.GetECUCLXName(i)
51
+ clx_dict[i] = path
52
+ print(f"CLX {i+1}: ------ {path}")
53
+ return clx_dict
54
+
55
+
56
+
57
+
58
+ def SysmaReadCal(self, calib, clx_data):
59
+ calibrations = {}
60
+
61
+ for idx, path in clx_data.items():
62
+ self.SYSMA.Project.LoadECUCalibrations(path)
63
+ temp_dict = {} # It is filled with valid values
64
+
65
+ for var in calib:
66
+ try:
67
+ value = self.SYSMA.Project.ECUCalibrations.FindByDisplayName(var).Values(0)
68
+ temp_dict[var] = value
69
+ except Exception:
70
+ pass # if not found, ignore
71
+
72
+ # Store only if at least one variable was found
73
+ if temp_dict:
74
+ calibrations[path] = {
75
+ "index": idx,
76
+ "data": temp_dict
77
+ }
78
+ return calibrations
79
+
80
+
81
+ def SysmaDisplay(self, calibrations):
82
+ print("\n--------Read Calibrations--------\n")
83
+ for archivo, contenido in calibrations.items():
84
+ nombre = archivo.split("\\")[-1]
85
+ print(f"\nCLX {contenido['index']+1}: {nombre}")
86
+ for clave, valor in contenido["data"].items():
87
+ #print(f"{clave}: {valor}")
88
+ print(f"{clave}: {str(valor).strip()}")
89
+
90
+
91
+ def SysmaReadMeas(self, meas):
92
+ measurements = {}
93
+ for var in meas:
94
+ try:
95
+ value = self.SYSMA.Project.ECUChannels.FindByDisplayName(var).GetValue(0)[1]
96
+ measurements[var] = value
97
+ except:
98
+ pass
99
+ print("\n--------Read Measurements--------\n")
100
+ for var, value in measurements.items():
101
+ print(f"{var}: {value}")
102
+ print("\n---------------------------------")
103
+ return measurements
104
+
105
+
106
+
107
+
108
+ def SysmaWriteCal(self, calib, value, clx_data):
109
+ calibrations_w = {}
110
+ for idx, path in clx_data.items():
111
+ self.SYSMA.Project.LoadECUCalibrations(path)
112
+
113
+ for var in calib:
114
+ try:
115
+ value_ref = self.SYSMA.Project.ECUCalibrations.FindByDisplayName(var).Values(0)
116
+
117
+ if value_ref is None:
118
+ continue
119
+
120
+ clx_name = path.split("\\")[-1]
121
+ print(f"\nfrom CLX : {clx_name}")
122
+ print(f"Before {var}: {value_ref}")
123
+ self.SYSMA.Project.ECUCalibrations.FindByDisplayName(var).SetValues(0, value)
124
+ self.SYSMA.Project.ECUCommunication.WriteCalibration(var)
125
+ value_after = self.SYSMA.Project.ECUCalibrations.FindByDisplayName(var).Values(0)
126
+ print(f"After {var}: {value_after}")
127
+ except Exception:
128
+ pass
129
+
130
+ def SysmaSave(self):
131
+ print("\nSaving project...")
132
+ self.SYSMA.Project.ECUCommunication.StopLink()
133
+ self.SYSMA.SaveProject()
134
+
135
+
136
+
137
+ ##Function Close Sysma
138
+ def SysmaClose(self):
139
+ print("\nClosing SYSMA...")
140
+ self.SYSMA.CloseApplication()
141
+ print("SYSMA closed successfully.")
142
+
143
+
144
+
145
+