Conditional Statement in HFSS?

Status
Not open for further replies.

engrvivs

Junior Member level 3
Joined
Dec 12, 2006
Messages
27
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Visit site
Activity points
1,488
Hi
Is someone aware how to create an "if-then-else" type of conditional statement in HFSS? I wish to assign value to a Project or Design Variable based on a condition. More explicit, my requirement is as follows:
We are aware of creation of project/design variables in HFSS. Say, I wish to create following project variables in HFSS:
$Wt: Width of a Microstrip Transmission Line Trace,
$Lt : Length of the Microstrip Transmission Line Trace, and
$Hs: Height of the Substrate.
What I now wish to do is to create two more such variables for the Width and the Height of a Waveguide Port (that is connected on one of the edges of the microstrip trace), say Wp and Hp. Since, Wp and Hp depend on Wt and Hs, thus, I wish to create a logical expression so as to assign values for Wp and Hp, like the following logic:
if (Wt/Hs < 1)
Wp = 20*round(Wt);
Hp = round(Hs/Wt)*ceil(Hs);
else
Wp = round((Wt^3)/(Hs^2));
Hp = round(Wt);
end
Thanks in Advance!
Vivs.
 

Someone has suggested that the syntax for "if-then-else" type of statement in HFSS is if(<logical condition>, <statement to be executed for true condition>, <statement to be executed for false condition>).
I will try that out.
 

The syntax worked []! However, I am not able to use HFSS's intrinsic functions (round and ceil) while assigning values to project variables for Port Dimensions. Specifically, I am not able to use them in following ways:
$Wp = if($Wt/$Hs < 1, 20*round($Wt), round(($Wt^3)/($Hs^2)));
$Hp = if($Wt/$Hs < 1, round($Hs/$Wt)*ceil($Hs), round($Wt));
I am forced to remove 'round' and 'ceil' functions from above logic.
Any solutions for this issue?

Someone has suggested that the syntax for "if-then-else" type of statement in HFSS is if(<logical condition>, <statement to be executed for true condition>, <statement to be executed for false condition>).
I will try that out.
 
Last edited:

Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…