The General Algebraic Modeling System (GAMS) is a high-level modeling system for mathematical programming and optimization. It is a cutting edge tool consists of a language compiler and several high-performance solvers. It is tailored for complex, large scale modeling applications, and allows you to build large maintainable models that can be adapted quickly to new situations. It is specifically designed for modeling linear, nonlinear and mixed integer optimization problems.
Usually, while deploying complex GAMS models in production environment or run GAMS models that are deployed in a remote machine/cloud, REST API is often used to interface GAMS with its clients. In such cases, OPC GAMS is a nice alternate where it uses robust client server architecture facilitated by state-of-the-art industry standard OPC UA protocol. OPC UA clients can call GAMS models via OPC UA server by passing required inputs and retrive outputs of the models after their execution.
OPC Unified Architecture (OPC UA) is a machine to machine communication protocol for industrial automation. It is cross-platform (not tied to one operating system or programming language) protocol with service-oriented architecture (SOA) and buildin robust security.
What is OPC GAMS?
OPC GAMS is a reference implementation to integrate OPC UA server with GAMS tool. It is a light weight tool to run GAMS models and access the model input/output data remotely. It can run on any workstation/server which supports java environment (for example, Linux or windows desktops etc). It was written Java using GAMS Java API and OPC UA Milo mavan project stack. The OPC GAMS project is available on gitlab under following link:
Files · master · Venkatesh Pampana / OPC GAMS
Reference implimetation of OPC UA server for integrating with GAMS (General Algebraic Modeling System) tool.
How to get it up and running?
- Clone this repository on to your local machine.
- Import it to Eclipse Project as a Maven project.
- Edit the GAMS installation path(GAMS Java API jar file) in pom.xml
- Build it or Run it as Java Application.
How the whole project code is organized?
The java source code files are organized in 3 packages. Namely, opcPi, serverConfigurationClasses and connectorPlugins.
opcGAMSServerpackage contains, all the OPC UA server setup classes, server namespaces, server configuration xml files.
serverConfigurationClassespackage contains java classes representing
server_config.xmlfile. Basically used to marshell and unmarshell the data present in the xml file.
gAMSConnectorpackage contains java classes for interfacing the GAMS tool with OPC UA server. It contains GAMS Java API methods.
What are the basic flow of events?
OPC UA Server Startup:
Call GAMS Model to run:
When server is up and running, the requests from clients are handled by methods written in ServerNamespace class.
I would like to change the structure of server_config.xml and adopt the source code accordingly. How do I do it?
Add your changes to server_config.xsd schema file. Parse it to xjc.jar a (can be found in jdk bin folder). Overwrite the existing serverConfiguration Classes with the newly generated classes by xjc.jar.
I would like to run my own GAMS models, pass/retrive custom input/output variables. How do I modify the code?
- Copy the GAMS model files into /ECOWET folder.
- Edit the server_config.xml file to add input and output variables of GAMS models as OPC UA server nodes
- Add/Edit ModelConnector classes in gAMSConnector Package to interface GAMS models