What is an Api?

An application program interface is code that allows two software programs to communicate with each other. An API defines the correct way for a developer to request services from an operating system or other application and expose data within different contexts and across multiple channels.

This is the way that online platforms give outside applications ways to interact platform. You can read things in that platform, you can post things to that platform etc.

The issue with these online platforms, they want to give access to outside applications but they don’t want to give too much information. They don’t want outside application to know what internal databases run, what programming languages are used.

Think about an application which lets you tweet about something using a button. That application sends request to tweeter using api provided by tweeter. Tweeter receives the api request, does required backend manipulations and tweets it to your tweeter feed. That’s a basic idea of what an Api is. It allows these external applications to be able to read and write.

Whenever you are dealing with apis it is important to understand there is not one standard api system. When you are using facebook, facebook has its own way of dealing with apis. Similarly Tweeter, Amazon have different ways of dealing with apis.

For the authentication, they generally require to sign up to use api then give you authentication credentials for you application be able to connect to their api. Big platforms publishes great api documentation that defines the ways of integration to a developer.

When we are talking about apis,terms of service is the most important thing to consider. If the platform providing the api decice to cut off the api there is limited things you could do about that.
This is the most important thing you should keep in mind dealing with apis.

If there is not ready to use api or platform announced to cut off the published api you may consider using Robotic Process Automation which is another topic to deep dive into.

Edge Computing and Accurate Data Collection in Industrial Iot

Most people in the industry is talking about big data, deep learning, machine learning, artificial intelligence, data science and digital twin. We need to keep in mind that all of these studies have a single prerequisite, accurate data collection. We can have all the best technology in the world but if we don’t have the data to send to these systems we are not going to get anything.

Data is just numbers without context so we have to do an extra work to transform that data into information. Doing that requires analysis skills and process knowledge. Transformed data should tell us something like, this machine processed that part using these bits and pieces at this time. This is called timestamping. After you’ve done this initial processing you will be able to use it for data science purposes.

There’s a lot also of data in PLCs, robots, sensors and also in our IT systems. First step is connecting these data and putting them into one place, a data lake. Many people say at first step just send all the data up to the cloud but this is not ideal because it will take time to handle that data and it costs.

It is time to give an example for the necessary interval that we log data. Think about a production line with a machine running on a specific rpm and producing a product with A grade and Johny operating the machine at that shift. We have sensors around like temperature and humidity that we read from our conditioning systems.

Is it ok to log all the data at five second interval? How about two or one? The answer depends on the application. If we are trying to find a sudden spike that happens on split seconds one second interval is not enough. Suppose an operator operates a single machine at a shift, it is not necessary to log who is operating the machine in seconds interval.

We need something on the edge of the factory for both OT and IT systems that help us on initial processing of the data. We can use this edge computer to filter and change data into the information throwing away unnecessary information that we won’t need in analytics.

Edge computing pushes data processing to edge devices, meaning workloads are placed closer to the source of data collection. Data transforms into information where action takes place.
Suppose we prepared the data and pushed to the cloud for analytics. Analytics suggests at some point temperature and pressure levels cause valve crash and leads downtime. Analysis of that relational pressure data taking place at cloud servers, the automatic shutoff instructions may come too late. If we leave that job to the edge, relatively higher processing power and very less latency we significantly save downtime, property and even lives.

While emphasizing on the importance of edge devices we do not place less value on computing centers. Although edge devices provide local computing and storage, there will still be a need to connect them to data centers, whether they are on premises or in the cloud. Thanks to high computing power the cloud or on-premise data centers are better when we develop knowledge. When we talk about execution it’s better to be near where the action is happening.

HMI HUMAN-MACHINE INTERFACE


HMI is short for human machine interface. They are also referred to as touchscreen operator panels in the market.

We use HMIS and industry to control and monitor machines. It would be hard to have a good automated process in industry without an HMI.

