f



Simulink: How to manage the step size during the simulation

Simulink: How to manage the step size during the simulation 

Here is the description of my system

1. Start time = 0.0, Stop Time = 87600 (in hours, This Means 10 years)
2. Fixed-step size = 1.0
3. State of the system evolves slowly, with Fixed-Step size = 1.0, I got satisfactory results.

I am now working on another system and I have a big problem with running time: During the first year, the state of the system evolves slowly, Fixed-step size = 1.0 is sufficiently accurate. But in 366ieme days, during 24 hours, it will change very rapidly, the step size = 1 is not enough. We have to use time step much smaller: 1 / 36000 (0.1 seconds). Of course I can use step size = 1 / 36000 during 10 years, but the execution time is too long ....

The ideal solution would be to use two different time steps,
1. Step size = 1 during the period [0, 8760]
2. Step size = 1 / 36000 during the period [8760, 8784]
3. Step size = 1 during the period [8784 87600]

Do you how to fix this? 
0
ludonglu (2)
6/17/2011 10:04:04 AM
comp.soft-sys.matlab 211266 articles. 23 followers. lunamoonmoon (257) is leader. Post Follow

2 Replies
682 Views

Similar Articles

[PageSpeed] 37

There's not really anything to fix -- you can't change the step size during simulation.

You'll need to run the simulation 3 times, over different time periods.
Save the state variables after the 1st and 2nd time periods and use them to initialize the state variable for the 2nd and 3rd time periods.

Phil.
0
phil9363 (124)
6/18/2011 2:00:19 AM
"Phil Goddard" <phil@modeling-simulation-visualization.com> wrote in message <ith0rj$hus$1@newscl01ah.mathworks.com>...
> There's not really anything to fix -- you can't change the step size during simulation.
> 
> You'll need to run the simulation 3 times, over different time periods.
> Save the state variables after the 1st and 2nd time periods and use them to initialize the state variable for the 2nd and 3rd time periods.
> 
> Phil.

Thank you very much. I am trying to do this. 

1. At the first time, I use Fixed Size = 1.0 and I save SimState variable (xFinal), the simulation run is ok. 
2. At  the next time, before simulation, I chose Initial state = xFinal and I use the Fixed Size = 0.01 and Stop Time to 8684. But when I run the simulation I have following error: 

- Simulink cannot load the initial SimState because the model, 'periode8760_8784', was changed after the SimState was saved. Run the simulation again and resave the SimState.

The same simulation will be Ok if I use Fixed Size = 1.0 (as in first simulation).  I do not know how to  change Step Size (using SimState method). 



  
0
ludonglu (2)
6/23/2011 2:26:04 PM
Reply:

Similar Artilces:

How to manage Serial data with Matlab/Simulink?
Good morning, I'm facing this problem to solve with Matlab/Simulink. I've an other program that can manage a DLL made with Simulink. The problem= is that this program send the message(voltage waveform) in serial way to t= he DLL, therefore I've to create a function inside Simulink with an Input t= hat receive this serial data and put it in a vector (maybe it is better to = call it buffer). These data are send with a certain sampling frequency. It is a pleasure to get you suggestion. Best regards. ...

Soft handoff simulation in matlab #2
Hey all, I am having problem in soft handover implementation with MATLAB please help me out. It is my final dissertation .I am unable to do this. ..pls mail me at nikhilpatel0786@gmail.com Thank you very much... Please helpp "vpmp patel" <mecs@yahoogoups.com> wrote in message news:jkh46d$i9m$1@newscl01ah.mathworks.com... > Hey all, > I am having problem in soft handover implementation with MATLAB > please help me out. It is my final dissertation .I am unable to do > this. Then you need to talk to your dissertation advisor first; if he or she can't give you enough help, post SPECIFIC DETAILS about the problem you're experiencing with your implementation and ask a SPECIFIC question and someone may be able to offer some suggestions. -- Steve Lord slord@mathworks.com To contact Technical Support use the Contact Us link on http://www.mathworks.com ...

