Overview

Overview

The Sum block computes the sum of several Inputs (2-6), each multiplied by a gain value. The sum is calculated at the rate specified by the Evaluate Block. A diagram of the Sum (2 Input) block is shown below:

Example

The following example demonstrates how to make a summation routine, where the model starts with a constant, then uses the Sum block to add the output to the constant after each sample.

In this example a 4 Input Summing junction is used to add Feed Forwards into the control loop.

The configuration values for this block are as follows:

 
K1, K2, K3...

Input gains. There may be up to six gains (K1..K6) corresponding to the number of inputs.

Ts

Sample period for the algorithm. This is the cycle time of the algorithm in Simulink simulation. This value has no effect on the execution of the block on the controller.

Evaluate Block This block allows you to specify whether the block executes Every Sample, Every Other Sample (Odd or Even), or Every Fourth Sample (and specify the First, Second, Third, or Fourth). This provides greater flexibility in controlling the execution of a model and to preserve performance for other areas of motion control.
User Defined Block Priority When selected, allows you to enter a Priority Code to modify Execution Ordering of this block. For more information, see Block Execution Order and User Defined Block Priority.
Priority For an explanation of how the Priority field is used by the MechaWare Model Downloader, see Block Execution Order and User Defined Block Priority.
User Data 0 Application-specific data. See User Data Storage.
User Data 1 Application-specific data. See User Data Storage.

Matlab/Simulink

Simulink Interface

The inputs are double precision values that are multiplied by their respective gains and summed to form the output.

The block has two user data fields (User Data 0, User Data 1) to store application-specific data for convenient storage and retrieval. See User Data Storage for details.

The block's update schedule is determined by the Evaluate Block. The following Parameter Dialog Box can be opened by double-clicking on the block in a Simulink Model (2 Input version shown):  

sum_sim2

 

C++ API

SUMBlock

Declaration

Public Method

 
class SUMBlock: public virtual Block
{
public:
	// User accessible coefficients
	long	nSum;
	double	Coeff[MFWMaxObserverSize];
};
  Required Header: mechaware.h

Description

The Sum block computes the sum of several Inputs (2-6), each multiplied by a gain value.

 
double nSum

Number of inputs (and gains).

double Coeff[ ]

Gain Array.

Methods

Block Methods