We can operate the machine from the HMI. The screen and push buttons (physical or virtual) allow us to operate the machines. We can also monitor the machine statuses, process steps, material counts etc via HMI screen.

Comparing analog indicators, HMIs show very precise levels and exact positioning of machines where machine information used to be viewed on multiple indicators. On one digital screen almost unlimited (software limited) indicators are possibile.

HMIS connect to PLC to control and monitor near real time data. HMIs are also used to load recipes to PLCs. Compared to connecting a computer or laptop every time, HMIs can save valuable time.

Another benefit of having a modern HMI is the fact that plants can monitor and control multiple machines or sensors with a single hmi. Small manufacturing facilities could even monitor the entire plant with a couple of HMIs located centrally.

HMIs and PLC’s work together to monitor and control the machine. This means they have to be compatible and they also have to speak the same language. They do this on what’s called a protocol. Different companies use different protocols such as PROFIBUS and PROFINET.Protocol information is found on each manufacturers website.

HMIS use special software so engineers can program them correctly. Different brands of panels use different software.

Those specific software allow the engineer to design what the operator will actually see on the screen what they can monitor on the screen what buttons can be pushed and how the operator can manipulate the machine for.

PLC Programmable logic controller

Today I am going to talk about the basics of a PLCs, the brain of industrial automation.

The programmable logic controller or PLC is a special-purpose computer that is hidden in the control panel of most machines.

The plc was a replacement for panels of relay devices that turn on and off machine.

The cons of relay logic control forced industry innovate PLCs. Making a machine run using relays as logic was time-consuming and challenging. Making a change in the logic or the operation of the machine was almost as complicated as starting over. Relays also fail far more frequently than computer components so that relay logic required more downtime to keep it running. Controls based on relays use a lot of electricity make lots of heat and sound and take up lots of space.

An installed PLC looks pretty simple. In appearance you have a CPU module and input/output devices referred to as IO. Sometimes the IO is part of the CPU and sometimes it is in other modules. in some equipment the i/o modules can be miles away from the CPU and connected with data cables so that the PLC is not limited to a single cabinet or even same room.
Since the plc is a computer there is no need to limit it to only digital inputs and outputs. To make these numerical devices more useful, manufacturers added analog and other numerical inputs and outputs to these devices over the years.

Plcs have calculation capability in the programming as well so that we can now calculate for instance statistical process control or SPC values and put PID controllers directly into the PLC program

As the name programmable logic controller suggest we need to program it. Most PLC’s are programmed using an application running on a PC. These specific applications communicate with the PLC using Ethernet/IP , Modbus or similar communication bus depending on the manufacturer.

Most manufacturers seem to have settled on Ethernet and/or USB in recent years but unfortunately the PLC manufacturers have failed to agree on how we program the control logic.
We have several choices when it comes to choosing a brand of plc depending on where you work you may have to familiarize yourself with many different plc brands. Some places use more than one manufacturer in a single facility so let’s list some of the major brands down so we can see the difference. Probably the biggest names out there in the automation and PLC world is Siemens, Rockwell, Allen Bradley, ABB, Omron, Mitsubishi, Schneider and Delta.

Re-innovate all your Machines and Equipment for Industrial IOT

In manufacturing, getting the most out of a capital investment, holding on to older equipment and maintaining it as long as possible is typical. It’s likely to find equipment that is 30 years or older that is still in operation. However, those machines were made long before the internet age. These machines, are often very capable of providing real time information with little touches of experts who have grown up with this older technology and who have experience to bring it forward.

Machines built 30 years ago are typically equipped with either relay logic or outdated Programmable Logic Controller devices. Some of those spare parts are so rare and some hardware failure may lead to unknown stop times. While changing control panel with modern iot ready hardware, new alternative machine equipment should also be considered. At some point modernization of pneumatics or mechanical parts may suit better with the new offerings of the renewed control panel. Some of these early technical methods will require adaptation to enable the sensing of movement, positional location, pressures, and temperatures.

