I am working on anylogic as beginner, and I have issue with adding statistic into analysis.
I am unable to find any obvious question.
Please, let me clarify on this.
The matter illustrate in the image
Thank you
Asanka
Function is name of another class, used in AnyLogic. Using this name, you refer to the class, not to the agent type. Use full name of the agent type — modelPackageName.Function.Working. Also, you may simply rename Function agent type to FunctionAgent or other one.
Related
I have a model of a supply chain in which my agents "Product" pass through blocks in some agents (i.e. "Vendor", "Factory", "Wholesaler", and "Retailer") and I have a flowchart block in which the said agents in the supply chain use it. I would like to measure the time my agent "Product" spent, which its TimeMeasureStart is in for example its "Vendor" page and its following TimeMeasureEnd is in the said flowchart block like this. Now I have difficulty defining TimeMeasureStart in the TimeMeasureEnd block in the flowchart block.
I tried to use getRootAgent() but this way I couldn't access the timeMeasureStart block of the root agent so I couldn't try this.
Also tried to define a variable in the flowchart block page like this (and I know this way is wrong but I have no idea how to define a variable to suit TimeMeasureStart)
and then use it to define the corresponding TimeMeasureBlock the "Product" had passed: timeMeasureEnd Properties
but it gave me these 2 errors:
Type mismatch: cannot convert from TimeMeasureStart[] to TimeMeasureStart.
Variable must provide either dimension expressions or an array initializer.
Also tried set_startObjects but I didn't understand how to work with it and couldn't find the documentation in AnyLogic Help.
I really would appreciate any help.
(Also so sorry if the images are blurry, I don't know why their quality gets like this when I upload them.)
Either use
((Main)getRootAgent()).timeMeasureStart()
Or simply use
main.timeMeasureStart
Both take you back to Main. The former uses type casting, the latter is a direct link created by AnyLogic (assumes your timemeasureStart is in an agent embedded in Main)
I have been following the tutorial book "Anylogic in 3 days", in the last chapter airport model phase 6.
Setting up flights from MS excel spreadsheet, when I try to run the model after I finished all the settings, it says The method planBoardings(Flight) in the type Main is not applicable for the arguments ().
I have checked the tutorial and my model, I don't know where I did wrong.
is there anyone who had the same problem or can you tell me where I might be wrong.
I am really new to Anylogic, I really appreciate if anyone can help!
the model logic
startBoarding function I have defined according to the tutorial
the Main - Agent Type property
Not sure about the tutorial itself, but your function planBoardings does not need an argument flight.
Delete that as below:
You may also need to adjust the code. Change the line below:
such that it says create_DepartureEvent(dateToTime(f.departureTime), f)
Is there an easy way to figure out all places where a variable or parameter is being utilised in annylogic. Trying to locate where each variable is used can be a pain during debugging.
Sure. Just "ignore" it in the properties and compile the model.
You will get a list of errors for all places where it is called. Double-click on each error and AnyLogic even takes you there :)
Else, you can also use the AnyLogic search functionality.
in order to get some relief for that pain if your model is too big, all your variables should be private and you create setters, so each time you change your variable, you required to use a set function.
This doesn't solve your question, but it tells you what to do in future models to make it easier for you
check this video
https://www.youtube.com/watch?v=gNBfdB6YF7o
So, I'm pretty new with Anylogic, but have done a lot of tutorials and I have programming experience in Java. For my thesis I'm modelling a vehicle flow as a process. In the source block, I create custom agents (vehicles) with some parameters from the database. This works fine. Then I want to assign an electric parameter with randomTrue(0.5). For this, I call a setupTaxi-function, where electric ist set. The parameter for the randomTrue-function should be changeable, so I set it as an extra paramter anteilEtaxis (0.5).
After that, I want the vehicles to do different things depending on the value of electric using SelectOutput. I selected the Condition and test on agent.electric.
I basically did the exact same thing as described in the Anylogic help. And yet the framework always chooses the true Output port, no matter if the parameter ist set to true or false.
See the image for setup and parameters. I tested this via console (the first line is a println-call in source, the second a println-call in selectOutput.). Plus you can see that the parameter is set to different values, because the 3D visualisation model depends on it:
enter image description here
Also, I tried a few different combinations of setting the parameters, reading them etc... The only thing that will work is putting randomTrue(0.5) directly in the Condition box. This is not what I want though. So if you have an idea, what is wrong, please tell me.
This is a typical beginners problem.
I will assume you are calling the setupTaxi-function in your source in the "on exit" action... If you are doing that, then it's too late and the agent already made its decision on where it will go after the select output block.
You have to call your setupTaxi-function in 2 possible places:
1) In your source on the "on at exit" action
2) In your vehicle agent on the "on startup" action
Or even.. just make electric variable have a default value of randomTrue(main.anteilEtaxis)... that will also work.
I would like to add a post-build hook to my code generation process. However, when I try to associate a function with the simulink model's PostCodeGenCommand, I get the following error.
set_param(bdroot, 'PostCodeGenCommand', 'packNGo(buildInfo);')
A configuration set reference does not allow writing to parameters in the source configuration set
I don't really understand the error message, and it doesn't bring up any useful hits on my favourite search engine. Can anyone help me decipher it?
Unfortunately, I could not reproduce this problem on a simple simulink model, even if I included a reference model. (I thought that might be what the word "reference" was, um, referencing in the error message. And I've noticed previously that referenced models are handled differently to other models in the simulink code generator.)
I'm using R2015a, but have access to the newer versions if that would help.
Note that this question was originally posted on the Matlab forum, but didn't get any answers.
It turns out that the model was using a "configuration reference" rather than storing its configuration internally. The Model Explorer provides the following description
Configuration Reference
A model may reference a 'Configuration set' that is defined in the
source location rather than stored in the model....
This is useful for us because we use several models which all share the same configuration set. It's saved in a central place and all updates apply immediately to all models.
The side effect is that bdroot no longer has a PostCodeGenCommand associated with it. Instead, the command I was looking for was
configurationSettings.set_param('PostCodeGenCommand', 'packNGo(buildInfo);')
where configurationSettings is a variable in your workspace, and the variable's name should match the "Referenced configuration set name" in the Model Explorer.