MATRIXx

cancel
Showing results for 
Search instead for 
Did you mean: 

calling systembuild access commands from a UCB

Is there a way to call system build access commands from a UCB (e.g., using XmathCommand() call)?

The goal is to modify the same UCB or other blocks using SBA modifyblock and have the changes available during the same or the consecutive simulations.

Thanks
0 Kudos
Message 1 of 4
(7,279 Views)
Farshid,
If you use a SBA command through XmathCommand then it would affect the model that is in the SystemBuild browser. It will not affect the model of the current simulation. When a simulation is started the model is copied to a new process (simexe). The value of %vars are also copied from Xmath. There fore the changes would only affect the next simulation.
It would probably be more effecient to run the simulation and when it is done decide on the changes and use SBA before the next run.

Why do you want to modify the model while it is still running? What kind of changes do you need to do? Maybe there is some other way to accomplish it.

Carl L
National Instruments
Message 2 of 4
(7,278 Views)
Thanks Carl.

The reason to call SBA routines from a UCB is to automatically configure the UCB block parameters (such as number of parameters) and maybe the number of inputs/outputs or states.

Obviously, this can be done using a script, but, in this way all the setting is handeled directly from the UCB code and the risk of wrong parameter setting for the block is reduced.
0 Kudos
Message 3 of 4
(7,278 Views)
Farshid,
That is an interesting idea, but it would be hard to do since you would need to set the parameters before you run the simulation.

Setting up a script to do it for you would be a good idea. You could also use the same technique as UCB code that is generated by autocode with the procedure-only option. It has comment section before the function that gives the correct parameter settings. That way you can refer to that section when configuring the UCB block, and if you later have problems it is easy to verify that the correct settings are being used.

Carl L
National Instruments
0 Kudos
Message 4 of 4
(7,279 Views)