@@ -3595,9 +3595,81 @@ def create_circuit_port_from_edges(
3595
3595
edge_list , port_impedance , port_name , renormalize , deembed , renorm_impedance = renorm_impedance
3596
3596
)
3597
3597
3598
+ @pyaedt_function_handler ()
3599
+ def edit_sources (
3600
+ self , excitations , include_port_post_processing = True , max_available_power = None , use_incident_voltage = False
3601
+ ):
3602
+ """Set up the power loaded for Hfss Post-Processing in multiple sources simultaneously.
3603
+
3604
+ Parameters
3605
+ ----------
3606
+ excitations : dict
3607
+ Dictionary of input sources to modify module and phase.
3608
+ Dictionary values can be:
3609
+ - 1 Value to setup 0deg as default
3610
+ - 2 values tuple or list (magnitude and phase) or
3611
+ - 3 values (magnitude, phase and termination flag) for Terminal Solution in case of incident voltage usage.
3612
+
3613
+ Returns
3614
+ -------
3615
+ bool
3616
+
3617
+ Examples
3618
+ --------
3619
+ >>> sources = {"Port1:1": ("0W", "0deg"), "Port2:1": ("1W", "90deg")}
3620
+ >>> hfss.edit_sources(sources, include_port_post_processing=True)
3621
+
3622
+ >>> sources = {"Box2_T1": ("0V", "0deg", True), "Box1_T1": ("1V", "90deg")}
3623
+ >>> hfss.edit_sources(sources, max_available_power="2W", use_incident_voltage=True)
3624
+ """
3625
+ data = {i : ("0W" , "0deg" , False ) for i in self .excitations }
3626
+ for key , value in excitations .items ():
3627
+ data [key ] = value
3628
+ setting = []
3629
+ for key , vals in data .items ():
3630
+ if isinstance (vals , str ):
3631
+ power = vals
3632
+ phase = "0deg"
3633
+ else :
3634
+ power = vals [0 ]
3635
+ if len (vals ) == 1 :
3636
+ phase = "0deg"
3637
+ else :
3638
+ phase = vals [1 ]
3639
+ if isinstance (vals , (list , tuple )) and len (vals ) == 3 :
3640
+ terminated = vals [2 ]
3641
+ else :
3642
+ terminated = False
3643
+ if use_incident_voltage and self .solution_type == "Terminal" :
3644
+ setting .append (["Name:=" , key , "Terminated:=" , terminated , "Magnitude:=" , power , "Phase:=" , phase ])
3645
+ else :
3646
+ setting .append (["Name:=" , key , "Magnitude:=" , power , "Phase:=" , phase ])
3647
+ argument = []
3648
+ if self .solution_type == "Terminal" :
3649
+ argument .extend (["UseIncidentVoltage:=" , use_incident_voltage ])
3650
+
3651
+ argument .extend (
3652
+ [
3653
+ "IncludePortPostProcessing:=" ,
3654
+ include_port_post_processing ,
3655
+ "SpecifySystemPower:=" ,
3656
+ True if max_available_power else False ,
3657
+ ]
3658
+ )
3659
+
3660
+ if max_available_power :
3661
+ argument .append ("Incident Power:=" )
3662
+ argument .append (max_available_power )
3663
+
3664
+ args = [argument ]
3665
+ args .extend (setting )
3666
+ for arg in args :
3667
+ self .osolution .EditSources (arg )
3668
+ return True
3669
+
3598
3670
@pyaedt_function_handler ()
3599
3671
def edit_source (self , portandmode , powerin , phase = "0deg" ):
3600
- """Set up the power loaded to the filter for thermal analysis .
3672
+ """Set up the power loaded for Hfss Post-Processing .
3601
3673
3602
3674
Parameters
3603
3675
----------
0 commit comments