&: Signed Summation & Vector SumBlock.
MJMcCann-Consulting

Adds or Subtracts (4 channels) according to sign given to the links or does Square root of sum of (weighted) Squares
Scales output by any (variable) ratio.
MJMcCann-Consulting Logo

&:Signed Summation Block.
The default version of this block (Mode=0) is a simple adder, but the sign of the An, Bn, Cn and Dn values is noted and used to decide if the value from that block is to be added in or subtracted.
Furthermore, to take advantage of the available parameters to give more flexibility, the sum can be weighted and a constant value added. With an overall multiplier also specified, it can create any linear combination of the 4 input variables
With the default values it simply acts as a signed summation.

The overall formula is:
Vn=(pp +-Pv)*(aa +-Va +-bb*Vb +-cc*Vc +-dd*Vd)
where Va is the value from block An, etc.
With the default values (as created) it reverts to: Vn= +-Va +-Vb +-Vc +-Vd
Of course, you could make bb,cc and dd negative and really confuse yourself.

In Mode 2 it performs the square root of the sum of the squares of the values assembled as in Mode 0. Thus it can compute the length of a vector.
Until I think of something else to do with it, Mode 1 stays the same as mode 0. Higher modes don't work.

Summation Block Code
Procedure ActivateSum(ii:integer); //signed summation corresponds to symbol '&'
var Va,Vb,Vc,Vd, Pv : real;
begin with B[ii] do begin //Note 'aa','pp' are additive, 'bb','cc','dd' are multipliers
if OnOff=0 then EXIT; //sign of inputs is used for add/subtract
Va:= aa + Sign(An)*B[abs(An)].Vn;
Vb:=bb*Sign(Bn)*B[abs(Bn)].Vn;
Vc:=cc*Sign(Cn)*B[abs(Cn)].Vn;
Vd:=dd*Sign(Dn)*B[abs(Dn)].Vn;
Pv:=pp+Sign(Pn)*B[abs(Pn)].Vn;
case State of
0,1: Vn:=Pv*(Va+Vb+Vc+Vd); //weighted sum of inputs
2: Vn:=Pv*sqrt(Va*Va +Vb*Vb +Vc*Vc +Vd*Vd); //Sqrt of sum of weighted squares
end;{case}
end;
end;

MJMcCann-Consulting

Help Index:
Index/Search

Background
Simulation Concepts
Continuous Systems
Discrete Systems
McSimAPN Structure
McSimAPN Operation

Using McSimAPN
Start McSimAPN
Save Model,data
Create Blocks
Run-Hold-Reset
Link Excel+VBA

PetriNet Block Types
A activity/action
B belt conveyor
C container/constant
D diverter(random)

Analogue Block Types
E exponents
F flux/flow
G function Generator
H hysteresis
I integrator
J inductor
K logic element
L logarithms
M memory
N note/label
O oscilloscope/graph
p not assigned
Q quantizer/rounding
R relay on/off
S sin/asin/atan
T timer/clock
U user link Excel
V visual voltmeter
W sWitch selector/MUX
X multiply
y not assigned
Z random (fuZZ)
& signed summation
% division/difference
@ access/move values

Invitation. McCann can help if you have a design or operational problem that needs some technical support that is outside your team's experience, some quantitative assessment of what is really the cause of the difficulties, some design alternatives or just a fresh look by an intelligent interrogator.
If you have a problem with the behaviour of a market sector, plant, process or item of equipment and would like to get a quantitative handle on it to improve yield or optimise performance, then contact us. We are always ready to give a little time to discuss a new puzzle, in confidence, of course. We'll only worry about fees when we have some defined work. We can be flexible about how we work with you.
Top
MJMcCann-Consulting,
POB 902,
Chadds Ford PA
19317 USA.
T: 1 302 654-2953
F: 1 302 429 9458
E: mjmccann@iee.org
Request. Please let us know how you found this software and your interests by sending an email to mjmccann@iee.org Thank you Date: 2012.02.26
File: sum.htm