ElmoMC SimplIQ User Manual

4 (1)
ElmoMC SimplIQ User Manual

SimplIQ

Software Manual

May 2011 – Version 1.4

www.elmomc.com

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 SimplIQ line of servo drives.

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.

Information in this document is subject to change without notice. Corporate and individual names and data used in examples herein are fictitious unless otherwise noted.

Doc. No. MAN-SIMSW

Copyright © 2011

Elmo Motion Control Ltd.

All rights reserved.

Revision History

Ver. 1.4

May 2011

MTCR 05-001-11: Minor correction on p. 6-19.

 

Ver. 1.3

Mar. 2010

MTCR 02-010-01: Minor correction on p. 9-1. Various additional corrections.

Ver. 1.2

Apr. 2009

MTCR 47: Minor correction in section 15.3

(MAN-SIMSM.PDF)

Ver. 1.1

Sep. 2004

Updated for SimplIQ

Ver. 1.0

July 2003

Preliminary Release for Harmonica

(HAR_SF_0903.pdf)

Elmo Worldwide

Head Office

Elmo Motion Control Ltd.

64 Gisin St., P.O. Box 463, Petach Tikva 49103

Israel

Tel: +972 (3) 929-2300 • Fax: +972 (3) 929-2322 • info-il@elmomc.com

North America

Elmo Motion Control Inc.

42 Technology Way, Nashua, NH 03060

USA

Tel: +1 (603) 821-9979 • Fax: +1 (603) 821-9943 • info-us@elmomc.com

Europe

Elmo Motion Control GmbH

Steinkirchring 1, D-78056, Villingen-Schwenningen

Germany

Tel: +49 (0) 7720-85 77 60 • Fax: +49 (0) 7720-85 77 70 • info-de@elmomc.com

China

Elmo Motion Control Technology (Shanghai) Co. Ltd.

Room 1414, Huawen Plaza, No. 999 Zhongshan West Road, Shanghai (200051) China

Tel: +86-21-32516651 • Fax: +86-21-32516652 • info-asia@elmomc.com

Asia Pacific

Elmo Motion Control

#807, Kofomo Tower, 16-3, Sunae-dong, Bundang-gu, Seongnam-si, Gyeonggi-do,

South Korea

Tel: +82-31-698-2010 • Fax: +82-31-698-2013 • info-asia@elmomc.com

SimplIQ Software Manual

Introduction

i

MAN-SIMSW (Ver. 1.4)

 

 

Contents

Chapter 1: Introduction ........................................................................................

1-1

1.1

Scope

...............................................................................................................

1-1

1.2

Abbreviations.................................................................................................

1-2

Chapter 2: .................................................................SimplIQ Drive Description

2-2

2.1

Software ..................................................................................Organization

2-2

 

2.1.1 ....................................................................................................

Boot Software

2-2

 

2.1.2 ............................................................................................................

Firmware

2-2

 

2.1.3 .........................................................................................................

Personality

2-2

2.2

Related ............................................................................................Software

2-2

2.3

Units ...................................................................................of Measurement

2-3

 

2.3.1 ...............................................................................................................

Position

2-3

 

2.3.2 ....................................................................................

Speed and Acceleration

2-4

 

2.3.3 ..........................................................................................

Current and Torque

2-4

2.4

Internal .......................................Units of Measurement and Conversion

2-4

2.5

SimplIQ ..............................................................................Drive Peripherals

2-5

 

2.5.1 .............................................................................................

Position Decoders

2-5

 

2.5.2 ..................................................................................................

A/D Converter

2-5

 

2.5.3 .....................................................................................................

Digital Inputs

2-5

 

2.5.4 ..................................................................................................

Digital Outputs

2-6

Chapter 3: .........................................................Communication with the Host

3-1

3.1

RS-232 ..................................................................................................Basics

3-1

3.2

The Echo .........................................................................................................

3-2

3.3

Background ............................................................................Transmission

3-2

3.4

Errors ..................................................................and Exceptions in RS-232

3-3

Chapter 4: .................................................................The Interpreter Language

4-1

4.1

The Command .......................................................................................Line

4-1

4.2

Expressions ...........................................................................and Operators

4-2

 

4.2.1 ............................................................................................................

Numbers

4-2

 

4.2.2 ..............................................................Mathematical and Logical Operators

4-3

 

4.2.3 ............................................................................General Rules for Operators

4-4

 

4.2.4 ................................................................................................

Operator Details

4-5

 

4.2.5 ...................................................................................

Mathematical Functions

4-6

 

4.2.6 ........................................................................................................

Expressions

4-7

 

4.2.7 ........................................................................................................

Comments

4-11

Chapter 5: ......................................The SimplIQ User Programming Language

5-1

5.1

User Program .........................................................................Organization

5-1

5.2

Single ..................................................and Multiple Command Execution

5-3

5.3

Standard ..................................................................................Conventions

5-3

 

5.3.1 ...................................................................Line and Expression Termination

5-3

 

5.3.2 .............................................................................................

Line Continuation

5-4

 

5.3.3 .........................................................................................................

Limitations

5-4

5.4

Expressions ...........................................................................and Operators

5-4

 

5.4.1 ............................................................................................................

Numbers

5-4

SimplIQ Software Manual

Contents

ii

MAN-SIMSW (Ver. 1.4)

 

 

 

 

5.4.2

..............................................................Mathematical and Logical Operators

5-5

 

 

5.4.3

General Operator Rules....................................................................................

5-5

 

 

5.4.4

Operator Details ................................................................................................

5-5

 

 

5.4.5

Mathematical Functions ...................................................................................

5-5

 

 

5.4.6

Exclusive OR Operation ...................................................................................

5-5

 

 

5.4.7

CAN Object Emission .......................................................................................

5-6

 

 

5.4.8

Expressions ........................................................................................................

5-7

 

5.5

Comments ....................................................................................................

5-11

 

 

5.5.1

Double Asterisk...............................................................................................

5-11

 

 

5.5.2

Double Slash ....................................................................................................

5-11

 

 

5.5.3

C-style Start and End Comment....................................................................

5-11

 

5.6

Fault Handling.............................................................................................

5-12

 

 

5.6.1

Unexpected Fault ............................................................................................

5-12

 

 

5.6.2

Expected Fault.................................................................................................

5-12

 

5.7

Program Flow Commands .........................................................................

5-12

 

 

5.7.1

Labels (Entry Points) and Subroutines .........................................................

5-13

 

 

5.7.2

For Iteration .....................................................................................................

5-14

 

 

5.7.3

While Iteration.................................................................................................

5-15

 

 

5.7.4

Until Iteration ..................................................................................................

5-16

 

 

5.7.5

Wait Iteration...................................................................................................

5-16

 

 

5.7.6

If Condition......................................................................................................

5-17

 

 

5.7.7

Switch Selection...............................................................................................

5-18

 

 

5.7.8

Continue...........................................................................................................

5-19

 

 

5.7.9

Break.................................................................................................................

5-20

 

 

5.7.10

Return...............................................................................................................

5-20

 

 

5.7.11

Try-Catch .........................................................................................................

5-21

 

5.8

Functions ......................................................................................................

5-22

 

 

5.8.1

Function Declaration ......................................................................................

5-22

 

 

5.8.2

Dummy Variables ...........................................................................................

5-24

 

 

5.8.3

