Prev: First steps -> Signal Procesing
Next: how to imshow images to GUI in a communication interrupt function?
From: Kate J. on 11 Sep 2009 12:14 Thanks for your helpful reply, Gordon! As I mentioned in my OP, I had already set the Mask Parameters field to the correct Target PC. However, your first suggestion was very useful; I changed my Default Target from PC1 to PC2. This allowed my example models to run without a problem! However, when I try to run the 2 models of my own, I get the following problem: After the Target model has been Built and loaded onto the Target PC, and has started running, I try to run my Host model. However, errors result from both my To and From xPC Target blocks within my Host model: Error for the To xPC Target block: Error in 'Host_model_v3b/To xPC Target ': Initialization commands cannot be evaluated. MATLAB error message: Error using ==> <a href="error:C:\Program Files\MATLAB\R2007b\toolbox\rtw\targets\xpc\target\build\xpcblocks\toxpcmaskinit.m,43,0">toxpcmaskinit at 43</a> parameter not found. Error for the From xPC Target block: Error in ‘Host_model_v3b/From xPC Target 1’: Initialization commands cannot be evaluated. MATLAB error message: Error using  fromxpcmaskinit at 62 signal not found. Given that, as I mentioned, the Matlab example models now run correctly, does anyone have an idea about what might be specifically wrong with my own Host model to cause these errors? Thanks!
From: Gordon Weast on 11 Sep 2009 15:07 Kate, For a moment I was worried that the problem was the old version of MATLAB, R2007b, but I was just able to create and run a pair of models just fine in R2007b. Target model: very simple, a sine wave feeding a target scope. The signal is tagged with the name 'sine'. Model name is 'tgmdl'. Run xpcsliface('tgmdl') creating tgmdlsimxpc.mdl with a from xPC block with attachment to 'tgmdl' and the signal 'sine'. I opened the mask on the from block and changed the target association to TargetPC2, where I built and downloaded the target model to. The host side model has the from block just connected to a scope block. I open the host side scope block and start the host side model in simulation. I start the target side model with +tg. The scope shows the value of the sinewave block just fine. There must be something wrong with the way you've set up your model pair. Generally, when you insert a block directly into your model from xpclib, instead of using xpcsliface to generate the model with the block, you have to get the parameter name correct for the 'to' block and the signal name correct for the 'from' block. Your error messages suggest that you don't have the names correct, hence the 'parameter not found' on the 'to' block and the 'signal not found' on the from block. How are you identifying the signal and parameter names to put in the to and from blocks? If you are using xpcsliface to generate the host model from a tagged target model, then the to and from blocks won't have names 'To xPC Target' and 'From xPC Target', but will be named from the signal or parameter name. It appears you've added these blocks manually and you don't have them set up correctly. Gordon Weast xPC Target Development The MathWorks Kate J. wrote: > Thanks for your helpful reply, Gordon! > > As I mentioned in my OP, I had already set the Mask Parameters field to the > correct Target PC. However, your first suggestion was very useful; I changed > my Default Target from PC1 to PC2. This allowed my example models to run > without a problem! > > However, when I try to run the 2 models of my own, I get the following > problem: After the Target model has been Built and loaded onto the Target PC, > and has started running, I try to run my Host model. However, errors result > from both my To and From xPC Target blocks within my Host model: > > Error for the To xPC Target block: Error in 'Host_model_v3b/To xPC Target ': > Initialization commands cannot be evaluated. MATLAB error message: Error > using ==> <a href="error:C:\Program > Files\MATLAB\R2007b\toolbox\rtw\targets\xpc\target\build\xpcblocks\toxpcmaskinit.m,43,0">toxpcmaskinit > at 43</a> parameter not found. > > Error for the From xPC Target block: Error in ‘Host_model_v3b/From xPC > Target 1’: Initialization commands cannot be evaluated. MATLAB error > message: Error using  fromxpcmaskinit at 62 signal not found. > > Given that, as I mentioned, the Matlab example models now run correctly, does > anyone have an idea about what might be specifically wrong with my own Host > model to cause these errors? Thanks!
From: Kate J. on 14 Sep 2009 12:36 Thanks for your detailed reply, Gordon. First, I tried to repeat the creation and execution of the simple models you described in your last post. I successfully created and named the Target model (tgmdl), as in your first step. However, when I next executed the command >> xpcsliface('tgmdl') , I get the error message: ??? Error using ==> xpcsliface at 36 Can't generate tgmdl Simulink instrumentation model. No tagged xPC signals or block parameters found. I'm not sure how to correct this error to proceed with your example. ___________ Regarding your suggestion that I have to get the parameter name correct for the To block and the signal name correct for the From block, and your question about how I'm identifying the signal and parameter names to put in the To and From blocks: Here are the essential features of my model (I can email files, if that's easier): In the Host model, there is a To xPC Target block, with the following Parameter Name: value -- I had previously had 'u0', my signal's name, in this field, but the Mathworks engineer who has been advising me, told me that I should have 'value' in this field instead. I also switched this back to u0, but the error message didn't change. The Host model also contains my From xPC Target block, with signal name/block name = TargetOut1, which is the name of the output signal in my Target model. I have also tried specifying 'ToHost', the name of my Outport block in my Target model, but again, either way I still get the error "signal not found" (with the From block highlighted) when I try to run the Host model. I'm stumped, because I appear to be specifying the correct signals/parameters needed. Could there be some other, more obscure setting, that needs to be modified? Thanks in advance for any suggestions.
From: Kate J. on 14 Sep 2009 12:51 To clarify my previous post: u0 is the output signal within my Host model, that I'm trying to send to the Target model. u0 is the input to my To xPC Target block in my Host model. In the Target model, I have a block named FromHost, whose 'Constant Value' parameter = u0. This is how I'm attempting to 'receive' this u0 value from the Host model.
From: Gordon Weast on 14 Sep 2009 13:12 Kate, You're missing a step. Please bring up the MATLAB help browser, and do a search for 'xPCTag'. The page titled 'xPC Target Interface Blocks to Simulink Models' contains information about how to tag signals and parameters so xpcsliface will find them. On this help page, look down for the sections labeled 'Marking Block Parameters' and 'Marking Block Signals'. That should help you out. Gordon Weast xPC Target Development The MathWorks Kate J. wrote: > To clarify my previous post: u0 is the output signal within my Host model, > that I'm trying to send to the Target model. u0 is the input to my To xPC > Target block in my Host model. > > In the Target model, I have a block named FromHost, whose 'Constant Value' > parameter = u0. This is how I'm attempting to 'receive' this u0 value from > the Host model.
|
Next
|
Last
Pages: 1 2 3 Prev: First steps -> Signal Procesing Next: how to imshow images to GUI in a communication interrupt function? |