Energy efficiency of a 30 years old machine is not equal to modern ones. Modernization need gives us opportunity to replace old energy consuming parts with modern energy saving parts. The above example is an often case with old motors. Both oversized and undersized motors cause huge spikes in energy consumption. Similarly, other supplementary units such as HVAC systems are also very important on overall efficiency. Reducing the total load required by the machinery is one of our key motivation.

Modernization of these machines saves energy, increase uptime, avoid suffering from spare part extinction. It is highly recommended to spend some time on high tech proof of concepts before final machine deployment. In another article I will discuss specific outcomes of industrial iot.

Using Influxdb as an on premise alternative to SAP Cloud IoT Service – SAP MII

In this article i will discuss using Influxdb as an on premise alternative to SAP Cloud IoT Service. Before we move on lets begin with some definitions and facts.

SAP Manufacturing Intelligence Integration (MII) is an application that links SAP ERP with MES. It aims to improve manufacturing operations with real-time analytics. It provides real-time visibility to overall business.

SAP MII is meant to run on SAP HANA which is a high-performance in-memory database that accelerates data-driven, real-time decision-making and actions, and supports all workloads, with the broadest advanced analytics on multi-model data, on premise and in the cloud.

Unlike most shopfloor application technologies, MII works flawless on premise. But there is a missing link for the Sap Cloud Iot service. On premise customers encouraged to use Sap Cloud Iot and thats all. If the on premise users like to integrate their sensor ecosystem they are left alone.

On customer site of influxdata platform i saw SAP used InfluxDB to monitor their Cloud Foundry multi cloud application platform. They chose InfluxDB for its ability to tag metric and event data and enjoy using both Grafana and InfluxDB.

Below comment was so convincing

We researched the best time series platforms and chose InfluxData because it is highly performant, provided high availability, and was more cost effective than the SaaS solutions we were considering,” said Christina Abraham, VP, Global Cloud Infrastructure & Operations at SAP Ariba. “InfluxData was easy to implement and is now the primary data store to collect metrics and events for SAP Ariba operations. InfluxData provides the basis for all the visualizations and alerting that is critical to our business.

I have investigated options to integrate mii with influxdb, so that i could use an on premise timeseries in memory database to store sensor driven bigdata.

In this part of the article i will try to explain the technical steps i followed. I assume you have a working influxdb server. If you dont you should set it up before moving on the below steps.

First you will need to open up your mii workbench and create a transaction.

Create an http post by drag and drop. Then assign the following properties to http post.


HTTP_Post_0.URL="http://yourserveripaddress:8086/write?db=yourdatabasename"

HTTP_Post_0.PostData="temperature,device=Machine1 value=29"

If you run the transction you will see the static string line query is processes on your influxdb.

The above postdata is an example insertion using influxdb line protocol. If you want you can use Local.Variablename Repeater_0.Item etc.  If you have questions leave comments below.

References:

https://www.influxdata.com/customer/sap/

https://docs.influxdata.com/influxdb/v1.8/write_protocols/line_protocol_tutorial/

https://www.sap.com/

How to shutdown or restart a server using node red


You can import the code below;


