Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » How to program x ^ y in Structured Text
How to program x ^ y in Structured Text [message #1742792] Wed, 07 September 2016 15:38 Go to next message
Wolfgang Trischnigg is currently offline Wolfgang TrischniggFriend
Messages: 45
Registered: April 2016
Member
Dear all,

can anyboday help me please?
I'm trying to do a operatiobn like x^y.

How can I handle that in ST?

I've tried EXPT(x, y), but without of success.

Thank you, Wolfgang
Re: How to program x ^ y in Structured Text [message #1742826 is a reply to message #1742792] Wed, 07 September 2016 22:59 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1582
Registered: January 2014
Senior Member

Hi,

I would have suggested to use EXPT. Therfore I'm curiose what is the problem with it?

Alois
Re: How to program x ^ y in Structured Text [message #1743587 is a reply to message #1742826] Fri, 16 September 2016 15:23 Go to previous messageGo to next message
Wolfgang Trischnigg is currently offline Wolfgang TrischniggFriend
Messages: 45
Registered: April 2016
Member
When I export EXPT(x,y) I get Errors when compiling.
When I remove EXPT, eb´verything is fine - seems cpp does not know "EXPT"?
Re: How to program x ^ y in Structured Text [message #1743588 is a reply to message #1743587] Fri, 16 September 2016 15:27 Go to previous messageGo to next message
Wolfgang Trischnigg is currently offline Wolfgang TrischniggFriend
Messages: 45
Registered: April 2016
Member
It only works when I write pow(x,y) in cpp.
Re: How to program x ^ y in Structured Text [message #1743632 is a reply to message #1743588] Sat, 17 September 2016 11:55 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1582
Registered: January 2014
Senior Member

Hi,

I just wrote a simple test FB where I used two input ars of type lreal and one outputvar of type lreal and EXPT the two inputs on the output and it worked without issues. Would you have an algorithm or an EXPT line for me that reproduces the issue. Maybe there is a bug in the code generator.

Thanks,
Alois
Re: How to program x ^ y in Structured Text [message #1743704 is a reply to message #1743632] Mon, 19 September 2016 06:58 Go to previous messageGo to next message
Wolfgang Trischnigg is currently offline Wolfgang TrischniggFriend
Messages: 45
Registered: April 2016
Member
Hi Alois,
in my case the FB has several inputs, which were used to calculate a formula.
Inputs:
A, B, C - type Float
Output:
D - type Float
This should happen for example:
EXPT( ( (A+B) * C ), 0.8 ) = D

Visual C++ says:
error C2825: "T": Muss eine Klasse oder ein Namespace sein, wenn gefolgt von "::".
4> ..\..\..\src\modules\test.cpp(44): Siehe Verweis auf die Instanziierung der gerade kompilierten Funktions-template "const T EXPT<double>(const T &,const T &)".
4> with
4> [
4> T=double
4> ]
4>\desktop\forte\forte_1.8_m1\src\core\iec61131_functions.h(535): error C2039: 'TValueType': Ist kein Element von '`global namespace''
4>\desktop\forte\forte_1.8_m1\src\core\iec61131_functions.h(535): error C2061: Syntaxfehler: Bezeichner 'TValueType'

[Updated on: Mon, 19 September 2016 07:13]

Report message to a moderator

Re: How to program x ^ y in Structured Text [message #1743885 is a reply to message #1743704] Tue, 20 September 2016 12:07 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1582
Registered: January 2014
Senior Member

Hi,

thanks for this info this helped me to sort the problem out. As this affects several of the functions I created a bug report for it [1]. A first fix for the EXPT is already committed to FORTE's git repository. So if you clone it and switch to the 1.8.x branch your FB should now compile.

BR,
Alois

[1] https://bugs.eclipse.org/bugs/show_bug.cgi?id=501817
Re: How to program x ^ y in Structured Text [message #1743904 is a reply to message #1743885] Tue, 20 September 2016 13:56 Go to previous messageGo to next message
Wolfgang Trischnigg is currently offline Wolfgang TrischniggFriend
Messages: 45
Registered: April 2016
Member
Hi Alois,

thank you for the quick fix. FB compiled successfully!

Best, Wolfgang
Re: How to program x ^ y in Structured Text [message #1743906 is a reply to message #1743904] Tue, 20 September 2016 14:08 Go to previous message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1582
Registered: January 2014
Senior Member

Great.
Previous Topic:WSTRING data input
Next Topic:Problem occurres when testing
Goto Forum:
  


Current Time: Fri Apr 19 11:41:12 GMT 2024

Powered by FUDForum. Page generated in 0.03005 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top