How to manage Serial data with Matlab/Simulink? #2
Good evening, I'm facing this problem to solve with Matlab/Simulink. I've an other program that can manage a DLL made with Simulink. The problem is that this program send the message(voltage waveform) in serial way to the DLL, therefore I've to create a function inside Simulink with an Input that receive this serial data and put it in a vector (maybe it is better to call it buffer). These data are send with a certain sampling frequency. It is a pleasure to get you suggestion. Best regards ...

Stateflow Model Simulation error in Matlab Simulink Environment.
Hi all, I am trying to simulate a STATE-FLOW model of a Single Input and Single Output system. The error which I am getting on Simulation is "Unable to locate a C-compiler required by Stateflow and MATLAB Function blocks. Use 'mex -setup' to select a supported C-compiler." Please suggest me the necessary action that can be taken for the ERROR RECTIFICATION. Thanks in advance. Sumanta Kumar Show Research Scholar National Institute Of Technology Karnataka Surathkal India "Sumanta " <show.sumanta@rediffmail.com> wrote in message news:lu1m87$q7q$1@newscl01ah.mathworks.com... > Hi all, > > I am trying to simulate a STATE-FLOW model of a Single Input and > Single Output > system. The error which I am getting on Simulation is "Unable to locate a > C-compiler > required by Stateflow and MATLAB Function blocks. Use 'mex -setup' to > select a > supported C-compiler." Please suggest me the necessary action that can be > taken for the > ERROR RECTIFICATION. Well, did you try using the command "mex -setup" to select a supported C compiler as the error message instructed you to do? If so, what happened when you did? -- Steve Lord slord@mathworks.com To contact Technical Support use the Contact Us link on http://www.mathworks.com ...

Simulink - Embedded Matlab Function
Hey all, I'm trying to convert a .m file into something usable by a user defined function block in simulink but am having trouble with the following style of equation: x = exp([-y:y]); where y is an integer which normally has a value between 40 and 120. Running this through simulink results in the following error: ------------------------------------------------ Computed maximum size of the output of function 'colon' is not bounded. Static memory allocation requires all sizes to be bounded. The computed size is [1 x :?]. Function 'testing.m' line 8, column 14: "[-y:y]" ---------------------------------------------------- I know simulink doesn't like variably sized arrays/matrices but I'm not sure I can set an upper bound in this case since it's referring to the operation itself rather than x or y. Anyone know of a potential work around for this? Cheers. What sort of user defined function: Embedded MATLAB, S-Fuction, MATLAB Fcn Block? Is y and input? Is x an output? Or are they local variables? Phil. "Phil Goddard" <phil@modeling-simulation-visualization.com> wrote in message <j020k4$gkv$1@newscl01ah.mathworks.com>... > What sort of user defined function: Embedded MATLAB, S-Fuction, MATLAB Fcn Block? > > Is y and input? > Is x an output? > Or are they local variables? > > Phil. Sorry should have been more clear. It is an Embedded Matlab Function block, x and y are just local v...

Simulation simulation?
Hello all, I am looking for a good software to simulate a software. For training purposes we would like to simulate an ERP software. That means we would like to take screen shots of the software we want to teach and then simulate the processes which are done with the real data and only show the results to the trainee. Of cause that can be done with p*werpoint, but we would like to have different paths, choosen by selections made on the screens. Any hint would be appreciated! Thank you in advance, Stephan. ...

MATLAB Simulink?
Dear All Can you please confirm if this forum belongs to MATLAB Simulink questions as well or this is another discussion forum for these issues? Thank you in advance hadi motamedi <motamedi24@gmail.com> wrote in message <93146fc1-d029-4270-84e1-1e6b8cd3f144@h17g2000yqn.googlegroups.com>... > Dear All > Can you please confirm if this forum belongs to MATLAB Simulink > questions as well or this is another discussion forum for these > issues? > Thank you in advance Hi Hadi, You can certainly post Simulink questions here. Wayne "hadi motamedi" <motamedi24@gmail.com> wrote in message news:93146fc1-d029-4270-84e1-1e6b8cd3f144@h17g2000yqn.googlegroups.com... > Dear All > Can you please confirm if this forum belongs to MATLAB Simulink > questions as well or this is another discussion forum for these > issues? Questions about MATLAB, Simulink, or any MathWorks product are on-topic here as are questions about programs written by users using any or all of those products. For future posts please use a more descriptive subject line, one related to the question you're asking. It makes it easier for people that are interested in the type of question you're asking to find your question. Just keep in mind that this is not the official Technical Support mechanism; if you're having trouble installing or with your license, or if you want an official Technical Support response, see my signature for instructions on ...

Simulink in MATLAB
Hello folks, I understand that most of the modelling community tend to call Simulink models from MATLAB using the 'sim' command and this makes sense since most of the 'clever stuff' is developed in Simulink and MATLAB would be just used for initialisation and post-processing. However I'm in a situation where I have inherited a model that is largely in MATLAB; but there is a small component in it that needs to be turned into Simulink for code-generation purposes. The Simulink model will be called up at say every 6 'system model ticks', fed in 6 ticks worth of data which then gets processed. This processed data is then used back in MATLAB in the other bits of the model. The system model on average has around 1000-2000 ticks which means Simulink would be called up around 200-300 times which makes the model run way slower compared to the pure MATLAB version (ie where the simulink bit written in pure matlab). Since I cannot avoid using Simulink, are there other ways to interface my simulink model with MATLAB model efficiently ?. I am aware that one can turn simulink models into .exe and then call it up using the '!modelname' syntax. It is also possible to code generate from Simulink and interface it with MATLAB using MEX functions. Which of these approaches do you think would work the best ? Or do you guys have other suggestions ? Any advice much appreciated. Cheers Depends on at least what products you have licensed and h...

Simulink Simulation Model Controls Greyed Out During Running Of Simulation In LabVIEW...
Hello, &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; I have a simulation model that I have made in Simulink and we are running it in LabVIEW.&nbsp; I went through the SIT Connection Manager and loaded my model and put some knobs and charts down to change and monitor variables.&nbsp; I also went to the Mappings section of the SIT Connection Manager and mapped the corresponding parameters.&nbsp; So now that I have everything linked, I go and run the VI and a chart and two knobs are greyed out and I cannot monitor or change the values, but some of the others are working just fine.&nbsp; I am not sure why, I guess I am assuming that it is just a compatibility issue between LabVIEW and Simulink, but I wanted someone elses opinion.&nbsp; So if someone could shed some light on this, I would greatly appreciate it.&nbsp; Thank you. &nbsp; Michael &nbsp; &nbsp; Thank you both very much for the information!!! I will definately be looking into it deeper now.&nbsp; I have a better udnerstanding of what is going on.&nbsp; Thank you both very much! &nbsp; &nbsp; Michael ...

Simulation in Matlab
Hi, I am new in this group. Does anyone of you know how to make a model and then a simulation in Matlab !without! using simulink. Just using the Matlab code. I have done some simulation befor but i ever used simulink. thanx for reply el_loco el_loco wrote: > ly > > el_loco Derive the system of differential equations governing your system and use solvers like ode45 etc to solve them. Typing 'doc ode45' should get you started. HTH, Maarten -- =================================================================== Maarten van Reeuwijk dept. of Multiscale Physics Phd student Faculty of Applied Sciences maarten.ws.tn.tudelft.nl Delft University of Technology ...

How to/step by step guide to write/use matlab m-file
I found it difficult write on matlab m-file editor. It is because I dont know step by step guide on how to program on matlab. What could come first or what follows suit in programming I lack such knowledge. Please help. Thanks in anticipation. "HARRISON " <harrinov@yahoo.com> wrote in message news:j61872$bfl$1@newscl01ah.mathworks.com... > I found it difficult write on matlab m-file editor. It is because I dont > know step by step guide on how to program on matlab. What could come first > or what follows suit in programming I lack such knowledge. > Please help. > Thanks in anticipation. I recommend you read through the Getting Started section of the documentation; it's designed to give new users or users who have been away from MATLAB for a while the basic information they'll need to write programs. To access this documentation, type this command at the prompt in the Command Window: doc matlab Getting Started should be one of the links in the right-hand frame. Once you've gone through that, you can continue on with the Programming section in the User's Guide documentation for more information about more advanced programming techniques if you want. -- Steve Lord slord@mathworks.com To contact Technical Support use the Contact Us link on http://www.mathworks.com ...

MATLAB /SIMULINK question
I would like to ask how do i read the spectrum scope output in simulink its y axis is in dB from 0 to -100 and x axis from 0 to 0.5 in Hz. I find it weird since my filter response is surpossed to at much higher freq but the output on scope shows response within range of 0 to 0.5 on x axis in units of Hz On 22 Mar, 08:03, "Bryan" <s...@xilinx.com> wrote: > I would like to ask how do i read the spectrum scope output in simulink > its y axis is in dB from 0 to -100 and x axis from 0 to 0.5 in Hz. > > I find it weird since my filter response is surpossed to at much higher freq > but the output on scope shows response within range of 0 to 0.5 on x axis in > units of Hz Seems to me that the sampling frequency hasn't been set? If you don't set it yurself, a good implementation of an analyzer will use a default value instead. Fs = 1 Hz is a natural choise for such a default value. Rune ...

GUI and Simulink matlab
good evening all I have a GUI which orders a model of simulink, however I have to try to build a GUI which orders several models of simulink (links), but I finely find difficulties in the popone and callback! thus how to make a GUI which contains pop-up menu(links) which orders models of simulink? I votres assistances waits ...

Mouse Simulation in MATLAB
Can anyone please tell me "How to simulate using MATLAB code?" On Sep 13, 5:57=A0am, "Nitin Gove" <gove...@gmail.com> wrote: > Can anyone please tell me "How to simulate using MATLAB code?" For this you will need to learn how to program in MATLAB. In internet you will find very good tutorials on the topic. The documentation (PDFs) that come bundled with MATLAB and are an excellent resource too. Kind regards, Diego Andr=E9s ...

simulink matlab code
hello everyone. I m working on simulink based model for transient stability analysis of a multi-machine system. i have completely constructed the model using basic simulink blocks. But i m not able to include a program in the model to run the matlab model. I tried writing a program in a m-file and then executing the model still its not working. I get the same waveforms for all fault clearing time. Pls can anyone help ...

Matlab as Packet Simulator
Hi, I am new to Matlab. Can anyone please help me/guide me to create a network packet simulator where in I have to create a buffer queue to accommodate the packets and plot the characteristics of the wait time and packet loss. Thanks for your help in advance. ...

What is the step-size of fminunc?
Hello! I'm having some problems understanding the computations done by fminunc. At each iteration it reporst me the step-size, and I would like to set my TolX accordingly. Still I don't understand what fminunc computes to be the step-size. Using outputFcn I save the values of my X at each iteration. Euclidean distance between X at iteration 1 and iteration 2 is 48, max difference (max(abs(X1-X2)) is 3.7. Still fminunc reports the step size at iteration 1 to be 6e-10, at iteration 2 0.38 and at iteration 3 0.0033. What's step-size for fminunc?? Additional side question: the step size reported for iteration 1 is the step between which iterations? (1 and 0? 2 and 1?) ...

Problem with simulation in Simulink
Hello, I try to simulate two S-function blocks. Each of this blocks use the same 2 static libraries. Due to it, when I generate the 2 static libraries with Visual Studio 2010, in the project properties, I set the "Runtime Library" option to "Multi-threaded(/MT)". Afterwards, I generate the mex file including the 2 static libraries for each S-function and I "build" the Simulink model. Until here everything is fine, but when I try to run the Simulation, Simulink closes matlab and also itself and there is error message. I do not know if somebody has had already the same problem. I am stuck with this problem for some days and I do not know how to fix it. Any hint would be really appreciated. Thank you very much. Regards, waso. This has little to do with MATLAB or Simulink and everything to do with your S-Functions Somewhere in them you are stomping on memory that hasn't be allocated to you. Phil. Hello Phil, thank you very much for your answer. About the problem with Simulink is related with the memory. I did the debug and I got a similar error some time ago, and it was related to my C code; in this case the code in my library, because I was trying to access to some part of the memory where there was nothing. I am trying to fix it know. Once more, thank you very much. Regards, waso "Phil Goddard" <phil@modeling-simulation-visualization.com> wrote in message <j72imj$d03$1@newscl01ah.mathworks.co...

Matlab Function in Simulink not working
Hi, I have a problem running Matlab functions in Simulink. When I try running the simulink model the following error is given: Making simulation target "disc_control_sfun", ... C:\Users\JP\Desktop\sims\slprj\_sfprj\disc_control\_self\sfun\src>call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\\..\..\VC\vcvarsall.bat" AMD64 The specified configuration type is missing. The tools for the configuration might not be installed. 'nmake' is not recognized as an internal or external command, operable program or batch file. ___________________________ I tried searching online but i couldn't find anything...I think the problem is that it's trying to call the file which isn't placed in this path: "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\\..\..\VC\vcvarsall.bat" Is there any way to change this? Thanks in advance "Jean Paul Callus" wrote in message <jne2kk$97n$1@newscl01ah.mathworks.com>... > Hi, > > I have a problem running Matlab functions in Simulink. When I try running the simulink model the following error is given: > > > Making simulation target "disc_control_sfun", ... > > > > C:\Users\JP\Desktop\sims\slprj\_sfprj\disc_control\_self\sfun\src>call "C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\Tools\\..\..\VC\vcvarsall.bat" AMD64 > The specified configu...

Skipping some time steps in simulink???
Hi, I would like to know whether there is any command or similar facility in simulink that skips specified number of time steps if a particular condition is satisified?? Waiting for a positive reply. Thank you Kiran ...

BDI Agents with Matlab/Simulink
Hello everyone, i'm going to develot a Multi-Agent Simulation system using Matlab/Simulink. For the overall simulation i think Simulink is a very powerful tool to use. However i'm not sure how to implement the actual agents using BDI (Belief-Desire-Intention) Model? Are there any examples for BDI Agents developed with Matlab/Simulink? Is there any chance to insert agents from other frameworks (e.g. JADE)? Best Regards Sebastian JADEX ...

Calling simulink dll from matlab
Hi, I have a simulink model, which I via the Simulink Accelerator have generated into a .dll file. Furthermore, I have generated a m-file using this command: >> hfile = ['S:\J609_Barren Box\matlab\BBS 02 Simple GUI\SingleCell_v3_accel_rtw\singlecell_v3_acc.h'] >> loadlibrary('SingleCell_v3_acc.dll', hfile, 'mfilename', 'mxproto3') Then I'm able to load the library using: >> loadlibrary('SingleCell_v3_acc.dll',@mxproto3,'alias','SIMULATION') However, it does not seem to recognize this library (or the library does not contain any functions to be called), i.e. >> libfunctions SIMULATION No methods for class lib.SIMULATION or no class lib.SIMULATION. And if I try to use calllib: >> calllib('SIMULATION', 'singlecell_v3.bat',rain,evapPan,evapPET,Qinflow,Qoutflow) ??? Error using ==> calllib method was not found. I need to be able to run the simulation from Simulink in a matlab environment, so that I later can compile it to a stand-alone function. Thanks for your help, Soren ...

Simulink and Simulation Interface Toolkit
Hello, I have got LabView 7.1, Matlab 7.0 (R14), Simulink 6.0 (R14) and I work with Windows XP.I want to read in Labview a DLL created with Simulink and Real Time Workshop.I read that I have to buy the Simulation Interface Toolkit. Before buying it, I would like to know if I will be able to do so with my old software versions.And will it work in "realtime" that is to say how long does it take to call the DLL from Labview?Many Thanks,R�my No answer? Hi, If you will use the&nbsp;LabVIEW Simulation Interface toolkit, you need have : _&nbsp;MATLAB� or&nbsp;Simulink� vers.&nbsp;13.x ou 14.0-14.3 _&nbsp;Real-Time Workshop� version 13.x ou 14.0-14.3&nbsp;(The MathWorks, Inc.) _&nbsp;Visual C++ 6.0&nbsp;or Visual C++ .NET 2003 (Microsoft) _ and&nbsp;LabVIEW vers.&nbsp;7.1 (or higher) It's diffictult to give the time caused by LabVIEW for call the DLL, because it's depending of you computer and application. You can found on the link below a tutorial about how to create the DLL for call him on LV. <a href="http://zone.ni.com/devzone/cda/tut/p/id/3447" target="_blank">http://zone.ni.com/devzone/cda/tut/p/id/3447</a> Regards, Also note that you will need Simulation Interface Toolkit version 3.0 to work with LabVIEW 7.1. SIT 4.0 is only compatible with LabVIEW 8.5. Both these versions will work with your existing versions of third party software. ...

Simulink model within MATLAB
hi ...

Web resources about - Simulink: How to manage the step size during the simulation - comp.soft-sys.matlab

Simulation - Wikipedia, the free encyclopedia
... or behaviors/ functions of the selected physical or abstract system or process. The model represents the system itself, whereas the simulation ...

Simulation - Wikipedia, the free encyclopedia
... or behaviors/ functions of the selected physical or abstract system or process. The model represents the system itself, whereas the simulation ...

Simulation - Wikipedia, the free encyclopedia
... or behaviors/ functions of the selected physical or abstract system or process. The model represents the system itself, whereas the simulation ...

Simulation - Wikipedia, the free encyclopedia
... or behaviors/ functions of the selected physical or abstract system or process. The model represents the system itself, whereas the simulation ...

Glu Launches Kendall & Kylie Lifestyle Simulation Game on Mobile
... the release of Kendall & Kylie, its latest celebrity mobile game on iOS and Android. Starring Kendall and Kylie Jenner , the lifestyle simulation ...

Computer simulation fills in the blanks of Neanderthal extinction
A modern human and Neanderthal skull face off. (credit: By hairymuseummatt (original photo), DrMikeBaxter (derivative work) [CC BY-SA 2.0 (h ...

Shooting Simulations: What Do They Tell Us
Earlier, Anne Laurie posted about the recently staged, weapons free, mass shooting simulation/demonstration at the University of Texas. In that ...

Madden Super Bowl 50 Simulation: EA Sports Predicts Panthers vs. Broncos Winner - Bleacher Report
... got in Super Bowl 50? If you're having a hard time picking a winner, perhaps you'd like to know that the official EA Sports Madden NFL 16 simulation ...

This Mesmerizing Simulation Shows How Americans Spend a Typical Day
When it comes to a “typical” day, most of us are too wrapped up in our own routines to think about what others might be doing. Thankfully, this ...

Watch Caity Lotz and Brandon Routh Suddenly Realize That Their Space Simulation Is a Little Too Realistic ...
... equipped to make a trek into deep space. But mere days into the trip, things take a turn for the weird. Is this part of the simulation... or ...

Resources last updated: 3/30/2016 6:47:24 PM