[
    {
        "id": "d9e15954.1730b8",
        "type": "exec",
        "z": "fe1c6c2b.68e79",
        "command": "",
        "addpay": true,
        "append": "",
        "useSpawn": "true",
        "timer": "",
        "oldrc": false,
        "name": "System Command",
        "x": 770,
        "y": 100,
        "wires": [
            [],
            [],
            []
        ]
    },
    {
        "id": "f632c378.a9b95",
        "type": "inject",
        "z": "fe1c6c2b.68e79",
        "name": "Restart Computer",
        "topic": "",
        "payload": "C:\\Users\\akirankaya\\Desktop\\nr\\restart-node-red",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 330,
        "y": 100,
        "wires": [
            [
                "829d155b.1a9428"
            ]
        ]
    },
    {
        "id": "829d155b.1a9428",
        "type": "function",
        "z": "fe1c6c2b.68e79",
        "name": "Restart",
        "func": "msg.payload=\"shutdown /r\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 560,
        "y": 100,
        "wires": [
            [
                "d9e15954.1730b8"
            ]
        ]
    },
    {
        "id": "f5703503.ca4268",
        "type": "http in",
        "z": "fe1c6c2b.68e79",
        "name": "",
        "url": "restart",
        "method": "get",
        "upload": false,
        "swaggerDoc": "",
        "x": 310,
        "y": 180,
        "wires": [
            [
                "8a7104ee.96cf78",
                "829d155b.1a9428"
            ]
        ]
    },
    {
        "id": "9bc75e50.18d2f",
        "type": "http in",
        "z": "fe1c6c2b.68e79",
        "name": "",
        "url": "shutdown",
        "method": "get",
        "upload": false,
        "swaggerDoc": "",
        "x": 310,
        "y": 440,
        "wires": [
            [
                "715f87e0.e9b308"
            ]
        ]
    },
    {
        "id": "7bb61aa.8c1b3e4",
        "type": "debug",
        "z": "fe1c6c2b.68e79",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 820,
        "y": 180,
        "wires": []
    },
    {
        "id": "6e2210af.3b294",
        "type": "debug",
        "z": "fe1c6c2b.68e79",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 830,
        "y": 440,
        "wires": []
    },
    {
        "id": "8a7104ee.96cf78",
        "type": "function",
        "z": "fe1c6c2b.68e79",
        "name": "set payload as restart",
        "func": "msg.payload=\"restart\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 570,
        "y": 180,
        "wires": [
            [
                "7bb61aa.8c1b3e4"
            ]
        ]
    },
    {
        "id": "715f87e0.e9b308",
        "type": "function",
        "z": "fe1c6c2b.68e79",
        "name": "set payload as shutdown",
        "func": "msg.payload=\"shutdown\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 570,
        "y": 440,
        "wires": [
            [
                "6e2210af.3b294"
            ]
        ]
    },
    {
        "id": "f623b461.c9afa8",
        "type": "exec",
        "z": "fe1c6c2b.68e79",
        "command": "",
        "addpay": true,
        "append": "",
        "useSpawn": "true",
        "timer": "",
        "oldrc": false,
        "name": "System Command",
        "x": 750,
        "y": 360,
        "wires": [
            [],
            [],
            []
        ]
    },
    {
        "id": "7b9babbd.6a09a4",
        "type": "inject",
        "z": "fe1c6c2b.68e79",
        "name": "Shutdown Computer",
        "topic": "",
        "payload": "C:\\Users\\akirankaya\\Desktop\\nr\\restart-node-red",
        "payloadType": "str",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 320,
        "y": 360,
        "wires": [
            [
                "c4ddd093.06354"
            ]
        ]
    },
    {
        "id": "c4ddd093.06354",
        "type": "function",
        "z": "fe1c6c2b.68e79",
        "name": "Shutdown",
        "func": "msg.payload=\"shutdown /s\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 520,
        "y": 360,
        "wires": [
            [
                "f623b461.c9afa8"
            ]
        ]
    },
    {
        "id": "72fbc492.2373a8",
        "type": "inject",
        "z": "fe1c6c2b.68e79",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "1",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 270,
        "y": 560,
        "wires": [
            [
                "14e548a9.1a73d3"
            ]
        ]
    },
    {
        "id": "14e548a9.1a73d3",
        "type": "debug",
        "z": "fe1c6c2b.68e79",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "x": 510,
        "y": 560,
        "wires": []
    },
    {
        "id": "b98d1e00.43df7",
        "type": "comment",
        "z": "fe1c6c2b.68e79",
        "name": "http://127.0.0.1:1880/restart",
        "info": "",
        "x": 320,
        "y": 260,
        "wires": []
    },
    {
        "id": "9d0096d4.52a2f8",
        "type": "comment",
        "z": "fe1c6c2b.68e79",
        "name": "http://127.0.0.1:1880/shutdown",
        "info": "",
        "x": 310,
        "y": 500,
        "wires": []
    }
]

