FlexSim Knowledge Base
Announcements, articles, and guides to help you take your simulations to the next level.
Sort by:
The attached model draws a heatmap based on the total time AGVs are blocked in a particular location.   Approach Outline This model creates the output graphics as follows: There is a Group of all AGVs. A Statistics Collector listens to all state changes on all AGVs in the group. Each time an AGV goes into the “Blocked” state, the Statistics Collector adds a row, recording the location of the AGV and the current time. Each time an AGV leaves the “Blocked” state, the Statistics Collector updates the row for that AGV to calculate the total time the AGV was blocked. A Shape object (called CongestionHeatmap) reads the data in the Statistics Collector and draws the heatmap. All block times in the table are grouped into spatial “Pixels” based on the block location. Note: this article uses the word Pixel to mean the squares in the heatmap. For each Pixel, the shape sums the total block time in that Pixel. Pixels are colored relative to the Pixels with the most and least block time. Design Points The legend, drawn near the CongestionMap shape object, shows the numerical values for the min and max block time. To disable the heatmap, disable the Statistics Collector. To clear the heatmap, reset, then step, then reset again. Alternatively, you can call the resetheatmap() user command. The heatmap is cleared in the OnSimulationStart trigger of the CongestionMap shape. This way, the heatmap can be viewed when the model is reset. This way, the heatmap is visible without obscuring (or being obscured by) the AGVs. To change the Pixel size, set the PixelSize label on the CongestionMap shape object in the model. There isn’t  much of a performance impact to changing the pixel size. Choosing a good size is more like choosing a good bucket size for a histogram. If the Pixels are too large, it will be hard to tell where the congestion is truly happening, as a single Pixel might cover many areas of the network. If the Pixels are too small, congestion accumulation may be spread between many pixels, making the hotspots harder to see. You can change the pixel size during the model run if you change the label and call the  resetheatmap command. Performance is good. The biggest impact is from listening to the On State Change event of the AGVs. This model starts a real-time timer in the On Run Start model trigger and stops the timer in the On Run Stop model trigger. The output console shows the duration. You can compare model performance with and without the heatmap this way. This approach is most helpful with AGVs. However, it works with any object that goes in the Blocked state. AGVs just happen to go into a blocked state when they accumulate or when they can’t acquire control points/areas. The heatmap is drawn using a mesh. The mesh is more complicated to create, but is much, much faster to draw than using other draw commands. Meshes are used to draw triangles. Each Pixel is drawn as two triangles that form a square. All vertices of that square are set to the same color. Using a mesh also made drawing the legend simple. Meshes always interpolate colors between vertices. The legend draws squares where the top vertices are set to one color and the bottom vertices are set to another. Moving the CongestionMap object does not move the Pixels, so you can place it anywhere in the model. The legend won’t move until the next model run. How To Recreate in Another Model Create a group containing all the objects (AGVs) that should contribute to the heatmap. Create a Statistics Collector to record the location and duration of the block time For the On State Change event, the Statistics Collector responds twice. First, to finish the existing row and second to start a new row. When a row is added, the Statistics Collector adds a row label to record when the block started. When a row is updated, the BlockTime column is set to the current time minus the start time. Create a Shape object. Shape Object Details The shape object has the following labels: PixelSize – the size (in model units) of a Pixel. MeshZ – the height of the heatmap. If you set this to a non-zero value, be sure to reset the 3D view’s rotation and uncheck the “Perspective Projection” box. mesh – this label contains the mesh data. MeshMap – this label holds a Map (a collection of key-value pairs). Each key is an array containing the x and y coordinates of the Pixel. Each value is an array of the vertex numbers for that pixel. VertCount – the total number of vertices contained in the mesh. The mesh grows as blocks occur in more places. MaxBlockTime – the maximum block time in any Pixel MinBlockTime – the minimum block time in any Pixel The shape object as the following triggers: On Simulation Start – clears the mesh, MeshMap, VertCount, MaxBlockTime, and MinBlockTime labels. It also adds vertices to draw the legend. On Pre Draw – adds vertices (if needed) to the mesh and changes the vertex colors. This is the most complicated part. First, loop over the data in the Statistics Collector. For each “block” record: Use the exact location to calculate the Pixel location. Using a map, increment the running total of block time at that Pixel Keep track of the min and max values. Then, loop over the pixel/block time map If the MeshMap doesn’t have vertices for the desired Pixel, add them to the mesh and to the map Based on the color from the color palette, set the color for all six vertices. On Draw – draw the triangles of the mesh. Important: OnDraw should not change the mesh. OnDraw is called many times per draw to calculate shadows. OnPreDraw is only called once. Disable lighting – colors are not “shadowed” and the Pixels don’t draw shadows. Set the PolygonOffset so the mesh is always drawn above the grid.
View full article
Rápida demonstração de como usar o Graphical User Interface para controlar todo o modelo de simulação, desenvolver um painel de controle ou cockpit para alterar propriedades específicas de objetos dentro do modelo de simulação ou ainda, destruir ou recriar variáveis de objetos de forma a customizar ainda mais seu modelo. Tudo isso usando a estrutura do 'Tree' no FlexSim e também o recurso GUI, disponível no ícone em 'Tools'. Veja em nosso canal da FlexSim Brasil no Youtube.
View full article
[ FlexSim 2016 ] FlexSim 2016, version 16.0.5, is available. To download the installer log in to your account at www.flexsim.com, then go to the Downloads section and click on More Versions. If you have bug reports or other feedback on the software, please email dev@flexsim.com or create a new idea in the Development space. Release Notes Fixed sin() command not displaying in the Command Helper. Fixed a bug when shift-selecting entire rows and columns of global tables. Fixed C++ Variant comparisons where the primitive is on the left side. Fixed the return values for CURRENT_MINUTE, CURRENT_SECOND, and CURRENT_MILLISECOND in getmodelunit(). Fixed a bug with SQL parsing of FlexScript functions returning doubles in 32-bit FlexSim. Fixed some pin buttons in the Stats window. Fixed a bug in a Pull From List pick option. Fixed Crane and Robot speeds not scaling with model units. Fixed a bug with the From/To Lookup Table popup not putting quotes around table names. Fixed a bug with exporting Custom Chart data as CSV sometimes not working. Fixed some UI issues with the Edit Name box for User Libraries. Fixed an exception in the Set Label trigger popup. Conveyor Fixed header for OnMessage trigger of Photo Eyes. Fixed decision point rotation in a rotated container. Fixed a bug with calculating the time that items will split off from each other when an ahead item speeds up. Fixed a rare crashing issue with accumulated items. Fixed an issue with resuming nonaccumulating conveyors that weren't stopped. Process Flow Fixed a UI bug with the process flow variable panel in Quick Properties when opening a model. Fixed some instance references from showing just the name to now showing the path to better distinguish objects in containers. Fixed an extra line being added in the token Shared Assets list when requesting a Zone. Fixed the Quick Library so you can collapse sections. AGV Fixed issue with click-creating AGV control points before creating paths. Fixed issue with calling stopobject() on an agv when it has arrived at a control point at (near) zero speed.
View full article
Top Contributors