I have a 3 simulink models: the first is used as multiple-instance component inside the second; the second is a component inside the third (the third one is just used for testing purpuse and inkect test stimuli on the second).
If I simulate my model in "Normal" way all works fine.
If I set my HW configuration (ARM Cortex) and try to run it in "SIL" mode it doesn't work because "The component has an unsupported continuous sample time. Input and output ports with continuous sample times are not supported. To avoid this error you should update the component so that there are no continuous sample times crossing its boundary."
Same error also trying to simulate the first model (the inner one).
Do you have an idea to solve my problem?
Thank you.
Yes. Use discrete sample times, not continuous ones. You can display the sample times in your model to see which ones are continuous and you need to change, see the documentation for more details.
Related
I am working on the evacuation time of pedestrians by running 100 runs using monte carlo. I have trouble creating the graphs and am very confused in the steps. Something is missing and I am not sure what it is.
I have created a parameter variation experiment page and included a Histogram2D data and a graph from analysis but I don't know how to read the data I want from the main.
Below image is the data I am trying to acquire from the timeMeasureEnd which isn't linked yet.
I use the code
root.timeEnd
but get this error as shown below
You can directly access the timeMeasureEnd's internal dataset: timeMeasureEnd.dataset. See the AnyLogic example model Measuring Length of Stay, referenced in the documentation.
As for your error, your statement gets interpreted as a variable declaration. As soon as you put some useful code in there it works, eg. a simple assignment to a local dataset in your Experiment class:
dataset = root.timeMeasureEnd.dataset;
To save the longest measured time after each run:
add a dataset, deactivate update automatically
add a integer variable iteration to save the current iteration index
use the following in After Simulation run code:
iteration++;
dataset.add(iteration,root.timeMeasureEnd.dataset.getYMax());
I've developed a controller in Simulink and am trying to export it as a pure C class using Simulink coder for deployment on our microcontroller. We are using a fixed step solver in simulation, however, when the exported code gets used on our actual plant, the actual step size may change depending on load of the processor.
My concern is this: say I have set the fixed time step as 0.05s in simulation (and therefore the exported code assumes it is being executed every 0.05s), but then the microprocessor sometimes executes after 0.1s, and sometimes after 0.03s, etc. I think this would cause some unwanted behaviour.
Is there a way to have Simulink coder create a variable for step-time that we can adjust during run time? That is, measure how long it has been since the last execution, and then fill in the variable during each execution.
For an analogy, in videogame programming the update functions usually include a dt parameter so we know how long its been since the last frame.
The only solution I can find is to manually search and replace the step size in all the integrator blocks after the code has been generated. This, however, seems error prone.
I have two model references - Slow model and Fast model, each running at its own rate for concurrent execution on the grt "generic real time" . However when I attempt to build the block I get the following error:
Simulink cannot generate code for the signal at output port 1 of block
'Multirate/Fast' because the signal requires data transfer that
generates lock-free code for a rate monotonically scheduled task.
I am not sure what to configure in simulink to overcome this error. I attempted to add rate transition from the Fast model to the Slow model but the error remains.
Any thoughts
Since there are many possibilites I can't give you a simple answer but you can try the following:
Check if simulink can determine your sample rates... Did you configure that correctly (go to view and set sample rate colors) then you see if Simulink detects the execution times correctly.
If your Simulink Block ('Fast') is contained in a single subsystem make it an atomic subsystem... an configure the sample rate on the subsystem properties.
Set the strictest constrains in the rate transition block...
How is your Model configuration? is it set to multitaskig....
I'am trying to speedup my simulink project and want to use the Accelerator-Simulation mode.
The aim of my project is to control a cyclic process and is structured as followes:
matlab-script, where all parameters and a feedforward control with
parameter estimation is implemented. Also it starts simulating the
simulink model for each iteration.
simulink model, where the dynamic system and the feedforward control (basically a lookup-table) together with a feedback control
is implemented. Parameters of all blocks are set by workspace variables/structs generated by the script.
The feedforward control variable is calculated and parameter are estimated from the simulated data after every simulation pass. Then the model is simulated again. The model is not changing during the iterations, but still it is compiling at every cycle. From the first: Is this solution appropriate for using the Accelerator mode?
I tried to follow theses proposed steps to determine, why it is built at every iteration: mathworks
If i run it with the Accelerator-Mode (referring to the documentation of this function, it now compiles for simulation), I still cannot reproduce why it is compiled at every iteration.
csdet1.ContentsChecksum.Value ~= csdet2.ContentsChecksum.Value
is true, but the proposed code does not find any details.
csdet1.InterfaceChecksum.Value ~= csdet2.InterfaceChecksum.Value
is also true, the proposed code outputs that
UserDefinedTypesChecksum
is different. What does that mean and how can I resolve this?
Sidefact: When I run Simulink.BlockDiagram.getChecksum() with the Model opened in Simulink and Normal-Mode chosen, I get this error:
Continuous update specified for this chart chartname This is not
supported for RTW."
But this chart is a Matlab-Function block, not a stateflow chart?!
how to import a bitsream form binary vector from workspace into simulink.Actually I have found that I can use simin block or In block but my binary vector is independant of time. I tried to use Const block and it works but afer that when I wanted to put my output in the Buffer block in simulink, it didn't work because the input is continuous and not discrete. So I am asking if it's a way to add time to my binary uni-dimensional without having any influence on the result?and how can I do it?
Or is there another way to import this date to avoid this problem with Buffer block?
Your screenshot shows your constant block to have a sample time of Inf. As the error message suggest, you need to change that to a discrete sample time. In addition, you should also:
check your model is using a fixed-step solver
check what time step you are using for your chosen fixed-step solver (ideally the same as your constant).
You can have multi-rate models, but you need to manage the rate transitions with Rate Transition blocks. For more details on sample times, see the documentation, in particular how to view sample time information in a Simulink model. You should probably also have a quick look at the Choose a Solver section.