I am using creating my equipments as resourcepools which are created within a rectangular node as a zoning region. During the model run I will increase or decrease the equipment quantity using a slider. I have set the settings to destroy the units when capacity is reduced (as guided in this thread Removing agent when resourcepool capacity reduced). However, after reducing the capacity, the first few rows of resources are destroyed and when the capacity is increased again, new equipments are built from the last row within the node, leaving the first few rows permanently empty. How can I rearrange the layout to always fill up the empty regions first?
You need to take control of positioning the agents yourself. Use the "on unit creation" code box to 'unit.setXY(...)' and position them where needed. Note that AnyLogic does also not care about positioning agents on top of each other. So if you want to have a concept of "this space is taken" you need to model that explicitly as well, best via a custom agent type itself.
Related
I have two agents:RE and SUB.
Agent RE is the content and Agent SUB is the container.
The container SUB moves to a gis point and picks up RE and I want to know the number of RE that picked up by the container.
I tried to use time plot to obtain the number and visualize it, with code agent.contents().size().
But the time plot did not update after I run the model.Do you have any solution to this?
enter image description here
enter image description here
/wYAkZ.png
Appreciate for any help!
enter image description here
enter image description here
Based on your screenshot you are trying to plot the size of the container element inside the pickup object (which will always be empty) and not the size of the container agent that is used in the pickup object.
See the simple example model below
As you can see when an object exists the pickup block I add the size of the contents it is carrying to the dataset.
Since I am adding the data manually to the data set I have disabled all auto-updating on the data set
as well as the chart
For the simple example I have set the container agent (the top source) to sent agents about every minute, and for the agents that will be loaded into the container to arrive about every second.
Here are the results
In AnyLogic 8, how do I create a Time Color Plot which has one row for each agent in a pool of agents?
As explained in an answer to this question, I can create a separate dataset for each row, and then have the Time Color Plot display one row for each dataset. But this requires hardcoding the number of datasets (and thus the number of agents), whereas I want to create a model with a variable number of agents and thus a variable number of rows in the Time Color Plot.
This AnyLogic cloud model includes a Time Color Plot where each forklift in a pool of agents has its own row in a Time Color Plot. Unfortunately, because it is a cloud model, I cannot download the model to investigate how it is built.
How do I create a Time Color Plot where each row corresponds to an agent in a pool of agents (like in that linked cloud model)?
You can simply add the datasets programmatically using
chart.addDataSet();
Here is the code for the model you referenced where the chart starts off empty (except for the color setup) and you simply add the bars during run time.
You can also remove them as needed.
I have an agent Container and it has a parameter: weight. The parameter weight draws its values from a custom distribution(mentioned below 1). Now, I want to arrange the containers based on its weight in the pallet racks. The heavier ones should go to the bottom levels of pallet rack and lighter ones should be at the top. The properties of my palletRack is also mentioned below 2. What should I write in Pallet Rack/Rack System field of rackStore block in order to achieve this? Or if there is some other way to do this please let me know.
As of now, I am arranging the containers on the basis of other two parameters: carrier & type. I want to add this additional criteria of weight. I have mentioned my current rackStore properties here. rackStore-properties
This is the current code in Pallet Rack/Rack System field :
(agent.carrier==Truck && agent.type==C20 ? palletRack4 : (agent.carrier==Truck && agent.type==C40 ? palletRack6 :(agent.carrier==Train && agent.type==C20 ? palletRack5 :palletRack7)))
Thank you in advance for your help!
weightDistribution
palletRack-properties
I am placing the container in a particular cell of the palletRack(i.e. with a given value for row, position & level).The row and position is defined as parameters of the agent Container. The level depends on the weight parameter of Container which is defined using a function. The values of row, position & level mentioned in rackStore properties can be found here: rackStore properties.
Here, agent.row= uniform_discr(0,1) as we have only two rows for a 2 rack 1 aisle palletRack. agent.position= uniform_discr(0,9) as the palletRack has 10 cells.
The function getLevel can be found here: function body
This approach assigns containers in a particular weight range to a particular level in the palletRack, but I would like it to be more generic such that, if the incoming container can be stored on any level, provided the containers below it are heavier.
I'm trying to graph workload (by day) stacking hours from tasks. I'd like to add a line indicating daily capacity of the relevant resource. I have a table for tasks and table for daily resource capacity.
When adding capacity as an independent data source, I get an error indicating I need a relationship to the primary data source.
If I join the data (on date and resource), I can get a capacity line to show, but only by adding it to the secondary axis, which leads to mismatching of scales (unless I lock in the same maximum scale for both primary and secondary axes). This works, but it's less than ideal :
a) it requires foreknowledge of maximum load,
b) lower usage resources barely move off the horizontal axis,
c) it seems to force the capacity line to use the same color palette as the column chart, plotting each time period with a different color.
Does anyone have any better suggestions?
So both axes are hours? You can synchronise the two axes to make it dynamic. Just right click on the axis on the right and there should be a check box titled "synchronize dual axes". Check that and it will sync both of them and will responded to changes dynamically.
You can also then hide the axis marks for hours on the right to make it look better. Again right click the axis and deselect the "Show Header" option.
Is it possible to give an edge a fixed length? Even if I set the length of individual edges, physic engine changes it.
I am trying to visualize 3 clusters, each with couple hundred of nodes. There is an option to aggregate the cluster into couple of nodes. I want to connect these aggregated nodes with really short edges and give these nodes high mass so they will repulse other clusters like they were doing when they had hundreds of nodes.
It seems like the answer to this question these days is YES! The network/edges visjs.org docs describe a "length" option:
"The physics simulation gives edges a spring length. This value can
override the length of the spring in rest."
So when you're setting up your edges you might do something like this to make an extra long edge:
myEdges.push({from:'nodeid1', to:'nodeid2', length:300});
The length by default is about 95 I think, so a length of 300 would be about three times the normal.
If you want to change the default edge length (not including any which you've set explicitly on edges) then this is the 'springLength' of the network, so pass an option while making the network:
var network = new vis.Network(container, data,
{"physics": {"barnesHut": {"springLength":100, "springConstant": 0.04}}}
);
The physics engine might constrain things and sort of hide the changes you're trying to see, so you may also need to tweak things like 'springConstant'.
It's not possible to set a fixed length. You can play around though with the default springLength and springConstant though, checkout the docs on physics:
http://visjs.org/docs/network/physics.html