Count of Output Variables.............................................................................

5-24

 

 

5.8.4

Automatic Variables .......................................................................................

5-26

 

 

5.8.5

Global Variables ..............................................................................................

5-26

 

 

5.8.6

Jumps................................................................................................................

5-27

 

 

5.8.7

Functions and the Call Stack..........................................................................

5-27

 

 

5.8.8

Killing the Call Stack ......................................................................................

5-29

 

 

5.8.9

Automatic Subroutines...................................................................................

5-30

 

Chapter 6: Program Development and Execution ............................................

6-1

 

6.1

Editing a Program .........................................................................................

6-1

 

6.2

Compilation....................................................................................................

6-1

 

6.3

The Preprocessor .........................................................................................

6-14

 

6.4

Compiler Pragmas.......................................................................................

6-15

 

 

6.4.1

Compiler Directives........................................................................................

6-15

 

 

6.4.2

Evaluating Expressions Used in Compiler Directives.................................

6-20

 

6.5 Downloading and Uploading a Program .................................................

6-20

 

 

6.5.1

Binary Data ......................................................................................................

6-21

 

 

6.5.2

Auxiliary Upload/Download Commands ...................................................

6-22

 

 

6.5.3

Downloading a Program ................................................................................

6-23

 

 

6.5.4

Uploading a Program .....................................................................................

6-24

 

6.6

Program Execution ......................................................................................

6-24

 

SimplIQ Software Manual

Contents

iii

MAN-SIMSW (Ver. 1.4)

 

 

 

 

6.6.1

........................................................................................Initiating a Program

6-25

 

 

6.6.2

Halting and Resuming a Program.................................................................

6-25

 

 

6.6.3

Automatic Program Execution with Power Up ...........................................

6-26

 

 

6.6.4

Save to Flash ....................................................................................................

6-26

 

6.7

Debugging ....................................................................................................

6-26

 

 

6.7.1

Running, Breaking and Resuming ................................................................

6-26

 

 

6.7.2

The Elmo Studio..............................................................................................

6-27

 

 

6.7.3

The DB Command...........................................................................................

6-27

 

 

6.7.4

Machine Status ................................................................................................

6-28

 

 

6.7.5

Program Status ................................................................................................

6-28

 

 

6.7.6

Error Status ......................................................................................................

6-29

 

 

6.7.7

Setting and Clearing Breakpoints..................................................................

6-30

 

 

6.7.8

Continuing the Program.................................................................................

6-30

 

 

6.7.9

Single Step .......................................................................................................

6-30

 

 

6.7.10

Getting Stack Entries ......................................................................................

6-32

 

 

6.7.11

Setting the Stack ..............................................................................................

6-32

 

 

6.7.12

Retrieving the Call Stack ................................................................................

6-33

 

 

6.7.13

Viewing Global Variables ..............................................................................

6-33

 

 

6.7.14

Viewing Local Variables.................................................................................

6-34

 

Chapter 7: Development Aids .............................................................................

7-1

 

7.1

Wizard Mode Password ...............................................................................

7-1

 

7.2

Simulation ......................................................................................................

7-1

 

 

7.2.1

Starting the Motor without a Motor Power Supply ......................................

7-1

 

 

7.2.2

Applying Digital Inputs without Connecting to an Input Device ...............

7-2

 

 

7.2.3

Applying a Motor Fault....................................................................................

7-2

 

7.2.4Applying a Follower Reference without Connecting an Encoder Signal to

the Auxiliary Input ........................................................................................................

7-2

7.2.5Applying Analog Inputs without Connecting to an Analog Voltage Source7-3

7.3

Optimizing the Controller Sampling Time.................................................

7-4

7.4

The Recorder ..................................................................................................

7-5

 

7.4.1 Recorder Sequencing: Programming, Launching and Uploading Data......

7-6

 

7.4.2

Signal Mapping .................................................................................................

7-6

 

7.4.3 Defining the Set of Recording Signals.............................................................

7-8

 

7.4.4 Programming Length and Resolution ............................................................

7-8

 

7.4.5 Trigger Events and Timing ..............................................................................

7-9

 

7.4.6

Launching the Recorder .................................................................................

7-11

 

7.4.7

Uploading Recorded Data..............................................................................

7-12

7.5

Debugging Commands for Database Failures .........................................

7-14

Chapter 8: Commutation ......................................................................................

8-1

8.1

General Description.......................................................................................

8-1

 

8.1.1

DC Brush Motors ..............................................................................................

8-1

 

8.1.2

Stepper Commutation ......................................................................................

8-2

 

8.1.3

BLDC Commutation .........................................................................................

8-2

8.2

Mechanical and Electrical Motion ...............................................................

8-2

8.3

Commutation Sensors ...................................................................................

8-3

 

8.3.1 Rotor Magnetic Field Sensors ..........................................................................

8-3

 

8.3.2

Shaft Angle Sensors ..........................................................................................

8-4

 

8.3.3

Combining Sensor Types .................................................................................

8-5

 

8.3.4

Parameterization of Commutation and Commutation Errors....................

8-5

SimplIQ Software Manual

Contents

iv

MAN-SIMSW (Ver. 1.4)

 

 

 

....................................................8.4 Auto-phasing and Commutation Search

8-8

 

 

8.4.1

Selecting Parameters.........................................................................................

8-8

 

 

8.4.2

Method Limitation ............................................................................................

8-9

 

 

8.4.3

Protections .......................................................................................................

8-10

 

 

8.4.4

Maximum Number of Iterations for Auto-phasing.....................................

8-10

 

 

8.4.5

Starting the Motor without Digital Hall Sensors .........................................

8-10

 

8.5 Continuous vs. Six-step Commutation .....................................................

8-10

 

 

8.5.1

Six-step Commutation ....................................................................................

8-11

 

 

8.5.2

Continuous Commutation .............................................................................

8-12

 

8.6

Winding Shapes...........................................................................................

8-12

 

Chapter 9: The Current Controller......................................................................

9-1

 

9.1

Current Limiting............................................................................................

9-2

 

9.2 The PI Current Controller.............................................................................

9-5

 

9.3

Current Amplifier Protections .....................................................................

9-6

 

Chapter 10: Unit Modes......................................................................................

10-1

 

10.1

Unit Mode 1: Torque Control.....................................................................

10-1

 

10.2

Unit Mode 2: Speed Control.......................................................................

10-2

 

 

10.2.1

Software Speed Command.............................................................................

10-3

 

 

10.2.2

The Auxiliary Speed Command ....................................................................

10-5

 

 

10.2.3

Stop Management ...........................................................................................

10-6

 

10.3

Unit Mode 3: Stepper Mode .......................................................................

10-8

 

10.4

Unit Mode 4: Dual Feedback Mode...........................................................

10-9

 

10.5

Unit Mode 5: Single Feedback Mode.......................................................

10-11

 

Chapter 11: The Position Reference Generator ..............................................

11-1

 

11.1

Software Reference Generator ...................................................................

11-1

 

 

11.1.1

Switching Between Motion Modes................................................................

11-2

 

 

11.1.2

Comparing PT and PVT Interpolated Modes ..............................................

11-2

 

 

11.1.3

Idle Mode and Motion Status ........................................................................

11-3

 

 

11.1.4

Point-to-Point (PTP)........................................................................................

11-4

 

 

11.1.5

