How to create a time varying constant?

26 visualizaciones (últimos 30 días)
Monika Jaskolka
Monika Jaskolka el 10 de Jun. de 2021
Editada: Monika Jaskolka el 24 de Jun. de 2021
I have data that I logged from my Simulink model using ToWorkspace blocks. This data is in the usual [Time, Data] format and a sample is attached. I have migrated this data into the data dictionary for the model, and now want to use it as input using a Constant block. However, I am getting an error:
Error in port widths or dimensions. Output port 1 of 'Model/Convert' is a one dimensional vector with 334 elements
It seems like it is reading the entire vector at once, instead of one element per time step. Is it possible to have a constant store time varing data? Note, I do not want to read this data into the model using FromWorkspace blocks because these blocks are not supported when using Simulink Design Verifier.

Respuesta aceptada

Walter Roberson
Walter Roberson el 11 de Jun. de 2021
Is it possible to have a constant store time varing data? Note, I do not want to read this data into the model using FromWorkspace blocks because these blocks are not supported when using Simulink Design Verifier.
NO. Simulink is permitted to reason about the effect that constants have on the output, under the assumption that they are indeed constant. It is permitted to uses them to reason about whether indexes will be in range, about whether derivatives will be singular, reason about whether an integration will overflow, reason about whether a variant system will be selected, and so on. If the constant could change with time, then that would not be possible.
For example, V1+1/R0 is fine when R0 is a constant that can be tested as not being close to realmin(), but if the "constant" were varying, then it would have no idea whether R0 is ever 0 or not.
If you have fixed input "constants" then you can in theory break your model up piecewise in time, verify, and glue the pieces together. Though using a lookup table like Markus suggests sounds reasonable if you can get Simulink Design Verifier to support those.
  1 comentario
Monika Jaskolka
Monika Jaskolka el 24 de Jun. de 2021
Editada: Monika Jaskolka el 24 de Jun. de 2021
You are right. I was thinking that by providing SDV with pre-recorded inputs it would allow SDV to perform range determination and assist with narrowing that state space of the analysis. However, this can be achieved with inport blocks that are adequately configured to have Min/Max information, as well as using SDV parameter configuration.

Iniciar sesión para comentar.

Más respuestas (1)

Markus
Markus el 11 de Jun. de 2021
You could use a counter that counts up and use data as a 2D Lookup-Table.
You can do this with a counter or with the timestamps and attach the clock if you use a fixed timestep.
Either way you would use Data.Data as Table data and either Data.Time as Breakpoints or [1:length(Data)] or length(Data.Data) respectively.
Is this going in the direction you want?

Categorías

Más información sobre Create Large-Scale Model Components en Help Center y File Exchange.

Productos


Versión

R2019a

Community Treasure Hunt

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

Start Hunting!

Translated by