Jump to content

Recommended Posts

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 (:).

Level Scope

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"

Definition Scope

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"

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
You are posting as a guest. If you have an account, please sign in.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...