DanielOlsen

Change Pi Tag Values from a button w/ macro in Processbook

Discussion created by DanielOlsen on Nov 13, 2014
Latest reply on Oct 6, 2017 by ManuelFco

Hi everyone, my name is Daniel Olsen and i am new to the forums but have been using Pi for 2+ years at my pulp mill in Oregon now.

 

I was asked to create a calculation based on operator inputs of what the purpose of a pump is.

 

Background:

There are 5 feed pumps (with flow and consistency meters for each) but they can either be OFF/ON, BLEND, OR MAIN SUPPLY.  The blend is a slightly different material added to increase strength and can come from any one or multiple of the 5 available pumps, the main supply is typically pulled from one main pump but it may also be any of the 5 pumps.

 

The goal is to create a blend % based on operator clickable selection of each pumps purpose within PI Processbook.

There is no way to automatically decide which is blend/main supply based on our current instrumentation.

 

1st idea (do not mind doing it simpler if another option exists):

Create a 5(pumps)X 3(possible mode choices) grid of buttons that have macros that run on a operator click.

On a click it would take Pump A and set the value of a new pi tag (example:Pump A would have 3 associated tags- Pump A Blend Run Status/Pump A Main Supply Run Status/Pump A OFF/ON Run Status)

 

If the operator selected the button associated with Pump A = Main Supply the following changes would occur:

-Pump A OFF/ON Run Status = 0

-Pump A Blend Run Status =0

-Pump A Main Supply Run Status =1

and once you set the values write them to the corresponding Pi Tags.

 

basically the macro will set the associated value =1 and set the other 2 choices for the pump =0

 

With the "purpose" of each pump selected i can create performance equations to gather mass flow rate and get a blend %. (if blend run status =0 the volume*%consistency is multipled by zero and not counted as a blend, same with main supply)

 

 

 

Problem:

How to create a button macro/VBA script that will change the 3 tags and write them to the database when clicked.

 

 Lack of Pi knowledge: Can i write a Pi Tag Value from Pi Processbook

 Lack of VBA/PI experience: Not entirely sure of syntax and commands to use to change value/write value within Processbook.

 

Any help is appreciated

 

Thanks,

 

Daniel Olsen.

Outcomes