Ho un problema nell'utilizzo, in simulink, del blocco Parameter Writer all'interno del blocco For Each Subsystem

3 Ansichten (letzte 30 Tage)
Salve, sto cercando di implementare su simulink all'interno del blocco For Each, dei blocchi Parameter Writer con lo scopo di attribuire ad un Subsytem delle proprietà che ho definito in un file.m esterno ma ottengo ogni volta questo messaggio di errore:
Parameter Writer block 'PROVA_FOR_EACH/For Each Subsystem/Subsystem1/Initialize Function/Parameter Writer15' is unable to write to the parameter 'InitialCondition' of the block 'PROVA_FOR_EACH/For Each Subsystem/Subsystem1/MODEL SYSTEM' because the block is initialized with a mask parameter or workspace variable on its dialog. Writing to such parameters using the Parameter Writer block is not supported.

Antworten (1)

Rajanya
Rajanya am 2 Sep. 2024
I understand that you are trying to implement ‘parameter writer’ blocks to assign properties to a subsystem. The error you are facing states that the ‘Parameter Writer15’ is unable to write its value to the ‘initial condition’ of the block ‘'PROVA_FOR_EACH/For Each Subsystem/Subsystem1/MODEL SYSTEM'.
This error is occurring because of a conflict between the parameter values that are already defined in your ‘external.m’ file which the subsystem initializes itself with, and the values that the ‘parameter writer’ blocks try to assign the subsystem. I was able to reproduce your issue with the simple example as shown:
The ’g’ parameter in the ‘Gain’ block has been defined previously in the workspace and the ‘parameter writer’ block is also connected to update the 'gain' value of the ‘Gain’ block. Updating or running this model throws the same error because of the reason mentioned above.
As a workaround, maybe you could try to remove the dependencies between the ‘parameter writer’ and the subsystem blocks which might cause conflicts at the time of initialisation/reset or remove those conflicting parameter variables from your ’external.m’ file.
Hope this helps.

Kategorien

Mehr zu Event Functions finden Sie in Help Center und File Exchange

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by