Analogue values on the screen

A forum devoted to the discussion of all topics having to do with scripting and other advanced programming using iX Developer.
Post Reply
wlederer
Posts: 175
Joined: Fri Jan 27, 2012 4:20 am

Analogue values on the screen

Post 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

Skylar
Posts: 42
Joined: Wed Jan 04, 2012 11:17 am

Re: Analogue values on the screen

Post 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.
Attachments
decimalSetting.png
decimalSetting.png (324.28 KiB) Viewed 10700 times
Best Regards,

Beijer Electronics, Inc.
Skylar Walker | Applications Engineer

wlederer
Posts: 175
Joined: Fri Jan 27, 2012 4:20 am

Re: Analogue values on the screen

Post 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

mark.monroe
Posts: 824
Joined: Tue Mar 13, 2012 9:53 am

Re: Analogue values on the screen

Post 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 10611 times
Snap 2012-06-08 at 07.55.03.png
Snap 2012-06-08 at 07.55.03.png (58.77 KiB) Viewed 10611 times
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer

wlederer
Posts: 175
Joined: Fri Jan 27, 2012 4:20 am

Re: Analogue values on the screen

Post by wlederer »

Works fine. Thank You very much Mark.

Post Reply