Home / FactoryTalk Optix / Optix for HMI
Description
Part 2 – Reusable Graphics with an Alias to an Object Model
Continuing on from the FactoryTalk Optix Object Oriented HMI concept tutorial, this video shows how to use a model type as an alias to pass the desired variables into the reusable graphic object.
This example sets up a “MyPump” model consisting of the variables Label, Running, and Speed. The “MyPump” model is converted to a type. An alias for “MyPump” is then added to the reusable “PumpInfo” graphic that was originally built in the previous tutorial.
This is considered as resolving at design time since the reusable graphics are preconfigured in FactoryTalk Optix Studio.
- The video discusses the implementation of object-oriented concepts in FactoryTalk Optix, focusing on passing parameters or variables into instances.
- It begins with creating a model named “my pump” to structure the variables.
- Variables like label, running status, and speed are added to the model and instances (my pump 1, 2, 3) are created.
- The video then demonstrates linking these instances to specific variables and creating an alias (“my pump Alias”) for easier organization.
- Finally, instances of the base object “pump info” are created and linked to the respective “my pump” instances, showing how values are passed to each object during design time.
Transcript
(00:02) so in a previous video we showed how we talked about objectoriented um Concepts in Factory talk Optics and what I did in that video was simply I had made a base Optics folder and I made a um a display called pump info and if I to were to go to that it was just basically a like a little face plate or a little widget essentially that we were then able to copy um over here in the on the pump One display so that you know um I created three instances of basically that that uh base object or that widget or face plate or however you want to call it
(00:49) what I did not show in that video was how would we go about passing in uh parameters or variables into each of these objects that we created or instances so I’m going to show that in this video so I’m going to go ahead and delete uh the instances I had created here of the pump info widget and what I want to do first is I I need to create a model which is basically going to be um kind of the structure of the variables that would kind of get passed in to those those um instances and we’ll kind of call that an alias but
(01:32) we’re going to create a model first so I’m going to come here to model right click say new and say object now um up here is called object one so I’m going to rename it I’m going to call it my uh pump and what we’ll do is we’ll come to the plus symbol here we’ll say add new we’re going to say add new variable I’m just going to add a couple variables here for each pump each pump will have a kind of a you know a common set of variables first variable uh we’ll call it a label and we’ll make this a string type uh we’ll add a second variable
(02:16) we’ll call this one running we’ll make this a Boolean type this would basically indicate if the pump was running or not and we’ll make one more variable here for demonstration we’ll call this one speed and we’ll keep that as integer 32 now the uh the trick here is that we need to convert this to a type to do that we’re going to rightclick on the U on this object under model and we’re going to say um [Music] uh o sorry we’re going to say refactor um looking in the wrong spot look for refactor and we’re going to say
(03:04) transform instance into type now if you don’t see this what you need to do is you need to come up here to the to the factory talk Studio options gear icon choose the options and then make sure that your advanced mode is checked on by default it is most likely checked off so check it on and hit save uh it would require you to restart Studio uh if it wasn’t checked and you uh and you had to check it so now that that’s checked we’ll come back here to my pump we’re going to say refactor transform instance into type so we just converted
(03:43) it to a type so now I can come back here to model right click and I can say new my pump so here’s my pump one and I can say uh right click new my pump there’s my pump to and we’ll create one more to make three so we got my pumps one two and three if I click on each one of these instances or one each one of these uh you know instances of the object you’ll see that the my pump one has a label running in speed my pump two label running speed my pump three label running speed so in each of these instances for pumps 1 two and three I
(04:24) can go ahead and link to the variable in the controller that would uh relate to each of these points for this example I’m not going to actually link it to a a real variable in the controller I’m just going to kind of hardcode it so to speak um so that just to show just to show that uh how this works so we’ll call the label first maybe call Pump 101 maybe we’ll keep it off and the speed is zero pump 2 uh we’ll label this as pump 2011 let’s go ahead and say that this pump is running and let’s say that its speed is
(05:03) set to um 25 perhaps and then pump 3 uh once again we’ll give it a label 301 or something uh true and then we’ll say that its speed is uh we’ll say 65 all right so we basically just you know gave a number into each one of these again we would typically dynamically link these to a real tag and a controller um but just to show data I’m I’m just going to kind of hardcode these so to speak okay so now we have that set up um now we’ll go back to our base object so pump info so in the previous video I created this object I’d put a label up top I put a
(05:50) slider I put an LED indicator I’d kind of put two um switches uh on here so we’re just going to link a couple of these to those tags I just created um but first what you want to do is on this pump info type under base objects folder I want to come over here to add new and I’m going to say add an alias now we get this Alias one I’m going to just call it my pump Alias to kind of keep it uh keep it organized and we’re going to keep that node ID as it is and inner kind I’m going to go ahead and choose um go to my model and I’m going to choose my pump
(06:41) and the reason for this is that it’ll help kind of filter it out when we when we come to here um so now we have our our base object we’re going to uh click on um you know we have this converted to an alias now so to speak or tied to an alias uh we’re going to come to each one of these uh things in the base object and we’re going to link it to the the uh my pump um object so for instance uh on this pump X right now it’s set to just pump X I’m going to actually link it to the Alias my pump and the label and then for for the
(07:31) slider for the value uh right up here aliases my pump Alias speed and for the LED uh we will uh tie this to the running all right so we just basically tied those I’m not going to tie the switches at the moment so label speed and our pump running so now we’re ready to come back to our um so we go ahead and save this we’re ready to come back to our pump one page and now we come back to pump one and we can say uh new base object pump info all right so there’s instance one new base object pump info oops there’s instance actually that
(08:38) might have got crossed up there it doesn’t really matter probably but try to get keep them organized pump two that’s pump two that’s pump one pump two and lastly uh base objects pump info there’s pump three so all we got to do now is we’re going to tie the my pump Alias to the right pump so to do that we have to we we’ll hit my pump Alias go to Dynamic link we’re going to scroll down until we find the model and we’ll say my pump one we’ll come here do the same thing scroll down till we find the model my pump 2 and lastly we’ll do the same thing
(09:31) for pump three all right so that’s all we got to do I go ahead and save it let’s fire up the emulator so you can see um the emulator pump zero or sorry pump one is uh is showing uh no speed and off pump 2011 was showing 25 and on on and pump 301 is showing about 65 and on so it worked our um our our our values from our our pump um pump objects that we created passed into each one of these so this is what was uh called um resolving at the design time meaning that we were of course pre-programming this in the application
(10:24) during the design phase and then deploying it there is of course a way to to dynamically pass into it during runtime so that we could choose when we open up each object which you know which motor or which pump would we want to tie it to um that I’ll show in a different video
Tutorial List
- Linking pushbuttons to a Logix tag
- Dynamic Link Key-Value Converter
- Create reusable graphics
- Object model alias
- Alias with Logix a UDT
- Dynamic alias index with Logix UDT
- Popup Dialog Box
- Build a faceplate
- Create Variables with Structured Data Types
- Rockwell Automation Device Libraries for Optix
- Optix Presentation Engines
- New Windows for Web Presentation Engine
- Changing Languages for Localization
- ComboBox to Change PLC Tag
- Custom Made Buttons