Jog .....................................................................................................................

11-8

 

 

11.1.6

Position - Velocity - Time (PVT)..................................................................

11-10

 

 

11.1.7

Position - Time (PT) ......................................................................................

11-21

 

11.2

The External Position Reference Generator............................................

11-29

 

 

11.2.1

Follower .........................................................................................................

11-30

 

 

11.2.2

ECAM.............................................................................................................

11-32

 

 

11.2.3

Dividing the ECAM Table into Logical Portions.......................................

11-36

 

 

11.2.4

Fast ECAM Programming Using CAN.......................................................

11-38

 

 

11.2.5

Initializing External Position Reference Parameters .................................

11-38

 

11.3

Stop Manager .............................................................................................

11-40

 

 

11.3.1

General Description ......................................................................................

11-40

 

 

11.3.2

Stop Manager Internal Elements .................................................................

11-41

 

Chapter 12: Sensors, I/O and Events.................................................................

12-1

 

12.1

Modulo Counting ........................................................................................

12-1

 

12.2

Digital Inputs ...............................................................................................

12-2

 

12.3

Digital Outputs ............................................................................................

12-2

 

12.4

Events and Response Methods ..................................................................

12-3

 

 

12.4.1

Manual Query .................................................................................................

12-3

 

SimplIQ Software Manual

Contents

v

MAN-SIMSW (Ver. 1.4)

 

 

 

 

12.4.2

................................................................................................Periodic Query

12-4

 

 

12.4.3

Automatic Routines ........................................................................................

12-4

 

 

12.4.4

Real Time: Motion Management, Homing, Capture and Flag ..................

12-4

 

12.5

Homing and Capture ..................................................................................

12-5

 

 

12.5.1

Homing Programming ...................................................................................

12-6

 

 

12.5.2

Homing the Auxiliary Encoder .....................................................................

12-6

 

 

12.5.3

On-the-fly Position Counter Updates ...........................................................

12-6

 

 

12.5.4

Example 1: Homing with Home Switch and Index .....................................

12-7

 

 

12.5.5

Example: Double Homing Corrects Backlash Offsets .................................

12-9

 

 

12.5.6

Capture...........................................................................................................

12-10

 

Chapter 13: Limits, Protections, Faults and Diagnosis..................................

13-1

 

13.1

Current Limiting..........................................................................................

13-2

 

13.2

Speed Protection ..........................................................................................

13-4

 

13.3

Position Protection ......................................................................................

13-5

 

13.4

Enable Switch...............................................................................................

13-6

 

13.5

Limit Switches..............................................................................................

13-7

 

13.6

Connecting an External Brake....................................................................

13-7

 

13.7

When the Motor Fails to Start ....................................................................

13-8

 

13.8

Motion Faults ...............................................................................................

13-9

 

13.9

Diagnosis ....................................................................................................

13-10

 

 

13.9.1

Monitoring Motion Faults............................................................................

13-10

 

 

13.9.2

Inconsistent Setup Data................................................................................

13-10

 

 

13.9.3

Device Failures and CPU Dump .................................................................

13-11

 

13.10Sensor Faults ..............................................................................................

13-12

 

 

13.10.1 Motor Cannot Move......................................................................................

13-12

 

13.11Commutation is Lost.................................................................................

13-13

 

 

13.11.1 Reasons for and Effects of Incorrect Commutation...................................

13-13

 

 

13.11.2 Detection of Commutation Feedback Faults ..............................................

13-14

 

Chapter 14: Filters................................................................................................

14-1

 

14.1

Internal Structure of a Filter Link ..............................................................

14-4

 

 

14.1.1 Fixed Link (Type 16) .......................................................................................

14-4

 

 

14.1.2 Scheduled Link (Type 26)...............................................................................

14-5

 

14.2

Examples of Filter Implementation ...........................................................

14-5

 

 

14.2.1 Low-pass (Complex Pole) Element (Represented by Second-order Block)14-6

 

 

14.2.2 Notch Filter Element (Represented by Second-order Block)......................

14-6

 

 

14.2.3 Double-lead Element (Represented by Second-order Block) .....................

14-7

 

 

14.2.4

First-order Element (Represented by Second-order Block) .......................

14-8

 

Chapter 15: The Controller.................................................................................

15-1

 

15.1

Speed Control...............................................................................................

15-2

 

 

15.1.1

Block Diagram .................................................................................................

15-2

 

 

15.1.2

Speed Controller Parameters .........................................................................

15-3

 

15.2

The Position Controller...............................................................................

15-5

 

 

15.2.1

Block Diagram .................................................................................................

15-5

 

 

15.2.2

Position Controller Parameters......................................................................

15-6

 

15.3

The Gain Scheduling Algorithm................................................................

15-7

 

15.4

Automatic Controller Gain Scheduling ....................................................

15-8

 

SimplIQ Software Manual

Introduction

1-1

MAN-SIMSW (Ver. 1.4)

 

 

Chapter 1: Introduction

1.1Scope

This manual describes, in detail, the software used with the SimplIQ line of digital servo drives. It is an integral part of the SimplIQ documentation set, which includes:

SimplIQ product line Installation Guides, which provide full instructions for installing a SimplIQ drive.

The Composer User Manual, which includes explanations of all the software tools that

are a part of Elmo’s Composer software environment.

The SimplIQ Command Reference Manual, which describes all of the software commands used to manipulate SimplIQ drives.

The Elmo CANopen Implementation Guide, an auxiliary document that describes the CAN communication objects used with SimplIQ drives.

The following diagram illustrates the hierarchy of SimplIQ documentation.

CANopen Implementation Guide

Software Manual

Command Reference Manual

Programming

Composer User Manual

Setup

 

 

 

 

 

 

 

 

 

Servo Drive

 

 

 

 

 

 

 

Installation

 

 

 

 

 

 

 

 

Installation Guides

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

SimplIQ Software Manual

Introduction

2-2

MAN-SIMSW (Ver. 1.4)

 

 

1.2Abbreviations

The following abbreviations are used in this document:

Download

Transfer of data from the host to the drive.

DSP

Digital signal processor.

EDS

Electronic data sheet. The list of CAN objects supported by a device, in a

 

form suitable for standard configuration software.

IDE

Integrated development environment.

PDO

Process data object. A CAN message type, which eliminates the need for

 

allocation the data payload for object addressing by pre-agreement

 

concerning the message contents (PDO mapping).

Upload

Transfer of data from the drive to the host

Chapter 2: SimplIQ Drive Description

SimplIQ drives are sophisticated, network-oriented, single-axis digital drives, featuring:

State-of-the-art control algorithms including high-order filters and gain scheduling

A sophisticated reference generation algorithm, which includes absolute time interpolated motion, auxiliary signal following and ECAM

Synchronization capability for network operation

Conformance to CANopen standards

User-friendly programming

Advanced analysis tool for setup

Built-in auto-tuning facilities

Built-in database maintenance tools

Built-in firmware maintenance tools

All these features are implemented in the tiny DSP environment.

2.1Software Organization

In the SimplIQ family of drives, the DSP software is divided into three parts:

Boot software, which is permanently burnt into the internal DSP flash memory and cannot be upgraded during product life. The boot software includes data that assists the firmware in identifying the exact drive model in which it is operating. The data includes the maximal motor phase current, the nominal bus voltage, the hardware of the communication sensors and I/O interface, and the grade (model) of the drive (Standard or Advanced).

SimplIQ Software Manual

Communication with the Host

2-2

MAN-SIMSW (Ver. 1.4)

 

 

Operational software (firmware), which may be updated at the user site if upgrades or modifications are required. .

A supportive database that is loaded to the serial flash memory. This database serves as a filing system for personality descriptions, storage of the application database and storage of factoryor user-provided programs. .

2.1.1Boot Software

The boot software performs the following functions:

Initializes certain DSP registers.

Automatically validates test codes. If code validation fails, it transfers automatically to Download Firmware mode.

Handles and interprets degenerated communication, at the level required for firmware downloading functions.

Supports firmware downloads to the on-chip flash memory.

Transfers control to firmware.

2.1.2Firmware

The firmware implements all other software functions, as described in this manual and in the SimplIQ Command Reference Manual. The firmware transfers control to the boot software when a download firmware (DF) command initiates a firmware version upgrade. At the end of the firmware downloading process, the SimplIQ drive reboots.

2.1.3Personality

The personality data is loaded to the serial flash memory. It includes a file allocation table and several files containing data about the SimplIQ drive, including:

List of supported commands

List of error codes

CAN EDS (not yet implemented)

All data items in the personality enable the IDE to deal with the SimplIQ drive. The File Allocation table reserves space for the storage of application parameters and user programs. The personality data is burnt into the serial flash memory using the firmware software. The firmware can boot without personality data, but it does not become fully functional before the personality data is programmed in place. Full explanations of the personality data are given in Appendix A.

2.2Related Software

The Elmo Composer application, which runs on a PC under Microsoft Windows, provides the supporting software used to set up, tune, program and assess the performance of SimplIQ drives. Among its many tools, the Composer contains:

Setup and tuning tools:

Menus for entering basic application data and limits

SimplIQ Software Manual

Communication with the Host

2-3

MAN-SIMSW (Ver. 1.4)

 

 

Tools for associating functions to I/O connector pins

Automatic current controller tuning

Automatic commutation tuning

Manual, advanced manual and automatic speed controller tuning

Manual, advanced manual and automatic position controller tuning

Smart Terminal, for direct user interface using RS-232 or CAN

A recorder with advanced scope controls, for observing up to eight signals simultaneously, triggered by a selection of events

Application database maintenance: save and load application database, and edit application parameters, with help

Advanced IDE for user program development:

Editor

Compiler

User program upload and download

Debugger with: breakpoint and stepping options, watches for local and global variables, call stack watch

The Composer software reads the personality data from the SimplIQ drive and can thereby adapt to the specific drive model.

2.3Units of Measurement

This section describes the units of measurements used by the SimplIQ drive for time, position, speed, voltage and current.

2.3.1Position

The SimplIQ drive refers to position using sensor counts, which may be related to physical units using the following commands:

Command

Description

CA[18]

For rotary motors, CA[18] is the number of sensor counts per one full

 

mechanical revolution.

CA[23]

For linear motors, CA[23] stores the number of counts per user unit

 

(meter or any other unit selected by the user). This value is stored for

 

convenience only; the SimplIQ software does not use this number for any

 

internal calculation. For rotary motors, set CA[23]=0.

YA[1], YA[3]

YA[1] is the auxiliary feedback resolution, in counts/physical unit. YA[3]

 

indicates what that physical unit is: revolution, meter or other. YA[1] and

 

YA[3] are stored for convenience only; the SimplIQ software does not use

 

these numbers for any internal calculation.

SimplIQ Software Manual

Communication with the Host

2-4

MAN-SIMSW (Ver. 1.4)

 

 

2.3.2Speed and Acceleration

Speed is measured in counts/second and acceleration is measured in counts/second2. The speed units may be related to physical units by converting the counts to revolutions, meters or other, as explained in section 2.3.1.

2.3.3Current and Torque

Currents are measured in amperes, although there is no single accepted method for specifying the current of three-phased motors. For sinusoidal motors, RMS phase current normally specifies the motor current. The RMS is determined during a mechanical revolution so that phase currents are the “motor current” only if the motor revolves at a constant speed. For trapezoidal motors, the conventional six-step drive leaves one motor phase open-circuited, and only one current flows through the two driven motor phases. This driven-phase current specifies the “motor current.” For trapezoidal motors running six-step commutation continuously at 1 ampere, the RMS current is 0.92 amperes.

SimplIQ drives have a single motor current definition, although it can run equally well with sinusoidal, trapezoidal or free-form motor windings. Motor current is defined as the maximum winding current in a mechanical revolution. This definition is consistent with the traditional current definition for six-step motors and it can be readily extended to other winding forms.

To obtain the RMS phase current for sinusoidal motors, multiply the motor current reported by the SimplIQ drive by a factor of 0.71.

2.4Internal Units of Measurement and Conversion

In order to optimize the use of its CPU, the SimplIQ drive operates internally with local units for time, current, DC bus voltage and electrical angle.

While time is normally measured in seconds, most control algorithms measure time by counting controller sampling times.

While current is usually measured in amperes, the SimplIQ drive performs this measurement internally in terms of A/D bits.

Rather than degrees or radians, the SimplIQ drive divides the electrical cycle into 1024 sections.

These internal measurements are normally transparent to the user, because the SimplIQ drive translates its internal calculations into standard units of measurements. However, the following situations require the user to use the internal data representation:

Uploading data from the real-time recorder

Interpreting CAN-mapped synchronous PDOs

Specifying motions in micro-stepping mode

In these situations, the conversion factors can be retrieved using the relevant user interface commands.

SimplIQ Software Manual

Communication with the Host

2-5

MAN-SIMSW (Ver. 1.4)

 

 

2.5SimplIQ Drive Peripherals

2.5.1Position Decoders

The SimplIQ drive includes two position decoders — main and auxiliary — which are similar to each other. Both decoders are timed (through timer sets A and B) for accurate speed information. A position decoder measures quadrature or pulse/direction. The maximum counting rate of a decoder is 20 MHz, without an input filter. If an input filter is applied, the maximum pulse rate is reduced (this is fully explained in the EF[N] command in the SimplIQ Command Reference Manual).

The encoder input is not protected: no hardware identifies illegal transitions. Exceeding the maximum pulse rate causes a loss of counts that cannot be detected.

2.5.2A/D Converter

The A/D converter samples the following signals:

 

Ia, Ib, Ic

The three phase currents, sampled simultaneously

 

Ain,ref

The analog input and the reference voltage, sampled simultaneously to

 

 

form a differential measurement

 

Bus voltage

Sampled to correct the current loop gain

The resolution of all the measurements is 12 bits, and, in practice, the last bit is noisy. The motor currents are measured offset-free, as the result of a special measurement mechanism. Due to electronic inaccuracies in the SimplIQ drive circuits, the analog inputs cannot avoid an offset, which can be corrected to a resolution of about 5 millivolts, using the AS[1] parameter. AS[1] can correct offsets within the limited resolution range of

5 to 10 millivolts. This means that, for example, if AG[2]=10,000, the offset correction quality of the speed analog reference will be limited to about 100 counts/second.

2.5.3Digital Inputs

