I would like to load my trucks on specific docks like loading truck A on dock 50. After I insert population loaded from database I get the error that it doesn't find my storages and it cant't calculate the space of my palletracks/ docks. Could it be that whenever I insert a population via database that the program ignore the other parameters of the agent like my storage? Before I insert the database, it works fine.
error
populationloadDocks
resourcepool_dockloading
Make sure to load all parameters from the dbase table in the properties of your agent population under "Agent parameter mapping" (visible in your second screenshot).
The AnyLogic help explains more on how this works but you essentially tell your agents which parameters should be filled from which table column.
Related
In my model I want to loop through the database which contains multiple columns (see example) by an event. The idea behind it is that I want to create dynamic events based on the rows in the database.
But I've no clue how to iterate through a database in anylogic and also was not able to find an example of a loop with a database.
The dummycode of my problem would look something like this:
For order in orderdatabase:
Create order based on (order.name, order.quantity, order.arrivaltime, order.deliverylocation)
Where order in the loop is every row of the database, and the value on which the creation is based based on the different column values of that specific row.
Can somebody give me a simple example of how to create such a loop for this specific problem.
Thanks in advance.
Use the database query wizard:
put your cursor into a code field
this will allow you to open the database wizard
select what you need (in your case, you want the "iterate over returned rows and do something" option
Click ok
adjust the dummy code to make it do what you want
For details and examples, check the example models and the AnyLogic help, explaining all options in detail.
I would like to create a database to load my trucks at a certain time and on a certain dock. So for example truck A should load on dock 1 at 6 am. The problem is that I don't know how to get the different IDs of my docks. I create a parameter called id but don't know which ID my different docks have which I write into my database.
Database
]1
agent/population_dock
Create a new dbase table "docks" with an int-column "dock_id". Fill it with as many docks as you want to create and give them an id number.
In your existing table, link the "id" column to that new table "dock_id".
When you create "Dock" agents in your population "loadDocks", you can select "loaded from database". Create 1 agent for each record in table "docks" and map the "dock_id" column to your parameter "Dock.id".
Now each dock knows its id.
Lots of AnyLogic example models use this setup, so check these out as well (search for "database"). And read around in the help, this is documented very well :)
OK... let me retry the question.
I'll just walk through the steps I (wrongly) assumed would work.
Create a data table in excel with passenger info (id, flight_time, type, class, qty...), note that the table is sorted by id... not flight_time.
Import this database into anylogic.
Create a population of agents (Passenger/Passengers) from the data table (one/row).
Create a schedule that addresses the Start Column as flight_time and Value column as qty (for this job I'm only sending one passenger at a time therefore qty = 1 for each row).
Set the pedSource to arrive according to schedule and to use the Passenger Agent as the New pedestrian.
So here is where I'm losing it. When I run this model the new Passengers do not have any parameters associated from the data table. The pedestrian id is some weird number (say 3000 or so). I can click on the Passengers icon during run time and scroll through the created agents (all of the parameter data is there and correctly assigned), but I'm not sure how to associate the new Agents in the run-time model with the population of Passengers agents.
Am I missing a step here? I was thinking that if I import a population of agents from a data table and then have each show up at a particular time in the model that I could then do some calculations with regard to each such as ped.exitTime = time() - ped.flightTime - ped.bufferTime.
I'm just not understanding why the table data is not available for use during run-time through ped? Is there another mapping step that must be performed to push the data to the ped agnets?
I'm at an impasse at this point. I hope this question is described more clearly and your feedback is appreciated.
Several things are wrong here.
You do not create agents in a pop first and then try to reuse them in a PedSource. The latter creates agents itself.
You don't seem to create pedestrians but just agents
you are not mapping the data to parameters
Quick guide to help:
create custom agent type "MyPed" . Make sure its "use in flowchart" property is set to "Pedestrian"
add 1 param into "MyPed" for each dbase table column
set your PedSource to "calls of inject()" function for its arrivals
delete your schedule, you cannot get the data you need
USe a DynamicEvent. Include 1 parameter argument for each dbase column. On Startup of main, loop across all dbase entries and create a dynamic event with the current row-data.
in the action of the DynEvent, call myPedSource.inject(1) and then manually fill that ped with the data from the arguments
This is not straightforward, especially the DynEvent stuff. So do more research in the AL help to understand these and how they work, check example models...
continuing a project I have posted a few questions for already are you able to have a more precise definition of what a dropdown is populated with?
I am using FM Starting Point and have a Projects, Estimate and Task table. A project can hold multiple estimates and tasks. Estimates contain multiple lines (stored in a separate table).
When In a Project you can add a task for that project. What I want to do is replace the field that gives the task a name with a list of lines contained within the estimates related to the project i have selected to add the task from.
I have created a dropdown and using the inspector got it to display all estimate lines but somehow I need to write a function that will only select lines from estimates that are within the project and also only estimates that have a field set to "active" for example.
what I am struggling with is where I can programme such a thing? In the inspector, you are limited to displaying a value and cant programme in a statement. I have tried a script that executes OnObjectEnter or OnObjectModify but that doesn't appear to work.
Any ideas where I can enter a more complex set of rules as to what populates a dropdown?
Create a relationship with the criteria you need. Base the value list for the dropdown on this relationship.
As for display, The value list's second field can be from a calculated field with any data or several other fields stringed together if no single field is sufficient. The first field should be the ID.
I am trying to generate Model based on MS SQL Server Analysis Services. To do so I am following these steps:
Select a Datasource (that points to Analysis services database) from
Report Manager
Click on "Generate Model"
Enter Name, Description and select location for the Model
Click on "OK"
Instead of Model I am getting below error message:
The ID property for the Role "xxxxxxxx" has a local name that exceeds the maximum length of 250 characters. (IDLocalNameLengthExceeded) Get Online Help
Where "xxxxxxxx" is my cube name.
I am sure that this SSAS database is working fine without any issue and also I have checked name/id of the cube that doesn't have more than 250 characters but I am not able to generate Model, please any one can suggest a solution for this? I am using SQL Server 2008R2(RTM) - 10.50.1600.1 (Intel x86)
The name of cubes, dimensions ect should be short if we want to create a Report Model from SSAS database. The most important thing to note here is - the length of name does not mean the length of name of individual cubes, dimensions only. It also include the qualified path e.g. "yourcube/yourdimension", so when we talk about the length it is length of full qualified name.