Page 1 of 1

alter_element with an RPN equation and -macro

Posted: 19 Apr 2012, 18:55
by Chris Prokop
Hi,

I am attempting to use alter_element to modify several components of an EMATRIX based on a -macro entered at the command line. Each of the components that I am changing is to be replaced with an equation, usually a function of the variable specified with the -macro command. However, it appears that only the first term in the equation is being used in the transfer matrix.

For example, if I use:
&alter_elements
name = TDC_*,
item = R12
value = "0.07687 2.0 /"
&end

The R12 element will then become (by inspecting the .matext file)
R12 = 0.07687 M

i.e. ignoring the division by two. Likewise,

&alter_elements
name = TDC_*,
item = R65
value ="$TDCSTRENGTH $TDCSTRENGTH * 0.07687 * 8 /"
&end

with -macro=TDCSTRENGTH=1.5 gives

R65 = 1.5 1/M

What am I doing wrong?

Thanks,
Chris

Re: alter_element with an RPN equation and -macro

Posted: 23 Jul 2012, 20:31
by michael_borland
Chris,

Sorry, I just saw this in going through some old posts.

The correct syntax is
&alter_elements
name = TDC_*,
item = R12
value = "(0.07687 2.0 /)"
&end

and

&alter_elements
name = TDC_*,
item = R65
value ="($TDCSTRENGTH $TDCSTRENGTH * 0.07687 * 8 /)"
&end

--Michael

Re: alter_element with an RPN equation and -macro

Posted: 13 Mar 2018, 04:50
by daniel.marx
I was also confused by this until I saw this post. May I suggest that a note about parentheses is added to the alter_elements entry in the manual?

Re: alter_element with an RPN equation and -macro

Posted: 13 Mar 2018, 08:13
by michael_borland
Daniel,

It's discussed in section 7.2, General Command Syntax. We'll add some information elsewhere, as you suggest.

--Michael