How do I move AnyLogic agents from one space to another? - anylogic

In my AnyLogic model, Container agents are moved around within the Main agent to various locations.
Main contains several instances of Block agents at specific locations. Block contains a multi-bridge overhead crane which is supposed to pick up the Container and move it to local storage.
When the Container is placed at an Attractor within range of the Block's crane, a process inside the Block is called.
This process contains Entry, MoveByCrane, and Exit blocks.
In the MoveByCrane block, at the seize step, AnyLogic is giving me the following error:
Exception during discrete event execution
root.blocks[0].moveContainerIn.seize:
The agent root.containers[0] and the crane com.anylogic.engine.markup.OverheadCrane#50b7349f have different spaces
at com.anylogic.engine.Engine.error(Unknown Source)
at com.anylogic.engine.Agent.error(Unknown Source)
at com.anylogic.engine.Utilities.error(Unknown Source)
at com.anylogic.libraries.material_handling.MHLBlock_xjal.error(Unknown Source)
at com.anylogic.libraries.material_handling.SeizeCrane.j(Unknown Source)
at com.anylogic.libraries.material_handling.SeizeCrane.k(Unknown Source)
at com.anylogic.libraries.material_handling.SeizeCrane.getHookDestinationPoint(Unknown Source)
at com.anylogic.libraries.material_handling.SeizeCrane.a(Unknown Source)
at com.anylogic.libraries.material_handling.SeizeCrane.a(Unknown Source)
at com.anylogic.libraries.material_handling.SeizeCrane$1.onEnter(Unknown Source)
at com.anylogic.libraries.processmodeling.Delay.b(Unknown Source)
at com.anylogic.libraries.processmodeling.Delay.b(Unknown Source)
at com.anylogic.libraries.processmodeling.Delay$9.onEnter(Unknown Source)
at com.anylogic.libraries.processmodeling.InputBlock$1.b(Unknown Source)
at com.anylogic.libraries.processmodeling.InPort.a(Unknown Source)
at com.anylogic.libraries.processmodeling.InPort.receiveImmediately(Unknown Source)
at com.anylogic.libraries.processmodeling.InputBlock$1.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.b(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock.forwardReadyEntityNotification(Unknown Source)
at com.anylogic.libraries.processmodeling.InputBlock$1.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.b(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock$2.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock$2.action(Unknown Source)
at com.anylogic.libraries.processmodeling.AsynchronousExecutor_xjal$a.execute(Unknown Source)
at com.anylogic.engine.LibraryEventHandler$b.execute(Unknown Source)
at com.anylogic.engine.Engine.c(Unknown Source)
at com.anylogic.engine.Engine.hi(Unknown Source)
at com.anylogic.engine.Engine.f(Unknown Source)
at com.anylogic.engine.Engine$b.run(Unknown Source)
All of the Block agents are located at different coordinates within main. They each have their own coordinate reference/origin. (The location (0,0) in the block is not the same as (0,0) in main.) Is this the meaning of the term "spaces" in the error message?
Is there a way to move an agent from one space to another?
Should I remove (sink) the agent from one space and create a new one in the other?

Yes.
Easiest way is to use Enter and Exit blocks in Main and your agent types and send the agents across different spaces this way. In the Enter properties, specify a location within the agent type and it will make your arriving agent "switch" to the new space.
If you are not using process modelling blocks, you need to call setEnvironment() and then define the agent location within its new environment using setLocation(...)

Related

Error code while accessing custom parameter values from excel file

I am tryig to build a discrete agent based model.
I have a set of agents with custom parameters, these parameters are loaded via an excel file (this part works, I can view the agents). All agents are created at once at the model start-up.
Now I want the agents to move through the system based on these parameters.
I have build a dummy-model with a selectOutputIn and two SelectOutputOut blocks and a function.
I want the agent to move to selectOutputOutBasic if a string-parameter has a certain value.
The function code is:
if (agent.variation == "Basic")
return selectOutputOutBasic;
else return selectOutputOut;
Anylogic builds the model, but when I try to run it, I get the following error corde:
Exception during discrete event execution:
class com.anylogic.engine.Agent cannot be cast to class test.Order (com.anylogic.engine.Agent and test.Order are in unnamed module of loader 'app')
java.lang.ClassCastException: class com.anylogic.engine.Agent cannot be cast to class test.Order (com.anylogic.engine.Agent and test.Order are in unnamed module of loader 'app')
at test.Main$1.choice(Main.java:1)
at com.anylogic.libraries.processmodeling.SelectOutputIn.b(Unknown Source)
at com.anylogic.libraries.processmodeling.SelectOutputIn.b(Unknown Source)
at com.anylogic.libraries.processmodeling.SelectOutputIn$1.outputBlock(Unknown Source)
at com.anylogic.libraries.processmodeling.InputBlock$1.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.b(Unknown Source)
at com.anylogic.libraries.processmodeling.OutPort.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock$2.a(Unknown Source)
at com.anylogic.libraries.processmodeling.OutputBlock$2.action(Unknown Source)
at com.anylogic.libraries.processmodeling.AsynchronousExecutor_xjal$a.execute(Unknown Source)
at com.anylogic.engine.LibraryEventHandler$b.execute(Unknown Source)
at com.anylogic.engine.Engine.m(Unknown Source)
at com.anylogic.engine.Engine.jj(Unknown Source)
at com.anylogic.engine.Engine.c(Unknown Source)
at com.anylogic.engine.Engine$b.run(Unknown Source)
Turns out, those who can read have an advantage...
I found the solution to my problem in this post, thanks # Dat Boi!
Try going to the service properties. Under the "Advanced" tab, is
Agent Type selected as "MyAgent" or as "Agent"? Similarly, go to the
source properties and check the tab Agent and make sure "MyAgent" is
selected.

Anylogic - Error when drawing animation frame with custom GIS routes

I am using a GIS map for a waterway transportation system and have to use my own GIS Route (not automatically generated). I use the moveTo block but each time the agent arrives at the GIS Point I get an error message saying:
"Error while drawing animation frame. Possibly caused by dynamic properties of animation shapes. The picture will be restored when (and if) the error goes away."
The following message appears in the console:
Error during drawing animation frame:
java.lang.RuntimeException: root:
gisRoute8 (GISRoute) : Offset (9539.429153529953) is greater than length (687.4357796935112)
at com.anylogic.engine.Engine.error(Unknown Source)
at com.anylogic.engine.Agent.error(Unknown Source)
at com.anylogic.engine.Utilities.error(Unknown Source)
at com.anylogic.engine.markup.GISMarkupElement.error(Unknown Source)
at com.anylogic.engine.markup.GISRoute$1.n(Unknown Source)
at com.anylogic.engine.markup.AbstractCurve.n(Unknown Source)
at com.anylogic.engine.markup.AbstractCurve.getPositionAtOffset(Unknown Source)
at com.anylogic.engine.markup.GISRoute.getPositionAtOffset(Unknown Source)
at com.anylogic.engine.markup.SimpleDirection$2.getPositionAtOffset(Unknown Source)
at com.anylogic.engine.markup.AbstractNetwork.n(Unknown Source)
at com.anylogic.engine.markup.AbstractNetwork.n(Unknown Source)
at com.anylogic.engine.markup.AbstractNetwork.n(Unknown Source)
at com.anylogic.engine.markup.AbstractNetwork.getPosition(Unknown Source)
at com.anylogic.engine.markup.AbstractNetwork.getPositionAtOffset(Unknown Source)
at com.anylogic.engine.markup.AbstractNetwork.getPositionAtOffset(Unknown Source)
at com.anylogic.engine.b.i(Unknown Source)
at com.anylogic.engine.ih.updatePosition(Unknown Source)
at com.anylogic.engine.ExtAgentWithSpatialMetricsDelegate.updatePosition(Unknown Source)
at com.anylogic.libraries.processmodeling.l.updatePosition(Unknown Source)
at com.anylogic.engine.Agent.h(Unknown Source)
at com.anylogic.engine.Agent.getX(Unknown Source)
at com.anylogic.engine.ih.getLat(Unknown Source)
at com.anylogic.engine.presentation.ShapeEmbeddedObjectPresentation.updateDynamicPropertiesStructural(Unknown Source)
at com.anylogic.engine.presentation.ShapeAgentGroup_xjal.updateDynamicPropertiesStructural(Unknown Source)
at com.anylogic.engine.presentation.ShapeGroup.updateDynamicPropertiesStructural(Unknown Source)
at com.anylogic.engine.Presentable.n(Unknown Source)
at com.anylogic.engine.Presentable.updateShapeDynamicProperties(Unknown Source)
at com.anylogic.engine.gui.SVGFrameProducer.n(Unknown Source)
at com.anylogic.engine.gui.ExperimentHost$1.l(Unknown Source)
at com.anylogic.engine.gui.ExperimentHost$1.n(Unknown Source)
at com.anylogic.engine.gui.SVGFrameCollector.l(Unknown Source)
at com.anylogic.engine.gui.SVGFrameCollector.c(Unknown Source)
at java.base/java.lang.Thread.run(Thread.java:834)
This happens everytime an agent arrives at a GIS Point from a custom made GIS Route, while automatically generated GIS Routes work. Am I doing something wrong or is this a known bug?
There is an error in AnyLogic 8.7.2 when using custom-GIS-routes: the default setting for the GIS Map to get routes from an OSM server conflicts with agents which are using a custom GIS Network for routing. (Confirmed with AnyLogic support and due for fix in 8.7.3.)
If you are only using custom GIS Routes, you can workaround this by setting the GIS Map (Routing section) so that routes are Straight lines (so that no routing servers are used).
(The error message is stating that it somehow thinks the target point (or some intermediate point en-route) is beyond the extent of the GIS Route network. Initially they are just 'temporary' animation errors but, if you attempt to do a subsequent movement, you get a hard error --- so it seems like the agent has somehow been positioned in a point beyond the confines of the GIS network.)

Install4j silent updater process hangs in case of incorrect proxy settings

The install4j silent update check process seems to hang in case Windows is configured with a "proxy script" that no longer exist. For example: when it is set to http://127.0.0.1:50000/proxy.pac, IE gives a "connection refused error", but install4j will wait indefintely while attempting to download the script.
This also prevents our own application from starting, because it is configured to start after the silent update check.
The installer and updater was created in Install4j 6.1.2. I don't see anything in the change log of 6.1.3 that would fix this issue. Can you have a look or provide us with a work around?
"main" #1 prio=5 os_prio=0 tid=0x0000000001f7f000 nid=0x1440 runnable [0x000000000028c000]
java.lang.Thread.State: RUNNABLE
at java.io.FileOutputStream.writeBytes(Native Method)
at java.io.FileOutputStream.write(Unknown Source)
at java.io.BufferedOutputStream.flushBuffer(Unknown Source)
at java.io.BufferedOutputStream.flush(Unknown Source)
- locked <0x00000000d7c99bd0> (a java.io.BufferedOutputStream)
at java.io.PrintStream.write(Unknown Source)
- locked <0x00000000d7c99bb0> (a java.io.PrintStream)
at sun.nio.cs.StreamEncoder.writeBytes(Unknown Source)
at sun.nio.cs.StreamEncoder.implFlushBuffer(Unknown Source)
at sun.nio.cs.StreamEncoder.flushBuffer(Unknown Source)
- locked <0x00000000d7c99cf8> (a java.io.OutputStreamWriter)
at java.io.OutputStreamWriter.flushBuffer(Unknown Source)
at java.io.PrintStream.write(Unknown Source)
- locked <0x00000000d7c99bb0> (a java.io.PrintStream)
at java.io.PrintStream.print(Unknown Source)
at java.io.PrintStream.println(Unknown Source)
- locked <0x00000000d7c99bb0> (a java.io.PrintStream)
at java.lang.Throwable$WrappedPrintStream.println(Unknown Source)
at java.lang.Throwable.printStackTrace(Unknown Source)
- locked <0x00000000d7c99bb0> (a java.io.PrintStream)
at java.lang.Throwable.printStackTrace(Unknown Source)
at java.lang.Throwable.printStackTrace(Unknown Source)
at com.sun.deploy.net.proxy.ProxyConfigException.<init>(Unknown Source)
at com.sun.deploy.net.proxy.AbstractAutoProxyHandler.getJSFileFromURL(Unknown Source)
at com.sun.deploy.net.proxy.AbstractAutoProxyHandler.retrieveContentOfPACFile(Unknown Source)
at com.sun.deploy.net.proxy.AbstractAutoProxyHandler.contructLegacyPACScript_16(Unknown Source)
at com.sun.deploy.net.proxy.AbstractAutoProxyHandler.init(Unknown Source)
at com.install4j.runtime.installer.helper.content.DeployProxyHelper.getProxyHostInfoWindows(DeployProxyHelper.java:70)
at com.install4j.runtime.installer.helper.content.ProxyHelper.getProxyHostInfoUnguarded(ProxyHelper.java:37)
at com.install4j.runtime.installer.helper.content.ProxyHelper.access$000(ProxyHelper.java:13)
at com.install4j.runtime.installer.helper.content.ProxyHelper$1.fetchValue(ProxyHelper.java:25)
at com.install4j.runtime.installer.helper.content.ProxyHelper$1.fetchValue(ProxyHelper.java:22)
at com.install4j.runtime.installer.helper.comm.actions.FetchObjectAction.execute(FetchObjectAction.java:14)
at com.install4j.runtime.installer.helper.comm.HelperCommunication.exe
The bug is in JRE classes, so we cannot fix that directly. The only option is to pass the VM parameter
-Dinstall4j.noProxyAutoDetect=true
to the installer so proxy auto-detection is switched off.

Node cannot have more than one incoming/outgoing edge

I am trying to start using jbpm and I am following this tutorial.
http://www.mastertheboss.com/jbpm5/jbpm-5-tutorial-first-example?start=1
On the second page I have to add a diverge gateway, converge gateway, constrains, change the type to XOR, and create a variable "money". When I try running the program I get the following error.
java.lang.IllegalArgumentException: This type of node cannot have more than one incoming connection!
at org.jbpm.workflow.core.node.ActionNode.validateAddIncomingConnection(ActionNode.java:50)
at org.jbpm.workflow.core.impl.NodeImpl.addIncomingConnection(NodeImpl.java:100)
at org.jbpm.workflow.core.impl.ConnectionImpl.connect(ConnectionImpl.java:76)
at org.jbpm.workflow.core.impl.ConnectionImpl.<init>(ConnectionImpl.java:71)
at org.jbpm.bpmn2.xml.ProcessHandler.linkConnections(ProcessHandler.java:293)
at org.jbpm.bpmn2.xml.ProcessHandler.end(ProcessHandler.java:145)
at org.drools.xml.ExtensibleXmlParser.endElement(ExtensibleXmlParser.java:422)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.xs.XMLSchemaValidator.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl.parse(Unknown Source)
at org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:301)
at org.drools.xml.ExtensibleXmlParser.read(ExtensibleXmlParser.java:180)
at org.jbpm.compiler.xml.XmlProcessReader.read(XmlProcessReader.java:46)
at org.jbpm.compiler.ProcessBuilderImpl.addProcessFromXml(ProcessBuilderImpl.java:262)
at org.drools.compiler.PackageBuilder.addProcessFromXml(PackageBuilder.java:673)
at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:709)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:51)
at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:40)
at com.sample.ProcessMain.readKnowledgeBase(ProcessMain.java:31)
at com.sample.ProcessMain.main(ProcessMain.java:20)
Exception in thread "main" java.lang.IllegalArgumentException: Could not parse knowledge.
at org.drools.builder.impl.KnowledgeBuilderImpl.newKnowledgeBase(KnowledgeBuilderImpl.java:79)
at com.sample.ProcessMain.readKnowledgeBase(ProcessMain.java:32)
at com.sample.ProcessMain.main(ProcessMain.java:20)
0 02/04 10:05:21,243[main] ERROR builder.impl.KnowledgeBuilderImpl.newKnowledgeBase - ProcessLoadError: unable to parse xml : Exception class java.lang.IllegalArgumentException : This type of node cannot have more than one incoming connection!
I tried debugging, by deleting nodes/edges until I got different errors. If I delete a whole branch, the error will be that gateways need 1+ edges. If I delete edges from one of the branches it will say that the script has more than one incoming/outgoing edge. It seems to be that the second script with different id and name, is being confused with the first or there are edges that I cannot see.
Extra Questions:
1. How do i know which node it is referring to? (I am using eclipse, and the links that normally would send you to a code line do not show anything)
Screenshot of the problem:
![http://imgur.com/0gL5twY][1]
Can you share your process diagram image?
It is making reference to an ActionNode which is usually a Script Node.
I will recommend you using the web process designer which is much better in terms of features and validations.
Regards

Error in applet in the navigator with fingerprint reader

First thank you very much for your time, I have a problem with the development of an applet to control users via fingerprint, as developed in eclipse using the DigitalPersona SDK, the problem is when I run it from a web page browser,
Exception in thread "AWT-EventQueue-2" java.lang.RuntimeException: com.digitalpersona.onetouch.jni.JniException
at com.digitalpersona.onetouch.capture._impl.DPFPCaptureFactoryImpl$CaptureImpl.startCapture(DPFPCaptureFactoryImpl.java:187)
at CDesVerifinger.formComponentShown(CDesVerifinger.java:76)
at CDesVerifinger.access$1(CDesVerifinger.java:73)
at CDesVerifinger$1.componentShown(CDesVerifinger.java:64)
at java.awt.Component.processComponentEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
Caused by: com.digitalpersona.onetouch.jni.JniException
at com.digitalpersona.onetouch.jni.AcquisitionLibrary.getInstance(AcquisitionLibrary.java:50)
at com.digitalpersona.onetouch.jni.Acquisition.<init>(Acquisition.java:45)
at com.digitalpersona.onetouch.capture._impl.DPFPCaptureFactoryImpl$CaptureImpl.startCapture(DPFPCaptureFactoryImpl.java:104)
... 16 more
Thank you very much for any help
good day
You need to add the dptojni.jar to the library of your project, it is in c:/programs files/digital persona/bin/java. Or you can get the class jniException and add it to your project.
Having the same problem, here is someone telling that is necessary put
capturer.setPriority(DPFPCapturePriority.CAPTURE_PRIORITY_LOW);
after calling createCapture to solve it. I will try this answer now.
You have to sign the jar files. That's what I did, and now it's working.
Make sure you have instatiated the DPFPCapture object before calling the setCapturePriority method and also make sure you stop capture after you have finished using the capture object