In the Harmonica, the drive’s six digital input connector pins are routed to a digital input port. In addition, two pins (5 and 6) are routed to high-speed capturing input for main and auxiliary homing. Special functions — such as Enable, Stop, RLS and FLS — can be associated with the digital input pins (refer to the IL command in the SimplIQ Command Reference Manual). Digital Input is handled differently in the other drives, see their

Installation Guide for details.

The digital input response time is limited by the speed of the optical couplers and the input filters. The encoder index and home input are filtered similarly to the position decoders. The timing of the position decoder filters is explained in the EF[N] command section in the SimplIQ Command Reference Manual.

The other digital inputs are filtered in the software only. The timing of the software filtering is explained in the IF[N] command section in the SimplIQ Command Reference Manual.

The use of digital inputs is detailed in Chapter 12 of this manual.

SimplIQ Software Manual

Communication with the Host

2-6

MAN-SIMSW (Ver. 1.4)

 

 

2.5.4Digital Outputs

The SimplIQ drive’s two digital output connector pins can be used for non-committed digital outputs, or they can be programmed by the OL command for special functions, such as activated external brakes.

SimplIQ Software Manual

3-1

MAN-SIMSW (Ver. 1.4)

 

Chapter 3: Communication with the Host

The SimplIQ drive can operate with RS-232 communication or CANopen communication. This chapter discusses RS-232 communication. Refer to the Elmo CANopen Implementation Manual for detailed information about SimplIQ drive operation with CANopen networking.

The SimplIQ drive can communicate by RS-232 with baud rates of up to 57,600 baud/ second, depending on the sampling time. Refer to the PP[N] command section in the

SimplIQ Command Reference Manual.

3.1RS-232 Basics

The RS-232 communication operates only between a host and a single drive. RS-232 lines are full duplex, enabling them to carry bi-directional communications. This means that the host can transmit to the drive at any time, without considering the current state of the drive.

RS-232 communication consists of ASCII printable characters only, with certain exceptions:

The characters 0xD (carriage return)

Certain non-printable characters used as error codes (and listed in the EC command section in the Harmonica Command Reference Manual)

The basic syntax for RS-232 commands may be of two types:

