TCP Client block, cannot make the "Remote server IP address" an instance parameter

4 visualizaciones (últimos 30 días)
I sucessfully developed and tested a Simulink real-time model that uses two TCP Client blocks, and a TCP Receive and a TCP Send block.
The two client connections represent the interaction with one external device.
Now I would like to integrate this in a larger contect, where I have two instances of this model, to interact with two instances of the external device. The only difference between the instances is the target IP address.
I tried and failed with two approaches
1) Model Reference with Instance Parameters (new to me)
As I'm trying to follow instuctions to set up the instance parameter, I can't get the "remoteAddress" parameter, which is a mask parameter of the TCP Client block, to show up in the Model Data Editor
2) Masked Library block
I put my functionality into a masked library block, where I'm trying to pass the IP address as a mask parameter at the library level down into the "remoteAddress" mask parameter of the TCP Client blocks.
That appears to work, but now I'm getting error messages from the associated TCP Send and TCP Receive blocks... They have a "Send using..." drop down mask parameter which gets populated based on the available TCP clients in the model, and that fails to uddate.

Respuesta aceptada

Vinayak
Vinayak el 2 de Ag. de 2023
Hi Kai,
Firstly, some common issues for variables not getting populated in the model data editor are as follows:-
  1. Incorrect Configuration: It's possible that the variables are not properly configured to be displayed in the Model Data Editor. Double-check the configuration settings of the variables to ensure that they are set to be visible in the Model Data Editor.
  2. Masked Subsystems: If the variables are defined within a masked subsystem or a referenced model, they might not be directly visible in the Model Data Editor. In such cases, you may need to navigate to the appropriate subsystem or model and access the variables from there.
  3. Variable Scope: The variables that are not appearing in the Model Data Editor might have a different scope than the variables that are visible or might be defined in a different workspace or script that is not currently accessible to the Model Data Editor. The Model Data Editor typically displays variables that are scoped to the base workspace or the model workspace. Make sure that the variables you want to see are defined in the appropriate scope.
Secondly, Since the mask parameter fails to update,
I would suggest you to go to the "Callbacks" section in your Simulink model and place the code which updates the mask parameter inside the "InitFcn" which would update it everytime the model is updated.
More information about callbacks can be inferred from here.
https://www.mathworks.com/help/simulink/ug/model-callbacks.html

Más respuestas (0)

Productos


Versión

R2023a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by