Hi list, David wrote: >Here's a subroutine that handles positive, integer exponents. Please keep in mind, that each line of sequence code loads the CP and that this routine can load the CP a lot if BPCSTM and exponent are large. In any case (also for small exponents) it would be more efficient to use a MATH block for the calculation and link that to the sequence, this is what I'd recommend. Best regards / Mit freundlichen Grüßen Marcel Sieling Senior Application Consultant Invensys Systems GmbH Emanuel-Leutze-Str. 11 D-40547 Düsseldorf Germany T +49 211 5966302 M +49 163 5966302 F +49 163 99 5966302 E marcel.sieling@xxxxxxxxxxxx <- new! iom.invensys.com P Please consider the environment before printing this e-mail q ________________________________________ Von: foxboro-bounce@xxxxxxxxxxxxx [foxboro-bounce@xxxxxxxxxxxxx] im Auftrag von Johnson, David [David.Johnson@xxxxxxxxxxxxxxxxxx] Gesendet: Mittwoch, 28. April 2010 00:37 An: foxboro@xxxxxxxxxxxxx Betreff: Re: [foxboro] HLBL "to the power" expression Peter, Here's a subroutine that handles positive, integer exponents. This compiled and worked as an IND seq block, so you can test it out. Regards, David INDEPENDENT_SEQUENCE{******************************* ** ** ** INDEPENDENT SEQUENCE ** ** CONTROL BLOCK ** ** ** *****************************************} CONSTANTS VARIABLES USER_LABELS SUBROUTINE POW ( IN NUMBER : R IN EXPONENT : R INOUT ANSWER : R) STATEMENTS ANSWER := 1; WHILE (EXPONENT > 0) DO ANSWER := ANSWER * NUMBER; EXPONENT := EXPONENT - 1; ENDWHILE; ENDSUBROUTINE STATEMENTS{***************************************** * Specify the statements here * *****************************************} CALL POW (RI0001, RI0002, RO0001); ENDSEQUENCE -----Original Message----- From: foxboro-bounce@xxxxxxxxxxxxx [mailto:foxboro-bounce@xxxxxxxxxxxxx] On Behalf Of Bruley, Peter T Sent: Tuesday, April 27, 2010 4:31 PM To: 'Foxboro DCS Mail List' ('Foxboro DCS Mail List') Cc: Radtke, Richard W Subject: [foxboro] HLBL "to the power" expression Hi List Does anyone know how to do a power function x^y in HLBL? Similar to the pow(x,y) call under C or CALCA block EXP x y Thank you, Peter Bruley Xcel Energy | Responsible By Nature Plant Process Computer Analyst Sherburne County Generating Plant *** Confidentiality Notice: This e-mail, including any associated or attached files, is intended solely for the individual or entity to which it is addressed. This e-mail is confidential and may well also be legally privileged. If you have received it in error, you are on notice of its status. Please notify the sender immediately by reply e-mail and then delete this message from your system. Please do not copy it or use it for any purposes, or disclose its contents to any other person. This email comes from a division of the Invensys Group, owned by Invensys plc, which is a company registered in England and Wales with its registered office at Portland House, Bressenden Place, London, SW1E 5BF (Registered number 166023). For a list of European legal entities within the Invensys Group, please go to http://www.invensys.com/legal/default.asp?top_nav_id=77&nav_id=80&prev_id=77. You may contact Invensys plc on +44 (0)20 7821 3848 or e-mail inet.hqhelpdesk@xxxxxxxxxxxxx This e-mail and any attachments thereto may be subject to the terms of any agreements between Invensys (and/or its subsidiaries and affiliates) and the recipient (and/or its subsidiaries and affiliates). _______________________________________________________________________ This mailing list is neither sponsored nor endorsed by Invensys Process Systems (formerly The Foxboro Company). Use the info you obtain here at your own risks. Read http://www.thecassandraproject.org/disclaimer.html foxboro mailing list: //www.freelists.org/list/foxboro to subscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=join to unsubscribe: mailto:foxboro-request@xxxxxxxxxxxxx?subject=leave