An assignment: <command mnemonic>{[index]}{[equal sign><value>}<terminator>

A free evaluation: <value><terminator>

where:

 

 

command mnemonic

Two (case sensitive) letters assigned to a command

 

 

(complete list given in SimplIQ Command Reference Manual).

 

index

Index, if mnemonic refers to a vector parameter or

 

 

command.

 

equal sign

The “=” character (optional, if the command assigns a value

 

 

to a parameter).

 

value

Parameter value (optional, if the command assigns a value to

 

 

a parameter).

 

 

The parameter value may be any legitimate arithmetic or

 

 

functional expression, as explained later in this section.

 

terminator

<CR> (carriage return), which is the character 0xD

 

 

(13 decimal) or “;”.

An assignment evaluates an expression and stores the result in a variable. A free evaluation evaluates an expression and sends the result to the terminal.

SimplIQ Software Manual

Communication with the Host

3-2

MAN-SIMSW (Ver. 1.4)

 

 

Typical examples of assignments are:

MO<CR>

Asks the drive to report the value of the variable MO.

MO=1<CR>

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.

An example of a free evaluation is:

(5+sin(PX) * sqrt(abs(VX)) Returns a numerical value to the terminal.

More details about text interpretation are given in Chapter 4:.

The drive responds to commands communicated by the host it but never initiates a message to the host if not requested. The syntax of the drive response is: {<value>}{<error code>}<terminator>

where:

 

value

Parameter value (optional, if the command requests a

 

 

parameter)

 

error code

A binary number that may be interpreted according to the

 

 

error code tables (refer to the EC command in the SimplIQ

 

 

Command Reference Manual).

 

terminator

“;” if the host command has been successfully executed;

 

 

otherwise “;?”

3.2The Echo

When using RS-232, each character received by the drive is echoed back to the host. The echo is immediate, per each received character. The echo can be turned off using the EO=0 command.

When communicating via RS-232, the Composer must have the echo turned on in order to operate.

3.3Background Transmission

When the host sends the BH=n command to the drive, the drive uploads the recorder data to the host. The uploading process may take a few seconds, during which time the drive is available to receive new commands from the host.

For the command sequence BH=1;MO=0<CR>, the drive will begin to transmit the recorder data immediately. A few milliseconds later, while the recorder data is still being transmitted, the drive will execute the MO=0 command. It will then store the response message to the command in order to transmit it later, immediately after the record upload terminates.

If the host has not been informed of the communication parameters, it may transmit a series of terminators and attempt to use several baud rates until it receives a matching sequence of echoes.

SimplIQ Software Manual

Communication with the Host

3-3

MAN-SIMSW (Ver. 1.4)

 

 

3.4Errors and Exceptions in RS-232

If an error is intercepted (over-run, noise, parity or framing), the entire message, including the error, is discarded and a “communication error” code response is transmitted.

The communication is defined as 8 bits per character. The SimplIQ drive will normally only transmit characters in the range [0…127] with the exception of error codes (refer to section 3.1). The SimplIQ drive accepts RS-232 bytes only in the range [0…127]; received byte values in the range [128…255] are treated as UART errors.

Empty strings with terminators are echoed back, but are otherwise ignored.

SimplIQ Software Manual

The Interpreter Language

4-1

MAN-SIMSW (Ver. 1.4)

 

 

Chapter 4: The Interpreter Language

SimplIQ servo drives use a communication language that enables the user to:

Set up the drive

Send commands to the drive indicating what functions to perform

Inquire as to the drive status

Two methods can be used to communicate with the drive:

Using a communication interface — either RS-232 or CANopen — to transfer commands to the drive and receive an immediate response from the drive. This method requires on-line communication and close cooperation between the drive and its host. The physics and standards of RS-232 and CANopen communication require different command syntax per method. This chapter describes the drive language according to basic RS-232 or CAN “OS” syntax.

Writing a program in the drive language and storing it in the drive memory. The drive can then run the program with minimal or no host assistance.

The CANopen communication method can access simple numeric interpreter “get” and “set” commands very efficiently. The CAN binary interpreter uses PDO objects to issue interpreter commands and to collect the responses. This is the most economical way to minimize both the communication load and the drive CPU load.

The CAN OS (command prompt) method can be used to access the entire set of interpreter services, including those inaccessible by the binary CAN interpreter, using a text format. The CANopen communication method is a broad topic and beyond the scope of this manual (it is covered in the Elmo CAN Implementation Manual).

Software programs use the interpreter syntax, with extensions that are needed to support program flow instructions and in-line documentation.

The full set of drive commands is documented in the SimplIQ Command Reference Manual.

4.1The Command Line

The Interpreter evaluates input strings, called “expressions,” which are sequences of characters, terminated by a semicolon (;), a line feed or a carriage return.

The maximum length of a legal expression is limited to 511 symbols.

A command line may include a comment marker, which is two consecutive asterisks (**). All text from the comment marker to the next line feed or carriage return is ignored. The comment marker is used to prepare documented batch files, sent later directly to the drive.

SimplIQ Software Manual

 

The Interpreter Language

4-2

MAN-SIMSW (Ver. 1.4)

 

 

 

 

 

Example:

 

 

 

 

 

Command Line

Results

Remarks

 

3+4;

7

 

 

 

 

PX=7; PX-3;

4

PX is set to 7 and 3 is then subtracted.

(3.2+4)/2;

3.6

 

 

 

4.2Expressions and Operators

The drive language supports operators, which specify a mathematical, logical or conditional operation/relation between two or more operands. Operands (or parameters) and operators may be combined in almost any way to create an expression. The following sections describe the operators and expression syntax rules.

4.2.1Numbers

SimplIQ drives use two number types: 32-bit integers and 32-bit floating-point numbers (“floats”). At text inputs, numbers containing a decimal point or an exponent notation are interpreted as floats. Other numbers are interpreted as integers.

The range for integers is [-2,147,483,648…2,147,483,647]. If an integer number exceeds the integer range, it is interpreted as an error. For example, if 2,147,483,648 is entered, the SimplIQ drive will respond with a Bad Command Format error.

The lowest integer – -2,147,483,648 – cannot be entered explicitly through the interpreter due to the means by which immediate numbers are internally evaluated. Nevertheless, this integer value is valid and can be entered in hexadecimal form as 0x80,000,000.

Positive integers may be written as decimal or as hexadecimal.

The hexadecimal notation 0x10 is equivalent to the decimal number 16.

An integer value is always truncated to the nearest lower number. For example, 5/2 is 2, whereas 5/2.0 is 2.5. If an integer exceeds the integer range, it is interpreted as an error.

The range for floating-point numbers is [-1e20…1e20].

A floating-point number may be written with or without an exponent.

2.5e4 is equivalent to 25,000.0. It is not equivalent to 25,000, because the latter number is interpreted as an integer. If a floating-point number exceeds the floating-point range, it is also interpreted as an error.

SimplIQ drives evaluate floating-point numbers with the standard IEEE floating point precision of approximately six significant decimal digits. For example, the number 12,345.0 has an exact IEEE floating point representation. The number 1,234,568.0 is understood by the SimplIQ drive to be 12,345,680.0 due to truncation into float IEEE format.

SimplIQ Software Manual

The Interpreter Language

4-3

MAN-SIMSW (Ver. 1.4)

 

 

SimplIQ drives cannot evaluate numbers with an absolute value greater than 1020. For example, if you enter =12.3e+20 or -13.56e-20, the SimplIQ drive will respond with a Badly Formatted Number error.

Logical operators yield 0 or 1 as a result.

The results of logical operators are integers.

4.2.2Mathematical and Logical Operators

Expressions may contain any combination of arithmetic, relational and logical operators. Precedence levels determine the order in which the expression is evaluated. Within each precedence level, operators have equal precedence and are evaluated from left to right.

For example, a*b/c is equivalent to (a*b)/c.

The following table lists the mathematical and logical operators used in the SimplIQ drive language. The table also specifies operator precedence, ordered from highest to lowest precedence level.

Operator

Description

Precedence

~

Bitwise NOT of an operand

17

!

Logical negation

17

-

Unary minus

17

%

Remainder after dividing two integers

16

*

Multiplication of two operands

16

/

Division of the left operand by the right operand

16

+

Addition of two operands

15

-

Subtraction of the right operand from the left operand

15

<<

Bitwise shift left

14

>>

Bitwise shift right

14

<

Logical smaller than

13

<=

Logical smaller than or equal to

13

>

Logical greater than

13

>=

Logical greater than or equal to

13

==

Logical equality

12

!=

Logical not equal

12

&

Bitwise AND between two operands

11

|

Bitwise OR between two operands

9

&&

Logical AND

8

||

Logical OR

7

=Assignment

(

)

Parentheses, for expression nesting and function calls

[

]

Brackets, for array indices and multiple value function returns

Table 4-1: Mathematical and Logical Operators

1+2
1+0x10
1+2.0
2.1+3.4

SimplIQ Software Manual

The Interpreter Language

4-4

MAN-SIMSW (Ver. 1.4)

 

 

The default precedence can be overridden using parentheses, as in the following examples:

A = 3;

B = 2;

C = A/B/2;

C = 0.75

C = A/(B/2) C = 3

4.2.3General Rules for Operators

Most arithmetic operators work on both integers and floats. An arithmetic operation between integers yields integers. An operation between floating-point numbers, or between an integer and a floating-point number, yields a floating-point result. For example, all of the following expressions are legitimate:

(The result is 3, integer.)

(The result is 17, integer. Note that 0x10 is treated as a standard integer.)

(The result is 3.0, float.) (The result is 5.5, float.)

If the result of add and subtract operations between two integers exceeds the integer range [-2,147,483,648…2,147,483,647], the result is truncated and the type remains an integer. For example:

The result of 2,147,483,647 + 10 is -2,147,483,639

A division operation between two integers may yield a floating-point result if the result includes a remainder. For example:

8/2

(The result is 4, integer.)

9/2.0

(The result is 4.5, float.)

If a multiplication operation between two integers exceeds the integer range, the result is converted into a floating-point number and is not truncated. For example:

100,000 * 100,000 (The result is 1.0e+10, float.)

Bit operators require an integer input. Floating-point inputs to bit operators are truncated to integers. For example:

7.9 & 3.4 is equivalent to 7 & 3 because the floating-point number 7.9 is truncated to the integer 7 and 3.4 is truncated to the integer 3 before applying the operator & (bitwise AND).

The result of a unary minus operation for the minimum integer value exceeds the integer range; therefore, the result is truncated to the maximum integer value: -0x80,000,000 results in 2,147,483,647 or 0x7FFFFFFF.

SimplIQ Software Manual

The Interpreter Language

4-5

MAN-SIMSW (Ver. 1.4)

 

 

4.2.4Operator Details

The following table describes the operators in detail.

Operator /

Nota-

No. of

Output

 

Description

tion

Arguments

Type

Examples

Arithmetic

+

2

See section

4+5=9

addition

 

 

4.2.3

3.45+2.78=6.23

Arithmetic

-

2

See section

4-5=-1

subtraction

 

 

4.2.3

3.45=2.78=0.67

Arithmetic

*

2

See section

PA=PA*2 doubles PA

multiplication

 

 

4.2.3

5*4=20

 

 

 

 

 

1.5*2=3.0

Arithmetic

/

2

See section

20/4=5

division

 

 

4.2.3

3/1.5=2.0

Remainder

%

2

32-bit long

20%4=0

after division of

 

 

integer

5%2=1

two integers

 

 

 

 

 

Bitwise NOT

~

1

32-bit long

~3 is 0xfffffffc, which is actually -4

 

 

 

integer

~3.2 is the same as !3

Bitwise OR

|

2

32-bit long

PA=0x2 | 0x5 is equivalent to PA=7

 

 

 

integer

PA=0x2 | 5.1 is the same

Bitwise AND

&

2

32-bit long

PA=0x7 & 0x3 is equivalent to PA= 3

 

 

 

integer

PA=0x7 & 3.1 is the same

Logical equality

==

2

0

(false) or

If x=3 and y=3 as x==y yields 1

 

 

 

1

(true)

If x=3 and y=5 as x==y yields 0

Logical inequality

!=

2

0

(false) or

If x=3 and y=3 as x!=y yields 0

 

 

 

1

(true)

If x=3 and y=5 as x!=y yields 1

Logical greater

>

2

0

(false) or

If x=3 and y=3 as x>y yields 0

than

 

 

1

(true)

If x=3 and y=2 as x>y yields 1

 

 

 

 

 

If x=1 and y=2 as x>y yields 0

Logical greater

>=

2

0

(false) or

If x=3 and y=3 as x>=y yields 1

than or equal to

 

 

1

(true)

If x=3 and y=2 as x>=y yields 1

 

 

 

 

 

If x=1 and y=2 as x>=y yields 0

Logical less than

<

2

0

(false) or

If x=3 and y=3 as x<y yields 0

 

 

 

1

(true)

If x=3 and y=2 as x<y yields 0

 

 

 

 

 

If x=1 and y=2 as x<y yields 1

Logical less than

<=

2

0

(false) or

If x=3 and y=3 as x<=y yields 1

or equal to

 

 

1

(true)

If x=3 and y=2 as x<=y yields 0

 

 

 

 

 

If x=1 and y=2 as x<=y yields 1

Logical AND:

&&

2

0 or 1

1 && 5 yields 1

Result is 1 if both

 

 

 

 

0.21 && 2 yields 1

arguments are

 

 

 

 

0 && 2 yields 0

nonzero, 0 if any

 

 

 

 

 

is zero *

 

 

 

 

 

SimplIQ Software Manual

 

 

The Interpreter Language

4-6

MAN-SIMSW (Ver. 1.4)

 

 

 

 

 

 

 

Operator /

Nota-

No. of

Output

 

 

 

 

Description

tion

Arguments

Type

Examples

 

 

 

Logical OR:

||

2

0 or 1

1||0 yields 1

 

 

 

Result is 1 if any

 

 

 

0||0 yields 0

 

 

 

argument is

 

 

 

 

 

 

 

nonzero, 0 if both

 

 

 

 

 

 

 

are zero *

 

 

 

 

 

 

 

Logical NOT:

!

1

0 or 1

!4 yields 0

 

 

 

Result is 1 if

 

 

 

!0 yields 1

 

 

 

argument is zero;

 

 

 

!0.0004 yields 1

 

 

 

otherwise it is 0*

 

 

 

 

 

 

 

Unary minus:

-

1

Same as

-4.5 yields -4.5

 

 

 

Result is negative

 

 

argument

-4 yields -4

 

 

 

if argument is

 

 

 

(-4) yields 4

 

 

 

positive, and vice

 

 

 

-5+5 yields 0

 

 

 

versa*

 

 

 

 

 

 

 

Bitwise left shift:

<<

2

32-bit long

8<<2 yields 32

 

 

 

Shifts 1st operand

 

 

integer

 

 

 

 

left by number of

 

 

 

 

 

 

 

positions the 2nd

 

 

 

 

 

 

 

operand specifies*

 

 

 

 

 

 

 

Bitwise right shift:

>>

2

32-bit long

8>>2 yields 2

 

 

 

Shifts 1st operand

 

 

integer

 

 

 

 

right by number of

 

 

 

 

 

 

 

positions the 2nd

 

 

 

 

 

 

 

operand specifies*

 

 

 

 

 

 

* The arguments are truncated to integers before evaluation.

Table 4-2: Operator Details

4.2.5Mathematical Functions

The following table lists the built-in mathematical functions of the SimplIQ Interpreter language. Function names are case sensitive.

Operator

Description

Returns

sin

Sine

Floating point

cos

Cosine

Floating point

abs

Absolute value

Same type as input argument

 

Note:

 

 

The absolute value of an input argument of

 

 

hexadecimal 0x80,000,000 exceeds the long

 

 

value range and will therefore be limited to

 

 

the maximum long value for positive

 

 

numbers.

 

sqrt

Square root, or zero if argument is negative

Floating point

SimplIQ Software Manual

The Interpreter Language

4-7

MAN-SIMSW (Ver. 1.4)

 

 

Operator

Description

Returns

fix

Truncate to integer:

Integer

 

fix(3.8) is 3

 

 

fix (-3.8) is -3

 

 

Note:

 

 

If an input argument exceeds the long value

 

 

range, it will be limited to the maximum long

 

 

value (for positive numbers) or the minimum

 

 

long value (for negative numbers).

 

rnd

Truncate to nearest integer:

Integer

 

rnd(3.8) is 4

 

 

rnd(-3.8) is -4

 

 

rnd(3.4) is 3

 

 

Note:

 

 

If an input argument exceeds the long value

 

 

range, it will be limited to the maximum long

 

 

value (for positive numbers) or the minimum

 

 

long value (for negative numbers).

 

sign

Returns the sign of the input argument:

Integer

 

-1 for negative numbers, 1 for positive

 

 

numbers and zero for a zero.

 

 

sign (-3.8) is -1

 

 

sign (3.8) is 1

 

real

Convert integer to float. If argument is

Floating point

 

floating point number, the function does

 

 

nothing:

 

 

5/2 is 2

 

 

real (5)/2 is 2.5

 

 

5/real (2) is 2.5

 

Table 4-3: Mathematical Functions

4.2.6Expressions

An expression is a combination of operands (parameters) and operators that is evaluated in a single value. Expressions work with immediate numbers, drive commands, and drive and global user-program variables. The following sections describe the different types of expressions.

4.2.6.1 Simple Expressions

A simple expression is evaluated in a single value. Any parameter and mathematical/ logical operator may be used to create a simple expression. Normally, simple expressions may be used as a part of other types of expressions.

Simple expressions are evaluated according to the operator priority, as specified in Table 4-1. In case of equal priorities, the expression is evaluated from left to right. The use of parentheses is allowed to 16 nesting levels.

SimplIQ Software Manual

 

The Interpreter Language

4-8

MAN-SIMSW (Ver. 1.4)

 

 

 

 

 

Examples:

 

 

 

 

 

Command Line

Results

Remarks

 

 

SP*2/5+AC

101,000

The order is ((SP*2)/5) + AC

 

IP|5

5

OR operation on IP

2+3

 

 

 

1,400,000

1,400,000

 

 

 

4.2.6.2 Assignment Expressions

Assignment expressions are used to assign a value to a variable or to a command. The syntax of an assignment expression is:

<parameter or command name>=<simple expression>

Examples:

SP=SP*2/5+AC

OP=IP|5

If the variable or the command is a vector, the assignment is allowed only for its single member. The syntax of the vector member assignment is:

<parameter or command name>[index]=<simple expression>

The index is an index of the relevant member vector. Indices are enumerated from zero.

Example:

CA[1]=1

Be aware that when different types are assigned, the value may be truncated. If, for example, the variable or command type is integer and the assigned value is floating point, the floating value is rounded to the nearest integer. If a rounded integer value exceeds the integer range, this value is truncated to the nearest valid integer.

Example:

 

 

 

Response

 

Expression Sent

Received

Remarks

AC=12,345.6789

Assign floating value to integer AC command.

AC

12,346

Floating value rounded to nearest integer.

KV[10]=215.789e8

Assign floating value to integer KV[10]

 

 

command.

KV[10]

2,147,483,647

Floating value truncated to maximum integer

 

 

value.

When an integer value is assigned to a floating point command or variable, it is converted to a float. The conversion process may be imprecise due to the truncation into float IEEE format.

SimplIQ Software Manual

The Interpreter Language

4-9

MAN-SIMSW (Ver. 1.4)

 

 

Example:

A floating point variable “temp” is defined in a user program.

 

Response

 

Expression Sent

Received

Remarks

TC=1

Assign integer value to floating point command

 

 

TC.

TC

1.0

Assigned integer value is converted to float.

temp=12,345,678

Assign integer value to floating point variable.

temp

1.234568e+7

Assigned value is truncated to 12,345,680.0.

4.2.6.3 User Variables

User variables are defined within a user program. The description and syntax rules of the variable definition are outlined in Chapter 5:.

User program variables may be used within the command line only if a program was compiled successfully and downloaded to the drive. The user may then use the Interpreter to query a user variable value or change it.

The user should pay special attention to the scope of a variable. A variable may be defined at the global or local level. Local variables are available only within the function in which they are defined, while global variables are available within any function and outside a program.

A user variable may be queried or changed when the program is running or halted.

For example, suppose that a compiled program includes the following lines at the global level:

int ZEBRA,GIRAFFE[3]; float GNU;

The expression GNU=ZEBRA*GIRAFFE[1]+2*sin(GIRAFFE[2]); is valid. User program variables are case sensitive.

4.2.6.4 Built-in Function Calls

The built-in function call may be used in a single expression. For a list of mathematical built-in functions, refer to Table 4-3. Non-mathematical built-in functions are as follows:

Operator

Description

Returns

tdif

Time difference

Integer

 

x=TM

 

 

tdif(x) returns the time in msec since x=TM has been

 

 

sampled.

 

emit(n)

Emits the n TPDO (CAN transmit process data object),

 

where n equals 1, 3 or 4. Details given in section 5.4.7.

Integer, 1 if function is completed successfully; otherwise 0

SimplIQ Software Manual

The Interpreter Language

4-10

MAN-SIMSW (Ver. 1.4)

 

 

Operator

Description

Returns

emcy(n)

Issues an emergency message from a user program,

Nothing

 

where n is error code (32-bit long integer) defined by a

 

 

user.

 

PrgErr(N)

Returns the last program error of machine N, where N is

Integer

 

a value between -1 and 2. This operator can be used in an

 

 

AUTO_PERR routine to query about the recent failure. If

 

 

N = -1, the SimplIQ drive returns the last error code of the

 

 

machine from which this function was called. Note that it

 

 

makes no sense to call PrgErr(-1) from the interpreter.

 

tick

Reads the system time in internal units. This function

Integer

 

uses an internal timer unrelated to the system

 

 

microsecond counter (refer to the TM command section

 

 

in the SimplIQ Command Reference Manual). As such, the

 

 

TM command timer can be modified by CAN SYNC And

 

 

Time Stamp, while the tick function timer is not affected

 

 

by any external event.

 

 

This function is used to implement the wait statement

 

 

(5.7.5). The tick(x) argument is the time difference used

 

 

in the wait statement. The valid range of the argument is

 

 

[0…32,000] milliseconds, a limitation based on the

 

 

implementation of the tock function (following). An

 

 

argument greater than 32,000 will abort the tick function

 

 

with an OUT_OF_RANGE error code. To read the system

 

 

time in internal units, set the argument to 0.

 

tock

Returns the time difference.

Integer

 

If internal = tick(x), tock (internal) will return the time in

 

 

milliseconds once internal = tick(x) has been sampled.

 

 

The tock function operates in a manner similar to tdif,

 

 

but it uses an internal timer, unrelated to the system

 

 

microsecond counter.

 

 

Note:

 

 

For a time difference greater than 32 seconds, the

 

 

function tock(internal) may return an erroneous result.

 

The built-in function call may be a part of a single expression.

Examples:

sin(3.14/3)

AC=abs(DC)

SP=SP+sin(3.14/2)

SimplIQ Software Manual

The Interpreter Language

4-11

MAN-SIMSW (Ver. 1.4)

 

 

4.2.6.5 Time Functions

The TM command is used to read the system 32-bit microsecond counter. The time difference from the present time to an older sampling of TM can be determined using two methods, as in the following examples:

QP[1] = TM ; ** QP[1] is used just as storage ….** Do something

QP[2] = TM -QP[1]; ** QP[2] is time difference in microseconds

QP[1] = TM ; ** QP[1] is used just as storage ….** Do something

QP[2] = tdif( QP[1]) ; ** QP[2] is time difference in milliseconds

Time differences can be no longer than 31 minutes. To pause for a given time in a user program, use the Wait function (section 5.7.5).

In a CAN network, the time counter can be changed by the CAN network master, in which case, the tdif(x) function may return a value different than the time elapsed since X=TM was sampled.

To prevent an external event from affecting the timer, use the tick function. The time difference between the present time and an older tick sampling can be determined by one of two methods, as shown in the following examples:

Example 1:

QP[1] = tick(0) ; ** QP[1] is used as storage only

. . . **Do something

QP[2] = QP[1]-tick(0); **QP[2] is the time difference in microseconds

Example 2:

QP[1] = tick(1000) ; ** QP[1] is used as storage only

. . . **Do something

QP[2] = tock(QP[1]); **QP[2] is the time difference in milliseconds

The tick( ) and tock ( ) functions cannot measure time differences greater than 32 milliseconds.

4.2.6.6 User Function Calls

The XQ command enables a user function call (see Chapter 6:). A user function cannot be called from the command line without the XQ command.

4.2.7Comments

Comments are texts written into the code to enhance its readability. A comment starts with a double asterisk (**) and terminates at the next end of line. The drive ignores comments when evaluating an expression. The Interpreter handles comments from the user program only.

SimplIQ Software Manual

4BThe SimplIQ User Programming Language

5-1

MAN-SIMSW (Ver. 1.4)

 

 

Chapter 5: The SimplIQ User Programming

Language

SimplIQ servo drives read a user program in Elmo High-level language (EHL)1 after it has been translated by the compiler into a sequence of virtual assembly commands (described in Chapter 6:). The Compiler, part of the Elmo Studio IDE, is integrated into the Composer. The compilation process can run off line inside the PC. It is not part of the SimplIQ firmware. Before the SimplIQ drive executes a user program, the program must first be compiled, and the compiled code must then be downloaded to the serial flash memory of the SimplIQ drive. By compiling code prior to downloading, text analysis can be performed offline, saving online time and boosting user program performance. Another advantage is that user syntax improvements can be made without upgrading the drive software.

A drive program is a list of commands in a certain order. A user program can be anything from a simple list of commands to a very complicated machine management algorithm. The compiled code stored in the SimplIQ drive is a list of commands in a certain order.

This chapter describes how to write, maintain and run user programs for the SimplIQ drive.

5.1User Program Organization

A user program is organized as follows:

Integer and floating point variable declarations

Program text, including expressions, commands, labels and comments

An exit directive, which may be used to terminate the program

Most Interpreter commands can be used in the program text. This feature is given for each command in the “Source” attribute of the command in the SimplIQ Command Reference Manual. Interpreter commands that cannot be used in a program are those that:

Upload or download data between the drive and its host.

For example, VR cannot be used for version identification (upload process).

Store data in the flash memory or retrieve data from the flash memory

For example, CD cannot be used to reload parameters from the flash memory. For example, XC## resumes a halted user program.

Are involved in executing the using program

1 The Elmo Clarinet, Mini-Saxophone and Saxophone digital drives use Elmo Low-level Language (ELL). The Elmo Studio (part of the Composer) can distinguish between these languages and activate the compilation process accordingly.

Loading...
+ 196 hidden pages