Universidad de Almería Develops and Deploys Greenhouse Models as a Service to Maximize Crop Production

“With MATLAB Production Server, deploying a new model is simple. I develop and test the model on my computer in MATLAB, compile it into a package, and then upload the package to the server. I don’t need to recode the model myself or involve other programmers.”

Challenge

Accelerate the development and deployment of greenhouse models used to maximize crop production

Solution

Use MATLAB to develop models for climate, irrigation, and crop production and use MATLAB Production Server to deploy the models as a web-accessible service

Results

  • Cloud deployment time cut by more than 90%
  • Model updates accessed immediately
  • Greenhouse revenues increased by 15%
The greenhouse models as a service system (GMaaS) developed by Universidad de Almería researchers.

The greenhouse models as a service system (GMaaS) developed by Universidad de Almería researchers.

The region around Almería, Spain, has the largest concentration of greenhouses in the world. Covering more 33,000 hectares, the greenhouses produce enough fruits and vegetables each year to meet about half of European demand. To help researchers and farmers optimize greenhouse production and profitability, a team of Universidad de Almería (UAL) researchers created greenhouse models as a service (GMaaS). The GMaaS system is part of the EU-funded Internet of Food & Farm project, which aims to increase yields of better-quality produce with Internet of Things (IoT) technologies.

UAL’s models, developed in MATLAB® and deployed in the cloud with MATLAB Production Server™, combine data from IoT sensors with market and weather data to enable simulation of greenhouse processes and automated control of temperature, irrigation volume, irrigation times, and other key variables.

“MATLAB made it easy to translate equations and ideas into code,” says José Luis Guzmán Sánchez, professor at Universidad de Almería. “After we had developed our models, MATLAB Production Server enabled us to make all of them accessible via the cloud without recoding them in another language, saving months of development effort.”

Challenge

The UAL researchers needed a programmatic way to implement complex sets of nonlinear differential equations containing physical, chemical, and biological variables. The GMaaS climate model, for example, includes about 20 of these equations. Each model had to be calibrated using historical data gathered from greenhouse operations over many years. The team also needed a way to rapidly develop and evaluate model predictive control algorithms for temperature and irrigation that would use the models.

The UAL team wanted to deploy the models as a web-accessible service to make them widely available to farmers, researchers at other institutions, and students. The team initially considered reimplementing the models in Python or another language, but they estimated that this effort would take a year or longer. Further, recoding in another language could introduce bugs into models that had already been extensively validated.

Solution

UAL researchers used MATLAB to develop the greenhouse models and used MATLAB Production Server to deploy the models as web-accessible services.

Working in MATLAB, the team developed climate, irrigation, and production models based on nonlinear differential equations.

The climate model calculates optimal day and night temperature set points based on weather forecasts and indoor temperature and humidity. The crop production model combines an estimate of the current stage of the crops with market data to suggest an optimal harvest time. The irrigation model uses temperature, humidity, and growth predictions from the other models to estimate crop irrigation and nutrient requirements.

Each model was calibrated using greenhouse data and either a genetic algorithm solver from Global Optimization Toolbox or custom calibration algorithms.

Using Control System Toolbox™ and Model Predictive Control Toolbox™, the UAL team developed control systems to automate greenhouse processes. In one system, for example, they combined a PID controller for variables that change relatively quickly, such as temperature and humidity, with a higher-level model predictive controller for variables that change more slowly, such as crop growth, market prices, and weather conditions.

The team packaged the greenhouse models using MATLAB Compiler SDK™ and then deployed them using MATLAB Production Server. They tested the deployment by accessing the models via a RESTful API using JSON-formatted input and output.

The GMaaS system is being used by farmers and by the university as a teaching tool. In one undergraduate class, students design control algorithms in MATLAB and close the control loop with the GMaaS system.

The team is currently developing and testing a plant disease model. This model will be added to the GMaaS system together with models for microalgae production, wastewater treatment, and solar energy.

Results

  • Cloud deployment time cut by more than 90%. “It would have taken us at least a year to deploy our models to the cloud if we had recoded them in another language,” says Guzmán Sánchez. “With MATLAB Production Server, we set up, deployed, and verified the service in about a month—with no code changes.”
  • Model updates accessed immediately. “When we shared our models with Ph.D. students and other researchers in the past, we had to track who had the models and remember to send updates, which then had to be installed,” says Guzmán Sánchez. “Now, after I test an update locally, I deploy it with MATLAB Production Server, and it is available to all users immediately.”
  • Greenhouse revenues increased by 15%. “Using the models and the control architecture that we developed in MATLAB, we improved the quality of greenhouse crops and increased incomes for the farmers,” says Guzmán Sánchez. “Specifically, quality increased by 10% and incomes rose by 15% because crops were harvested at the correct moment according to market prices.”