12.07.2015 Views

Logix5000 Controllers General Instructions - SLAC Confluence

Logix5000 Controllers General Instructions - SLAC Confluence

Logix5000 Controllers General Instructions - SLAC Confluence

SHOW MORE
SHOW LESS
  • No tags were found...

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

666 Structured Text ProgrammingFor example:Use This Formatvalue1 operator value2operator value1function(numeric_expression)value1 operator(function((value2+value3)/2)ExampleFor This SituationIf gain_4 and gain_4_adj are DINT tags and yourspecification says: "Add 15 to gain_4 and store theresult in gain_4_adj."If alarm and high_alarm are DINT tags and yourspecification says: “Negate high_alarm and storethe result in alarm.”If overtravel and overtravel_POS are DINT tags andyour specification says: “Calculate the absolutevalue of overtravel and store the result inovertravel_POS.”If adjustment and position are DINT tags andsensor1 and sensor2 are REAL tags and yourspecification says: “Find the absolute value of theaverage of sensor1 and sensor2, add theadjustment, and store the result in position.”You’d Writegain_4_adj :=gain_4+15;alarm:=-high_alarm;overtravel_POS :=ABS(overtravel);position :=adjustment +ABS((sensor1 +sensor2)/2);Use relational operatorsRelational operators compare two values or strings to provide a trueor false result. The result of a relational operation is a BOOL value:If The Comparison IsThe Result Istrue 1false 0Use the following relational operators:For This Comparison Use This Operator Optimal Data Typeequal = DINT, REAL, stringless than < DINT, REAL, stringless than or equal DINT, REAL, stringgreater than or equal >= DINT, REAL, stringnot equal DINT, REAL, stringPublication 1756-RM003I-EN-P - January 2007

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!