You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This lacks a bit of context. Is that supposed to work in @circuit macro? That doesn't support for loops in the first place. And it's not meant for such advanced uses. You achieve what (i think) you want like so:
circ = Circuit()
for i = 1:10
add!(circ, Symbol("v_$i"), voltagesource())
connect!(circ, (Symbol("v_$i"), +), Symbol("vsrc_$i"))
connect!(circ, (Symbol("v_$i"), -), Symbol("gnd"))
end
Also see the example at the very end of the documentation section on circuit desciption and note that you can create circ with the @circuit macro to populate it with the basic components and then still add to it programmatically.
Does this answer your question/solve your problem, or did I isunderstand?
Hi, yes I meant a bit of a pseudocode by writing a for loop. I see that it must be defined outside of the macro. I need the pins to have names that depend on function outputs, so I think your code here will work! Will try this out and let you know if it solves my problem. Thanks!!
Hi!
I would like to have netname for pins that is a function of external variables, such as
Currently the code will show that i is undefined due to the QuoteNode nature of the pins.
Thanks a lot!!
The text was updated successfully, but these errors were encountered: