Multisim and Ultiboard

cancel
Showing results for 
Search instead for 
Did you mean: 

ABM Current Source - Referencing Nets in an HB/SC

Is there a way to reference nets inside an HB/SC using an ABM Current Source?  The ABM Current Source appears to only have the capability of referencing nets on the upper-level circuit and not actually within the HB or SC. This seems like it should be the other way around if it's going to be exclusive referencing some nets and not others.

To reduplicate:
  • Create an HB or SC with an Input Pin
  • Put a DC voltage on that pin as an input (ground the DC source)
  • Inside the HB/SC put a resistor to ground
  • The IO1 pin will have a net named IO1 for example
  • Create a grounded ABM Current Source in parallel with a resistor (any value, say 1 Ohm)
  • For "Value", put V(I01) and then run it - no current
  • For "Value", put V(1), which references the upper-level circuit input node - that results in current
V(I01) and V(1) have the same potential (they are the same line in essence), but the ABM Current Source doesn't recognize the net inside of the HB/SC
0 Kudos
Message 1 of 7
(5,631 Views)

I just wasted a whole morning trying to get this to work... Now I know why it doesn't!  

I too have an ABM source in a hierarchical block.  I can see the voltages that the ABM source uses in its equation are present, but the ABM voltage source refuses to generate a voltage.   If I test the ABM as a stand-alone circuit, it works fine!

 

Does NI know about this bug?

0 Kudos
Message 2 of 7
(5,616 Views)
Hi m3nth:

The issue you are describing is one of the challenges of using an ABM source. The reason you cannot use V(IO1) is uniqueness. In the particular case you've described, there is only one instance of the subcircuit/hierarchical block, so specifying V(IO1) seems to make sense. There can of course be multiple instances of that subcircuit, (I've attached an example as I understand your instructions), in which case V(IO1) is not unique, but V(1) is. This is why V(1) does work and V(IO1) does not.

When I use ABM, one of my last checks before simulation is to export the SPICE netlist (Transfer > Export Netlist), and check that the arguments in my ABM source expressions are correct. In your particular case, you would find that V(IO1) simply doens't exist.

I will enter a feature request to perhaps provide a warning that you are referencing a node that doesn't exist.
Garret
Senior Software Developer
National Instruments
Circuit Design Community and Blog

If someone helped you, let them know. Mark as solved or give a kudo. 🙂
0 Kudos
Message 3 of 7
(5,602 Views)

Hi Garret,

I stumbled onto the renaming of voltage and current sources as you describe and instead set my ABM to refer to node (net) names within the subcircuit/hierarchical block as these appear not to change.  Or are you saying they do change?  Are you saying node 33 becomes X1.33 where X1 is the hierarchical block name?

0 Kudos
Message 4 of 7
(5,599 Views)
Hi d-smes:

The behaviour you've described, renaming net 33 to X1.33 in subcircuits is expected. 'Under the hood,' Multisim is a SPICE simulator, and SPICE requires that these net names be unique (otherwise they are connected). Net 33 is renamed to X1.33 because there can be multiple instances of hierarchical block X1.

If you want to reference net 33 in hierarchical block X1, you need to reference it as X1.33, not 33. This is a tradeoff. We've given you the power to reference any node in the circuit with the ABM source, but that comes with the added responsibility to ensure that you reference the nodes correctly.
Garret
Senior Software Developer
National Instruments
Circuit Design Community and Blog

If someone helped you, let them know. Mark as solved or give a kudo. 🙂
0 Kudos
Message 5 of 7
(5,597 Views)
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.
0 Kudos
Message 6 of 7
(5,587 Views)
I think your suggestions make sense, so I've added a couple of requests.

1. Referencing a non-existent net (in any context) should give an error or warning.
2. Add an option to control the scope of each ABM source. When in a SB/HB, the ABM can be controlled to reference either any node, as in the way it works now, or get automatically translated to local scope, reference to V(A) in X1 becomes V(X1.A).
3. Allow referencing connectors, such as IO1, which do not exist in the netlist.
Garret
Senior Software Developer
National Instruments
Circuit Design Community and Blog

If someone helped you, let them know. Mark as solved or give a kudo. 🙂
0 Kudos
Message 7 of 7
(5,559 Views)