From: Kate J. on 30 Jun 2010 13:48 I believe that this is a straightforward question, but I haven’t been able to discover the solution by looking at the Mathworks documentation ('Inport' block info): I have a Simulink model “my_model” that contains a block (sub-level) named “Joint Angles”, which contains a bunch of blocks that specify joint angles to be plotted in an animation. I need to pass a value from the top level of the model into the Joint Angles block, so that this rapidly-changing value can be used within the Joint Angles block to update the animation. I successfully passed this value by inserting an Inport block to the Joint Angles block, which caused an input port to appear on the Joint Angle block within the main model, my_model. I routed my desired signal into this input port, and I confirmed (via scope) that it's being passed into the Joint Angles block correctly. However, as I mentioned, the Joint Angles block contains numerous blocks, each of which contains 2-3 constant values that specify the animation. I need to take the In1 value that I’m passing into this block, which changes rapidly, and specify this value as one of the (previously constant) values in the Joint Angles blocks. However, neither using “In1” nor the variable name (as specified in the my_model level) works: the former option generates an error message that says that there is an “Undefined function or variable In1”. The latter option allows the model to run, but no animation appears, because the variable name is apparently not recognized. Simply put, once I pass my variable into the sub-block “Joint Angles” using an Inport block, how can I “pass” this variable into one of the blocks that specifies the animation? Do I need to somehow assign this In1 block to a specific variable, and then use that variable name within the animation-specification blocks? If so, can anyone instruct how this can be done? Thanks in advance for your input.
From: Phil Goddard on 30 Jun 2010 16:45 You cannot. A signal, i.e. data that is being calculated/propagated down a black line and that "flows" though inports and outports, is very different from a parameter, i.e. data entered into a dialog box. Parameters are typically constant, and get evaluated during model initialization. Signals can/may/usually change from one time step to the next. If you have a block that needs to change its behaviour depending on the value of a signal then that block much be capable of accepting the signal through an inport. Phil.
|
Pages: 1 Prev: UITree Refresh without collapsing Next: writing values into excel column wise |