7/8/2013 9:11 AM  
Joined: 1/28/2009 Last visit: 11/11/2019 Posts: 6581 Rating: (1226) 
Hello, You are right,I was talking about the real number such as (1.2)^(1.2).For such a cases,They do not have direct solution.They don't support (X^N) in general.If you check samples in online manuals or Books published officially by SIEMENS,They recommend using Mathematics with basic available instructions (such as EXP,LN,SIN,COS) to make complex math functions. Best regards Hamid Hosseini 
Last edited by: hdhosseini at: 7/8/2013 11:39 AM 

7/8/2013 1:03 PM  
Joined: 9/23/2005 Last visit: 11/10/2019 Posts: 3745 Rating: (1032)

Hi, is in your case to use fractionary power numbers (for example 2^{3,5}), or you would be satisfied with integer power number (2^^{3})? Is the power number a constant or a variable? As work around, for x<>0 and y as integer, you can use: x^{y} = (abs(x))^{y} * (abs(x)/x) 
Last edited by: Pegaia at: 7/8/2013 1:07 PMLast edited by: Pegaia at: 7/8/2013 1:04 PMDenilson Pegaia 

7/8/2013 1:58 PM  
Joined: 1/28/2009 Last visit: 11/11/2019 Posts: 6581 Rating: (1226) 
Hello Pegaia, What is your idea about checking the followig general solution,Even calculating "2^{3,5}" with output of complex numbers i.e result:= Real Part + j (Imaginary Part).In case of INT numbers just a conversion is needed because this function block supports "Real" numbers: General solution for (X^N) in SCL(Complex Variables)[code] FUNCTION_BLOCK FB100 TITLE = 'General X^N' // // Block Comment... // VERSION: '1.0' AUTHOR: hdhosseini NAME: COMPLEX_CALC FAMILY: FORUM_E // Block Parameters VAR_INPUT // Input Parameters base:REAL:=1.0; Power:REAL:=1.0; END_VAR VAR_OUTPUT // Output Parameters Error:BOOL:=false; complex:BOOL:=false; // true when complex resultfalse real R_part:REAL:=0.0; I_part:REAL:=0.0; END_VAR VAR // Static Variables END_VAR IF ((base=0) AND (Power=0)) OR (base=0) THEN error:=1; complex:=0; R_part:=0; I_part:=0; else IF (base<0) THEN error:=0; complex:=1; R_part:=EXP (POWER* (LN(ABS(base)))) * COS (POWER*3.14); I_part:=EXP (POWER* (LN(ABS(base)))) * SIN (POWER*3.14);; END_IF; IF (base>0) THEN error:=0; complex:=0; R_part:=EXP (POWER* (LN((base)))) ; I_part:=0.0; END_IF; END_IF; ; END_FUNCTION_BLOCK[/code] Best regards Hamid Hosseini 
7/8/2013 2:23 PM  
Joined: 11/16/2012 Last visit: 2/26/2019 Posts: 42 Rating: (0) 
We are going for a simillar solution as Pagaia is suggesting since we are using only constant positive integer powers and thus avoiding complex numbers I havn't had enough time to go through your solution hdhosseini since my problem is "too easy" to include complex math . But if i remember correct that was the way to go when calculating fractional power of a negative numbers. Who knows maybe we'll get use of it in the future Thanks for a good discussion! 
7/8/2013 4:21 PM  
Joined: 9/23/2005 Last visit: 11/10/2019 Posts: 3745 Rating: (1032)

Hi, I tried to simulate your behavior (V12 / 1500 / Simulator) WITH Integer expoent and doesn't have problem. AttachmentC:\Users\z0008iwv\Pictures\Untitled_13.zip (55 Downloads) 
Denilson Pegaia 

This contribution was helpful to1 thankful Users 
7/8/2013 4:32 PM  
Joined: 1/28/2009 Last visit: 11/11/2019 Posts: 6581 Rating: (1226) 
Hello friends, Thank you for all contributions.We reached to a conclusion after all discussions.I also prefer Pagaia's solution for INT as the snapshot suggests. Thank you for the BEST thread I have contributed during the campaignTopic discussed in very details and has some positive point for me and this was why I asked the moderators to mark it "Highlight".Stars from me (as soon as I have some to give) for all positive attitudes. Hamid Hosseini 
12/11/2018 12:52 PM  
Joined: 8/24/2006 Last visit: 10/24/2019 Posts: 140 Rating: (7) 
Hi, sorry for my replay, this work at 100% with + and  in awl? Thank you in advace
 
Last edited by: Jen_Moderator at: 12/12/2018 6:40:55 AMNew subject after splitting 

12/13/2018 10:06 AM  
Joined: 3/5/2014 Last visit: 11/6/2019 Posts: 3857 Rating: (689)

What do you mean exactly? Please explain in detail, what you want to do. regards, 
There is no bad feedback! 

Follow us on