I'm in the process of modelling a buck converter following the approach in Sam Ben-Yaakov's A unified SPICE compatible average model of PWM converters article in which he models a switched inductor using behavioural current sources (PDF link,) but I am running in to trouble when I try and make the switched inductor an LTspice sub-circuit.
Here is a toy example that produces the same error.
There is an independent voltage source V1 and a dependent behavioural current source B1, the current through B1 is related to the V1 by a simple expression.
If I now take B1 and make it into a sub-circuit I get the error
"Unknown circuit node "u1:in" requested in behavioural source"
It's obvious that the sub-circuit cannot access the node outside of it's self.
How can I give the subcircuit access to this voltage? It's not a parameter (in the usual sense) and it is not a node. Is there a way to pass the voltage in?