W: Witch Switch.
In the default mode [Mode 0] the Witch is a multiplexer (MUX) and selects whichever channel is defined by the rounded value of the signal coming in on connection An.
Internally, the choice is forced into the range 0 to 4, with the zero selection producing zero output.
Channels B,C,D,P, are selected by choices 1,2,3,4 respectively.
Also in mode 0, if the value of An is zero, i.e. there is no connection made, then the selection will be controlled manually . L-click on the block and it will move on to the next value, returning to zero after the 4th connection.
Variants
In mode 1, the An input is ignored and the least input signal is selected.
In mode 2, the An input is ignored and the greatest input signal is selected.
These choices are made regardless of whether the Bn, Cn, Dn, Pn links are defined, so the bb, cc, dd, pp values are always included and can therefore define bounds.
Values used
The selection is made, on the basis of 'Round(Va)', between Vb+bb, Vc+cc, Vd+dd, Vp+pp
where Va is the output value from block An, etc.
The value of 'aa', which is not used in the rounding, is used internally as an index to show which selection was made so that the display can be changed appropriately, so there is no point in the user changing it.
Witch Block Code
Procedure ActivateW(ii:integer); //WitchSwitch, Multiplexer ,Min/Max selector
var Index: integer; //Va, used as index, controls the selection between B,C,D,P
//note that 'aa' is used as the selection marker for display.
Bv,Cv,Dv,Pv: real;
begin with B[ii] do begin
if OnOff=0 then EXIT;
Bv:=B[Bn].Vn+bb;
Cv:=B[Cn].Vn+cc;
Dv:=B[Dn].Vn+dd;
Pv:=B[Pn].Vn+pp;
case State of
0: begin //act as 4 channel (or zero) selector switch, controlled by A signal
Index:=max(0,(min(4,round(B[An].Vn)))); //prevent nonsense
aa:=Index; //for display purposes.
case Index of
0: Vn:=0.0;
1: Vn:=Bv;
2: Vn:=Cv;
3: Vn:=Dv;
4: Vn:=Pv;
end{case}
end {state 0};
1: begin //act as finder of least input signal from the 4, connected or not.
Index:=1; Vn:=Bv; //start by assuming Bv
if Cv
if Dv
if Pv
aa:=Index; //store the result in aa for use in display
end {state 1};
2: begin // act as finder of greatest input signal from the 4, connected or not.
Index:=1; Vn:=Bv; //start by assuming Bv
if Cv>Vn then begin Index:=2; Vn:=Cv end;
if Dv>Vn then begin Index:=3; Vn:=Dv end;
if Pv>Vn then begin Index:=4; Vn:=Pv end;
aa:=Index; //store the result in aa for use in display
end {state 2};
end {state cases};
end{withBii}
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
|