Uncheck the Ignore option and press Build model (or F7) to see if the error is resolved. The reason why an element doesn't show in code completion (click to enlarge) If the element you need is visible on Canvas but doesn’t show in code completion, check that it is not marked as Ignore. You follow an error, and it indicates a mistake in naming, so you call code completion, but it doesn’t give you the right option. Name resolution: it doesn’t show up in code completion What you can do is leave the part of the name that you’re sure about, then call code completion (Ctrl + Space or Option + Space), and select the right option from the suggestions. However, AnyLogic complains about the name in the code. The modeler’s intention here was to add the time that the agents had spent going through the flowchart to the histogram. Sometimes, at first glance, there seems to be no typos, so there’s a trick that helps you make it right. Misspelling is one of the hardest things to catch. įixing misspelling in an AnyLogic model (click to enlarge) Try this yourself with the Error demo – name resolution example. Now if you press Build model (or F7) again, you’ll see that you’ve resolved the error. So, here you can just delete mypopulation and, from the drop-down menu, select the suggested population name – Customers. The modeler’s intention was that the Source block should refer to the agent population called Customers. The error indicates there’s a problem with the name of the population that is referred to. Name resolution: the name of the referred element is wrongįixing the wrong name of the element (click to enlarge) Here are some scenarios for dealing with this error. It is usually caused by misspelling or renaming an object without refactoring. Something is wrong with the name you refer to, which is why AnyLogic can’t process it.These are the ways to find elements in your model that you will need when working with errors and these problematic elements.Ĭompile-time error 1: " cannot be resolved… (…to a variable/…or is not a field)" Searching for model elements through the Search button On the second double-click, the searched element in that agent will be highlighted.Īnother way to search for elements is through the Search button (Ctrl + F for Windows or Command + F on a Mac). When you first double-click the element, you will have the corresponding agent open. Let’s say you want to find not an agent but a specific element that belongs to that agent on Canvas. These two elements will be the focus of this blog post because they help you work with error messages. It will appear there as a new tab and will be highlighted in bold in the Projects view, so that you always know where you are in the model.Īt the bottom, you’ll see a Status bar and two windows – Console and Problems. To have an agent open in the Graphical editor, double-click it. In the Projects section, the model’s elements are sorted out into different categories, so you can easily navigate through them. Properties view – where you see the properties of the model’s selected elements.Graphical editor or Canvas – a space where you drag and drop elements from the Palette to create both the model’s logic and the physical representation of your model.Palette view – contains AnyLogic library elements, presentation elements, and other tools for model building.As a beginner, you might want to have one model open at a time to avoid confusion. Projects view – where all your open models are located.From left to right, there are four sections: If you’re new to AnyLogic, there are a few essential elements in the interface that you should be familiar with before you move any further.ĪnyLogic interface elements (click to enlarge)Īt the top, you have a Menu and a Toolbar. It is only available in AnyLogic Professional and is primarily useful for code-heavy models. The blog post is based on a recent webinar and focuses on the recommended strategies using AnyLogic's comprehensive out-of-the-box model building tools and paradigms that are available to all users.Īs such, AnyLogic’s Debug mode – which allows you to suspend and resume the program, inspect variables, and evaluate expressions – is not covered. This blog post can be used as a beginner’s guide that you refer to when errors appear. However, if you’re having a hard time understanding how and where to fix errors in AnyLogic, we’re here to help. Everybody makes mistakes, as it is part of the learning process.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |