Flow chart level comparation

hi every body I need some help on a startegy that I’m currently working on…i have two signals(4-20ma)…from level transmitters that shloud be compared and a alarm generated from my strategy if the difference in the readings exceed 5% of the full scale value…my strategy also sholud select a reliable signal and then allows the operator to select level signal from the console process diagram…once the alarm is cleared then my strategy resumes the average of both level signals…any help will be apreciated…thanks

Hi BENO74,

I will take a crack at this…
(And trust that someone will come and show me where I am wrong and we will all learn something :-))

Here is what I would stick in an OptoScript block for a start.



if (IsWithinLimits (input1-input2, -5, 5)) then
   alarm = 0;
else
   alarm = 1;
endif


So, the way I read it, if the difference between the two analog inputs is outside those limits (of -5 to +5), then sound an alarm (in this case, just set the alarm variable true, this will be handled elsewhere).
If the difference is small, then the signals are Ok, so clear the alarm variable.

Of course, the hard limits I have set there could be swapped out for variables, so you could have a fine range at some times and the a bigger range at others (I’m thinking process start up or shutdown alarm suppression).

Can anyone see what I have missed?

Ben.

thankx Ben…

If I understand correctly, under normal circumstances you want the strategy to use the average of the two level sensors. If the difference between them ever exceeds 5% of full scale, you want the strategy only to use the sensor that an operator designates as reliable. Once the readings are back within range, the strategy resumes using the average.

I’m not sure how I would go about handling your alarm condition. How does the strategy know which of the two readings is reliable? How does the operator know? However, if you are able to answer those questions, it might make sense to implement this with a pointer. I’ve found that if PAC Display is involved in choosing what a pointer is supposed to reference, a pointer table makes it easier.

If you create the following tags:
aiLevel_Sensor_1 (your analog input point)
aiLevel_Sensor_2 (your analog input point)
fLevel_Sensor_Average (a float variable)
nLevel_Source_Index (an I32 variable)
pLevel_Reading (a pointer to a float variable)
ptLevel_Reading_Source (a pointer table)

Somewhere in your powerup chart, you would initialize the pointer table like this:
ptLevel_Reading_Source[0] = &fLevel_Sensor_Average;
ptLevel_Reading_Source[1] = &aiLevel_Sensor_1;
ptLevel_Reading_Source[2] = &aiLevel_Sensor_2;

and you would initialize the pointer as well. If you want to use the average by default, that is element 0.
nLevel_Source_Index = 0;
pLevel_Reading = ptLevel_Reading_Source[nLevel_Source_Index];

Your strategy would have sections of code that includes the following:

  1. Main flowchart activity that always looks at the pLevel_Reading pointer if it needs to know the level.

  2. A continuously running flowchart that updates the fLevel_Sensor_Average tag by averaging the two analog inputs.

  3. A continuously running flowchart that looks for changes to the nLevel_Source_Index tag and updates the pointer when detected.

  4. The alarm handling section would change the nLevel_Source_Index based on rules you define, and default back to 0 whenever things are running well.

Your PAC Display program would allow the operator to choose which signal source to use, and the dynamic attribute would the send the corresponding value (0 for average, 1 for sensor 1, 2 for sensor 2) to the nLevel_Source_Index tag.