|
35 | 35 | SherlockLoadShockProfilePulsesError, |
36 | 36 | SherlockLoadThermalProfileError, |
37 | 37 | SherlockNoGrpcConnectionException, |
| 38 | + SherlockSaveProfileError, |
38 | 39 | ) |
39 | 40 | from ansys.sherlock.core.grpc_stub import GrpcStub |
40 | | -from ansys.sherlock.core.types.lifecycle_types import ImportThermalSignalRequest |
| 41 | +from ansys.sherlock.core.types.lifecycle_types import ( |
| 42 | + ImportThermalSignalRequest, |
| 43 | + SaveHarmonicProfileRequest, |
| 44 | + SaveRandomVibeProfileRequest, |
| 45 | + SaveShockPulseProfileRequest, |
| 46 | + SaveThermalProfileRequest, |
| 47 | +) |
41 | 48 | from ansys.sherlock.core.utils.version_check import require_version |
42 | 49 |
|
43 | 50 |
|
@@ -2167,3 +2174,182 @@ def import_thermal_signal( |
2167 | 2174 | raise SherlockNoGrpcConnectionException() |
2168 | 2175 |
|
2169 | 2176 | return self.stub.importThermalSignal(import_thermal_signal_request) |
| 2177 | + |
| 2178 | + @require_version(261) |
| 2179 | + def save_harmonic_profile( |
| 2180 | + self, request: SaveHarmonicProfileRequest |
| 2181 | + ) -> SherlockCommonService_pb2.ReturnCode: |
| 2182 | + """Save a harmonic life cycle event profile to a .dat or .csv file. |
| 2183 | +
|
| 2184 | + Available Since: 2026R1 |
| 2185 | +
|
| 2186 | + Parameters |
| 2187 | + ---------- |
| 2188 | + request : SaveHarmonicProfileRequest |
| 2189 | + Request object containing the information needed to save a harmonic profile. |
| 2190 | +
|
| 2191 | + Returns |
| 2192 | + ------- |
| 2193 | + SherlockCommonService_pb2.ReturnCode |
| 2194 | + Status code of the response. 0 for success. |
| 2195 | +
|
| 2196 | + Examples |
| 2197 | + -------- |
| 2198 | + >>> from ansys.sherlock.core.types.lifecycle_types import SaveHarmonicProfileRequest |
| 2199 | + >>> from ansys.sherlock.core.launcher import launch_sherlock |
| 2200 | + >>> sherlock = launch_sherlock() |
| 2201 | + >>> response = sherlock.lifecycle.save_harmonic_profile( |
| 2202 | + >>> SaveHarmonicProfileRequest( |
| 2203 | + >>> project="MyProject", |
| 2204 | + >>> phase_name="DurabilityPhase", |
| 2205 | + >>> event_name="Harmonic_100Hz", |
| 2206 | + >>> triaxial_axis="x", |
| 2207 | + >>> file_path="/tmp/Harmonic_100Hz.csv", |
| 2208 | + >>> ) |
| 2209 | + >>> ) |
| 2210 | + >>> assert response.value == 0 |
| 2211 | + """ |
| 2212 | + grpc_request = request._convert_to_grpc() |
| 2213 | + |
| 2214 | + if not self._is_connection_up(): |
| 2215 | + raise SherlockNoGrpcConnectionException() |
| 2216 | + |
| 2217 | + response = self.stub.saveHarmonicProfile(grpc_request) |
| 2218 | + |
| 2219 | + # Raise error if save failed |
| 2220 | + if response.value != 0: |
| 2221 | + raise SherlockSaveProfileError(response.message) |
| 2222 | + |
| 2223 | + return response |
| 2224 | + |
| 2225 | + @require_version(261) |
| 2226 | + def save_random_vibe_profile( |
| 2227 | + self, request: SaveRandomVibeProfileRequest |
| 2228 | + ) -> SherlockCommonService_pb2.ReturnCode: |
| 2229 | + """Save a random vibe life cycle event profile to a .dat or .csv file. |
| 2230 | +
|
| 2231 | + Available Since: 2026R1 |
| 2232 | +
|
| 2233 | + Parameters |
| 2234 | + ---------- |
| 2235 | + request : SaveRandomVibeProfileRequest |
| 2236 | + Request object containing the information needed to save a random vibe profile. |
| 2237 | +
|
| 2238 | + Returns |
| 2239 | + ------- |
| 2240 | + SherlockCommonService_pb2.ReturnCode |
| 2241 | + Status code of the response. 0 for success. |
| 2242 | +
|
| 2243 | + Examples |
| 2244 | + -------- |
| 2245 | + >>> from ansys.sherlock.core.types.lifecycle_types import SaveRandomVibeProfileRequest |
| 2246 | + >>> from ansys.sherlock.core.launcher import launch_sherlock |
| 2247 | + >>> sherlock = launch_sherlock() |
| 2248 | + >>> response = sherlock.lifecycle.save_random_vibe_profile( |
| 2249 | + >>> SaveRandomVibeProfileRequest( |
| 2250 | + >>> project="MyProject", |
| 2251 | + >>> phase_name="RandomVibePhase", |
| 2252 | + >>> event_name="RV_Event_01", |
| 2253 | + >>> file_path="/tmp/RV_Event_01.dat", |
| 2254 | + >>> ) |
| 2255 | + >>> ) |
| 2256 | + >>> assert response.value == 0 |
| 2257 | + """ |
| 2258 | + grpc_request = request._convert_to_grpc() |
| 2259 | + |
| 2260 | + if not self._is_connection_up(): |
| 2261 | + raise SherlockNoGrpcConnectionException() |
| 2262 | + |
| 2263 | + response = self.stub.saveRandomVibeProfile(grpc_request) |
| 2264 | + |
| 2265 | + # Raise error if save failed |
| 2266 | + if response.value != 0: |
| 2267 | + raise SherlockSaveProfileError(response.message) |
| 2268 | + |
| 2269 | + @require_version(261) |
| 2270 | + def save_shock_pulse_profile( |
| 2271 | + self, request: SaveShockPulseProfileRequest |
| 2272 | + ) -> SherlockCommonService_pb2.ReturnCode: |
| 2273 | + """Save a shock pulse life cycle event profile to a .dat or .csv file. |
| 2274 | +
|
| 2275 | + Available Since: 2026R1 |
| 2276 | +
|
| 2277 | + Parameters |
| 2278 | + ---------- |
| 2279 | + request : SaveShockPulseProfileRequest |
| 2280 | + Request object containing the information needed to save a shock pulse profile. |
| 2281 | +
|
| 2282 | + Returns |
| 2283 | + ------- |
| 2284 | + SherlockCommonService_pb2.ReturnCode |
| 2285 | + Status code of the response. 0 for success. |
| 2286 | +
|
| 2287 | + Examples |
| 2288 | + -------- |
| 2289 | + >>> from ansys.sherlock.core.types.lifecycle_types import SaveShockPulseProfileRequest |
| 2290 | + >>> from ansys.sherlock.core.launcher import launch_sherlock |
| 2291 | + >>> sherlock = launch_sherlock() |
| 2292 | + >>> response = sherlock.lifecycle.save_shock_pulse_profile( |
| 2293 | + >>> SaveShockPulseProfileRequest( |
| 2294 | + >>> project="MyProject", |
| 2295 | + >>> phase_name="ShockPhase", |
| 2296 | + >>> event_name="Pulse_200g", |
| 2297 | + >>> file_path="/tmp/Pulse_200g.csv", |
| 2298 | + >>> ) |
| 2299 | + >>> ) |
| 2300 | + >>> assert response.value == 0 |
| 2301 | + """ |
| 2302 | + grpc_request = request._convert_to_grpc() |
| 2303 | + |
| 2304 | + if not self._is_connection_up(): |
| 2305 | + raise SherlockNoGrpcConnectionException() |
| 2306 | + |
| 2307 | + response = self.stub.saveShockPulseProfile(grpc_request) |
| 2308 | + |
| 2309 | + # Raise error if save failed |
| 2310 | + if response.value != 0: |
| 2311 | + raise SherlockSaveProfileError(response.message) |
| 2312 | + |
| 2313 | + @require_version(261) |
| 2314 | + def save_thermal_profile( |
| 2315 | + self, request: SaveThermalProfileRequest |
| 2316 | + ) -> SherlockCommonService_pb2.ReturnCode: |
| 2317 | + """Save a thermal life cycle event profile to a .dat or .csv file. |
| 2318 | +
|
| 2319 | + Available Since: 2026R1 |
| 2320 | +
|
| 2321 | + Parameters |
| 2322 | + ---------- |
| 2323 | + request : SaveThermalProfileRequest |
| 2324 | + Request object containing the information needed to save a thermal profile. |
| 2325 | +
|
| 2326 | + Returns |
| 2327 | + ------- |
| 2328 | + SherlockCommonService_pb2.ReturnCode |
| 2329 | + Status code of the response. 0 for success. |
| 2330 | +
|
| 2331 | + Examples |
| 2332 | + -------- |
| 2333 | + >>> from ansys.sherlock.core.types.lifecycle_types import SaveThermalProfileRequest |
| 2334 | + >>> from ansys.sherlock.core.launcher import launch_sherlock |
| 2335 | + >>> sherlock = launch_sherlock() |
| 2336 | + >>> response = sherlock.lifecycle.save_thermal_profile( |
| 2337 | + >>> SaveThermalProfileRequest( |
| 2338 | + >>> project="MyProject", |
| 2339 | + >>> phase_name="ThermalPhase", |
| 2340 | + >>> event_name="ThermalCycle_A", |
| 2341 | + >>> file_path="/tmp/ThermalCycle_A.dat", |
| 2342 | + >>> ) |
| 2343 | + >>> ) |
| 2344 | + >>> assert response.value == 0 |
| 2345 | + """ |
| 2346 | + grpc_request = request._convert_to_grpc() |
| 2347 | + |
| 2348 | + if not self._is_connection_up(): |
| 2349 | + raise SherlockNoGrpcConnectionException() |
| 2350 | + |
| 2351 | + response = self.stub.saveThermalProfile(grpc_request) |
| 2352 | + |
| 2353 | + # Raise error if save failed |
| 2354 | + if response.value != 0: |
| 2355 | + raise SherlockSaveProfileError(response.message) |
0 commit comments