We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!
Presentation is loading. Please wait.
Published byBeatriz Syme
Modified over 2 years ago
© 2013 SPiiPlus Training Class Mathematical and Signal Processing Functions 1
© 2013 Mathematical and Signal Processing Functions ACSPL+ includes a large command set of built-in mathematical and signal processing functions. These functions allow for powerful algorithms to be written in minimal lines of code, including: o I/O debouncing o Digital controllers and filters o Teach-and-go o Array processing o Error mapping o Kinematic transformations (forward and inverse) 2
© 2013 Assignment Command Assignment Command: o Assigning a value to a variable using an expression o ‘=‘ is used to separate the variable from the expression o An assignment command can only assign a value to a scalar variable, a single element of an array, or a specific bit of a scalar variable or single element of an array. Syntax: variable = expression variable.(bit) = expression 1d_array(index) = expression 2d_array(index1)(index2) = expression 3
© 2013 Assignment Command Examples: GLOBAL INT tiVar GLOBAL REAL trVar GLOBAL INT tiArr(5) GLOBAL REAL trArr(7) GLOBAL INT tiArr2(10)(3) GLOBAL REAL trArr2(12)(7) tiVar = 1 trVar = 1 * 2 tiArr(0) = tiVar + trVar trArr(3) = tiArr(0) / 2 tiArr2(9)(0) = tiArr(0) + trArr(3) trArr2(0)(3) = 1 + tiArr2(9)(0) * 0.4 4 NameValue tiVar1 trVar2.0 tiArr(0)3 trArr(3)1.5 tiArr2(9)(0)4 trArr2(0)(3)2.6
© 2013 Unary Operators Unary operators are functions that act on one operand o - (unary minus) Can be used with INT or REAL variables o ~ (inversion) Can only be used with INT variables REAL variables are converted to INT o ^ (logical not) Can only be used with Boolean (0,1) INT variables REAL variables and non-Boolean INT variables are converted to Boolean INT variables 5
© 2013 Unary Operators Examples: GLOBAL INT tiVar GLOBAL REAL trVar GLOBAL INT tiArr(3) GLOBAL REAL trArr(3) tiVar = 1 tiArr(0) = -tiVar tiArr(1) = ~tiVar tiArr(2) = ^tiVar trVar = 2.5 trArr(0) = -trVar trArr(1) = ~trVar trArr(2) = ^trVar 6 NameDecimalHex (rounded) tiArr(0)0xFFFFFFFF tiArr(1)-20xFFFFFFFE tiArr(2)00x00000000 NameDecimalHex (rounded) trArr(0)-2.50xFFFFFFFE trArr(1)-20xFFFFFFFD trArr(2)00x00000000
© 2013 Binary Operators Binary operators are functions that act on two operands 7 + (addition) - (subtraction) * (multiplication) / (division) & (and) | (or) ~ (xor) = (equal to) <> (not equal) > (greater than) >= (greater than or equal to) < (less than) <= (less than or equal to)
© 2013 Binary Operators Examples: GLOBAL INT tiArr(5) GLOBAL REAL trArr(5) tiArr(0) = 0b00001010 tiArr(1) = 0b11100100 tiArr(2) = tiArr(0) & tiArr(1) tiArr(3) = tiArr(0) | tiArr(1) tiArr(4) = tiArr(0) ~ tiArr(1) trArr(3) = 5 trArr(0) = trArr(3) * 4 trArr(1) = trArr(3) / 0.1 IF ( trArr(0) > trArr(1) ) trArr(2) = 1 ELSE trArr(2) = 0 END 8 NameDecimalHex (rounded) tiArr(0)100x0000000A tiArr(1)2280x000000E4 tiArr(2)00x00000000 tiArr(3)2380x000000EE tiArr(4)2380x000000EE NameDecimalHex (rounded) trArr(0)200x00000014 trArr(1)500x00000032 trArr(2)00x00000000 trArr(3)50x00000005
© 2013 Order of Operations ACSPL+ uses a standard order of operations. The following table shows the operator precedence from highest to lowest. Operators with the same precedence are evaluated from left to right. 9 OperatorOperation ()Brackets the expression.Bit selection - ~ ^Unary minus, Inversion, Logical not * /Multiplication, Division + -Addition, Subtraction = <> =Comparison & | ~Logical and bitwise AND, OR, XOR
© 2013 Order of Operations Examples: GLOBAL REAL trArr(6) trArr(0) = 1 + 2 * 3 trArr(1) = 1 * 2 + 3 trArr(2) = (1 + 2) * 3 trArr(3) = 5 * 6 / 7 trArr(4) = 5 / 6 * 7 IF ( trArr(4) > trArr(3) * 1 + 2 - 5 ) trArr(5) = -1 ELSE trArr(5) = 1 END 10 NameDecimal trArr(0)7 trArr(1)5 trArr(2)9 trArr(3)4.28571 trArr(4)5.83333 trArr(5)
© 2013 General Mathematical Functions ACSPL+ supports a set of standard mathematical functions. 11
© 2013 Trigonometric Functions ACSPL+ supports the standard list of trigonometric functions. All trigonometric function use radians (not degrees). 12 sin( angle ) cos( angle ) tan( angle ) asin( x ) acos( y ) atan( x / y ) atan2( x, y )
© 2013 Exponential and Logarithmic Functions ACSPL+ supports the standard exponential and logarithmic functions. 13
© 2013 Array Processing Functions ACSPL+ support some basic array processing functions 14 avg( ) = average of array elements copy( ) Copies elements from one array to another fill( ) Fills in an array with a constant value max( ) = maximum entry in an array maxi( ) = index of maximum entry in an array min( ) = minimum entry in an array mini( ) = index of minimum entry in an array
© 2013 Signal Processing Functions ACSPL+ supports some standard signal processing functions. 15 deadzone( ) = signal with deadzone dsign( ) = sign of signal with delay and ramp time edge( ) = edge detection of signal intgr( ) = integration of signal lag( ) = state of signal (high or low) with positive and negative edge delays sat( ) = signal with saturation range
© 2013 Mapping / Interpolation Functions ACSPL+ supports some standard 1D mapping and interpolation functions. 16 map( ) 1D linear interpolation with uniformly spaced points mapb( ) 1D B-spline interpolation with uniformly spaced points maps( ) 1D Catmull-Rom spline interpolation with uniformly spaced points mapn( ) 1D linear interpolation with non-uniformly spaced points mapnb( ) 1D B-spline interpolation with non-uniformly spaced points mapns( ) 1D Catmull-Rom spline interpolation with non- uniformly spaced points
© 2013 Mapping / Interpolation Functions ACSPL+ supports some standard 2D mapping and interpolation functions. 17 map2( ) 2D linear interpolation with uniformly spaced points map2b( ) 2D B-spline interpolation with uniformly spaced points map2s( ) 2D Catmull-Rom spline interpolation with uniformly spaced points map2n( ) 2D linear interpolation with non-uniformly spaced points map2nb( ) 2D B-spline interpolation with non-uniformly spaced points map2ns( ) 2D Catmull-Rom spline interpolation with non- uniformly spaced points
© 2013 ACSPL+ Programming Example: 1 Digital Input Debouncing: A digital input from a mechanical pushbutton is used to tell a rotary stage to advance 2 rotations. In order to remove false triggers when the pushbutton is pressed and released, a debouncing mechanism is required. 1.Load program “Programming 08 – DIODebouncing.prg” to the controller. o Should populate buffer 11 2.Open communication terminal and set it up to show DISP messages 3.Plot the variables di_signal and di_debounced on the scope o Set the time for 0.1 sec/div and the trigger on Auto 4.From the communication terminal start buffer 11 at line 1 (“ START 11, 1”). Follow the instructions on the screen 18
© 2013 ACSPL+ Programming Example: 2 Analog Input Filtering: An analog input is being used as accelerometer feedback for increasing the performance of a stage. The accelerometer feedback should be low frequency (< 5 Hz), so it is desired to put a single-pole low pass filter at 50 Hz. 1.Load program “Programming 08 – AnalogFiltering.prg” to the controller. o Should populate buffer 12 2.Open communication terminal and set it up to show DISP messages 3.Plot the variables ai_in and ai_filt on the scope o Set the time for 0.1 sec/div and the trigger on Auto 4.From the communication terminal start buffer 12 at line 1 (“ START 12, 1”). Follow the instructions on the screen 19
© 2013 ACSPL+ Programming Example: 3 20
© 2013 ACSPL+ Programming Example: 4 Simple Digital Controller: An application requires an EtherCAT drive to be run in torque mode in order to give a constant desired torque on a load. A simple PI controller is used with a torque sensor in order to give a steady effective torque. 1.Open buffer 14 2.Write a program to give the desired results. You can create user-defined variables for the drive output command and the torque sensor input. 21
© 2013 SPiiPlus Training Class Motion Profile Generation 1.
1 Chapter 3:Operators and Expressions| SCP1103 Programming Technique C | Jumail, FSKSM, UTM, 2006 | Last Updated: July 2006 Slide 1 Operators and Expressions.
SUBTRACTING INTEGERS 1. CHANGE THE SUBTRACTION SIGN TO ADDITION
WEEK 1 You have 10 seconds to name…
Addition 1’s to
DIVIDING INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
© 2013 SPiiPlus Training Class PEG and MARK 1. © 2013 What is PEG? PEG (Position Event Generator) creates pulses based on exact feedback position. These.
Test B, 100 Subtraction Facts
CS 1 Introduction CS 1 Part 11. Hardware 1.Central Processing Unit (CPU) 2.Main Memory 3.Secondary Memory / Storage 4.Input Devices 5.Output Devices CS.
MULT. INTEGERS 1. IF THE SIGNS ARE THE SAME THE ANSWER IS POSITIVE 2. IF THE SIGNS ARE DIFFERENT THE ANSWER IS NEGATIVE.
CS 3850 Lecture 5 Operators. 5.1 Binary Arithmetic Operators Binary arithmetic operators operate on two operands. Register and net (wire) operands are.
S i m u l i n k Prof. Muhammad Saeed Mathematical Modeling and Simulation UsingMATLAB 1.
Python By: Ben Blake, Andrew Dzambo, Paul Flanagan.
Topic Reviews For Unit ET156 – Introduction to C Programming Topic Reviews For Unit
25 seconds left….. 24 seconds left….. 23 seconds left…..
By D. Fisher Geometric Transformations. Reflection, Rotation, or Translation 1.
© Paradigm Publishing, Inc Excel 2013 Level 1 Unit 1Preparing and Formatting a Worksheet Chapter 2 Inserting Formulas in a Worksheet.
Basic Operators. What is an operator? using expression is equal to 9. Here, 4 and 5 are called operands and + is the operator Python language supports.
Copyright 2001 ACS-Tech80 1 ACSPL+ Training Class SPiiPlus Feedback Tuning.
0 - 0.
ADDING INTEGERS 1. POS. + POS. = POS. 2. NEG. + NEG. = NEG. 3. POS. + NEG. OR NEG. + POS. SUBTRACT TAKE SIGN OF BIGGER ABSOLUTE VALUE.
Week 6 - Programming I So far, we’ve looked at simple programming via “scripts” = programs of sequentially evaluated commands Today, extend features to:
1 The op-amp Differentiator. 2 Frequency response of a differentiator with a time-constant CR.
Chapter R: Reference: Basic Algebraic Concepts
All the Operators. Precedence An operator with higher precedence is done earlier (prededes) one with lower precedence –A higher precedence is indicated.
1 KU College of Engineering Elec 204: Digital Systems Design Lecture 18 Registers Register – a collection of binary storage elements In theory, a register.
ICS 103 Lab 2-Arithmetic Expressions. Lab Objectives Learn different arithmetic operators Learn different arithmetic operators Learn how to use arithmetic.
Lilian Blot CORE ELEMENTS PART I Python Language Autumn 2013 TPOP 1.
6-1 Copyright © 2008 by Jose Bastos Chapter 6 Thyristor Converters Chapter 6 Thyristor Converters Thyristor circuits and their control Line-frequency phase-controlled.
TWO STEP EQUATIONS 1. SOLVE FOR X 2. DO THE ADDITION STEP FIRST
1 C Programming. 2 Operators 3 Operators in C An operator is a symbol that tells the computer to perform certain mathematical or logical manipulation.
Chapter 5: Control Structures II (Repetition)
Computational Complexity, Choosing Data Structures Svetlin Nakov Telerik Corporation
September 30, 2014Computer Vision Lecture 7: The Fourier Transform 1 The Fourier Transform Last week we talked about convolution as a technique for a variety.
Fortran 1- Basics Chapters 1-2 in your Fortran book.
1 Unit 1 Kinematics Chapter 1 Day
Fisica Generale - Alan Giambattista, Betty McCarty Richardson Copyright © 2008 – The McGraw-Hill Companies s.r.l. 1 Chapter 21: Alternating Currents Sinusoidal.
Building Java Programs Chapter 13 Searching and Sorting Copyright (c) Pearson All rights reserved.
OPERATORS IN C CHAPTER 3. Expressions can be built up from literals, variables and operators. The operators define how the variables and literals in the.
CS 170 – INTRO TO SCIENTIFIC AND ENGINEERING PROGRAMMING.
1 ECE734 VLSI Arrays for Digital Signal Processing Loop Transformation.
Operators & Expressions. Operators C supports rich set of operators. An operator is a symbol that tells the computer to perform certain mathematical or.
Equations How to Solve Them. 7/8/2013 Equations 2 What Are Equations ? Equation Statement that two expressions are equal What do we DO with expressions.
Other Gate Types COE 202 Digital Logic Design Dr. Aiman El-Maleh College of Computer Sciences and Engineering King Fahd University of Petroleum and Minerals.
15-Nov-15 All the Operators. operators.ppt 2 Precedence An operator with higher precedence is done earlier (precedes) one with lower precedence A higher.
Processor Data Path and Control Diana Palsetia UPenn.
Vibrationdata 1 Unit 10 Sample Rate, Nyquist Frequency & Aliasing.
Credit hours: 4 Contact hours: 50 (30 Theory, 20 Lab) Prerequisite: TB143 Introduction to Personal Computers.
© 2017 SlidePlayer.com Inc. All rights reserved.