Jump to content
andyer

global variables in Diagram Context

Recommended Posts

Hello Activate enthusiasts!

 

Does Activate support global variables in Diagram contexts (OML)?   I see cases where it works (constant sources) and where it doesn't (MathExpressions/MatrixExpressions) from my testing (attached is an example).  Just wondering if it is supposed to work or not :)

e.g.,: Define in the Diagram context:

global var_a var_b var_c

 

Use var_a, var_b, var_c as parameters in the blocks within the superblocks.

 

I'd like to define a set of variables in a SuperBlock context and then use those same variables in another SuperBlock context to keep the variables encapsulated in the two superblocks and only define the variables in one place to make it easier to use.  (For example, define Vehicle data in only one place instead of multiple places).   What I would like to do is somewhat analogous to SignalScoping, but for constant (variable) values in the Diagram Context.

 

The workaround is to define the variables one level up, then all children get these variables.  But then the variables aren't defined locally to the superblock which I like to keep the data organized.   I guess this is fine, just wondering if I might be able to use global variables to make this work.    Other ideas are welcome, too :)

 

Thanks,

 

Andy

global_variables_test.scm

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.


×
×
  • Create New...