Find Average time in different flow paths - anylogic

Im currently building a Anylogic model and want to calculate average time spent by customer in different flow paths (I have added the process flow below). In the picture i have named the paths i want to calculate the average time as path A and path B

Anyligic has dedicated blocks for this (although it can be done simply in code).
See in detail here.
The TimeMeasureEnd block contains a dataset.
The following code returns the average of the Y-axis values:
timeMeasureEnd.dataset.getYMean();
Good luck!

Related

Reducing sampling in simulation

Is there any way in Modelica, to reduce the sampeling during simulations? I have a DCDC converter with high frequency, consequently generating huge dataset. I am wondering, if there is any way to reduce the size of the dataset during simulation/exportation?
Thanks
Trying to create smaller dataset from models that generate huge ones (models with high frequencies).
Basically when you simulate, do not press the -> press the S on the toolbar and you get several tabs and the ones you care about are General and Output.
In General you can specify the number of intervals to reduce the data stored. It will only be stored at each interval.
In the Output you can say not to store events for example. You can also filter out variables that you are not interested in to reduce the result file size. Note that "Equidistant Time Grid" is activated by default, if not this would generate quite a lot of output maybe even several times per interval.
See more here about the things you have in General/Output:
https://openmodelica.org/doc/OpenModelicaUsersGuide/1.20/omedit.html#simulating-a-model
By including our desired variables in the Variable Filter in Output tab one can reduce the size of the output file without compromising the interval points. Each entry follows a POSIX EXTENDED regular expression format, say:
for a list of x,y,z it is ^x|y|z$. Another best practice could be unchecking the flag Store variables at Events. The best answer for this question is already answered by Adrian Pop.

Parameter Variation in AnyLogic: Data for a specific variation

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).

How to obtain certain data from main on a graph using parameter variation in anylogic?

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.

How to Calculate 3 Phase Voltage & Current from Power (VA)?

I am trying to develop a MATLAB Simulink model that will help me study the load of my department.
The model works, however one of the blocks goes right over my head when it comes to understanding, as I used the internet to help me with it.
Here is the main block:
The Scope Displays the Voltage, Current & Power
The "dept01" block inputs the data from .csv file and contains only [Time,Power].
Here is what goes inside of the "Electrical Department" Block:
I have no problem understanding this part, I'm simply splitting the total power into three portions.
NOTE: I am also assuming that ultimately Q=0 so Total Power = Real Power
This is the Second Step of the "Electrical Department" block which I cannot understand in any way. Maybe my concepts are weak but this part makes no sense to me.
Can someone please explain it to me that how is the block calculating Voltage & Current using just the Power??? Also how does it imitate the function of a Load so that the Energy Meter sees it as a load?
Thanks!
Load can be emulated by connecting a current source in series with the voltage source as it is seen the diagram. In your case, the controlled current source has been used. It also looks like the dependent current source is derived from the voltage. I request you to give the details of relational operator used and the sigma block. Without which you can not derive the relation ship. If the current is dependent on the voltage like the case, voltage and current can be calculated simply from the power.

Average results from multiple simulations

I have a simulation with a lot of random components, so I would like to run many simulations and average the results (the result is determined by a variable called score).
How would you do this in Netlogo?
Currently I'm working on a program that will export the results to csv, then I plan to use python/excel to average them. I don't like this because I want to run 100+ simulations (so there will be 100+ files)... I'm hoping there is a better solution
EDIT or an implementation of what I described (I have to relearn enough python/vba to solve this, so it's going to take me some time)
This should be simple enough if you use BehaviorSpace.
In your experiment definition, put score in the Measure runs using these reporters textbox and uncheck Measure run at every step.
When you run your experiment, save your results using Table output. It will produce a csv that you can open in your spreadsheet application. From there, producing an average of the score column should be trivial.