Home / FactoryTalk Optix / Alarms, Trending, and Data Loggers
Description
This video provides a brief tutorial on how to connect a FactoryTalk Optix data store to a remote InfluxDB bucket.
Transcript
(00:01) This video I want to look at using Influx DB as one of our data logger or our data stores for our data loggers. Influx DB came about in optics uh maybe around version 1.4 and then in 1.5 the internal or embedded in flux DB um option came about. Um, so what I have simply going on here for demonstration is I have the the variable simulator uh net logics net logic uh in here.
(00:36) And all that the variable simulator does this comes right out of the out of the library. If you look under scripts, the variable simulator is a um a script that you can bring right on in. And all it does is it creates a sine wave, a cosine wave, and a ramp. And there is a um another boolean tag here for starting the simulation.
(01:01) And just to show real quick, if I go into the emulator, um if I enable it with this switch, well, now I am showing uh my sign, cosine, and ramp values updating. If I stop the simulation, then it just stops right where it is and restarts it. Now, this is a real-time trend. Um, previous video we did show how to create a data logger and and uh be able to bring historical data into this trend.
(01:32) So, I want to do that again. This time I want to use Influx DB as our options. So, the easiest way to do data loggers is to come right to the dashboard and use the wizard. Now, you do have the ability to also come right here to the project view and rightclick on loggers and say new in a in a data logger.
(01:54) So, can definitely do it that way. But the wizard kind of helps step you through everything. Um, so maybe you don’t forget a few steps along the way. So, we’re going to say uh new data logger because I don’t have any data loggers or data stores created right now. So, we’re going to say new data logger. the data logger name.
(02:13) Um, change it to whatever you like. I’m going to leave mine at the default uh data logger one. Uh, sampling mode, you have the options between periodic uh or change in value as well as none. Going to leave it periodic. And then the sampling period. Um, right now it’s set to one second.
(02:32) I’m going to speed things up just because to get a better clarity on our sign and cosine waves. I’m going to speed it up to 100 milliseconds for our sampling period. Um, next. So, this is just kind of a little bit of a confirmation showing you that, you know, here’s the name of the data logger and the sampling mode we picked and this is the one we’re choosing.
(02:53) If you had other data loggers already created, you know, then you can choose from this list here as well. Going to say next. Now, part of the wizard says, you know, there’s no database. What database, you know, do you want to um create a new database? and we’ll say yes to this. So in optics, you know, we we now have four options available to us for databases.
(03:14) We just have the standard embedded database which is essentially like a a a SQL Express or SQLite uh embedded database. Uh you can make a an ODBC connection to like a SQL server or some other um type of um you know database. uh or now we have the influx DB options and influx DB is basically a time series um database and it’s probably a better use for collecting um you know time series data such as a data point with a time stamp.
(03:50) So you have two two options available to you. One is to do the remote influx DB connection and one is a local. If you choose local, then essentially it just makes a its own embedded local Inflex DB database right there on your box and stores the data in that. And there’s not a lot to to do to kind of interface with that data at that point.
(04:17) I’m going to choose remote influx DB connection for this example and say next. Now it’s going to ask for some information here. It wants to know the server, the port, the organization name, the bucket, uh, and then the API token as well as, um, are you going to use SSL and if there’s any kind of server certificates. Now, this is where we’ll demonstrate how we can set this up in Influx DB.
(04:51) So, on this um on this image here, I do have an instance of Influx DB installed. I’m going to go ahead and log into it with my username. And right now, if I come to um buckets, there’s only um two buckets here. One is a FT view demo HMI and one is an FT view SE bucket. And both of these buckets come from the viewc uh demo applications. Uh and that’s where this instance of Influx TV actually comes from as well.
(05:24) um from the install from from factor talk views. I’m going to go ahead and create a new bucket and I’m going to call this one I’ll call it FT optics. Um but obviously you can call it anything um other than that. Uh and then you have two options here for your data. never delete it. Or one of the, you know, one of the features of of Influx DB is that you can set a uh a persistence uh setting for how long does your data um persist.
(05:58) So, you know, it could be an hour, 6 hours, up to a year, or indefinitely. Um so, it doesn’t really matter for this demo. Uh maybe I’ll set it to 14 days just to do that. We’ll say create. So now we have a bucket called FT Optics. Now one other thing to note is when we come back to our settings here um there’s an organization name.
(06:24) So so the organization name you know for the demo I’m going to use is going to be called Rockwell. Uh you might have a different organization name. The other thing to note there was the server and the port. So since I’m using this on my local image, the server will be localhost and then the port is going to be 8086.
(06:47) So right now we can go ahead and type in a few of these things. Um, local host, port is 8086. The organization name is going to be Rockwell and the bucket is FT Optics. Next is going to be the token. Uh we’ll have to go create an API token which we’ll do in just one second. Um the other option here is use SSL for this purpose.
(07:16) I’m going to set that to false so you don’t have to do any kind of um logging in for the demo. Now um if you don’t have the API created then if we come up here to um uh to this icon we can go to API tokens. And there’s this one token that’s been created by default um when I made myself a user in this instance of of um of Influx DB.
(07:47) But I’m going to go ahead and create a generate a new API token. And we can either make it an all access token which gives us access to everything and all the buckets or we can create a custom API token that only looks at you know this individual bucket. the the optics bucket that I just created. So, we’ll give this a name.
(08:09) Maybe I’ll go ahead and just call this FT optics as well. And then if I want if I come to buckets, I can see FT optics. And then my options here is uh are to, you know, choose either read and write or um one or the other. I’m going to go ahead and choose both. Um there are some other settings here that you could turn on or off.
(08:30) Um, but for this case, all I need to do is have access to read and write from the this bucket. This will limit this API token to only be able to interface with this bucket. We’ll say generate. That’s going to give us this API string, which I will copy and then come back here into optics and paste it. And we will say next.
(09:00) So this just again confirms all that information. We’ll say next. But the next step will be to select what is it that we’re going to log. And basically we’re going to come down to the net logic folder to the variable simulator. And I’m going to check the three variables that are getting created with the simulator s cosine and ramp and say next. All right. And then exit.
(09:24) So after doing that we now have data logger one created and we have have uh remote influx DB database one uh created. If I were to click on this the properties all those properties I just set up are right here. So I can come back and tweak any of those settings if I need to after the fact. Now going back to screen one.
(09:48) This is uh this trend chart. I’ll go ahead and make this bigger. this trend chart is you know tied directly to the to the variable itself and not to the historical. So to do uh to update this um up top here we have model. So again I’m I’m on the properties of this trend and there’s model. I’m going to uh choose data logger one and bring it to the model um to make a dynamic link.
(10:21) And when I did that the the pins in this uh trend chart actually did update to last value um and then you know the sign cosine and ramp. So if I go ahead and uh start the emulator now uh we will do two things. One we’ll see that we’ll have historical data showing up here in our emulator. Let me start it.
(10:51) So um there we are getting data in our trend chart. Now if I come back to the um instance of influx DB. Now if I come to my data explorer and if I choose uh switch to old data explorer I can see my buckets are here and there’s FT optics at the top. So if I click on FT optics, I’ll go ahead and make this bigger. Uh FT optics. Now um I have data logger one.
(11:22) And now I have my uh variables. I have cosine, ramp, and sign. So let me go ahead and click on sign. And it’s going to show the past hour. Maybe let’s change this to the past five minutes. So here is the data that it is receiving from pecker talk optics. So, you know, not only can we view this data, you know, historical data here on this trend chart inside of the factor talk optics application, um I could also look at these dashboards inside of Influx DB’s um you know, graphic interface. And if I wanted to, I
(12:04) can hit a save as up up here and I can create a dashboard cell uh to create dashboards. So, I wanted to I can create a I’m going to create a brand new dashboard. Um, we’ll call this um, let’s see, create a new dashboard. Sorry, missing the box down there. We’ll call this FT uh, call it FT Optics for just lack of anything more original.
(12:39) And the cell name is um, we’ll call that sign and we’ll say save it as a dashboard cell. So now here’s our dashboard and we have sign. If I wanted to, I can come back to my uh data explorer where I just was uh choose data logger. Maybe want to look at the ramp this time and um submit. There’s my ramp data.
(13:05) And uh we’ll do the save uh do the same do save as. save it to that existing dashboard. This time we’ll call it ramp. And then I can move this to wherever I want and create my dashboards. Notice here that this is the last hour. If I wanted to go to the last um minute, that would be right here. So there’s our nice smooth sine wave and there’s our nice um smooth ramp um uh waveform as well.
(13:35) So that was that’s basically it. I wanted to show you know two things. One that we you know did connect our data here to an influx DB to a remote Influx DB database. And then, you know, once we’re in the Infolex DV uh database, we can kind of pull that uh those those values out and and view them either here in our dashboard, you know, inside of Influx DB or even pass this data on to other dashboarding tools such as Graphfana, um which is also pretty pretty popular.
