%: Div Block.
MJMcCann-Consulting

Division: normal or modulo giving remainder.
MJMcCann-Consulting Logo

%: Div Block.
The use of division, as between two variables (not constants), in simulation of real world systems is actually rare. It also runs the risk of division by zero which, implicitly defining a singularity, is a nonsense in a realizable system. Mostly the action needed is division by a constant which is better done as multiplication by the reciprocal.
However, division does appear and this block provides it.
The extra feature, that does have relevance to real systems is the modulo division, where what is needed is really the remainder.
Rotating machinery, batch processes, daily events all are driven by or involve cyclic variables.
Hence the second mode of this device does modulo division and returns the remainder. The scale factor from the Pn value + pp is used as a multiplier after the modulo division is done so that things like converting radians to the range 0 to 2.PI can be followed by rescaling to degrees. If normal division is done then it serves simply as a second multiplier.

Variables in Use.
The division performs [(Va+aa) - (Vb+bb) divided by [(Vc+cc) - (Vd+dd)]
Where Vb is the value at the output of the block designated by An, etc.
In the default mode [Mode 0] it does the normal division and in the modulo mode [Mode 1], it delivers the remainder. After division or modulo operation (if used) the scaling by the Pa value is done.

% Div Block
Procedure ActivateDiv(ii:integer); //Division (% symbol) normal or MOD
var ratio, divisor, X: real;
begin with B[ii] do begin
if OnOff=0 then EXIT;
Pv:=B[Pn].Vn + pp;
X:= (B[An].Vn+aa -B[Bn].Vn-bb) ;
divisor:= (B[Cn].Vn +cc - B[Dn].Vn-dd) ;
if Divisor=0 then Divisor:=TinyNumber; // to avoid divide by zero
ratio := X / divisor;
case State of
0: Vn:= ratio ; //normal division scaled
1: Vn:= X - divisor*floor(ratio); // modulo division allows real values.
end{case};
Vn:=Vn*Pv; //scale by Pv after modulo if applicable.
end{withBii};
end{proc};

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: div.htm