SBR+ Doppler Example

This example shows how you can use PyAEDT to create a Multipart Scenario in SBR+ and setup a doppler Analysis.

# sphinx_gallery_thumbnail_path = 'Resources/sherlock_doppler.png'

Launch AEDT in Graphical Mode

This examples launches AEDT 2021.1 in graphical mode.

import os
import tempfile
import pyaedt
from pyaedt import examples, generate_unique_name

# Start Electronics Desktop
aedt_version = "2021.1"
projectname = "MicroDoppler_with_ADP"
designname = "doppler"
library_path = examples.download_multiparts()

Open Project

Download Project, opens it and save to TEMP Folder.

tmpfold = tempfile.gettempdir()


temp_folder = os.path.join(tmpfold, generate_unique_name("Example"))
if not os.path.exists(temp_folder):
    os.makedirs(temp_folder)

# Instantiate the application.
app = pyaedt.Hfss(
    specified_version=aedt_version, solution_type="SBR+", new_desktop_session=True, projectname=projectname,
    close_on_exit=True
)


app.autosave_disable()

Out:

Launching PyAEDT outside Electronics Desktop with CPython and Pythonnet
Launching AEDT installation C:\Program Files\AnsysEM\AnsysEM21.1\Win64
===================================================================================
pyaedt info: Launching AEDT with module Pythonnet.
pyaedt info:: Ansoft.ElectronicsDesktop.2021.1 Started with process ID 7108.
pyaedt info: Logger Started on C:\Users\ansys\Documents\Ansoft\pyaedt20211026_143236.log
pyaedt info: pyaedt v0.4.0
pyaedt info: Python version 3.8.10 (tags/v3.8.10:3d8993a, May  3 2021, 11:48:03) [MSC v.1928 64 bit (AMD64)]
pyaedt info: Project MicroDoppler_with_ADP has been created.
pyaedt info: No design is present. Inserting a new design.
pyaedt.generic.LoadAEDTFile._read_aedt_file: 0.0s
pyaedt info: AEDT Load time 0.0
pyaedt info: Design Loaded
pyaedt info: Successfully loaded project materials !
pyaedt info: Materials Loaded

True

Create Design

Save project and rename design

app.save_project(project_file=os.path.join(temp_folder, projectname + ".aedt"))
app.rename_design(designname)

Out:

pyaedt info: Saving MicroDoppler_with_ADP Project

True

Libraries

Setup Library Path to 3d Components

Environment

Define background environment

road1 = app.modeler.primitives.add_environment(env_folder=env_folder, environment_name="Bari")
prim = app.modeler.primitives

Out:

pyaedt info: Found 3D Components Duplication
pyaedt info: Found 3D Components Duplication

Actors

Put Actors in environment. This example has persons, birds, bikes and cars.

person1 = app.modeler.primitives.add_person(actor_folder=person_folder, speed=1.0, global_offset=[25, 1.5, 0], yaw=180,
                                            actor_name="Massimo")
person2 = app.modeler.primitives.add_person(actor_folder=person_folder, speed=1.0, global_offset=[25, 2.5, 0], yaw=180,
                                            actor_name="Devin")
car1 = app.modeler.primitives.add_vehicle(actor_folder=car_folder, speed=8.7, global_offset=[3, -2.5, 0],
                                          actor_name="LuxuryCar")
bike1 = app.modeler.primitives.add_vehicle(actor_folder=bike_folder, speed=2.1, global_offset=[24, 3.6, 0], yaw=180,
                                           actor_name="Alberto_in_bike")
bird1 = app.modeler.primitives.add_bird(actor_folder=bird_folder, speed=1.0, global_offset=[19, 4, 3], yaw=120,
                                        pitch=-5, flapping_rate=30, actor_name="Pigeon")
bird2 = app.modeler.primitives.add_bird(actor_folder=bird_folder, speed=1.0, global_offset=[6, 2, 3], yaw=-60, pitch=10,
                                        actor_name="Eagle")

Out:

pyaedt info: Adding person: Massimo_0
pyaedt info: Adding person: Devin_1
pyaedt info: Adding vehicle: LuxuryCar_0
pyaedt info: Adding vehicle: Alberto_in_bike_0
pyaedt info: Adding Vehicle: Pigeon_0
pyaedt info: Adding Vehicle: Eagle_1

Radar

Put radar on car. The radar will be created relative to the car coordinate system.

radar1 = app.create_sbr_radar_from_json(radar_file=radar_lib, radar_name="Example_1Tx_1Rx", offset=[2.57, 0, 0.54],
                                        use_relative_cs=True, relative_cs_name=car1.cs_name)

Out:

pyaedt info: Adding radar module:  Example_1Tx_1Rx_0
pyaedt info: Native Component Parametric Beam Example_1Tx_1Rx_0_tx1 has been correctly created
pyaedt info: Native Component Parametric Beam Example_1Tx_1Rx_0_rx1 has been correctly created
pyaedt info: Boundary SBRTxRxSettings SBRTxRxSettings has been correctly created.
pyaedt info: Group Created:  Example_1Tx_1Rx_0

Setup and validation

Create setup and validate it. This command will create a setup and a parametric sweep on the time variable of the duration of 2 seconds. the step is computed automatically from CPI.

setup, sweep = app.create_sbr_pulse_doppler_setup(sweep_time_duration=2)
app.set_sbr_current_sources_options()
app.validate_simple()

Out:

pyaedt info: SBR+ current source options correctly applied.

0

Solve and release desktop

Solves problem and close it. Uncomment the next command to activate the simulation

# app.analyze_setup(sweep.name)
app.save_project()
app.release_desktop(close_projects=True, close_desktop=True)

Out:

pyaedt info: Saving MicroDoppler_with_ADP Project

True

Total running time of the script: ( 0 minutes 26.737 seconds)

Gallery generated by Sphinx-Gallery