版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、Power PMAC Mathematical FeaturesMay 2011Power PMAC Floating-Point MathPower PMAC processor has hardware floating-point engine510 x (+) faster than Turbo PMAC software-library implementationSingle-precision (IEEE 32-bit) supportedDouble-precision (IEEE 64-bit) supported, default for user programsDoub
2、le-precision provides much greater resolution and range than PMAC/Turbo PMAC 48-bit format18 more bits in the mantissa 256K x increase in resolution/rangeRange of 1.80 x 10308Suitable for key automatic motor calculationsSuitable for axis calculations (trajectories, kinematics, lookahead)Suitable for
3、 user-program calculationsPower PMAC Numerical RepresentationsReceiving numerical values in text strings (e.g. P1=3)Standard decimal formatNo arbitrary limit on number of decimal places permittedScientific notationFormat mantissaEexponent (e.g. -1.76E10)Mantissa does not need to be normalized (e.g.
4、-17.6E9 is OK)Hexadecimal (with $ prefix)Non-negative integers onlyReporting numerical values in text stringsReporting format independent of receiving (e.g. hex vs. decimal)Automatic decision on number of decimal places reported (formatting to fixed number of decimal places must be done in host comp
5、uter)Floating-Point Math in Automatic RoutinesMotor phase and servo routines use floating-point mathWere fixed-point math in PMAC/Turbo PMACSpeed and precision of floating-point math now suitable for these calculationsMany problems with fixed-point math eliminatedRegister units are standardized (e.g
6、. counts, milliseconds)No position rollover worriesNo velocity saturation worriesMinimal quantization noise introduced in “aggressive” filteringNo conversion overhead from axis calculationsAxis calculations use 64-bit floating-point mathEffective range before resolution-loss problems increased 256K
7、times compared to Turbo PMACFloating-Point Math in User Script ProgramsMachine control applications require the use of many different numerical formatsInputs and outputs are fixed-point (Boolean, 16-bit, 32-bit, etc.)Most motion calculations are floating-pointPower PMAC Script environment does autom
8、atic type matching of different numerical formatsFixed-point and floating-point representations1-bit to 64-bit formatsAll “inputs” to calculations converted to 64-bit floating-point formatAll mathematical operations done in this formatIf calculation has a “result”, it is converted (if necessary) to
9、required formatUser does not need to concern himself with format conversions(Note that user C-language programs must follow C rules for type matching and format conversions)Special Floating-Point RepresentationsSpecial representations that are part of IEEE-754 standardPower PMAC reports these “value
10、s” with the text shown hereinf, -inf (+/-infinity)Obtained (for example) by division by 0Operations that generate +/-inf do not create errorsinf is greater than any finite number in a comparison-inf is less than any finite number in a comparisonnan (not-a-number)Obtained (for example) by function do
11、main error (e.g. sqrt(-1) )Operations that generate nan do not create errorsBoolean isnan function can be used to check-0 (minus zero)Obtained by underflow of negative valuesEquivalent to 0 (“plus zero”) in any subsequent operations+/-inf, nan generally useful as diagnostics; in application, best to
12、 check before operation that could producePower PMAC User Global Variables“Global” variables can be shared between programsP-variables (65,536 total)Double-precision (64-bit) floating-point variablesAccessible from all coordinate systemsDeclared as “global” (outside of a program) for IDE substitutio
13、nsQ-variables (8192 per coordinate system, not overlapping)Double-precision (64-bit) floating-point variablesSeparate coordinate systems access different variables for same nameDeclared as “csglobal” (outside of a program) for IDE substitutionsM-variables (16,384 total)Pointer variables; take on for
14、mat of what is pointed toAccessible from all coordinate systemsDeclared as “ptr” (outside of a program) for IDE substitutionsDefining M-Variables in Power PMACGeneral definition in I/O spaceMconstant-format.io:adr_offset.start.widthGeneral definition in user shared memory spaceMconstant-format.user:
15、adr_offset.start.widthSelf-defined (useful to create particular numerical format)Mconstant-*format.widthM-variable formatss signed integer that saturatesi signed integer that rolls overu unsigned integer that rolls overf short (32-bit) floating-point (does not take start or width )d long (64-bit) fl
16、oating-point (does not take start or width )start = 0 to 31 (default is 0, not limited to 1 & multiples of 4)width = 1 to 32 (default is 32, not limited to 1 & multiples of 4)Defined to data structure element (takes on format of element)Mconstant-data structure elementPower PMAC I-Variables“Legacy”
17、feature intended for convenience of experienced Turbo PMAC usersPoint to Power PMAC data-structure savable setup elements that are essentially equivalent to present Turbo PMAC I-vars:For Motors 0 31: I0 I3199For Coordinate Systems 0 15: I5000 I6599(Note that I0 I99 taken for Motor 0, I5000 I5099 for
18、 C.S. 0)For “Gate1” ICs 0 19: I7000 I7999For “Gate2” ICs 0 3: I6800 I6999Usable in programs and on-line commandsSetup elements for new features, motors, C.S.s generally not given I-variable numbersCan find out what element is used by an I-variable with on-line command Iconstant- e.g.:I428-I428-Motor
19、4.InPosBandPower PMAC User Local Variables“Local” variables are used within a programL-variables (8192 per C.S., PLC, & on-line command processor)Double-precision (64-bit) floating-point variablesNot (directly) accessible outside of program where usedDeclared as “local” (inside of a program) for IDE
20、 substitutionsR-variables are renamed L-variables for passing/returning values to/from general subroutinesRn of calling routine equivalent to Ln of called routinePermit true argument passing to subroutinesC-variables are renamed C.S. L-variables for passing/returning axis values to/from kinematic su
21、broutinesCn is equivalent to L(Sys.MaxMotors+n) for C.S.C.S. and PLC data structures provide full read access to local variablesCoordm.Ldata.Ln or PLCm.Ldata.Ln accesses Ln relative to L0 of present programCoordm.Ldata.Lindex or PLCm.Ldata.Lindex accesses number of L0 of present program relative to
22、root L0Coordm.Ldata.Rn or PLCm.Ldata.Rn accesses Rn relative to R0 of present programLocal Variable Stack ExampleThis example uses default “stack offset” of 256Other offsets can be declaredIDE declares optimal offsets automaticallyRn of calling routine equivalent to Ln of called routineRn of calling
23、 routine equivalent to L(n + StackOffset) of calling routinePass/return arguments should start with R0 of calling, L0 of calledIDE manages these definitions and assignments automaticallyAuto-Assigning User Names to VariablesRequires use of Project Manager in IDEWhen you dont care what variable is as
24、signed, use declarationsglobal MyPvar1, MyPvar2, MyPvar3(16);csglobal MyQvar1, MyQvar2, MyQvar3(256);ptr MyMvar1-definition, MyMvar2-definition;local MyLvar1, MyLvar2, MyLvar3(7);Project manager automatically assigns variables to namesCan set starting variable numbers for auto-assign with PVARSTARTn
25、, QVARSTARTn, MVARSTARTn directivesDirectives in /usrflash/project/pp_proj.iniDefaults are PVARSTART8192, QVARSTART1024, MVARSTART8192Local variable auto-assigns always start with L0Variables with lower numbers available for manual assignment or “raw” useCapabilities with Declared Variable NamesWhen
26、 writing programs, just use declared variable names, e.g.:MyPvar1 = MyMvar2 + 7;Can access from IDE terminal, watch window, etc., e.g.:MyPvar1&2MyQvar3MyMvar2 = 1If non-local variable declared with a value, e.g.:global MyPvar4 = 3;Value is automatically assigned to the variable on download, power-up
27、, and resetVery useful for setting power-up default valuesValue can be expressed as constant or expression (e.g. 5 * 65536), but expression cannot use variablesCommunications program gpascii -2 can use declared variable namesManual Assigning User Names to VariablesRequires use of Project Manager in
28、IDEWhen you do care what variable is assigned, use definitions#define MyPvar1 P10#define MyQvar7 Q50#define MyMvar3 M200Simple text substitution on downloadShould use variables numbered below P/Q/MVARSTART #Can be most important for local (L) variables to coordinate variable passing properly (IDE do
29、es automatically for subroutine arguments)#define MyLvar1 L0#define MyLvar2 L1#define MyRvar1 R0#define MyRvar2 RPower PMAC Variable ArraysFor any numbered variable type (P, Q, M, I, L, R, D, C)Specific variable can be specified by mathematical expression in parenthesese.g. P(P1-P2+7), L(Index-1)Tec
30、hnically, these are function calls, so use ( ), not Compare to indexed data structures, which use for indexComputed expression value rounded down to next integer (if necessary) before used to select particular variableUsable in motion and PLC programs, & many on-line commandsCan use arrays with vari
31、able declarations in IDEglobal MyParray(32) declares 32-element P-variable arrayIf IDE project manager assigns P620 P651 to this array, MyParray(Index) es P(620+Index)No protection against index exceeding declared array lengthNote distinction between arrays, vectors, and (2D) matricesPower PMAC Scri
32、pt Math: Scalar FunctionsTrig functions using radians: sin, cos, tan, sincosInverse trig functions using radians: asin, acos, atan, atan2Trig functions using degrees: sind, cosd, tand, sincosdInverse trig functions using degrees: asind, acosd, atand, atan2dHyperbolic trig functions: sinh, cosh, tanh
33、Inverse hyperbolic trig functions: asinh, acosh, atanhLog/exponent functions: log (or ln), log2, log10, exp, exp2, powRoot functions: sqrt, cbrt, qrrt, qnrtRounding/truncation functions: int, rint, floor, ceilRandom number generation : rnd (32-bit), randx (64-bit), seedMiscellaneous functions: abs,
34、sgn, rem, madd (mult & add), isnanPower PMAC Script Math: Vector FunctionsOperate on continuously numbered set of P-variablesSet of variables can be treated as 2D matrix for other purposesFunctions that produce new vectors (returned value is “OK” flag must “put” somewhere even if dont use)vadd: Adds
35、 2 vectors together to produce 3rd vectorvcopy: Copies contents of vector into 2nd vectorvscale: Multiplies each vector element by common scale factor, result in 2nd vectorFunctions that produce scalar (as returned value) onlysum: Adds a number of evenly spaced elements together (as for trace of mat
36、rix)sumprod: Multiplies pairs of elements of 2 vectors together, adding products into returned value (as for dot product)Power PMAC Script Math: Matrix FunctionsOperate on consecutively numbered set of P-variablesElements in same row are consecutively numberedFunctions that produce new matrices (ret
37、urned value is “OK” flag or determinant of result matrix must “put” somewhere even if dont use)mmul: Multiplies 2 matrices together to create 3rd matrixmmadd: Multiplies 2 matrices together, adds product to 3rd matrixminv: Inverts a square matrix to create a 2nd matrixmtrans: Transposes a matrix to
38、create a 2nd matrixmsolve: Solves simultaneous set(s) of equations represented by square (coefficient) matrix and 2nd (constant) vector/matrixFunctions that produce scalar (as returned value) onlymdet: Calculated determinant of square matrixmminor: Calculates specified minor determinant of square ma
39、trixOperators and Conditional ComparatorsArithmetic operators+ (add), - (subtract), * (multiply), / (divide), % (modulo)Normal rules of algebraic precedence applyBit-by-bit logical operators& (bit-by-bit AND), | (bit-by-bit OR), (bit-by-bit exclusive OR) (bit-by-bit invert; unary operator technicall
40、y a function) (shift right)Conditional comparators= (equals), != (not equals), (approx. eq.), ! (not approx. eq.) (greater than), = (greater than or equal to), =, =Increment/decrement assignments: +, -Synchronous Variable AssignmentsNeeded primarily because motion programs must calculate ahead durin
41、g sequence of blended movesStandard assignments would occur “too soon” compared to movesSynchronous assignments are delayed to be in sequence with movesGeneral syntax: variable synchronous operator expressionMost variable types can receive synchronous assignmentNot just M-variables as in PMAC/Turbo
42、PMACIncluding pre-defined data structure elementsNo local variables or self-referenced M-variables can receiveExpression following operator evaluated during program flowResulting value stored in buffered queue along with operation typeEach coordinate system has an independent buffered queueActual as
43、signment using operator occurs at beginning of execution of next commanded move (at start of blend)In PLC programs, use to assure that commanded move has startedSynchronous Variable Assignments (cont.)Simple assignment: = (expression value written into variable)For any type of variable formatAssignm
44、ents with arithmetic operation: +=, -=, *=, /=, %=*=, /=, %= for floating-point variables/elements onlyAssignments with logical operation: &=, |=, =For integer variables/elements onlyIncrement/decrement assignments: +=, -=Useful in PLC programs to know that commanded move has started, e.g.: P1=0; P1
45、=1; jog1=100000;/ P1 set at start of jog movewhile (!(P1) | !(Motor1.InPos) / Move not started or ongoingM1=1;/ Set output when move has finished and settled/ Motor must be assigned to a C.S. to trigger sync assignment in PLCSynchronous Assignment Motion Program ExampleOne move lookahead (for simple
46、 blending):X10;/ 1st moveX20;/ 2nd moveQ1 = 30;/ Standard assignmentM1=1;/ Standard assignmentM2=1;/ Sync assignmentX(Q1);/ 3rd moveQ1 set to 30 at X=10 (t1)Needs to be done at lookahead time to calculate next move properlyM1 set to 1 at X=10 (t1)Output would appear out of sequenceM2 set to 1 at X=20 (t2)Output would appear in sequenceSynchronous Assignment BufferSynchronous assignments
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 广州市老年教育发展报告
- 华为打胜仗培训
- 小班健康详案教案及教学反思《防火知多少》
- 中班音乐教案:猫捉老鼠
- 改善医疗服务活动
- 科技馆实践活动
- 2023-2024学年山东省泰安市高三(上)期末地理试卷
- 2023年山东省潍坊市昌乐一中高考地理一模试卷
- 2023年江西省鹰潭市高考地理一模试卷
- 2024-2025学年广东省深圳市盐田高级中学高一(上)期中语文试卷
- 辽宁省沈阳市沈阳市郊联体2024-2025学年高二上学期11月期中英语试题 含解析
- 《员工培训方案》课件
- 2024年贵州省贵阳修文县事业单位招聘133人历年管理单位遴选500模拟题附带答案详解
- 读书分享《非暴力沟通》课件(图文)
- 2024-2030年中国家禽饲养行业发展前景预测和投融资分析报告
- 2024-2030年中国净菜加工行业市场营销模式及投资规模分析报告
- 2024-2025学年广东省佛山市九年级(上)期中数学试卷(含答案)
- 湖南省长沙市雅礼教育集团2024-2025学年高一上学期期中考试数学试题 含解析
- 第二章 空气、物质的构成(选拔卷)(原卷版)
- 云南省昆明市昆十中教育集团2024-2025学年七年级上学期期中测试地理试卷(无答案)
- JJF1069-2012法定计量检定机构考核规范
评论
0/150
提交评论