Transient Electro-Thermal Simulation of Transient Voltage Suppression (TVS) Diodes#
This notebook demonstrates the process of running a Workbench service with Electronic Desktop on a local machine to solve highly non-linear Diode response subjected to high thermal load and mechanical stresses. It includes steps for uploading project files, executing scripts.
[1]:
import pathlib
import os
from ansys.workbench.core import launch_workbench
Launch the Workbench service on the local machine using specific options. Define the working directory and subdirectories for assets, scripts, and geometry databases (agdb). The launch_workbench
function starts a Workbench session with the specified directories.
[2]:
workdir = pathlib.Path("__file__").parent
[3]:
assets = workdir / "assets"
scripts = workdir / "scripts"
[4]:
wb = launch_workbench(client_workdir=str(workdir.absolute()))
Upload the project files to the server using the upload_file
method. The files uploaded are TVR14471_V_short.wbpz
, 10_1000_Pulse_short.csv
Note: use 10_1000_Pulse.csv for fullscale simulation
[5]:
wb.upload_file_from_example_repo("ansys-aedt-workflow/wbpz/TVR14471_V_short.wbpz")
wb.upload_file(str(assets / "10_1000_Pulse_short.csv"))
Uploading TVR14471_V_short.wbpz: 100%|██████████| 1.06M/1.06M [00:00<00:00, 39.8MB/s]
Uploading 10_1000_Pulse_short.csv: 100%|██████████| 38.0/38.0 [00:00<00:00, 6.12kB/s]
Execute a Workbench script (project.wbjn
) to define the project and load the geometry using the run_script_file
method. The set_log_file
method is used to direct the logs to wb_log_file.log
.
Note: For full-scale simulation use TVR14471_V.wbpz
in line 7 of project.wbjn
[6]:
export_path = 'wb_log_file.log'
wb.set_log_file(export_path)
wb.run_script_file(str((assets / "project.wbjn").absolute()), log_level='info')
WARNING: 5/19/2025 1:14:32 PM: [WARN] The script may not run properly as it was written for Workbench version 2024 R1 (24.1.144), and this is version 2024 R2 (24.2).
WARNING: 5/19/2025 1:14:32 PM: [WARN] The script may not run properly as it was written for Workbench version 2024 R1 (24.1.144), and this is version 2024 R2 (24.2).
WARNING: 5/19/2025 1:14:32 PM: [WARN] The script may not run properly as it was written for Workbench version 2024 R1 (24.1.144), and this is version 2024 R2 (24.2).
ERROR:root:Error when running the script: CommandFailedException: Unable to load project 'C:\Users\ansys\AppData\Local\Temp\wbpj\TVR14471_V.wbpj': Ansys.Core.Commands.UserReadableFailureException: This project contains data that requires software modules that are not installed, see Details below. Please install the required modules and try again.
at Ansys.Core.Persistence.ProjectPersistDataValidator.throwAddinValidationErrorifNotRunningUnderTestBench(StringBuilder missingAddinsError, List`1 eventsToPublishAfterReset)
at Ansys.Core.Persistence.ProjectPersistDataValidator.ValidateAddinModules(PersistenceContext context, IStorageObjectReader rootStorage, PersistenceScope scope, List`1 eventsToPublishAfterReset)
at Ansys.Core.DataModel.ProjectSystem.Project.initAndValidatePersistanceStorage(PersistenceContext context, String projectFilePath, IStorageObjectReader& projectRootStorage, IStorageObjectReader& designPointRootStorage, TextReader& projectFileHandle, String& designPointDir, String& baseDpName, List`1 eventsToPublishAfterReset)
at Ansys.Core.DataModel.ProjectSystem.Project.LoadProject(String projectFilePath, PersistenceContext context, Boolean merge, Boolean import)
at Ansys.Core.Persistence.Commands.OpenCommand.LoadProjectInternal(IFullContext context, String projectFilePath, Boolean mergedProject, Boolean importProject, AccessLock shareLock, Boolean skipStartingEvents, IReadOnlyDictionary`2 addinsToPostMigrate)
Start a Mechanical and AEDT client sessions to solve the Transient Electro-Thermal Simulation. Both MECHANICAL and AEDT sessions will be started
Note: Disable the Distribution of the solution in Ansys Mechanical. For Full scale simulation use 10_1000_Pulse.csv
in line 232 of DC_Cond_ThermTransient_VariableTimeStep.py
[7]:
wb.run_script_file(str((scripts / "DC_Cond_ThermTransient_VariableTimeStep.py").absolute()), log_level='info')
ERROR:root:Error when running the script: UnboundNameException: name 'MechSys' is not defined
Shutdown the Ansys Workbench server session
[8]:
wb.exit()
[ ]: