I am very new to ANYLOGIC. I have used the tutorial to build the windfarm model and have run the simulation. Just looking to set the length of the simulation to 2 weeks and then export the data on number of turbines offline over the period.
There are 2 options
the first one is to change it in your simulation experiment:
this number corresponds to what your model time units are that you can change in your initial project properties
another option, is to do it by code, you can go to Main on startup and use this code:
getEngine().setStopTime(2, WEEK);
Related
I am using parameter variation in AnyLogic (in a system dynamics model). I am interested in how one parameter changes with the various iterations. The parameter is binary: 0 when supply of water is greater than demand and 1 when supply is lower than demand. The parameters being varied are a given percentage of decrease in outdoor irrigation, a given percentage of decrease in indoor water-use, and a given percentage of households that have rainwater harvesting systems. Visually, I need a time plot where on the x-axis is time (10,950 days; i.e. 30 years) and the binary on the y-axis. This should essentially show which iteration pushes a 1 further into the future.
I have watched videos and seen how histograms and 2D data are used to visualize the results of the iterations, but this does not show which iteration produced which output specifically. Is there a way to first, visually show the output as I have described above and second, return the data for a specific iteration?
Many thanks!
Parameter variation experiments have After Iteration and After Simulation run actions that are executed after each iteration and simulation respectively. Here, it is possible to access the values inside the simulation object after it finished but before it is destroyed. There is also a getCurrentIteration() method which can be used to control the parameter variation experiment and retrieve the data.
For more detail please consult here and see "SIR Agent Based Calibration" example model in AnyLogic example models library (Help -> Example Models).
I am having a hard time trying to solve a very easy issue I can imagine, but I just can't see it.
Namely, I am building a dynamic simulation model which calculates accumulated costs and benefits.
However, I have introduced a 5 year time span for the model but there are certain costs and benefits which occur only once (in the first year for example). But currently, the model is using these parameters in each simulation for every year. How can model it such that these values are only taken into the simulation once?
Surely there is some kind of formula which could help me with this. The AnyLogic support page did not help me either.
For applying values that change over time, you should use a "Dynamic Variable" object and set it to 0 after one year as follows (assuming "999" is replaced yb whatever value you want):
I am having trouble with the coding process or steps to extract data from the main and onto the parameter variation experiment in anylogic. I am currently working on total evacuation time due to random fire obstruction.
For now I have successfully obtained the total max evacuation time for 100 runs in my study but I also need another set of data for the number of exits obstructed during each run. My main has the collection (of 3 exits) availableExits and I can see what is obstructed during the simulation.
Furthermore, I would like to obtain data for the number of people evacuating at a particular time (for example number of pedestrians using exit at 120 seconds). I can see this in main from timeMeasureEnd and creating a histogram distribution graph, which shows number of pedestrians escaping at each time. I've managed to create one in parameter variation but when I run the experiment, I am unable to store or view the data as it keeps changing after every run.
Here is the code from analysis Histogram Data which is entered in after simulation run
data = root.timeMeasureEnd.distribution;
i would recommend to add a dataset to your main which would store all the values you want to keep in parameter variation. Dataset differs from histogram data in a way that it doesnt aggregate, it is just a raw array of values, and later you will not have a problem of "aggregating aggregated data".
So, after each simulation run you can access your dataset in main via "root" reference (as you are already doing it) and loop through it to store all the values one by one.
I am trying to make a simulation in Simulink, with the fuzzy model.
As inputs, I have set four time series variables from the workspace (compatible to simulink after performing Simulink.Timeseries function): every row of the variables has a linked time starting from 0 to 10566 (seconds, I believe). How can I set the sample time in simulink source block in order to pick every exact case without interpolation?
Thank you for your kind answers,
Phalaen
Are you using the From Workspace block? If so, it's simply a matter of specifying the sample time in the block parameters and unticking "Interpolate data". You can also display the sample time information of the model to check which sample time each block is using, see View Sample Time Information in the documentation.
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.