The Siemens Community Catalyst program was co-created with our community to acknowledge technology leaders who consistently contribute to the Siemens Community. Nominations are accepted on a rolling basis.
Submitted by Joe on Wed, 04/20/2011 - 21:23
When I copy a compound block with variables, the new instances have renamed variables. Is there a way to prevent that?
Submitted by Anders89 on Wed, 04/20/2011 - 21:44.
Yes. The renaming only happens to global variables that are defined within a compound block. Because a variable can only have one defining instance, the paste of a 2nd instance causes the rename to happen. The solution is to use local or definition scoped variables that can not be 'seen' outside of the compound. Then there is no renaming that takes place on the copy/paste. The following is taken from the VisSim help file on variable name scoping:
You can define which portions of the diagram can reference a variable by designating its scope. There are three types of scope: level scope, definition scope, and diagram (or global) scope. To limit the scope of a variable, simply prefix the name with one or two colons (:).
A variable with level scope cannot be referenced outside of its current compound block level. Variables with hierarchical level scope are referred to as local variables. Although level scoping is the most restrictive type of scope, it has several advantages. By limiting the region over which variables can be referenced, you can construct sections of a diagram without worrying about whether your variable names conflict with other names used in other parts of the diagram. In addition, users reading your diagram will know immediately that the variables’ use is limited to a small region.
Variables with level scoping are prefixed with the colon (:) character. I.e. ':foo'
Giving a variable definition scope allows the variable to be referenced not only in the compound block level of the diagram at which it is defined, but also at all levels beneath it. If compound block A contains a definition scope variable, all the sublevels below the compound block are able to reference and use the variable.
By using definition-scoped variables, you can copy or add subsystems to an existing diagram without breaking or misdirecting references.
To give a variable definition scope, prefix the name with two colon (::) characters. I.e. '::foobar'
Join us for a community conversation on how High-Performance Computing (HPC) and Simcenter PSIM work together to meet the increasing demands of modern power electronics simulation. During this one-hour technical session, you'll discover how leveraging HPC can speed up simulations, improve scalability, and empower engineers…
Join us for a community conversation on accelerating your motor simulation workflow with Simcenter Simlab. In this beginner-friendly session, we'll introduce the platform's automated model-building capabilities and show how easy it is to set up your first electric motor analysis. You'll see the basic steps of geometry…
Join us for a Community Conversation where we'll discuss practical approaches to analyzing complex electromagnetic models using hybrid solver techniques. This session will provide a general overview of how different computational methods can be combined within a single simulation to address models containing varied…