Here's what it sounds like to me:
- Under the hood, Multisim is a SPICE simulator
- SPICE requires a unique list of net names or else it just won't work
- This is the lowest level of abstraction in terms of thinking
about the circuit - essentially it is the flattened view of the world
where all components are on a single page
- It might be likened to a computer program written in C++ which
gets compiled down to assembly level, where all the upper-level
variable names have now been replaced by their respective numerical
references
- This view of the flattened schematic is essentially the netlist that gets simulated
Now in order to make things a little more user friendly, Multisim has a
bit of UI abstraction -- that is, subcircuits and hierarchal blocks.
- These blocks get flattened into the netlist before simulation
- In the posted circuit example, net X1.IO1 is replaced by net 1 and net X2.IO1 gets replaced by net 2
- This is required at the lowest level of abstraction so that the
list of net names is unique (there is no duplication of a net named IO1)
- This is what everyone expects to happen for the circuit to be simulated properly
What is
not expected is that you can't reference nets in a
subcircuit or hierarchal block. I didn't entirely follow the last post
about referencing node 33 in a HB as X1.33, because when I tried that
with the posted circuit by making the ABM source value to be V(X1.IO1),
it doesn't work. Referencing a node like X1.IO1 is doing so at the
level of abstraction that the user interface is operating at, but it is
not translated correctly when the circuit is compiled to a netlist. X1
and X2 are flattened to their respective nodes--ie, X1.IO1 -> 1 and
X2.IO1 -> 2, but a reference in the ABM source to X1.IO1 does not
get translated -> 1, so you wind up with a reference to nothing in
the netlist (ie, X1.IO1 is referenced but the X1.IO1 net in the
subcircuit has been flattened/changed to 1, so there is no longer an
X1.IO1 net).
Now lets look at the case of an ABM source
inside of a
subcircuit or hierarchal block. This is where I definitely think a few
changes need to be made to Multisim. As has been stated, if we have an
ABM source inside of a subcircuit, we can globally reference any unique
net (ignoring for now previous headscratching over referencing nets
inside subcircuits). So say we have a single circuit, which among
other things contains a single subcircuit, which among other things
contains an ABM source. Even though the ABM source is inside of the
subcircuit, we can still reference anything in the main circuit, which
might be compared to something along the lines of having global scope.
This is a very powerful ability, as we are not limited to referencing
voltages or currents passed into the sub-circuit, but instead can
reference anything we like. So say we set the ABM to reference V(1) --
a voltage in the main circuit. If we now duplicate the use of
subcircuit so that now there are two 'instances' if it on the main
circuit diagram, the ABM source won't change. We don't expect it to.
It's referencing a net that is independent of however many copies you
make of the sub-circuit.
In the same way, we would expect Multisim to reference the net
correctly if we reference a local net, but this doesn't happen.
Multisim knows to translate the nets of the sub-circuit to correspond
with the actual connections of the main circuit so there are no
duplicate nets in the netlist, but this isn't implemented for the ABM
source. If it was, we would expect to be able to reference V(IO1) in
an ABM source. We would expect this to be local scope, not global, and
that any global reference to V(IO1) in an ABM source
outside of
the subcircuit would throw an error (but a reference to V(X1.IO1)
should work since we are specifiying the subcircuit and subcircuit
net). Inside of the subcircuit, we would expect that a local ABM
reference to V(IO1) gets translated to global reference of V(X1.IO1),
for whatever instance we happen to be in (X1 in this case), and
subsequently that V(X1.IO1) would be translated to the final connection
for the netlist before simulating, i.e. V(1). If the we were to
duplicate the use of the subcircuit so that there is an X1 and an X2,
then we would expect not to have to change anything, just like you
wouldn't change anything if you were making a global reference. Why?
Because we are referencing the local subcircuit net IO1, which would
get translated respectively to V(X1.IO1) -> V(1) for the ABM source
in X1 and to V(X2.IO2) -> V(2) for the ABM source in instance X2.
The problem currently, is that if we intend to have an ABM source
inside the subcircuit reference the voltage passed in on IO1 of that
subcircuit, we have to reference the global net which IO1 will be
connected to. If we duplicate the subcircuit then the ABM source is
still referencing V(1) instead of say V(2), which is now the net that
IO1 is connected to for the X2 instance of the subcircuit. This is
extremly counter-intuitive, especially for anyone used to programming a
function block with inputs and outputs, where the inputs are operated
on to produce the outputs.
So to boil it down, it seems that Multisim lacks a way to reference
subcircuit nets from within the subcircuit (and on the main schematic)
and have them be translated correctly when the netlist is compiled.
Here are some examples of items that seem like they should be translated correctly but aren't:
- Inside of X1, V(IO1) -> V(X1.IO1) -> V(1) in the netlist
- Inside of X2 the same V(IO1) -> V(X2.IO1) -> V(2) in the netlist
- For the main circuit, V(IO1) = ERROR (net exists but no subcircuit specified) (ie, could be V(1) or V(2), SPICE can't tell)
- For the main circuit, V(X1.IO1) is a correct reference and gets translated to V(1) in the netlist
For a specific example, say we model a device that has a fixed
relationship between the input and output terminals, where an ABM
source is used to simulate that relationship. Right now there just
doesn't seem to be a good way to model that, because you can't
reference the local input and output pins inside of the subcircuit. If you only have one instance of the subcircuit, you can change the ABM source to reference the global nets feeding the sub-circuit, but that nullifies the whole point of being able to duplicate the subcircuit and re-use the device model.