Signal Label Propagation in Simulink - simulink

I would like to follow the propogation of a signal in simulink in different subsystems in my M-script.
In the following example
I would like to be able to retrive the name In1 on the Inport block when i am out side the subsystem Subsystem. I am intresting as well in the oppsit situation, assuming i am inside subsystem Subsystem. I would like to be able to retrive the signal name which is outside Subsystem.

Related

What is the best way to build a model of automated system with neural network in Simulink (Matlab)?

I'm tring to build a model contating neural network in Simulink.
My idea is to compose a model which includes a controlled object (electrical drive), PID controller and NN block for fine-tuning of the PID controller.
NN training is provided for to be the reinforcement learning. NN calculates the koefficients of the PID controller, then it receives the feedback from the output of the object and calcucales the koefficients for the next cycle to minimize the static error.
I've build the model without NN successfully.
Now I'm triyng to add the NN block, and it puts me getting in stuck.
1). What type of block should I use to create NN? Are there pre-set blocks in Simulink for NN (in which I have to only set number of layers and neurons and finctions of activation and loss?) Or the only way is to build NN from zero?
2). As I know variables in workspace are updated only after end of modeling. If I want to change parameters of a block in runtime I need to use S-function block and 'set_param' function in it. So is it the only way to transfer object output to NN block? Or may be there a possibility for automative transfer in runtime (like between PID controller and controlled object)?
Or may be someone has a better concept for making such a model in Simulink (or even in another Matlab toolbox)?
Any thoughts and links appiriciate. Thanks in advance.
P.S. Model of the drive I took from http://pnu.edu.ru/media/ejournal/articles-2017/TGU_8_217.pdf

Simulink: Connection of simscape block and simpowersystems block

Please see the attached image of simulink block diagram. I am not able to connect the Simulink-PS converter to appropriate PS block. How shall I do it?

Matlab/Simulink: linmod fails for subsystem

Given a simple Simulink model Model with a single input, a single output and a transfer function in between, I can use linmod('Model') to get the linear state space model. However, when I put the same model into a subsystem called Subsystem under Model and I issue linmod('Model/Subsystem') I get the following error:
Error using dlinmod (line 147)
Subsystem block does not have a parameter named 'SimulationStatus'
Error in linmod (line 59)
[varargout{1:max(1,nargout)}] = dlinmod(model, Ts, varargin{:}, Args);
I am using Matlab/Simulink R2014a. How can this be fixed?
linmod only works for Simulink models, not subsystems. The input and output points for the linearization are those corresponding to Inports and Outports blocks at the top-level of the model.
If you have Simulink Control Design, you should use linearize, which is much more flexible and powerful (or the equivalent linear analysis tool).

Disable Zero-Crossing Detection for specific subsystem only

Trying to disable the Zero-Crossing detection for only a given subsystem ( User-defined Matlab Function Block) in my simulink Model, I referred to the Matlab Central Guide, however, for User-defined blocks, this option is not available from the block parameters Menu.
Does any one have an idea?
As you pointed out, MATLAB Function blocks are not part of the blocks that register zero crossings. Your options are either to enable/disable all zero crossings in the configuration parameters or to use a Stateflow chart in continuous-time mode. Alternatively, you can put your MATLAB Function block inside an Enabled/Triggered subsystem.

Input/output port in Simulink

Is there a way to create an input/output port in Simulink (some workaround)? The port would be a bus and some signals are set from outside the block while some signals are set by the block. Here is an example:
Given the following bus:
Flow (scalar)
Composition (vector)
Enthalpy (scalar)
I would like Flow to be set from outside the block (there's a pump downstream which sets this value). Composition and Enthalpy are computed by the block.
My solution so far: Make Flow an input into the block and with direct feedthrough set it on the outport. I don't find this solution intuitive because from a graphical point of view the outflow becomes an input into the block (which is true from a math point of view - but I would like to make the Simulink diagram intuitive). I've seen in Modelica the possiblity to create input/output ports (RealPort) and the signal could be read or written by the block. I would need such a feature in Simulink.
It sounds like you need to use Simscape and SimHydraulics, which do excatly what Modelica does, but within Simulink. Each physical domain is represented with through and across variables, which are flow rate and pressure for the hydraulic domain. However, that's extra $$/££/€€ and a new modelling paradigm (you don't think in terms of inputs and outputs anymore)...
If you stay with Simulink blocks, there isn't much else you can do above what you've already done, although I assume you mean the flow is set on the input, not the output.