How to loop through dates in node red


You can import the code below;


[
    {
        "id": "cb020599.1c4d48",
        "type": "inject",
        "z": "3c26b805.f73b58",
        "name": "",
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "x": 260,
        "y": 200,
        "wires": [
            [
                "624dd7f1.8f0988"
            ]
        ]
    },
    {
        "id": "f84398fe.40bfb8",
        "type": "debug",
        "z": "3c26b805.f73b58",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "payload",
        "x": 850,
        "y": 200,
        "wires": []
    },
    {
        "id": "624dd7f1.8f0988",
        "type": "function",
        "z": "3c26b805.f73b58",
        "name": "loop through dates",
        "func": "var start = new Date(\"01/03/2005\"); //MM DD YYYY\nvar end = new Date(\"02/03/2005\");\n\n\nvar loop = new Date(start);\nwhile(loop <= end){\n\n    var month = loop.getUTCMonth() + 1; //months from 1-12\n    var day = loop.getUTCDate();\n    var year = loop.getUTCFullYear();\n\n    var str = year + \"-\" + month + \"-\" + day;\n    msg.payload=str;\n    node.send(msg);\n\n   var newDate = loop.setDate(loop.getDate() + 1);\n   loop = new Date(newDate);\n}\nmsg.payload=\"done\";\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 510,
        "y": 200,
        "wires": [
            [
                "f84398fe.40bfb8"
            ]
        ]
    }
]

How to change location of Influxdb storage folder

In this article i will try to list out the steps to move influxdb default directories in windows. After following the steps you will be able to configure influxDB to store its data in a different folder.

1.Create the new influxdb directory.

E:\NewInfluxDatabaseDirectory

1.1 Create the new influxdb configuration.

Open influxdb.conf and save as newinfluxdb.conf

Edit meta, data, wal-dir strings with the corresponding values.

Meta Directory;

[meta]
# Where the metadata/raft database is stored
dir = "E:\\NewInfluxDatabaseDirectory\\meta"

Data Directory:


[data]
  # The directory where the TSM storage engine stores TSM files.
  dir = "E:\\NewInfluxDatabaseDirectory\\data"

Wal Directory:


# The directory where the TSM storage engine stores WAL files.
  wal-dir = "E:\\NewInfluxDatabaseDirectory\\wal"

2.Run influxdb with new database configuration
Go to directory where your influxd.exe is located. Open up command prompt and type the following.


influxd.exe -config newinfluxdb.conf

In another article i am planing to show you how to move databases.

You can also watch the screencast about changing influxdb database directory.

Grafana Cloud ,a highly available, fast, fully managed platform

In this article i will try to explain you importance of bi tools then share my experience on creating free grafana cloud account.

When we look at the developments of businesses and information technologies in the last 20 years, we can see that one of the most important concepts is data. This importance given to the data also increases the investments such as time and money on its collection and storage. Today, most institutions have already completed the stages of collecting data and storing this collected data.

Business intelligence is the analysis of business data across the entire organization to understand existing business performance and make informed business decisions. The information provided by the business intelligence solution should be targeted and have sufficient level of detail and presentation format for the targeted user group.

Grafana Cloud is a highly available, fast, fully managed OpenSaaS metrics platform operated by Grafana Labs.

Grafana is an open source monitoring tool compatible with most open source software. Grafana is actually a graphical tool rather than a monitoring tool to make the data meaningful. Easy to follow and stylish with a variety of themes and graphics. You can visit the site for detailed information. Do not wake up the worry that we can only watch a machine on the screen after the installation. Create dashboards with machines attached and add those dashboards to the playlist so that the dashboards will rotate at the interval you specify.

I leave you watch the steps to create your free grafana cloud account.