HARmonica Software Manual June 2002 www.elmomc.
Important Notice This guide is delivered subject to the following conditions and restrictions: This guide contains proprietary information belonging to Elmo Motion Control Ltd. Such information is supplied solely for the purpose of assisting users of the HARmonica servo amplifier. The text and graphics included in this manual are for the purpose of illustration and reference only. The specifications on which they are based are subject to change without notice.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT 1 Table of Contents: 1 1.1 ABOUT THIS MANUAL ................................................................................................................................. 10 Scope ......................................................................................................................................................................... 10 1.2 Relevant documentation ..............................................................
Elmo HARmonica Software Manual HARSFEN0602 4.2.2 4.2.3 4.2.4 4.2.5 4.2.6 4.3 5 5.1 PRELIMINARY DRAFT 2 Mathematical And Logical Operators....................................................................................................................19 General rules for operators ....................................................................................................................................20 Operator details.........................................................................
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT 3 6.4 The program execution............................................................................................................................................ 62 6.4.1 Initiating a Program............................................................................................................................................... 63 6.4.2 Halting and resuming a program ...................................................................
Elmo HARmonica Software Manual HARSFEN0602 7.7.28 7.7.29 7.7.30 7.7.31 7.7.32 7.7.33 7.7.34 7.7.35 7.7.36 7.7.37 7.7.38 7.7.39 7.7.40 7.7.41 8 PRELIMINARY DRAFT 4 RSLTE – Relational Operator (==)...................................................................................................................87 RSLTNE – Relational Operator (!=).................................................................................................................87 RSLTOR – Logical OR Operator ( || ) ..........
Elmo HARmonica Software Manual HARSFEN0602 10 PRELIMINARY DRAFT 5 THE CURRENT CONTROLLER.................................................................................................................. 115 10.1.1 Current limiting .............................................................................................................................................. 116 10.1.2 The torque command filter .................................................................................................
Elmo HARmonica Software Manual HARSFEN0602 13.5.2 13.5.3 13.5.4 13.5.5 13.5.6 14 PRELIMINARY DRAFT 6 Homing Programming ....................................................................................................................................176 Homing the auxiliary encoder.........................................................................................................................176 On the fly position counter updates ...............................................................
Elmo HARmonica Software Manual HARSFEN0602 16.1 PRELIMINARY DRAFT 7 Main partitions....................................................................................................................................................... 204 16.2 The firmware partition .......................................................................................................................................... 204 16.2.1 Table of Contents (TOC)...................................................................
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT 8 List of Tables: Table 2-1: Analog sampled signals .........................................................................................................................15 Table 3-1 – RS232 Rx Item Description .................................................................................................................16 Table 3-2 – RS232 Tx Item Description ...............................................................................
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT 9 List of Figures: Figure 1 - Slope and window trigger types ............................................................................................................. 98 Figure 2 – Pre trigger delay..................................................................................................................................... 99 Figure 3: Two phased linear motor ...........................................................................
Elmo HARmonica Software Manual HARSFEN0602 1 PRELIMINARY DRAFT About This Manual 1.1 Scope This specification presents relevant data for understanding and using the Harmonica software. The Software Specification complements the Command Reference Manual. The Command Reference Manual lists each single command with all its options. The Software Specification Manual is designed to give wider view of the Harmonica system. The topics are covered functionally, with reference to many commands. 1.
Elmo HARmonica Software Manual HARSFEN0602 2 PRELIMINARY DRAFT The Harmonica 2.1 Introduction The Harmonica a sophisticated and capable network-oriented single-axis amplifier, with: - State of the art control algorithms, including high order filters and gain scheduling - State of the art reference generation algorithm, including absolute timed interpolated motion, auxiliary signal following, and ECAM.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT The personality data is loaded to the serial flash memory. The personality data includes a file allocation table and several files. The personality files include data about the Harmonica. A partial list is: List of supported command List of error code CAN EDS All these data items enable an IDE to deal with the Harmonica. The File Allocation table reserves place for storage of application parameters and of user programs.
Elmo HARmonica Software Manual HARSFEN0602 CA[23] YA[1],YA[3] PRELIMINARY DRAFT mechanical revolution. For linear motors, CA[23] stores the number of counts per user unit (Meter, or any other unit the user may select). CA[23] is stored only for convenience – the Harmonica software does not use this number for any internal calculation. For rotary motors, set CA[23]=0. YA[1] is the auxiliary feedback resolution, counts/physical unit. YA[3] sets what a physical unit is: Revolution, Meter, or other.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT The internal representation of phase currents is by A/D bits. Torque commands, and the active and the reactive parts of the current have another representation, since the coordinate transformations from phase current to torque introduce scaling. The relation between internal phase currents, internal torque, and Amperes is given by the following commands: Command Description MC The full current range of the amplifier.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 a decoder is 20mHz, without input filter. If input filter is applied, the maximum pulse rate is reduced, as explained at the EF[N] command in the Command Reference Manual. The encoder input is not protected. There is no hardware to identify illegal transitions. Exceeding the maximal pulse rate will cause loss of counts that cannot be detected. 2.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 3 Communication With the Host 3.1 General 3.2 RS232 Communications The Harmonica can communicate by RS232 with baud rates up to 115200baud/sec. The maximum baud rate depends in the sampling time. The baud rate of 115200baud/sec works only when TS equals or is less than 70. The communication rate of 57600 baud/sec works with all sampling time options. Please refer to PP[] command in the Command Reference Manual. 3.2.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Sets the value of 1 to the MO variable. CA[2]=1; Sets the value of the CA[2] variable. CA[N] denotes a vector of parameters that can be accessed by their index. The free evaluation (5+sin(PX))*sqrt(abs(VX)) Returns a numerical value to the terminal. More detail about text interpreting is given in the chapter "The Interpreter Language". The amplifier responds to the host communicated commands.
Elmo HARmonica Software Manual HARSFEN0602 4 PRELIMINARY DRAFT The Interpreter Language The amplifier has a language that enables the user to communicate with the Amplifier. Using this language, the user can Setup the Amplifier Command the Amplifier what to do Inquire the Amplifier status There are two methods for communicating with the Amplifier.
Elmo HARmonica Software Manual HARSFEN0602 4.1 PRELIMINARY DRAFT The command line The Interpreter evaluates input strings, called “expressions”. An expression is a sequence of characters, terminated by a semicolon ‘;’, a line feed, or a carriage return. A command line may include the “Comment marker” – two consecutive asterisks. All the text from the comment marker to the next line feed or carriage return is ignored. The maximal expression length is 512 symbols.
Elmo HARmonica Software Manual HARSFEN0602 + * / % ^ ~ & | << >> == != < <= > >= && || ! = () [] PRELIMINARY DRAFT Add two operands. Subtract the right operand from the left one. Multiply two operands. Divide the left operand by the right one. Remainder after division two integers XOR Bitwise NOT of an operand. Bitwise AND between two operands. Bitwise OR between two operands.
Elmo HARmonica Software Manual HARSFEN0602 4.2.4.1 Addition Notation Description Number of arguments Output type Example 4.2.4.2 + Arithmetic addition 2 According to the section Promotion to float and truncation to integer 4+5=9 3.45+2.78=6.23 Subtraction Notation Description Number of arguments Output type Example 4.2.4.3 Arithmetic subtraction 2 According to the section Promotion to float and truncation to integer 4-5=-1 3.45-2.78=0.
Elmo HARmonica Software Manual HARSFEN0602 Output type Example 4.2.4.7 Notation Description Number of arguments Output type Example 4.2.4.8 Notation Description Number of arguments Output type Example 4.2.4.9 Notation Description Number of arguments Output type Example 4.2.4.10 Notation Description Number of arguments Output type Example 4.2.4.11 Notation Description Number of arguments Output type Example 4.2.4.12 32 bit long integer.
Elmo HARmonica Software Manual HARSFEN0602 Notation Description Number of arguments Output type Example 4.2.4.13 Notation Description Number of arguments Output type Example 4.2.4.14 Notation Description Number of arguments Output type Example 4.2.4.15 Notation Description Number of arguments Output type Example 4.2.4.16 Notation Description Number of arguments Output type Example 4.2.4.
Elmo HARmonica Software Manual HARSFEN0602 Notation Description Number of arguments Output type Example 4.2.4.18 || Logical OR. The result is 1 if any of the arguments is nonzero, 0 if both are zero. The arguments are not truncated to integers before evaluations 2 0 or 1 1 || 0 yield 1 0 || 0 is 0. Logical NOT Notation Description Number of arguments Output type Example 4.2.4.19 ! Logical NOT.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT sin Sine Floating point cos Cosine Floating point abs Absolute value Same type as input argument sqrt Square root, or zero if argument is negative Truncate to integer. fix(3.8) is 3 fix(-3.8) is -3 Truncate to nearest integer. rnd(3.8) is 4 rnd(-3.8) is –4 Time difference x=TM tdif(x ) returns the time in msec since x=TM has been sampled. Floating point fix rnd tdif 4.2.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT sp=sp*2/5+ac op=ip|5 If the variable or the command is a vector, the assignment is allowable only for its single member. The syntax of the vector member assignment is: [index]= The index is an index of the relevant member vector. Indices are enumerated from zero. Example: ca[1] = 1 4.2.6.3 User variables User variables are defined within a user program.
Elmo HARmonica Software Manual HARSFEN0602 4.2.6.6 PRELIMINARY DRAFT User Function Calls The XQ command enables a user function call. See Running of a User Program A user function cannot be called from the command line without the XQ command. 4.3 Comments Comments are texts that are written into the code to enhance its readability. A double asterisk marks comments. The comment starts in a double asterisk comment marker, and terminates at the next end of line.
Elmo HARmonica Software Manual HARSFEN0602 5 PRELIMINARY DRAFT The Harmonica User Programming Language This chapter describes the Harmonica user language in detail. This chapter is somewhat out of place, since the user program language is not really a feature of the Harmonica. The Harmonica can only understand virtual assembly commands – see commands at the chapter The Virtual Machines: Short reference. The Compiler translates user language into virtual assembly commands.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 X=0; for k=0:10 X=x+1; end exit ##Moo ... Initialize Iterate Do something End of iteration End of program directive More code The program defines two variables named x and k. ##Foo is an entry point. After compilation, it is possible to run this piece of code by commanding XQ ##Foo to the interpreter. When the program starts at ##Foo, it clears the user variable x. It then iterates 11 times, incrementing x with every iteration.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT A user program may contain too long line and its representation at the screen may be not convenient, because not all symbols are shown at the screen. In order to improve readability of the program, a user may continue this expression at the next line. Three points at the end of line indicates that this line will be continued. Example: Assume that a user program contains the next expression c = 12 * a + sqrt(2) – sin(3.
Elmo HARmonica Software Manual HARSFEN0602 5.3.4 PRELIMINARY DRAFT Operator details The description and syntax is the same as in the Interpreter Language. See Operator details of the Interpreter Language 5.3.5 Mathematical functions The description and syntax is the same as in the Interpreter Language. See Mathematical functions of the Interpreter Language 5.3.6 5.3.6.1 Expressions Simple Expressions The description and syntax is the same as in the Interpreter Language.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT The names of variables may include ASCII letters, digits (not leading) and underscores (not leading) only. It’s case sensitive. The maximal variable name length is 12 characters. A variable name cannot be a keyword.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT 33 Consider some examples using system commands. Example a = AC AC = a BG LS 5.3.6.5 Explanation This expression assigns value of the system command AC to the variable ‘a’. This expression is valid if the AC command is allowed to ‘get value’, i.e. it has PreProcess flag This expression assigns value of the variable ‘a’ to the system command AC. This expression is valid if the AC command is allowed to ‘set value’, i.e.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT Comments are texts that are written into the code to enhance its readability. There are three methods to write comments. A double asterisk marks comments. The comment starts in a double asterisk comment marker, and terminates at the next end of line. The Amplifier ignores the comments when running a program or evaluating an expression.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 wait : Iterate (suspend the execution of the program) until a specified time is elapsed. for - end : Iterate counted times break : Break an iteration or a switch expression (for, while, switch) if – else – elseif – end: Conditional expression. switch-case-otherwise-end: Case selection goto – Go to some point in the program reset – Kill the state of the executing program and jump to some point in the program.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Perform an indexed iteration in a program. Syntax: for k=N1:N2:N3 … end or for k=N1:N2 … end where N1, N2, and N3 are numbers or simple expressions. The syntax: for k=N1:N2:N3 … end iterates k from N1 to N3 with a step of N2. The syntax: for k=N1:N2 … end iterates k from N1 to N2 with a step of 1. Notes: 1. If the iteration step is zero, the program is aborted with the error code INFINITE_LOOP. 2.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT Syntax: while( expression ) … statement … end The while keyword executes statement repeatedly until expression becomes 0. The expression can be logical or/and numerical. Note: expression may be within round parentheses or without ones. Example: OB[1]=0 while(IB[1]) OB[1]=1 end OB[1]=0; …. … While (IB[2]) end MO=1; 5.5.
Elmo HARmonica Software Manual HARSFEN0602 … Do some work … IsFirstFinished = 1 ; The code of the second thread will include … Prior to suspension code until (IsFirstFinished) ; PRELIMINARY DRAFT **Signal that some work is completed **The second thread suspended until **signal … Continue program. If we want to suspend thread without terminating it, we can use until with a false expression. 5.5.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT Example: if (IB[4]) PR=1000; elseif(IB[3]) PR=5000; elseif(IB[2]) PR=3000; else PR=500; PR=1000 only if digital input 4 is ON PR=5000 only if digital input 3 is ON PR=3000 only if digital input 2 is ON PR=500 only if digital input 2,3 and 4 are OFF end 5.5.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 switch (k) case 1 PA=1000; case 2 PA=2000; otherwise PA=500; end 5.5.8 For example, k=2 This statement will be performed If k doesn’t equal to 1 or 2 , pa=500 Break Syntax: break The break statement terminates the execution of the nearest enclosing for, switch or while statement in which it appears. Control passes to the statement that follows the terminated statement.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 For example, 2 function func2 (struct float x1) 3 [int y1] = func3 (int x1) 4 function y1 = func5 This function is named func2, it gets the only input argument of float type and doesn’t return any output. This function declaration is illegal, because keyword function is absent This function prototype is illegal, because type of the output variable is absent. The valid function name observes the same rules as the variable name.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 y1 = x1; y2 = x2; if x2 > 0 return end y2 = y1 + y2 ; return ** Function body ** If block ** return inside block is not the end of the function ** End of if block ** Some executable code ** Function end Before function call, it must be declared. It may be either function prototype or function definition. For example, 13 function [int y1, int y2] = func (float x1, int x2) ; … function main() int a, b; [a,b] = func(2.3, -9.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT If some function does not return any output by its definition, then zero value as output will be inserted to the stack actually. Assume that the function foo is declared with no output arguments. So the following expression: foo () + 3 is legal, because foo returns zero by default. Example: float vec[11], RA[100]; float value; function [float mean, float std]=statistic(); ...
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 exits, the value of the automatic variables is not saved. Automatic variable cannot be a vector. Example: In the example of the STATISTIC function, variable k is the automatic variable 5.6.5 Global variables A function can refer a persistent variable. In this case the referred persistent variable must be declared global inside function and must be defined above function definition.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 The goto command may be specified only for destinations within the present function scope. It is not possible to jump to labels that are inside another function. The jump to the global label from within some function is illegal. Example: … if (PX>1000) goto##LABEL1; else goto##LABEL2; end … ##LABEL1; …. ##LABEL2; … 5.6.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Example: function factorial() ; … IA[1]=3 IA[2]=1 factorial() BG … function factorial() global int IA[] ; IA[2]=IA[2]*IA[1] IA[1]=IA[1]-1 if ( IA[1] > 1 ) factorial() ; end return **Function prototype **Function call **Function for factorial **Definition of array as global inside function **Recursive algorithm **Recursive call **Function end The factorial function of the example calculates the factorial of 3 in IA[2].
Elmo HARmonica Software Manual HARSFEN0602 5.6.8 PRELIMINARY DRAFT Killing The Call Stack In some rare situations, it is desirable to exit a function without returning to its return address. The reset instruction solves this problem by emptying the call stack before making a jump. Syntax: reset The valid jump after the ‘reset’ keyword is one of the following: 1. label 2. auto routine 3.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT according to system events. These routines will be executed only when their invocation condition is satisfied. These automatic routines doesn’t have output and input arguments. Syntax: There are two options to define an auto routine: either as a function or as a label. If it’s defined as a function, then all syntax rules for function definition are relevant (see the chapter Function definition).
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 AUTO_ I6 12 Called when a digital input #6 configured to the “GPI (General purpose Input)” function is activated. Refer the IL command. 4096 Table 5-1 – Automatic subroutines and their priority All the automatic routines, except AUTOEXEC, are activated only if a program is running.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 goto ##LOOP; **Endless loop #@TEST_PARS op=2; wait 2000; mi=0; goto ##LOOP; return **Subroutine **Set output 2 **Wait 2 seconds for testing the part **Enable automatic handling of digital in #1 #@AUTO_I1 op=3; return … exit **End of the autoexec function **Automatic handler for digital input #1 **Set output 3 to indicate din 1 sensed. **Subroutine body.
Elmo HARmonica Software Manual HARSFEN0602 6 • • • • • • 6.1 PRELIMINARY DRAFT Program Development and Execution The process of program development includes the following steps: Program editing – Writing\editing the program. Compilation – Let the Compiler process the program and find errors Program loading – Load the program to the Amplifier Flash memory.
Elmo HARmonica Software Manual HARSFEN0602 2 Empty expression 3 4 Stack is full Bad index expression 5 Bad variable type 6 Parentheses mismatch 7 Value is expected 8 Operator is expected 9 Out of memory in the data segment Bad colon expression 10 PRELIMINARY DRAFT 52 There is empty expression inside round brackets k = 1:2:20 Colon expression is used out of ‘for’ statement Expected right hand expression is absent For example, a=; After assignment symbol the right hand expression is absent S
Elmo HARmonica Software Manual HARSFEN0602 11 Name is too long 12 No such variable 13 Too many dimensions 14 Bad number of input arguments 15 Bad number of output arguments 16 Out of memory 17 Too many arguments 18 Bad context 19 20 21 Write file error Read file error Internal compiler error: bad database 22 Function definition is inside another function or flow control block 23 Too many functions PRELIMINARY DRAFT 53 Variable or function name exceeds 12 characters.
Elmo HARmonica Software Manual HARSFEN0602 24 Name is keyword 25 Name is not distinct 26 Variable name is invalid 27 Bad separator between variables 28 Illegal global variable definition 29 Bad variable definition PRELIMINARY DRAFT 54 them in the database Variable or function name is the same as some keyword. This error may appear if variable name is identical to some auto routine name. For example, int switch; ‘switch’ is keyword, so its use as variable name is illegal.
Elmo HARmonica Software Manual HARSFEN0602 30 Variable is undefined 31 Bad separator between dimensions 32 Bad variable dimension 33 Bad function format 34 Illegal minus 35 36 37 Empty program Program is too long Bad function call 38 Expression is expected PRELIMINARY DRAFT 55 float c, d; The definition of float variables ‘c’ and ‘d’ is illegal, because it occurs after executable code ‘b = a’ This error appears if iteration variable at ‘for’ statement is not defined before it.
Elmo HARmonica Software Manual HARSFEN0602 39 Code is too complex 40 Line compilation is failed Case must follow switch 41 42 Illegal case after otherwise 43 Bad nesting 44 Code is not expected 45 Bad flow control expression 46 47 Too many errors Expression is out of function 48 Otherwise without any case 49 Misplaced break PRELIMINARY DRAFT 56 User program contains very complex code that includes too many nested levels (actually this expression contains more than 100 nested levels).
Elmo HARmonica Software Manual HARSFEN0602 50 Too many outputs 51 Line is too long 52 Clause is too long 53 54 55 56 Cannot find end of sentance Open file failure Bad file name No such function 57 Variable is array 58 Variable is not array 59 Mismatch between left and right hand side expressions 60 Illegal local array 61 Function already has PRELIMINARY DRAFT 57 error occurs. For example, if a < 0 break ; end ‘break’ from ‘if’ statement is illegal.
Elmo HARmonica Software Manual HARSFEN0602 body 62 63 Opcode is not supported by the Harmonica Internal compiler error 64 Expression is not finished 65 Compiled code is too long Corrupted the Harmonica setup files Too many variables 66 67 68 69 70 71 72 Variable name length mismatch to the Harmonica setup Auto routine has argument Label definition is inside flow control block Function without return Block comments is not finished 73 Bad function after reset 74 Bad jump to label PRELIMINAR
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 75 Illegal nargout 76 77 Function without body Bad goto statement 78 Auto routine is local 79 Command has 'not program' flag 80 81 Image file is too long System function tdif is not supported by the Harmonica Unknown error 82 6.3 59 4.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 6.3.1 Binary data The Flash is interfaced with binary data. Sending binary data on the RS232 lines is a problem, since they complex the differentiation between data and delimiters. The characters that are problematic to send on the RS232 lines are: - All the high numbers, 128 to 255.
Elmo HARmonica Software Manual HARSFEN0602 6.3.2.2 PRELIMINARY DRAFT The CP command The CP command clears the entire user area in the serial flash. It may take a significant time. In special, CP sets the Program Valid flag to –1. Possible Execution Failures: 1) Motor is on. 2) Program is running. 6.3.2.3 The CC command The command CC=xxxx does as follows: Read the actual length of the user partition from the TOC. Calculate 32-bit checksum for the entire actual user partition.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT In order to download a program image to the Dama, follow the steps below. - Read the location (loc) and the length (len) of the user code partition from the main TOC. For this, use the LP[3] and the LP[4] commands. - Verify that your image block will fit inside the allocated space. - Clear the program flash, using CP - Download your image file by the sequence LP[1]=loc; DL##…100 bytes of payload LP[1]=(loc+100) DL##…next 100 bytes of payload ..
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 6.4.1 Initiating a Program A program is initiated by the XQ command. The XQ command states at which label the execution shall start. The XQ command resets all the program variables. In particular, it clears the call stack (refer the chapter the Functions and the Call Stack), it kills any pending automatic routines, and it clears the interrupt mask.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT HP; XQ##TASK2; 6.4.3 Automatic program running with power up If the user program includes the autoexec function, the next program line after function declaration will be performed with powering up. 6.4.4 Save to Flash Since a program is downloaded to a non-volatile memory, it is always saved. Information isn’t lost in cases of power down. 6.4.4.
Elmo HARmonica Software Manual HARSFEN0602 • • • • • PRELIMINARY DRAFT set and remove break points get information about existing VAC machines get running status of the program ask for or change a value of local variables get call stack of the program The DB command is designed for the IDE Manager use. The syntax of this command is strict, namely the spaces and white characters are not allowed to simplify the treatment of the command and all values must be numbers, expressions are illegal. 6.5.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT When any error occurs inside a specified VAC machine, it returns with error to the main loop that manages the running of the entire set of VAC machines. This manager stops all other VAC machines with the error ABORTED_BY_OTHER_THREAD. In order to define in which VAC machine the error occurred, find the error code different from ABORTED_BY_OTHER_THREAD.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT The treatment of Run to Cursor is very easy: the IDE sets at the relevant line fake break point with the number of repetitions as one. When a break point is reached, it has to be removed from the break point list. There is no need to define special debug command. 6.5.7.2 Step Over The DB##SO command executes the treatment of Step Over. It runs up to the nearest end of line. Syntax: DB##SO[N] where N is a handle of a specified VAC machine.
Elmo HARmonica Software Manual HARSFEN0602 • • 6.5.8 PRELIMINARY DRAFT If the current base pointer is less than the saved base pointer, the step is out - jump to the end the loop, otherwise go to the start of the loop. End of the loop When the nearest end of line is reached and the current base pointer is less than the saved base pointer, then the VAC machine enters to the halted state. Otherwise it just runs and does not enter halted state.
Elmo HARmonica Software Manual HARSFEN0602 BP-4 PRELIMINARY DRAFT Return address Program counter of the next program line after the function call BP-3 Index of the current function in the Function See 3.5.5 Symbol Table BP-2 Number of input arguments BP-1 Number of actual output arguments Number of left hand side values during function call Let’s try to understand how this information can help us to restore call stack. When the first function is called, its BP is zero.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT 1. Don’t analyze current state of the stack and just access to the relevant stack entries and get garbage. Try to analyze current program counter to find out whether the LINK was executed. If access to local variable occurred before LINK, then return error (something like VARIABLE_NOT_INITIALIZED).
Elmo HARmonica Software Manual HARSFEN0602 7 7.1.1 PRELIMINARY DRAFT The Virtual Machines Introduction Alla please complete where necessary The Harmonica can run a user program, as explained in the Chapter "The Harmonica User Programming Language". Although the user program runs syntactically the same statements as the interpreter, the processing mechanism is totally different. The interpreter analyses text on line. The user program does not – it runs a compiled code.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 [x,y] = f (a,b,c,d) ; Assume that BP before function call is 12 and SP is 15 (just number not better and not worse than every other). Before the opcode USRSUBJ is executed the stack contains: 2. n entries for actual output arguments (according to the function call, not prototype) 3.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 The virtual machine supports the following data types: - INTEGER: 32 BIT SIGNED INTEGER - Float: 32 bit IEEE floating point number (24 bit mantissa, 8 bit sign) Logical operators yield Boolean results – True or False. True is equivalent to the integer 1. False is equivalent to the integer 0. 7.
Elmo HARmonica Software Manual HARSFEN0602 REM RSLTAND RSLTOR XOR NOT SHR SHL AND F_OR UNARY_NOT RSLTE RSLTA RSLTAE RSLTB RSLTBE RSLTNE MOV CMP JMP JMP_EOL JMP_LABEL JNZ JNZ_EOL JZ JZ_EOL SPADD GETINDX SETINDX SET_COMM PRELIMINARY DRAFT Reminder from division of the number below top of stack by the top of stack.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 function table is given as an argument Call to function service of a ‘get’ command whose index in the function table is given as an argument Call to system function whose index in function table is given as an argument Call to user subroutine whose index in the symbol function table is given as an argument (push relevant function data to stack) Return from user subroutine – restore stack to its state before function call, save output arguments
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Attributes Attribute Op code Value Number of arguments Argument types None N.A. Addressing modes Promotion Output type Imposes end of line Absent N.A. Int & Int No 7.7.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 flags Addressing modes Promotion Output type Imposes end of line 7.7.5 Absent Int / Float Executes as (float) Int / Float Int / Int Int Int / Float Float Float / Float Float No → → → EOL – End Of Line Purpose: Indicate this is end of line to the Harmonica environment. Algorithm: Zeroes line execution flag. Attributes: Attribute Value Op code Number of arguments Argument types Addressing modes Promotion Output type Imposes end of line 7.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Addressing mode2 Mem_Direct , BP_Relative Promotion Output type Imposes end of line N.A. N.A. Only if jump address is out of the present executing line. 7.7.7 loop Iterator variable address, depend on the addressing mode. FREE_VAC - Free Virtual Machine Purpose: Stop program execution. Algorithm: Zeroes program execution flag.
Elmo HARmonica Software Manual HARSFEN0602 → PRELIMINARY DRAFT → DataSeg + Op1 Arr (array address) Ind (array index) (SP) Arr[Ind] (SP) (return value) → Attributes Attribute Op code Value Number of arguments Argument type Addressing modes 1 Signed short integer Mem_Direct Promotion Output type N.A. Argument Type1 Imposes end of line No 7.7.10 Comment May change in future versions Location of variable (index) in the variable symbol table. Address of array variable is taken from the table.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT → Immediate value PC Attributes Attribute Op code Value Number of arguments Argument type Addressing modes Promotion Output type Imposes end of line 7.7.12 1 Signed short integer Immediate2 N.A. N.A. Only if jump address is out of the present executing line. Comment May change in future versions Jump Address JMP_EOL – Jump Purpose: Jump to another location in the program and force end of line .
Elmo HARmonica Software Manual HARSFEN0602 Promotion Output type Imposes end of line 7.7.14 PRELIMINARY DRAFT N.A. N.A. Only if jump address is out of the present executing line. JNZ – Jump Not Zero Purpose: Jump to if value is not zero (change PC to different location in program). Algorithm: PC → IMMEDIATE VALUE Attributes Attribute Op code Value Number of arguments Argument type1 Argument type2 Addressing mode1 Addressing mode2 Promotion Output type Imposes end of line 7.7.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 the present executing line. 7.7.16 JZ – Jump If Zero Purpose: Jump to if value is zero (change PC to different location in program). Algorithm: PC → IMMEDIATE VALUE Attributes Attribute Op code Value Number of arguments Argument type1 Argument type2 Addressing mode1 Addressing mode2 Promotion Output type Imposes end of line 7.7.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Purpose: Increase stack pointer with the value given as an argument and zeroes the new entries to stack. Algorithm: SP → SP + OP1 Attributes Attribute Op code Value Number of arguments Argument type Addressing modes 1 Unsigned char integer Immediate1 Promotion Output type Imposes end of line N.A. N.A. No 7.7.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Attributes Attribute Op code Value Number of arguments Argument type1 2 Int or Float Argument type2 Addressing mode1 Int or Float Absent, Immediate, Mem_Direct , Stack_Immediate, BP_Relative Absent, Mem_Direct , Stack_Immediate , BP_Relative N.A. N.A. No Addressing mode2 Promotion Output type Imposes end of line 7.7.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 stack members flags) Addressing modes Promotion Output type Imposes end of line 7.7.23 Absent N.A. Int % Int No → Int RSLTA – Relational Operator (>) Purpose: Compare two numbers, if the first number is bigger condition is true otherwise it’s false (numbers are at top two entries of the stack) . Algorithm: ((SP-1) > (SP)) (SP) SP SP - 1 → → Attributes Attribute Op code Value Number of arguments Argument types None N.A.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 7.7.25 RSLTAND – Logical AND Operator (&&) Purpose: If both numbers are non-zero condition is true. Otherwise it is false (numbers are at top two entries of the stack). Algorithm: (SP-1) && (SP) (SP-1) SP SP – 1 Attributes Attribute Value Comment Op code May change in future versions Number of arguments None Argument types N.A. Both arguments types must be integer (set according to stack members flags) Addressing modes Absent Promotion N.A.
Elmo HARmonica Software Manual HARSFEN0602 Attribute Op code Value Number of arguments Argument types None N.A. Addressing modes Promotion Output type Absent N.A. Int Imposes end of line No 7.7.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Addressing modes Promotion Output type Absent N.A. Int Imposes end of line No 7.7.30 Compare result is always integer RSLTOR – Logical OR Operator ( || ) Purpose: If one of the numbers or both are non-zero condition is true otherwise it’s false (numbers are at top two entries of the stack). Algorithm: (SP-1) || (SP) (SP-1) SP SP – 1 → → Attributes Attribute Op code Value Number of arguments Argument types None N.A.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Imposes end of line 7.7.32 No SETINDEX Purpose: Set value to array variable defined in data segment. Algorithm: DataSeg + Op1 Arr (array address) Ind (array index) (SP) (SP –1) Val (assign value) Arr[Ind] = val ; (enter value to array) → → → Attributes Attribute Op code Value Number of arguments Argument type Addressing modes 1 Signed short integer Mem_Direct Promotion Output type N.A. N.A. Imposes end of line No 7.7.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Shift left the number below top of stack by the number at the top of stack. Algorithm: (SP-1) << (SP) (SP-1) SP SP – 1 → → Attributes Attribute Op code Value Number of arguments Argument types None N.A. Addressing modes Promotion Output type Imposes end of line Absent N.A. Int << Int No 7.7.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Addressing modes Promotion Output type Imposes end of line 7.7.37 Absent Int - Float Executes as (float) Int - Float Int - int int Int - Float Float Float - Float Float No → → → SYSSUBJ – Jump To System Subroutine Purpose: Call to system function.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 7.7.39 USRSUBJ – jump To User Subroutine Purpose: Call to user subroutine (push relevant function data to stack). SEE 8.2 → → → → → → → Algorithm: (save base pointer) BP (SP) SP SP + 1 OP2 (SP) (save return address) SP SP + 1 (SP) (save function index) FuncIndex SP SP + 1 (save number of input arguments) NArgIn (SP) 7.7.39.1.1.1.1.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Attributes Attribute Op code Value Number of arguments Argument types Addressing modes Promotion Output type Imposes end of line None N.A. N.A. N.A. N.A. Yes 7.7.41 Comment May change in future versions Jump address is out of the present executing line. XOR – Bitwise XOR Operator Purpose: Bitwise XOR operator – top two entries at the stack.
Elmo HARmonica Software Manual HARSFEN0602 8 PRELIMINARY DRAFT 94 The Recorder The recorder mechanism enables the user to record various signals that exist in the Harmonica, up to 8 signals simultaneously. The recorded signals can be uploaded to the host by communication, for the purpose of presentation and analysis. The following section details how to define the recorder parameters to the Harmonica, how to launch and trigger the recorder, and how to fetch the recorded data.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT 95 8.2 Signal mapping The recorder can record many different signals. The first 16 signals that may be recorded are compatible with older amplifiers. They are listed is in the table below.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Integer 21 Filtered torque command Short 45 64 Motor DC supply voltage External position reference Short Long Integer revolution, with origin at the electrical angle of zero. The command to the Q current controller, at the output of the command filter. Sample Motor DC supply voltage. The part of the position reference generated by external inputs.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 RG=1 means that a new sample shall be taken once per time quantum. If TS=60, and RP[0]=0, the recorder will sample once per 240usec. RG=2 means that a new sample shall be taken once per two time quanta. If TS=60, and RP[0]=1, the recorder will sample once per 120usec. Similarly, RG=N means that a new sample shall be taken once per N time quanta. Note that RG specifies only the recorder sampling-rate, not the trigger sampling-rate.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT Figure 1 - Slope and window trigger types - Triggered by a digital signal: The Harmonica will support this only in the future, TBD. Trigger delay The trigger defines when the recorder is to start. The recorder can be told to start before the trigger event, so that the trigger event can be caught in “the middle of the picture”.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 5000 S peed C ommand 4500 4000 Triggered on B G with 0% pre-trigger delay 3500 3000 2500 Triggered on B G with 20% pre-trigger delay 2000 1500 1000 500 Time 0 0 2 4 6 8 10 Figure 2 – Pre trigger delay The trigger parameters are listed in the table below. . RP[N] RP[0]: Recorder time quanta RP[1]: Trigger variable RP[2]: Pre trigger storage in percents.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 numbers. 8.6 Launching the recorder The recorder is launched (or killed) using the RR command. RR also reports the recorder status. The RR command has the following options: RR Value Meaning -1 Kill the recorder if active, and invalidate any recorded data. 0 1 2 3 Kill the recorder (Do nothing if the recorder is not active) Launch the recorder, triggered on the next BG. Launch the recorder with immediate trigger.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT The BH command is used to upload the values recorder by the recorder to a host. The BH command is designed to optimize the data transfer from the Harmonica to the host, assuming that the host has the computing power to analyze the Harmonica message. The basic condition for executing a BH command is that valid data is stored in the recorder for uploading. In that case the fields of the RC variable define the variables that had been recorded.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Byte Number Value 0-1: Variable type for user. This field does not have any practical significance. 2-3: Data width – number of hex character of a single transmitted data item. 4-7: Data length – The actual number of transmitted data items. 8-11: Variable time multiplier. This is the number in which TS must be multiplied to obtain the basic period of the recorder. 12-19: Floating number factor.
Elmo HARmonica Software Manual HARSFEN0602 9 PRELIMINARY DRAFT Commutation 9.1 General The harmonica drives fixed magnet motors. The principle of all the fixed magnet motors is the same: A winding creates a magnetic field. If the magnet is directed along the field lines of the winding, the magnet is in its steady state, and the winding exerts no power on the magnet. If the magnet is not along the winding field lines, the magnet will try to align with the field lines.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 In the stepper commutation policy, the windings field is set to point at the desired rotor position. The commutating device doesn't have to know where the rotor is – it just assumes that the rotor will come to rest at the field position. The stepper commutation has the advantages of simplicity and reliability. The main drawback is that normally θ << 90 o , thus to generate a given torque large currents are required.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 WS[20] WS[21] 9.3 Stator field angle, in 1024 counts/rev units. Stator field angle (deg) = WS[20] × (360/1024) Commutation counter. WS[21] counts the main high-resolution position sensor, modulo CA[18]. Commutation sensors For BLDC commutation, rotor position sensors are required. The commutation sensors divide into two main groups. - Direct field sensors that sense the magnetic field of the motor. - Shaft position sensors. 9.3.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 270 deg 330 deg 30 deg 90 deg 150 deg 210 deg 270 deg Hall A Hall B HallC Figure 6: Digital Hall sensors readout The crude division to six draws rough torque from the motor, and requires hard switching of the motor winding currents. The digital Hall sensors are used, in many applications, together with higher resolution position sensors.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT At that very instance the Hall sensors read the electrical angle accurately. After the first Hall sensor switch, the commutation is kept accurate by updating the commutation counter incrementally using the shaft position sensor. 9.3.3.2 Detecting commutation errors (loss of feedback) After commutation by the encoder starts, there exist two sources for the electrical angle measurement.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT hardly noticeable in low speed, significantly looses motor torque at high speed. If Hall sensors are not present, and if the commutation is performed using an incremental encoder, then upon motor start the Harmonica must first find the electrical direction of the motor. If digital Hall sensors are not present (CA[20]=0), then at motor on, a commutation search is made. The commutation search is described in the section "Commutation search".
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT full electrical cycles possible for that motor. Enter the "encoder counts in revolution" CA[18] parameter as the number of encoder counts for CA[19] electrical cycles. The encoder parameters are listed in the following table. CA[18] Encoder bits per revolution, after resolution multiplication by 4, in the range [24..10,000,000]. For an incremental encoder with 1000 lines, CA[18] will be 4000 CA[19] Number of motor pole pairs [1..50].
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT microseconds, which is about 160Hz. The frequency is 2 CA[15 ] ⋅ basic frequency for CA[15] in the range [-4..4]. For example, with CA[15]=2 the frequency is about 40 Hz, whereas with CA[15]=-2 the frequency is about 640Hz The selection rules for the parameters I and f are few and simple. • The torque I must be as large as possible, so as to reduce the relative effect of disturbance torques (like cogging and friction) on the resulting waveform.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT The method described here can work in reliably many practical situations, although it does not fit every application. If the parameters of the method are not tuned properly, or the method is not good for the application, the motor starting process will fail. After setting MO=1, the algorithm will try to oscillate the motor and find the commutation angle.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 100 80 60 40 Los t torque, % 20 0 -100 -50 0 50 Com m utation m is s angle, degrees 100 Figure 7: Loss of torque due to commutation miss Two principal methods are used to keep ε θ near zero. The first is called "Six-Steps" commutation, and the other is the continuous commutation. 9.5.1 Six-step commutation With Six-Steps commutation, only two motor terminals are energized at each time instance. The third motor phase is open-circuited.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 With continuous commutation all the three motor coils are powered simultaneously to yield a magnetic field exactly at the direction of the rotor. This brings ε θ near zero continuously, with minimal torque losses and ripple torques. The continuous commutation mode is native for the Harmonica and is used most of the time. The continuous commutation is much more complex to implement then six-steps commutation.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 0.8 0.6 0.4 h(theta) 0.2 0 -0.2 -0.4 -0.6 -0.8 0 50 100 150 200 250 Theta (degrees) 300 350 400 Figure 9: Winding shape function for sinusoidal motor In order to optimize the Harmonica to as many motors as possible, the Harmonica can be programmed to any winding shape function. The Harmonica comes from the factory programmed by default for sinusoidal motors, but using a tool in the Composer program the motor waveform may be changed.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 10 The current controller This section describes the current controller and its parameterization. In addition, it describes the current limiting process and the amplifier protections.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT IQ = I a h (θ) + I b h (θ + 120 o ) + I c h (θ + 240 o ) and ID = I a h (θ + 90 o ) + I b h (θ + 210 o ) + I c h (θ + 330 o ) Above, θ is the commutation angle and h (θ) is the input winding function.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 adapt to the specific amplifier model you bought. Units". Program PL[1] smaller then MC if you don't want to utilize the full power of the amplifier – because the amplifier is oversized with respect to the application, or because the line voltage is not enough to drive MC amperes into the motor. Do not specify PL[1] > VB RM , where VB is the DC motor supply voltage and where R M is the motor resistance.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 τ = − PL[2] CL[1] log 1 − MC With this selection, when PL[2] is set to MC, and after the current demand has been zero for a long time, the amplifier will permit a maximum of PL[2] seconds of peak current, and then switch to continuous current limiting.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 XP[6] − 10 6 Torque command filter bandwidth = Hz where TS is the sampling time log 2π ⋅ TS 32768 in usec. The output of the filter cannot change in steps greater than XP[5]. The units of XP[5] are internal torque command units, not Amperes. The ratio between the internal torque commands and Amperes is given by WS[22]. The role of XP[6] for small torque commands is plotted in the figure below. Torque Cm d V s .
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Torque Cm d Vs . Torque Controller Input 5000 4500 XP [5]= 5000 4000 3500 XP [5]= 1000 Amp 3000 2500 XP[5]= 400 2000 1500 1000 500 0 0 2 4 6 8 10 12 Current Controller S am pling Tim es 14 16 Figure 13: Rate limiting for the torque input filter We recommend not to change the factory setting of XP[5] and XP[6] in standard applications. 10.2.2 The PI current controller The controllers for the IQ and the ID components are similar.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Feedback IQ ID Output VQ VD The saturation is given by 0.5TS/ 25 ⋅10 −3 , where TS is the current controller sampling time in usec and 25 ⋅10 −3 is the period of the 40mHz PWM generator clock in usec. The division of the proportional and the integral gains by the DC voltage is since the output of the current controller is PWM duty cycle.
Elmo HARmonica Software Manual HARSFEN0602 Under Voltage 0x3000 Short circuit 0xb000 OverTemperature Over current 0xd000 0x8 PRELIMINARY DRAFT model – please refer product user manual. The power supply is shut down, or it has too high output impedance. The under voltage threshold differs with the power stage model – please refer product user manual. A large, fast current pulse has been detected. The motor or its wiring may be defective, or a faulty amplifier.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 11 Unit Modes The feedback structure of the amplifier can be arranged in several options. Those options are called "unit modes" and programmed by the parameter UM. Switching the unit mode is possible only with the motor off, since the feedback structure need be re-arranged. The following unit modes are available: Value Description (Related commands) 1 Torque control mode. 2 Speed control mode. 3 Micro Stepper mode.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 11.2 Speed mode: Unit mode 2 In this mode the amplifier controls the motor speed by feedback. The speed controller demands torque from the current controller. The reference to the speed controller is summed from a software commands, and an auxiliary speed command. The auxiliary speed command is derived using the analog input, the auxiliary encoder input, and the ECAM table – details are given below.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Command SF Description Smooth Factor: The time in milliseconds required to develop the full acceleration of AC and deceleration of DC. Stop command, activate profiler stop mode with Deceleration=SD Maximum speed command. Units counts/sec. Minimum speed command (bound on speed command from below, negative value). Units counts/sec. Map functions to digital inputs: Digital inputs may function as hardware ST or BG instructions.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Example: This example demonstrates the smoothing filter and the smoothing factor SF. Let us MO=1; JV=4000; AC=100000; DC=100000; SD=106; PM=1; RM=0; BG; with three different values of SF. 1. The SF=0 graph displays sharp corners, since smoothing is ignored, therefore non-continuity of acceleration is allowed. 2.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Analog input 1 (-10 to 10 Volts) Σ ` - Auxiliary speed com m and AG[2] Count/sec/ Volt Σ AS[1] Auxiliary input Speed estim ator FR[2] Figure 19: Auxiliary speed command generation The analog input is most useful when the Harmonica serves as an inner controller, embedded in an external control loop. The auxiliary encoder speed input enables to issue speed commands relative to a conveyor or other moving object. 11.2.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 limiting the rate of reference change to SD counts/sec2. When the Stop Manager stops the motor due to a switch action, the reference generator is replaced by a zero command at the input to the Stop Manager. The Stop Manager uses the SD parameter to decelerate the motor command from the output of the reference generator to a complete stop.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 The stepper unit mode enables the rotation of a motor without feedback control. The motor field is rotated to the desired direction, and the rotor magnet is believed to follow. The user must not rotate the field too abruptly in order that the rotor will be able to track its desired direction. If the rotor misses a full electrical revolution, it will be attracted to a wrong electrical equilibrium, with no feedback to correct that.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 The commutation accuracy will be limited by backlash and gear compliance The motor speed can be measured with better resolution and less delay because the motor rotates much faster than the load. In addition, the speed sensor is not subject to dead zones caused by backlash.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 131 The details of the speed and the position controllers are given in the chapter "Error! Reference source not found.". 11.5 The single feedback mode: UM=5 The single feedback mode is used when the same sensor is used for speed, commutation and for position. This is a common situation where only one position sensor is installed in the system.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT 12 The position reference generator The position reference signal is generated by the following components: • Software command generator • Auxiliary command generator • Stop manager. This section describes the components of the position reference generator in detail. 12.1 The software reference generator The Harmonica supports five modes of software references. The reference modes are: • Idle – The motor just stands at place.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 is on. Care must be taken if the smooth factor (SF) is nonzero. Upon switching from interpolated motion to PTP or jogging, the PTP or the Jogging will start un-smoothed. Smoothing will gradually build up. After SF milliseconds, the motion shall be fully smoothed. Care is required, however, when switching to the tabulated (PT and PVT) motion modes.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 MS Value 0 1 2 Description The position reference generator is idle. Moreover, the Motor position stabilized within the target radius for long enough time. The position reference generator is idle, or the motor is off (MO=0). The position reference generator is active in one of the optional motion profilers – PTP, Jog, PT, or PVT.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT The largest PTP motion available is XM/2 (or 2 30 if XM=0). This is since with modulo calculations, the PTP motion will always go the short way. For example, if XM=1000, the present position reference is 490, and the command PA=-490;BG is entered, then the position reference will increase and go through 499 to –500 and then to –490. The total length of the movement shall be 20 counts.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 2000 C onstant speed (S P ) S peed 1000 A cceleration (AC ) D eceleration (D C ) 0 0 0.01 0.02 0.03 0.04 0.05 0.06 0.02 0.03 0.04 0.05 0.06 100 Position 50 0 0 0.01 With shorter movement, the deceleration begins before the limit speed is reached, so that the SP speed limit is not effective. This situation is depicted in the figure below: 1000 S peed DC 500 AC 0 Time (sec) -500 0 0.01 0.02 0.03 0.04 0.05 0.06 0.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 S tar t S pe ed > S P ? Y es A p p ly D C W ill s t e a d y d e c e le r a t io n a t D C s to p m o tio n b e f o r e ta rg e t ? No A p p ly D C S pe ed = S P ? Y es M a in t a in S P A p p ly A C Figure 24 – PTP Decisions Flow Chart All the parameters of the above flow chart, including AC,DC, SP, and the position target are updated by a BG command, or by its hardware activated equivalent.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 5000 DC AC 0 AC DC -5000 C ounts/sec Time (S ec) -10000 0 0.05 0.1 0.15 0.2 0.25 0.3 0.35 200 Position reference 0 Target position -200 C ounts Time(sec) -400 0 12.1.5 0.05 0.1 0.15 0.2 0.25 0.3 0.35 Jogging In a jogging motion, the motor is commanded to move in a fixed speed. The acceleration (or deceleration) to the desired speed are the AC and the DC parameters.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Jog motions can continue forever. The position reference jumps when it arrives the modulo boundary (+/-230 for XM=0 or +/- XM/2) but the speed is kept constant The parameters of Jog motion are summarized in the table below. Parameter AC Action Acceleration in counts/ sec 2 DC Deceleration in counts/ sec 2 Smooth factor, in milliseconds Jog velocity SF JV The JV command has double role.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 4000 C ounts/sec 2000 0 Time (sec) -2000 0 0.1 0.2 0.3 0.4 100 0 P osition reference P osition Target -100 C ounts -200 Time (sec) 0 0.05 0.1 0.15 0.2 0.25 12.1.6 PVT: Position-Velocity-Time interpolated motion 12.1.6.1 What is PVT? PVT stands for Position Velocity Time. In a PVT motion, the user provides the desired position and speed at certain time instances.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT The user provides, for each motion interval, the boundary positions and speeds. Mathematically, the user provides the following data: • The starting position and speed, denoted by P0 and V0, respectively • The end position and speed, denoted by PT and VT, respectively. Let t 0 denote the starting time, and let T denote the length of the time interval.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 x 10 4 4 3 2 Nominal ellipse 1 Motion starts and teminates here 0 -1 Ellipse P VT points -2 -3 -4 -4 -2 0 2 4 x 10 4 The next figure takes a closer look at the error between the true ellipse and the Amplifier interpolated path.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 The next figure displays the interpolated trajectories generated by the Amplifiers for the x-axis and for the yaxis. x 10 6 4 X axis trajectory 4 2 0 -2 C ounts Y axis trajectory -4 msec -6 0 500 1000 1500 2000 2500 Example The Amplifier normally produces maximally smooth interpolating trajectories. For this reason, the ellipse of the previous example could be interpolated using so few points.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Starting speed End position End speed Time 100000cnt/sec 1200cnt 190000cnt/sec 6msec The interpolated path for the data of the table is depicted in the figure below, for a controller with a sampling time of 160 µsec. The + symbols show the points at integer multiples of the controller sampling time. At these points, the Amplifier evaluates the interpolated motion path.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 The speeds in the table are limited to +/- 2 23 counts/second. The times in the table are in the range [1,255] msec. If the position feedback sensor counts modulo, the PVT data must be so that the range of the interpolated data is [-XM...XM-1] (Set YM instead of XM here and in the next sentences if UM=4). Interpolated results in the ranges [-XM...-XM/2-1] or [XM/2...XM-1] will be folded modulo XM to the sensor range of [XM/2...XM/2-1].
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Initial conditions: PVT read pointer equals N Motion segment completed ? Yes N >= MP[2]-1 Yes MP[3]==1 No Yes No Set the read pointer to MP[1] Increment read pointer Read the N+1 row of the PVT table and calculate the parameters of the next motion segment Interpolate position command Go to position controller Figure 26 – PVT Decisions Flow Chart Exit PVT mode: Set Stop motion, using the SD deceleration 146
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT A PVT motion is initiated by stating PV=N with 1 ≤ N ≤ 64 , and BG. The command PV=N sets the read pointer of the table to N and specifies that the next BG will start a PVT motion. BG starts the motion. The PVT table may be written on-line while PVT motion is on. An infinite-time non-periodic motion can be generated in the cyclical mode (MP[3]=1), by programming the PVT table on the fly.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 12.1.6.5.1 The PVT Motion Programming Message An entire row of the PVT table may be programmed by a single PDO. The PDO used is 0x300+ID where ID is the node ID of the Amplifier. Note that before using PDO 0x300+ID it must be mapped to the object 0x2001. The mapping of this PDO for the PVT mode is listed in the table below.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Initial conditions: PVT read pointer equals N Motion segment completed ? Yes Read pointer == Write pointer Exit PVT mode: Set Stop motion, using the SD deceleration Yes No N >= MP[2]-1 Yes EMERGENCY: QUEUE UNDERFLOW No Set the read pointer to MP[1] Increment read pointer Read the read pointer row of the PVT table and calculate the parameters of the next motion segment MP[4]>0 and (Write pointer == N+1 or left time < MP[4]) Yes EME
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 12.1.6.5.2 Programming Sequence for The Auto Increment PVT Mode PVT motion must start with initial programming of the PVT arrays. Set MP[1] = First valid line in the PVT table MP[2] = Last valid array in the PVT table MP[3] = 1 for cyclical mode. MP[4] = Not relevant for PVT (PT only) MP[5] = Number of left programmed motion rows to issue a “PVT queue low” Emergency object. Set to zero if no “PVT queue low” warning is desired.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Stop Deceleration (SD) Position/Velocity/Time (PV) PVT table entries: QP[N], QV[N], QT[N] Motion Parameters (MP) The rate of deceleration in the case where motion is killed by queue underflow or by an exception. The rate off acceleration to catch up if PVT is started with bad initial conditions.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT The following CAN emergencies are supported, all as manufacturer specific: Error code (Hex) 0x56 Error code (Dec) 86 0x5b 91 0x5c 0x34 92 52 0x7 7 0x8 8 0x9 9 Reason Data field The queue is low: The number of yet unexecuted PVT table rows dropped below the value stated in MP[4] The write pointer is out of the physical [1,64] range of the PVT table. The reason may be a bad setting of MP[6].
Elmo HARmonica Software Manual HARSFEN0602 12.1.7 12.1.7.1 PRELIMINARY DRAFT PT Motion What Is PT PT stands for Position-Time. In a PT motion, the user specifies a sequence of absolute positions to be visited by the Amplifier with equal time spaces. The time space must be an integer multiple of the Amplifier sampling time. Between the user specified positions, the Amplifier interpolates smooth motion. The position specifications are absolute.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 1000 Interpolated path PvtPlan output 800 600 400 200 0 Motion path in counts -200 -400 -600 -800 -1000 12.1.7.3 Time (seconds) 0 0.02 0.04 0.06 0.08 0.1 PT Motion Programming – The Basic Mode 12.1.7.3.1 The PT Table The vector QP[N] defines the position points for PT motion. Each element of the vector defines the position at a given time.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 MP[3] MP[4] 0: Motion is to stop if the read pointer reaches MP[2] 1: Motion is to continue when the read pointer reaches MP[2]. The next row of the table is MP[1]. The number of controller sampling times in each PT motion segment. Cyclical behavior definition. Table 12-10 – PT Motion Parameters The flow chart of the basic PT mode is depicted below.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 BG starts the motion. The QP vector may be written on-line while a PT motion is on, as long as you don't program presently executing PT elements. 12.1.7.5 Mode Termination The PT motion terminates upon one of the following cases: • The motor is shut down, either by programming MO=0 or by an exception. • Another mode of motion is set active, e.g. by programming PA=xxx;BG.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Initial conditions: PT read pointer equals N Motion segment completed ? Yes Read pointer == Write pointer Exit PT mode: Set Stop motion, using the SD deceleration Yes No N >= MP[2]-1 Yes EMERGENCY: QUEUE UNDERFLOW No Set the read pointer to MP[1] Increment read pointer Read the read pointer to the QP vector and calculate the parameters of the next motion segment MP[4]>0 and (Write pointer == N+1 or left time < MP[4]) Yes EMERGENCY
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 PT motion must start with initial programming of the PT arrays. First set MP[1] = First valid line in the PT table MP[2] = Last valid array in the PT table MP[3] = 1 for cyclical mode. MP[4] = the ration between the length of the PT time interval and the sampling time of the position controller MP[5] = Number of yet unused QP[N] elements when a “PT queue low” emergency object is sent. Set to zero if no “PT queue low” warning is desired.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 MP[4] = Ratio between the command sampling time and the position controller sampling time MP[5] = Time for queue low alarm MP[6] = Initial value for write pointer Sampling time, in microseconds, of the position controller. WS[29] A read only parameter. WS[29] is an integer multiple of the basic sampling time as set by TS.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 • • PTP or PVT. The position of the conveyer is not known in advance, and it must be measured on line, for example by using the auxiliary encoder input. The reading of the auxiliary input is scaled by the follower ratio (FR[3]) parameter, and added to the software command. Driving the amplifier as a slave in a larger arrangement.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Example: This example illustrates working on a moving object. Consider the application depicted below: Moving conveyer Y axis Circle to draw 10000 Cake X axis In this application, an x-y stage draws a chocolate picture on a cake while the cake travels on a conveyer. The drawing has to be accurate with respect to the cake.
Elmo HARmonica Software Manual HARSFEN0602 12.2.1 PRELIMINARY DRAFT ECAM ECAM is an acronym for “Electronic Cam”. It means that the position reference to the Amplifier is not directly proportional to the summed external inputs, but is a function of them. The ECAM related commands are as follows: EM[1] EM[2] EM[3] EM[4] EM[5] Asserts whether the ECAM function is active. 1 for active ECAM. 0 for direct external referencing.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 ECAM table output ET[3] ET[4] ET[2] EM[4] EM[4] ET[1] EM[4] EM[3]+3 EM[4] EM[3] ECAM table input Example: Suppose that we want the following functional relationship between the voltage of the analog input and the motor position: 2000 1900 P o s i ti o n c o u n ts 1800 1700 1600 1500 1400 1300 1200 1100 A n a lo g v o lta g e ( V o lts ) 1000 1 1 .5 2 2 .5 3 3 .
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 EM[5]=1 ET[1]=1000 ET[2]=2000 ET[3]=1000 ET[4]=2000 EM[1]=1 is equivalent to 1000 counts First index of the table ECAM table values Activate ECAM. - For every input voltage less than 1v, the external position command will be 1000. - For input voltage of 1.5v the external position command will be 1500. - For input voltage of 2.75v the external position command will be 1250.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 The initial programming of the Amplifier includes: EM[1]=1 EM[2]=200 EM[3]=0 EM[4]=100 ET[1]=…;ET[2]=…;ET[100]= …; UM=5 RM=1 AG[3]=0;FR[3]=0; MO=1 PA=1000;BG HY[2]=0;HY[3]=5;HY[1]=1 Enable ECAM Length of the ECAM vector Starting position Conveyer encoder counts between two consecutive ECAM table entries Program the numeric data of the ECAM table Set single sensor position mode Enable external referencing Kill the external input Start motor Go
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Drawing x-y manipulator station Camera station CAN Camera Next cake Cake Assume that the amplifiers at the x-y manipulator station runs the ECAM table entries ET[1]...ET[100]. In the meantime, the system controller programs the next shape to run into ET[101] ...ET[200]. The preferred way to do that is by using the fast CAN ECAM points protocol. When the x-y manipulator will work on the ECAM table entries ET[101]...
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT The elements to be programmed are specified by a “write pointer”. The value of the write pointer may be set by the parameter MP[6]. 12.2.4 Initializing the external reference parameters. This section details what happens when the external reference generator is initialized. The external reference generator is initialized at MO=1, and each time a relevant parameter (FR[3], AG[3], EM[1]) is changed.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 The software command to the roller is set as point to point, to correct the roller position for the next arriving box. That way the printing is synchronized to the box.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 The commands relevant to the stop manager are: Command Description SD The maximum rate that the motor can accelerate/decelerate. IL[N] Input logic – define the functions associated to digital inputs. VH[N],VL[N] The maximum allowed controller command XM,YM Modulo count for the main and the auxiliary sensors 12.3.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT This block stops the desired position reference to its present position if a hard-stop switch is sensed. Right Limit Switch (Marked as 3 in the Figure) This block stops the desired position reference to its present position if an RLS switch is sensed, and if the output of the position reference generator is less than the controller's position command.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 x 10 4 8 6 4 Counts 2 0 -2 -4 -6 -8 0 0.5 1 1.5 S ec 2 2.5 3 Figure 33: Position output of the stop manager x 10 7 2 1.5 Counts /s ec 1 0.5 0 -0.5 -1 -1.5 -2 0 0.5 1 1.5 S ec 2 2.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT 13 Sensors, I/O, and Events The Harmonica has two encoder inputs for feedback, commutation, and auxiliary reference generation. In addition, it has an analog input, Hall sensor inputs, and digital I/O. The digital inputs and the encoder index signals can generate events that may register the motor position, or reload the position counters, or flag a digital output, or call a special user program.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 • RLS and FLS can be read by the user program and activate their corresponding automatic routines, but they do not affect the motion immediately. The position referencing limits VH[3] and VL[3] become ineffective. ! If the modulo value is selected low, and the sensor speed is high, more than one full revolution of the position counter may elapse within a single sampling time.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT (AOK) indication, or brakes output. The association of output pins to functions is described in detail in the Command Reference Manual, the OL[] command. 13.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Host logics only. 13.4.3 Automatic routines Many events can be tied to automatic handler routines in the user program. To learn more about automatic user program routines, refer the section "Automatic subroutines". The table below summarizes some of the properties off automatic routines. Topic Comment Capture probability: High.
Elmo HARmonica Software Manual HARSFEN0602 • • • • • PRELIMINARY DRAFT Absolute position control in the single-feedback position-control mode. Relative work in the single-feedback position-control mode. For example, an axis in a machine may be homed by a sensor of the edge of the product the machine works on. The position referencing of the axis becomes relative to the product.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT of PY, not PX. 13.5.4 On the fly position counter updates The updating of a position sensor during homing process has no effect in UM=1,2,3 since these modes do not use position feedback. The implications of position sensor (PY in UM=4, PX in UM=5) update by a homing process depend in the mode. • In PTP motions, the remaining motion to target becomes longer or shorter – refer example below.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Figure 35 – Switches location The following user program does the algorithm: function [int status] = homing1(int TimeOut) /* Homing routine. Input: TimeOut: Timeout for failure Output: status=1 if o.k.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT function [int status]=WaitArrive(int TimeOut) /* Wait until MS=0, or until too much time elapses */ int StartTime ; status = -1; StartTime = TM; while (MS) if ( tdif(handle) >= TimeOut) return ; end end status = 1 ; return function [int status]=WaitHome(int TimeOut) /* Wait until HM=0, or until too much time elapses */ int StartTime ; status = -1; StartTime = TM; while (HM) if ( tdif(handle) >= TimeOut) return ; end end status = 1 ; return ##Err
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT function [int status] = homing1(int TimeOut) /* Homing routine. Input: TimeOut: Timeout for failure Output: status=1 if o.k.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT 14 Limits, Protections, Faults, and Diagnosis This chapter discusses the limits and the protections implemented by the Harmonica. Limits are software restrictions that prevent the Harmonica from running into dangerous situations.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 VL[N] Command low limits for position and speed Table 14-1: Commands relevant to limits, protection, and diagnosis CAN users have an added protection level. The Harmonica issues Emergency objects in the case of errors or applied protections – refer the CAN manual. 14.1 Current limiting The Amplifier protects the motor from over current.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 6 A pplication current demand 5 m otor current com mand 4 3 F ilter state 2 LC current lim it Indication 1 0 0 14.2 1 2 3 4 5 6 7 8 9 Speed Protection The reference to the speed controller is limited to be in the range [VL[2]...VH[2]]. The limiting (applied on the sum of the software reference and the external reference) is made by the Stop-Manager.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 L L [2 ] A b o rt A re a O ve rsh o o t A re a H L [2 ] W ith in sp e e d fe e d b a c k lim its, o u t o f co m m a n d lim its.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 The position command and feedback limits are illustrated in the figure below. The amplifier normally operates in the area marked "Within command and feedback limits". It may, however, visit instantaneously the areas marked "Overshoot area" due to an overshoot, and this is Ok. If the position feedback reaches the "Abort area", that amplifier will issue an outof-position-range exception and automatically shutdown.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 attempts are made 10msec after the last motor shutdown, or 10msec after the last failure of MO=1. For safety reasons, we recommend to program the Inhibit function as "active low". That prevents incidental motor starts when the input pin is disconnected, or its driving source is powered-down. 14.5 Limit switches The Harmonica has 6 digital input pins. Each of the pins may be associated to a different function.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 1 MO Released BP[2] BP[1] Brake Tim e (m sec) Motion Com m ands N.A. Motor controlled to stop According tom otion program m ing Motor controlled to stop N.A. Figure 39: Normal Brake Activation Timing At the brake activation times (BP[2] msec to disengage, BP[1] msec to engage) the motor is controlled to complete stop. If MO=0 is set automatically by an exception, the brake is activated immediately, without any delay. 14.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT When the amplifier shuts down by exception, the motor will continue to run by its own inertia unless brakes are used (refer the section Connecting an external brake). We recommend the use of automatic brake activation upon motor shut down (refer the OL command) for all safety critical application. An amplifier exception shut down can be captured and reacted by placing an AUTO_ER routine in the user program.
Elmo HARmonica Software Manual HARSFEN0602 14.9 PRELIMINARY DRAFT Diagnosis 14.9.1 Monitoring motion faults You can monitor motion faults by: • Continuously polling the amplifier status • Observing an "AOK" digital outputs. • Trapping CAN Emergency objects. The CAN Emergency objects are covered in the CAN manual. 14.9.1.1 Polling the amplifier status The amplifier can be polled using the SR command. The SR command reports a bit-field that draws an entire picture of the amplifier activity.
Elmo HARmonica Software Manual HARSFEN0602 • PRELIMINARY DRAFT RM=1 with a modulo-counting position feedback. 14.9.3 Device failures, and the CPU dump Humans have programmed the Amplifier. The programmers, however hard they try, cannot completely avoid bugs in their code. Programming bugs may lead to CPU exceptions, like an attempt to divide in zero, or an attempt to access a variable that does not exist. Programming errors may also lead to CPU overloading.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT taken since almost every motion system applies high torques for short acceleration periods while the speed is slow. CL[2] defines the tested torque level as a percentage of the continuous current limit CL[1]. CL[3] states the absolute threshold main sensor speed under which the motor is considered not moving. Do not set CL[3] to a very small number. When a motor is stuck, a vibration may develop that will induce a speed-reading.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT In this situation, the direction of the stator field is constant, and if torque is commanded, the rotor seeks equilibrium, aligned to the magnetic field. If the motor is driven by an external speed or position controller, it will be commanded to full-torque, and dissipate the corresponding heat, without generating any motion. The commutation is drifting (i.e.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT 15 The Controller 15.1 General This Section details the speed and position control algorithms. For many applications, the details of this document are of no concern. People do not have to understand the internals of a motion controller in order to tune it with the Composer program.
Elmo HARmonica Software Manual HARSFEN0602 KI[N] KV[N] GS[N] MC WS[28] PRELIMINARY DRAFT N=3: Outer loop gain (UM=4 and UM=5) N=2: Inner speed loop Integral gain, I. Coefficients for the high-order filter. The parameter KV[0] asserts if these filters are used at all – if KV[0] is zero, then the advanced filter is not used. Gain scheduling parameters. More details see chapter “Error! Reference source not found.” Maximal motor phase current Sampling time of the controller in microseconds.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 FF[1] Autom atic Controller Selector d/dt Fixed if GS[2]=0 0 DV[2] Speed controller: KP,KI Σ Speed com m and High order filter Σ Torquecom m and (DV[1], Am p) Speed feedback Position sensor Speed Estim ator Encoder pulse tim er Figure 40 – A Block Diagram of the Speed Controller 15.2.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT The scheduled case is explained in the section on “Gain Scheduling”. The parameter GS[0] helps stabilizing the motion in very slow speeds. It cuts the proportional gain of the speed controller after enough controller sampling times elapsed without a change in the encoder readout. Consider for example a 200-count/sec, speed reference. A new encoder count is available once per 5 msec – which are about 25 sampling times of the speed controller.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 FF[2] d/dt Fixed if GS[2]=0 Autom atic Controller Selector 0 DV[3] Position com m and Σ - ePos Position Controller KP[3],GS[9] Speed com m and (DV[2], Am p) Σ Com m andPi Main Position sensor Position feedback UM=5 UM=4 Auxiliary Position Sensor Figure 41 – Block Diagram of The Dual Loop Controller 15.3.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 For UM=5 the position feedback is taken from the main encoder. All the parameters of the speed controller … 15.4 The High Order Filter 15.4.1 Block Types Several blocks chained in series make the high order filter. The block types are listed in the table below. Block type Block structure 12 Double lead-lag block 1-st order block, lead-lag or a pole 2-nd order, notch or complex pole 14 15 15.4.1.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 where p = β−α q , q = 1 − β , i.e. β = 1 − q , α = 1 − . 1− α 1− p Order 1 Parameter p 2 q 15.4.1.3 Description Comment Float, represented by 2 long values Float, represented by 2 long values Second order block (Block Type=15) The basic continuous time second order element is filter D Es 2 + As + B ⋅ B Es 2 + Cs + D Note that it can be used as a notch filter or as a low pass complex pole filter.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT For more details about gain scheduling, refer the section " The Gain-Scheduling Algorithm". 15.4.2 User Interface The parameters defined by an array of long integer values set by the KV command. If KV[0]=0, high order filter is not used and the vector is ignored. If KV[0] is not zero, the KV[2]..KV[n] defines the filter structure, where KV[1]=n, is the last index used. Anyway n <= 100. The filter consists of a number of blocks.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 KV [0] KV[1] KV[2] KV[3] KV[4] KV[5] KV[6] KV[7] KV[8] KV[9] KV[10] KV[11] KV[12] KV[13] KV[14] KV[15] KV[16] KV[17] KV[18] KV[19] 100 19 15 1734476372 -32 1480626866 -32 -1592218865 -31 2104573671 -32 14 1571662995 -32 1361652150 -31 0 0 0 -1 Last index used 1st block, 2-order Parameter 1 (k1), man Parameter 1 (k1), exp Parameter 2 (k2), man Parameter 2 (k2), exp Parameter 3 (k3), man Parameter 3 (k3), exp Parameter 4 (k4), man Parameter 4 (
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Table 15-3: Programming sets of controller parameters for gain schedulilng Only a subset of the controller parameters can be schedualed. The KG[] parameters can program sets of KP,KI gains, as well as one scheduled double-lead block at the high order filter. The other elements of the high order filter cannot be gain scheduled. The scheduling is automatic for GS[2]=64. GS[2]=0 selects the controller parameters of KP[2],KI[2],and KP[3].
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 commands are accepted slowly to guarantee stability.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 16 Appendix A: The Harmonica Flash Memory Organization This Appendix describes the internal partitioning of the internal serial Flash memory of the Harmonica. For normal use of the Harmonica, you don’t need to read this appendix, since the Composer IDE will deal with it for you. To learn how to upload and download flash data, refer the DL,LS, and LP commands in the Command Reference Manual. 16.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Start of Text1 Length of Text1 Start of Text2 Length of Text2 Start of Text3 Length of Text3 Start of Text4 Length of Text4 Start of Text5 Length of Text5 Start of Text6 Length of Text6 Start of Text7 Length of Text7 Start of Text8 Length of Text8 Start of Text9 Length of Text9 Start of Text10 Length of Text10 Start of Binary1 Length of Binary1 Start of Binary2 Length of Binary2 Start of Binary3 Length of Binary3 unsigned short unsigned short
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 16.2.5 Contents of Text4-Text7 This text specifies which op-codes a specific the Harmonica supports, and also the limitations: Size of available flash space (may vary with Harmonica grades), size of data segment in RAM, maximal number of variables, maximum number of functions, and Maximum stack depth. The text4 file specifies the supported mnemonics.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 0x20 0x40 0x80 0x100 0x200 0x400 0x800 0x1000 0x2000 0x4000 0x8000 FLAG_Assign FLAG_Operator FLAG_SysFunc FLAG_Mnemonic FLAG_String FLAG_Array FLAG_ResetIgnore FLAG_NotProgram FLAG_NotPdo Not used System parameter can be assigned a value Not used Virtual Assemby Code or operator System function System command - Mnemonic Indicate this is a string command Command is not executed automatically upon reset Indicate this is a string command Command
Elmo HARmonica Software Manual HARSFEN0602 Entry TextSpace CodeSpace NameLength StackDepth DataSpace MaxUserFuncs MaxUserVars UserPartMaxSize PRELIMINARY DRAFT Meaning Remarks The space (in characters) to store user program backup. This numbers specifies the entire space – including overhead, such as text-opcode matching data. The net text length is smaller that this number. The space (in characters) to store compiled opcode. The maximum length (in characters) of a symbolic function or variable name.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT If the priority is –1 if the Harmonica can’t service this function. 16.2.8 Contents of Text10 This file lists all the possible run-time errors of a specific Harmonica, including their codes. Text10 has the following format: 1 , motor must be off 2 , out of range In each line the number is the error code and the string follow it is the meaning of the error. For example if error code is 1 we know that motor is on and it must be shut down.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT The user code partition can be read by the LS command. The data in this partition is: • A TOC (Table of Contents) • A "Compilation done" flag • A virtual machine code segment • A text backup segment. The text backup includes virtual code counter references. • A function symbol table • A variable symbol table • An automatic function table Each partition starts at a page (264 bytes) boundary. 16.5.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT If the compilation flag is zero, program is ready. Other values indicate not ready program. The command CP sets the compilation flag to –1. The Compilation Flag is checked when: • DL command – If the flag is zero, DL will not execute (CP must be issued before DL). • XQ command – If the flag is nonzero, the command returns with PROGRAM_NOT_READY error • CC inquiry – Returns 1 if the flag is zero, otherwise 0.
Elmo HARmonica Software Manual HARSFEN0602 16.5.6 PRELIMINARY DRAFT The Variable Symbol Table The variable symbol table states what variables are accessible through the user program.
Elmo HARmonica Software Manual HARSFEN0602 PRELIMINARY DRAFT 17 Appendix B: Harmonica Internals This chapter summarises some of the Harmonica internals. The chapter to give some deeper insights. It is not required for the standard Harmonica user. 17.1 Software Structure The firmware is built from an initialisation block and from a run time block. The run-time block is built by (event) interrupt handlers and by an idle loop. Most of the motion control routines are performed by a periodic interrupt.
Elmo HARmonica Software Manual HARSFEN0602 - PRELIMINARY DRAFT Decide if to use the peak current limit or the continuous current limit. Match digital hall readout to encoder data, to detect loss of commutation Detect "Motor stuck" condition 17.1.3 The Idle Loop The term "Idle loop" describes the repetitive task performed filling the entire time when the processor is free from interrupt handling. Idle loop processing starts immediately after the initialization sequence is complete.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 Read any additional chars from RS232 buffer Message com pleted? Yes Route m essage to interpreterr Long Record in transm ission? Yes Present buffer done? Yes Last data loaded? Yes No Route transm ittter to interpreter output Reload buffer Auto routine waiting for execution? Yes Set program counter of thread 0 to auto routine User program running? Yes Break point? Motion Exception? Yes Shut m otor & set exception flag Node g
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 18 Appendix C: Converting Clarinet/Saxophone programs to the Harmonica language 18.1 The Converter The user program syntax for the Saxophone or Clarinet is different from the Harmonica’s syntax. The converter program provides an easy method to convert Saxophone/Clarinet style programs to the Harmonica syntax. The converter program requires that the source Sax/Cla program is a simple text file.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 2 3 4 5 6 7 8 9 10 11 12 13 14 15 18.
Elmo HARmonica Software Manual PRELIMINARY DRAFT HARSFEN0602 PX=0;UM=2;AC=60000000; IA[1]=2000;IA[2]=-2000 ; MO=1;**Motor On BG;**Begin ##LOOP1 JP##LOOP1,PXIA[2]; PX=0; UM=2; AC=60000000; IA[1]=2000; IA[2]=-2000 ; MO=1;**Motor On BG;**Begin ##LOOP1 if PXIA[2] reset LOOP2 end #@AUTOEXEC WT=200 ##LOOP JP##LOOP RT #@AUTOEXEC wait 200 ##LOOP goto##LOOP return #@AUTO_I1 **THE BLOCKING MODE MO=0;UM=2;RM=0;MO=1;JV=0;BG #@AUTO_I1 **THE B