MATRIXx

cancel
Showing results for 
Search instead for 
Did you mean: 

Dependency detection for simulation of models including ucb block(s)

Running sim() function for the models that include a ucb block will automatically
invokes the make utility to build the required shared object "simucb.so.1.0".

If the main C file (which is indicated by the block "file name" parameter) of ucb
block is changed then the make utility will be invoked before the simulation is started.

This works fine if the ucb only requires a single C file. However, if the ucb requires other
C files (or libraries) the sim() does not detect the dependencies correctly.

To illustrate the problem, consider that a ucb requires ucb.c as the main file
and also requires file1.c and file2.c (which are indicated in the Makefile).

simucb.so.1.0 will be re-built each time that ucb.c file is changed. However, if
file1.c or file2.c are changed the sim() will not build the simucb.so.1.0 eventhough the makefile
recognizes simucb.so.1.0 to be dependent on file1.c and file2.c,- The sim() will
not call the make utility in the case of changes to file1.c and file2.c.

Any suggestion to resolve this issue?
0 Kudos
Message 1 of 5
(8,063 Views)
Hello,

I am working to try to replicate what you are seeing. I should have that very soon. I also need the version for Xmath. On the mean time, you could call each c file with an independent ucb block or call the make file manually.

Thanks
Ricardo S.
National Instruments
0 Kudos
Message 2 of 5
(8,046 Views)
Hi,

We are using xmath 7.1.4 on Solaris.

Just to clarify, the multiple C-files are all related to a single ucb file and cannot be separated.

To illustrates the problem, I attach a zip file including:

1- example.xmd: sysbld model
2- usr01.c: ucb c code
3- myfile.c: implementation of getGain() function required by usr01.c.
4- makefile

You can see that sim() will rebuild the simucb.so.1.0 when usr01.c is changed and will not
rebuild the simucb.so.1.0 when myfile.c is changed.

Note that calling unix "make" utility from the command line will always work correctly.


Thanks
0 Kudos
Message 3 of 5
(8,028 Views)
Hello,

I couldn't open your files, but we have created something similar to what you described. In a Windows environment it does work fine, so now I will try to get a Solaris machine to test it. I will let you know as soon as I am done with it.
Thank you

Ricardo S.
National Instruments.
0 Kudos
Message 4 of 5
(8,015 Views)
Another thought in the mean time is to use the remake keyword with the sim, analyze and other functions that need to compile the model. The remake keyword forces a recompile of the UCB files even if MATRIXx does not see them as changed. Since it is recompiling it means that it takes a bit longer, so it would be best if you can use it selectively (when you know that you have made changes to a file).

Carl L
National Instruments
www.ni.com/matrixx
0 Kudos
Message 5 of 5
(8,011 Views)