hiltsend.blogg.se

Anylogic
Anylogic




anylogic anylogic

Then you can access individuals via, e.g., myResourceUnits(0).getUtilization(). (3) If you set your resource pool up so that its agents are added to a custom population (rather than the 'hidden' default population), you can then access them explicitly at all times via that population.įollowing the earlier example, you create an empty population (let's say called myResourceUnits for agents of type MyResourceUnit) and set the Resource Pool to Add units to: Custom population (in its Advanced properties), selecting the population you've set up. However, that again contains them just as Agents, so you have to cast them e.g., (2) As in the the Library Reference Guides > Process Modeling Library > Resource functions help page, you have access to all the resource units an agent has seized via that agent's built-in resourceUnits collection (list). ((MyResourceAgent) unit).getUtilization()

anylogic

So you have to cast (a Java thing) unit to effectively say "I know this is actually a MyResourceAgent so let me see it as one of those please" e.g., (Hover over the lightbulb when editing these action boxes to get info on this.) However, this just provides them as a vanilla Agent (even if it is actually a custom resource unit, let's say of type MyResourceAgent). (1) In the actions of your Resource Pool you have access to the current resource unit via the special keyword unit. (This effectively shows the same wizard as the first method but with the use in flowcharts not present and automatically set under the covers.)Ĭlicking create a custom type when adding a Resource Pool (under the New resource type setting), which takes you to the same wizard as the second alternative above. The Resource Type element in the Process Modeling Library palette.

anylogic

New -> Agent Type (right-click menu for your model in the Projects palette), specifying Agent will be used in flowcharts as: Resource Unit (You can get the overall utilization of the pool via its getUtilization function.)įor the Process Modeling library, you can create a custom type which acts as a resource unit in three ways: However, this is only accessible if you create your own custom resource unit agent type when you create a Resource Pool, by default the units therein are vanilla Agent objects and do not have this special resource unit functionality. Per-resource-unit utilization (as well as other functionality) is available as part of the special resource unit API (Application Programming Interface basically a set of functions) discussed in the Library Reference Guides > Process Modeling Library > Resource functions help page. This is not all explained very clearly in the AnyLogic help. (A ResourcePool does not have a get function or similar to directly get the agents inside it.) Actually accessing individual resource units.Creating resource unit agents that have per-unit utilization calculated and accessible.close() for them to be closed and saved to memory.Įxcel has the option to save on termination. It is possible to automate this with some effort You can use whatever separator you want "\t" for tab separated or "," for comma and so onĪt the end of a simulation run, you can simply export the data Or even better you can write out an entire datasetĮxcelFile.writeDataSet(dataset, sheetName, row, column) įileName.println("value" + "\t" + " value 2") columns(scenario_name, time, temperature)įtCellValue(value, sheetName, row, column) This will just insert a new line into a database table that you created, you can save multiple values to multiple columns by adding comma-separated entries into the parameters for columns and values. The best option is to write data using the following command insertInto(table_name) Setup either an Excel or text file using the objects provided by AnyLogic in the Connectivity paletteįor both cases you need to write your data to the object of your choosing, either as the data gets generated or at the end of the simulation model There are two main options for getting data out of your simulationĬreate an empty table with the columns you require






Anylogic