Control anylogic through external programs - interface

I want to use python or JAVA to control the anylogic model. For example, start or shutdown model, input and output data and so on.
Does Anylogic provide such an interface, like COM, Socket. or do i have to develop my own java interface to achieve the above functions.
Do you have any solution or advice?
Thank you in advance

for python, you can use this:
https://github.com/t-wolfeadam/AnyLogic-Pypeline
if a functionality is not there, you have to do it on your own.
But this is used to use python inside AnyLogic, if you want to use Python to run the model and such, I think you have to build your own thing

Related

Use python instead of Structured Text

I have a Codesys Project which becomes more and more complex.
Now I’m wondering if there is a python library that lets me do the programming part, I’m usually doing with Structured Text via Python?
Thank you
A
If you were using the Beckhoff platform which is very similar to Codesys I would have advised you to look into the ADS interface which helps interface PLC's with user space programs.
For Codesys there is also a proprietary interface called the PLC-Handler but it's not free of cost.
Since you have to pay one way or the other the approach I suggest is to buy the MQTT-Client for Codesys and write a Python-Client with one of the freely available libraries like the one of the eclipse foundatation: https://www.eclipse.org/paho/index.php?page=clients/python/index.php
The advantage of this approach is that once you've written the user space client you can interface with all PLC brands, since every major PLC brand offers an MQTT-Client library which you can use to write a small command and control PLC-Library for your PLC's.

How do I control a Beckhoff EtherCAT Coupler with powershell?

We have a Beckhoff EtherCAT Coupler which is currently being controlled by some c# code, we call that c# code from a powershell script. We want to move the entire process of toggling slots on the coupler to the powershell script but I'm not sure how to do that. If you could provide me even with information on how to send/receive Modbus commands in powershell that would be hugely helpful.
Thank you!
EDIT:
Here is the code used in C# to toggle one slot of the IO coupler:
using System.Net.Sockets;
using Modbus.Device;
TcpClient tcp_connection = new TcpClient(ip, MODBUS_TCP_PORT);
ModbusIpMaster coupler = ModbusIpMaster.CreateIp(tcp_connection);
coupler.WriteSingleRegister(0x1120, 0);
coupler.WriteSingleCoil(slot, state);
Acontis offers an EtherCAT Master for Windows library and a C# example application you could leverage to include into your own application: https://acontis.com/en/ecsta.html
Working with machine automation controllers is highly manufacturer specific. I've got working knowledge only about Omron PLC & MACs, so I cannot provide exact details.
Anyway, one way would be to create a C# DLL and call it from Powershell. As how to program the coupler, start by finding out which model, exactly, you are working with and searching Beckhoff's documentation. Maybe there are suitable samples available.
Consider also contacting manufacturer's support. They might be able to provide advice with very reasonable pricing, unless the task grows into a consulting gig.
Programming PLCs and MACs is often done via manufacturer specific solutions. Those are much simpler to use than general-purpose language such as C#.

Interfacing with ImageJ/Fiji

What options are there for interfacing with / controlling ImageJ/Fiji from another program?
I need to use some image filters that are available in Fiji. However, I cannot have Fiji be the centre of my workflow. I am using another system (scripting language) for that. I must manipulate some data in that other system, apply a filter to an image, get the result, then continue manipulating that image.
What are my options? What features does Fiji provide that make this possible?
In particular, is it possible to do this if the system I am using does not have a Java interface? It does have a C interface, and it can invoke command line programs.
For context: I want to interface Fiji with Mathematica. Mathematica does have a Java interface but it appears to lack support for some Java 8 features that ImageJ requires. I also don't know much Java and I am looking for a simple solution that I can set up quickly, rather than a long-term robust solution that requires a high initial investment.
If you can't run the ImageJ filters through Java integration, you may be able to write the necessary operations into an .igm macro and then get ImageJ to run it in headless mode.
Otherwise, it may be simpler to port the Java code for the particular filters that you need into a more convenient environment. ImageJ is primarily set up for GUI use, and Java/CLI/other integration can get messy very quickly.

Process/ Work Flow Engine

I am working on a solution for which I need a work flow/process flow engine. My work flow contains some Java based processes(classes) and some Linux Shell scripts. The flow would not be static and the execution of each process depends on the state/outcome of the previous process, and there would be multiple paths and the path would be determined the state of the previous processes.
I tried looking at jBPM, but I do not find a suitable support for invoking shell scripts. Please suggest me a suitable alternative for my requirement.
Many thanks.
well you can use jBPM5, it's extremely simple to add support for running shell scripts, we can help you with that.
Can you elaborate a little bit more on the requirements that you have?
Cheers

Testing a client-server application

I am coding a client-server application using Eclipse's RCP.
We are having trouble testing the interaction between the two sides
as they both contain a lot of GUI and provide no command-line or other
remote API.
Got any ideas?
I have about 1.5 years worth of experience with the RCP framework, I really liked it. We simply JUnit for testing...
It's sort of cliche to say, but if it's not easy to test, maybe the design needs some refactoring?
Java and the RCP framework provide great facilities for keeping GUI code and logic code separate. We used the MVC pattern with the observer, observable constructs that are available in Java...
If you don't know about observer / observable construct that are in Java, I would HIGHLY recommend you take a look at this: http://www.javaworld.com/javaworld/jw-10-1996/jw-10-howto.html, you will use it all the time and your apps will be easier to test.
As a former Test & Commissioning manager, I would strongly argue for a test API. It does not remove the need for User Interface testing, but you will be able to add automated tests and non regression tests.
If it's absolutely impossible, I would setup a test proxy, where you will be able to:
Do nothing (transparent proxy). Your app should behave normally.
Spy / Log data traffic. Add a filter mechanism so you don't grab everything
Block specific messages. Your filter system is very useful here
Corrupt specific messages (this is more difficult)
If you need some sort of network testing:
Limit general throughput (some libraries do this)
Delay messages (same remark)
Change packet order (quite difficult)
Have you considered using a UI functional testing tool? You could check out HP's QuickTest Professional which covers a wide varieties of UI technologies.
we are developing one client-server based application using EJB(J2EE) technology, Eclips and MySQL(Database). pl suggest any open source testing tool for functional testing .
thanks
Hitesh Shah
Separate your client-server communication into a pure logic module (or package). Test this separately - either have a test server, or use mock objects.
Then, have your UI actions invoke the communications layer. Also, have a look at the command design pattern, using it may help you.