From: Kate J. on
I have a couple of questions:

a) Do you think I might need to 'Mark Block Parameters' and/or 'Mark Block Signals' in my own models, in order to get them working correctly? Under what circumstances would/wouldn't I need to do this?
-- As far as I've seen, the documentation tells me *how* to do this, but not *why*, so I'm not quite sure if I need to do it or not. (I see the general explanation that "tagging params allows the function xpcsliface to create To xPC Target interface blocks"... just not sure if I *need* to do this or not; the Mathworks engineer I consulted with, had said I don't need to worry about this....)
-- Does marking block parameters always necessitate marking block signals, and vice versa? i.e., should I assume I need to do both? Or is it sometimes correct to do only one or the other?


b) I did read and attempt to implement the 2 sections you mentioned in your last post; in my very simple Target model (trying to emulate your own; named tgmdl), I right-clicked on my sine wave block, and in the Block Properties box, General tab, Description box, I typed
XPCTag(1) = sinewave;

Then, after I applied this change, I right-clicked on my signal being output from the sine wave block, chose Signal Properties, and in the Documentation tab, Description field, typed
XPCTag(1) = sinewave;

similar to the documentation's example. However, after I've saved these changes, when I execute >> xpcsliface('tgmdl') again, I still get the same error as before:

??? Error using ==> xpcsliface at 36
Can't generate tgmdl Simulink instrumentation model. No tagged xPC signals or block parameters found.

I've reread the documentation to be sure I haven't overlooked a step, but I can't figure out why I'm still seeing this error. Any suggestions? Maybe there is a more fundamental software setting that's not correct?
From: Kate J. on
Does anyone have any suggestions about either of my sets of questions in my last post above? Thanks in advance!
From: Kate J. on
bump
From: Gordon Weast on
Kate,

Using the tagging mechanism and xpcsliface is the easy way to get
the signal and parameter names correct.

Note, in the to and from blocks if you don't use xpcsliface but
work directly with them, the first parameter is populated with
two single quotes. That really is an error. For instance if
you have the xpcosc demo model that first entry should be
xpcosc, not 'xpcosc'. You don't want the quotes.

Tagging a signal line gives that line a name that you use in
a from xPC Target block. That's the most descriptive way of
naming. Otherwise, the signal name is the name of the last
block that drives the signal.

For instance, with xpcosc, if you want to pick up the output
of Gain2 without tagging it, you would fill in the from block
with:

xpcosc
Gain2
1 or .01 or whatever
<default or not>

If you tag the signal with xPCTag(1)=drive; (Note the capitalization!)
then you use drive instead of Gain2 as the signal name. If the
signal is in a subsystem, the signal name is also more complicated.

In your examples you have XPCTag instead of xPCTag, watch the capitalization.

For parameters there may be a problem with the actual name of the parameter
that you need to put into the block. Tagging uses the position of the
parameter in the block and then xpcsliface picks up the name you need to
use to get to that parameter.

For instance, I created an extremely simple model with a sine wave block
driving an out block. In the sine wave block, I added the tag description:

xPCTag(3,4,5)=amp bias freq;

The prompt for the 3rd parameter is Amplitude
The prompt for the 4th parameter is Bias
the prompt for the 5th parameter is Frequency (rad/sec)

After running xpcsliface, I get 3 to blocks, with mask decorations and names:

decoration: Sine Wave
Amplitude
name: amp

decoration: Sine Wave
Bias
name: bias

decoration: Sine Wave
Frequency
name: freq

Note that for the last one, only the first word of the prompt appears
as the parameter name inside the 'to' block.

These blocks connect to the parameters in the sine wave block.

While it is possible to set these up by hand, it's easier to get right
using tagging and xpcsliface. As you're seeing, getting the name wrong
results in an error that doesn't really tell you enough. You know it's
wrong, but you have no idea what it should be.

The to and from blocks are sluggish unless the target machine is running
and the model is loaded on it. You have to wait through the target
communication timeout if the target isn't running.

Finally, double clicking on a 'to' block highlights the block that the
parameter is in. Double clicking again takes the highlight away. The
same for signals.

I hope this is enough to get you going.

Gordon Weast
xPC Target Development
The MathWorks


