Cosine (COS)

The COS instruction takes the cosine of the Source value (in radians) and stores the result in the Destination.
The COS operator/function computes the cosine of Source and returns the floating point result. The resulting value is always greater than or equal to -1 and less than or equal to 1.
Available Languages
Ladder Diagram
Ladder Diagram_Cosine (COS)_v1
FactoryTalk Design Studio
DSL - Ladder Diagram
Operands
IMPORTANT
Unexpected operation may occur if:
  • Output tag operands are overwritten.
  • Members of a structure operand are overwritten.
  • Except when specified, structure operands are shared by multiple instructions.
There are data conversion rules for mixing numeric data types within an instruction. See Data conversions.
Ladder Diagram
Operand
Data Type
Format
Description
Source
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
REAL
LREAL
Immediate
tag
Find the cosine of this value.
Destination
SINT
INT
DINT
LINT
USINT
UINT
UDINT
ULINT
REAL
LREAL
tag
Tag to store the result.
Operator Aspects
The COS operator can be used in various expressions. Both applications of COS return a floating point result containing the cosine of the Source. Depending on the context this value may then be type converted if appropriate.
Affects Math Status Flags
Conditional, see Math status flags.
Major/Minor Faults
None specific to this instruction. See Index through arrays for array-indexing faults.
Execution
Ladder Diagram
Condition/State
Action Taken
Prescan
N/A
Rung-condition-in is false
Set Rung-condition-out to Rung-condition-in.
Rung-condition-in is true
Set Rung-condition-out to Rung-condition-in.
Dest = cosine value of the Source.
Postscan
N/A
Example
Ladder Diagram
FTStudio-COS-LD-EX-V1
Provide Feedback
Have questions or feedback about this documentation? Please submit your feedback here.