Page 1 of 1

Analogue values on the screen

Posted: Tue Mar 20, 2012 3:14 am
by wlederer
The task is to show an analogue value (e.g. pressure) on the screen. I wrote a script AnalogueValueScript.
Three tags were created
int Pressure_16bit;(to read value from a PLC register)
float Pressure_calculated; (used for further calculations)
string Pressure_text; (to be shown with comments on the screen)

The value of Pressure_calculated is taken from the script AnalogueValueScript, which is refreshing every 500mS from another script TimerScript:

Globals.Tags.Pressure_calculated.Value=Globals.AnalogueValueScript.Pressure();
Globals.Tags.Pressure_text.Value="Pressure= "+Globals.Pressure_calculated.Value.ToString()+" Bar";

Actually, it works, but only if I put the tag Pressure_16bit on the screen in an Analog Numeric control. Why? How can I avoid it?
Another question, too many decimals are shown on the screen. How to control their quantity?
Regards, Waldemar

Re: Analogue values on the screen

Posted: Tue Mar 20, 2012 10:14 am
by Skylar
Waldemar,

iX will only poll tags that are visible on the screen unless the "Always Active" box is checked. Try checking the "Always Active" box on the tag you are using.

Attached is a screen shot of where to set the number of decimal places.

Re: Analogue values on the screen

Posted: Fri Jun 08, 2012 2:53 am
by wlederer
Thank You Skylar.
As I understood, there is no way to control the number of decimals, unless the value is shown in an analog numeric box?
regards, Waldemar

Re: Analogue values on the screen

Posted: Fri Jun 08, 2012 6:57 am
by mark.monroe
Hi Waldemar,

You could always create your own on "Value Change Event" in the Tags scripting area and round the number.

Code: Select all

		void Tag1_ValueChange(System.Object sender, Neo.ApplicationFramework.Interfaces.Events.ValueChangedEventArgs e)
		{
			Globals.Tags.Tag1.Value = Math.Round((double) Globals.Tags.Tag1.Value, 1); //Returns 3.4.
		}
Snap 2012-06-08 at 07.54.47.png
Snap 2012-06-08 at 07.54.47.png (146.39 KiB) Viewed 10612 times
Snap 2012-06-08 at 07.55.03.png
Snap 2012-06-08 at 07.55.03.png (58.77 KiB) Viewed 10612 times

Re: Analogue values on the screen

Posted: Mon Jun 11, 2012 3:47 am
by wlederer
Works fine. Thank You very much Mark.