Kate J. wrote:
> I have a couple of questions:
>
> a) Do you think I might need to 'Mark Block Parameters' and/or 'Mark Block
> Signals' in my own models, in order to get them working correctly? Under what
> circumstances would/wouldn't I need to do this? -- As far as I've seen, the
> documentation tells me *how* to do this, but not *why*, so I'm not quite sure
> if I need to do it or not. (I see the general explanation that "tagging
> params allows the function xpcsliface to create To xPC Target interface
> blocks"... just not sure if I *need* to do this or not; the Mathworks
> engineer I consulted with, had said I don't need to worry about this....) --
> Does marking block parameters always necessitate marking block signals, and
> vice versa? i.e., should I assume I need to do both? Or is it sometimes
> correct to do only one or the other?
>
>
> b) I did read and attempt to implement the 2 sections you mentioned in your
> last post; in my very simple Target model (trying to emulate your own; named
> tgmdl), I right-clicked on my sine wave block, and in the Block Properties
> box, General tab, Description box, I typed XPCTag(1) = sinewave;
>
> Then, after I applied this change, I right-clicked on my signal being output
> from the sine wave block, chose Signal Properties, and in the Documentation
> tab, Description field, typed XPCTag(1) = sinewave;
>
> similar to the documentation's example. However, after I've saved these
> changes, when I execute >> xpcsliface('tgmdl') again, I still get the same
> error as before:
>
> ??? Error using ==> xpcsliface at 36 Can't generate tgmdl Simulink
> instrumentation model. No tagged xPC signals or block parameters found.
>
> I've reread the documentation to be sure I haven't overlooked a step, but I
> can't figure out why I'm still seeing this error. Any suggestions? Maybe
> there is a more fundamental software setting that's not correct?
From: Kate J. on
Thanks for your latest response, Gordon. You said:

>> Note, in the to and from blocks if you don't use xpcsliface but work directly with
>> them, the first parameter is populated with two single quotes. That really is an
>> error.
Great, this confirms what I discovered myself; trying to use the single quotes surrounding the filename didn't seem to work... glad to have confirmation.


>> Using the tagging mechanism and xpcsliface is the easy way to get
>> the signal and parameter names correct.
ok, thanks for the clarification. My game plan is to try to get your simple model working, and then decide if I should also use the xpcsliface function for my own model as well.
However, if there are only 4 parameters in the Mask Parameters box of the To and From xPC Target blocks, I'm still not sure why I'm apparently having so many problems getting these values right, when I verified twice with my Mathworks engineer that I had the right values for them... what other values could I enter??

Just to reiterate, here are my Mask Parameter values for:

To xPC Target block:
application name = Target_model (my target model's name)
Path to Block in target application = FromHost (the block in Target that receives Host's value)
Parameter name = value
Specify target name = TargetPC2

From xPC Target block:
1st & 4th parameters from To block repeated here
Signal name (block name) = TargetOut1 (name of desired output signal in Target model)
Observer sample time = 1


I corrected my capitalization error (xPCTag(1) = ...), and you were right, this solved that particular error. However, now when I execute xpcsliface('tgmdl'), I get the error:
Error using ==> add_block
A new block named 'tgmdlsimxpc/sinewave' cannot be added.

ans = taggedSrcBlks: {tgmdl/Sine Wave'}
taggedPortObjs: 272.0010


I executed xpcsliface('tgmdl') both before and after I added the "xPCTag(3,4,5)=amp bias freq;" tag to the sine wave block; however, both times, the output/error above was identical.

Also, in your earlier post, one of your suggested steps was:
>> Run xpcsliface('tgmdl') creating tgmdlsimxpc.mdl with a from xPC
>> block with attachment to 'tgmdl' and the signal 'sine'.
When I execute xpcsliface('tgmdl'), in addition to the output/error above, this new model with this same name (tgmdlsimxpc.mdl) is indeed created; however, it only contains a single block, named 'sinewave', that has 2 visible values within the block icon, 'Sine Wave' and 'SineType'. Again, this is the same both before and after I added the tag "xPCTag(3,4,5)=amp bias freq;" to the tgmdl's Sine Wave block -- i.e., I don't appear to get either the From or To blocks that you said I should...

Ever seen these problems before? Your advice is appreciated... thanks.