First we need to create a type so we need to have a type in OCS which has
these properties timestamp, temperature, wind speed and predicted active power. We
need to have a new OCS type then we need to have a new OCS stream based
on this new type and then we need to send the values for that new stream.
So first what we need to do is create a new type in OCS and there are two ways of doing this so
we can either use the UI so we can either go to the sequential data store and create a new type
now if you want to do that make sure you follow the naming convention in the workbook so make
sure you call this wind turbine predictions time underscore and then include your initials and then
the date you're creating this on. So in my case it's the 30th of March and make sure you use this
format so four digits here - two digit month - the two digit day. Okay you can include the different
name but I'm just gonna copy the ID and use the same for the ID and name and then you can specify
a description if you want so in this case you can use what's in the workbook it's basically a time
series index type with three values so remember we're gonna have four properties, time and then
three values so one for temperature, forecast temperature one for the forecast wind speed and
one for the forecast active power okay so that's the name and the ID and then you can specify the
properties here remember we need four properties so again you can use the UI it's pretty neat so
you can say so this one is air temperature and the name is the same. For the ID for
the properties it's not allowed to have space so that's why we're using underscore here and then in
the name you could have space so that's fine and then the type here so this is the air temperature
so this is a double you can also use single if it's float so yeah that's one of the properties
you can also add wind speed you can also add predicted power and you also need the timestamp.
So if we put timestamp here at the end the name are both timestamp and then this is a date-time
this is the key so that's very important that this is our property key which is the key is
the timestamp basically. So that's that's how you can use it using the UI I'm not gonna create it
using the UI you can go ahead and do that that's fine but I'm gonna use the script to do the just
the same thing we're doing here basically. So you can either go with the UI or go to the script and
the script is pretty simple. So if you go back to the code first we're connecting to OCS just like
we used to and then this is where we're creating the the new type in OCS so here again remember
to if you're gonna use the script remember to specify in the name of the type and the type ID
and name remember to specify your initials and the date so in this case this is 2020,
30th of March just make sure, just to make sure you put the initials and the day just
to make sure these are all unique so that you don't overwrite other students' creations.
We're also here creating the type basically so we're creating a new instance of a class as
the s-type class, we are passing the ID which is what we specified at the top and we're specifying
a description in this case and we're specifying what is the code type okay so here this creates
or prepares the type the new type and then under that is where we specify the properties so first
we have to specify the atomic types we're gonna use. So what atomic types are basically the
unit types so remember we have, we're gonna have these four properties so one of them is timestamp,
one of the properties are timestamps and all the other properties are either float,
or double or single. So we're going to basically use two atomic types one is
date-time and the other is double in this case so that's why here we're specifying those two
atomic types we're gonna use, so one is the double type and the other uses the date time.
And then after that we create the properties so we have four properties,
each property you can specify an ID and name like we were doing in the
UI and then specify the atomic type it's using so in this case air temperature,
wind speed and active power will all use the double type atomic type and then time we'll
use the time type and we make sure time is the key so that's why here is specifying that time
is the key. And then we add those properties to the type we've created at the top which is here
so after having all these properties ready we add them here and then we call the OCS endpoint,
we have a function called OCS client or types dot get or create type and this is gonna create the
type in the name space ID we have under this and it's gonna create this type in this name space ID.