|AutomationDirect Live Chat|
Learn how to setup Point of View to automatically scale numbers as they come into and out of Point of View from your PLC. Automatic scaling is great for unit conversion, adding offsets or simply getting numbers into a format you prefer. And since Point of View does all the work for you, your life just got a lot easier.
Often in automation we take in raw analog values which represent some fluid level or pressure or temperature or some other process. And it’s really handy when those raw numbers get converted automatically into inches or psi or temperature or something that makes sense to us. Other times the PLC may automatically convert the numbers, but we need them in Point of View with different units or offsets or other modifications. Whatever the reason, Point of view’s scaling feature is the answer because it does it automatically so you don’t have to do any conversions yourself in the app which makes your life easier. In this example we have a potentiometer going into a Do-more PLC. The Do-more scale function is used to convert the raw numbers into 0-100 inches. We want Point of View to fetch that and automatically convert it into centimeters. Here’s what it looks like in the Do-more code. We have an analog input coming in on port WX0 whose range is 0-4095. We want that scaled to 0 to 100 inches and then put that result in R0 which is the real register. You can see the result here in the data view as I rotate the potentiometer. As a reminder, you have to put a decimal point in these output values to get a real output. If I had put just a 0 and 100 here with no decimal point, that tells Do-more to do integer math and even though we have a real register specified we would still get an integer result with no decimal values – so keep an eye on that. In Point of View we want that inches value from the Do-more to come in automatically in centimeters. We do that by using Point of Views Driver Sheets. In this video we will assume you are already familiar with driver sheets, but if you aren’t then check out the videos on how to use driver sheets to get up and running quickly. There are two ways to automatically scale numbers as they come into Point of View, driver sheet math method and the min max method. First we’ll use the driver sheet math method. Let’s create a tag to show the Do-more raw input, we’ll call that Fluid Level Raw. Yes we want to create this as an integer tag. The Do-more is at this IP address – we don’t need the csv file because were not using any user defined memory - and this is the name of the memory location on the Do-more. Then we’ll want the Do-more’s converted value in inches. Yes we want to create this tag but as a real. Same IP, and this is its name on the Do-more. And finally let’s create a tag to put Point of View’s automatically converted result in, we’ll call that Fluid Level Centimeters and that needs to be a real, same IP Address, and we want to convert the that same inches value we brought in a minute ago. To convert inches to centimeters automatically in Point of View we just divide the incoming number by 0this scaling factor and there is no offset so we leave this blank. I’ve already created a screen with some text boxes to display the result. We have the raw fluid level which is just the tag we created, the inches level – another tag we created - and the centimeters level which is going to be the automatically created result. In all of these I specified a number format with two decimal places. I also modified the viewer so I could re-size the view to fit this video. Save all, run it. And sure enough we get the expected values. Here’s the raw Do-more data, the inches value the Do-more creates and we just read in, and here’s the centimeters value Point of View scaled for us automatically. Easy. The second method is the Min Max method. You specify the min and max of the incoming data and the min and max you want the local Point of View tag to have and Point of View automatically does the magic to make it happen. To use this method, go to the driver sheet and click on this Min Max check box. That changes these columns to min and max. So now we put the incoming tags actual min and max here which in our example is 0 to 100 inches. We can also put a global min and max here which serves as a default for all rows if min and max aren’t over ridden on that row. If I leave these blank then the values are just brought in as is. Save that. Now we go to the global tab of the project explorer, select the tag we want to scale and then on the home tab click on tag properties. Specify the scaled new min and max here. Just for demo purposes I’ll just pick a couple random numbers to scale it to – how about 57.4 to 475. Hit ok, run the project. And sure enough this tag in Point of View now runs from 57.4 to 475. Perfect. A couple notes: First, you can’t access the tag properties by right clicking on the tag and selecting properties. You have to use this menu version of the properties. Second, it is important to understand that which ever method you choose to convert data coming into point of view, it is automatically converted back when it heads out of point of view. For example, suppose the PLC is sending Point of View a temperature in degrees C but we want it in degrees F. That equation is degrees F is degrees C times 1.8 plus a minus 32 or Degrees C divided by .55 plus a minus 32. Same thing. So we put .55 here and -32 here and point of view does the conversion for us in BOTH directions. That is, if point of view writes data back out to the PLC, it does the exact opposite: it takes it’s degrees F subtracts the -32 and multiplies it by .55 so the PLC always sees degrees C and is never aware that this scaling is being done in Point of View. Let’s run this example. Here is the Point of view screen – I added this degrees F text box - and the Do-more data view. If we enter 25 degrees C on the Do-more, then point of view sees 77 degrees F. If we enter 32 degrees F in Point of View, then the PLC sees zero degrees C. Exactly what we expect. So again, the PLC has no idea that Point of Vview is working in degrees F, it always sees degrees C. That’s really powerful because now you don’t have to worry about how to handle reads and writes – it is all taken care of for you automatically! If you need any help, please contact AutomationDirect’s Free tech support during regular business hours – they will be happy to help. And don’t forget the forums – there are lots of folks there that love to share their years of experience. Just don’t post any questions directed at Automations support staff there – they don’t monitor the forums on a regular basis.