Info

This question is closed. Reopen it to edit or answer.

Problem with a generated model from Simulink Coder, the results are not the same!!

1 view (last 30 days)
I have a Simulink model with few blocks: Matlab fcn, Discrete Derivative, Discrete Integrator and Inport and Outport. Using the ert_shrlib.tlc system target file I have generated a DLL and after some adjustement in Visual Studio I build the model. After this I try to see if it works good, but using same values in input for the Simulink model and this generated model I obtain different output. I tryed to solve the problem even changing the DiscreteTimeIntegrator_gainvalue or also declare a variable after Initialise() or step(), the results is always different. The differerence is some units but should really be the same and I can't figure out why it isn't! Do you have any suggestion or idea?
  2 Comments
Eshwar
Eshwar on 29 Sep 2015
How do you supply the inputs in visual studio? For your model, can you try comparing numerical results from normal mode simulation, with software-in-the-loop mode? Are the differences within the numerical tolerance (eps) for the type? If they are different, you should contact MathWorks technical support.
Luigi
Luigi on 27 Oct 2015
Thanks for your answer: -the inputs in visual studio are given declaring the variable simply; -and no unlikely the error was bigger. I solved the problem adding a unit delay block so that the calculation is sinchronized with the intial condition given from the Discrete time Integrator at the first step, even if in Simulink this doesn't make sense when build the code, it's working!

Answers (0)

Community Treasure Hunt

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

Start Hunting!