Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 5 posts ] 
Author Message
 Post subject: Analogue values on the screen
PostPosted: Tue Mar 20, 2012 3:14 am 

Joined: Fri Jan 27, 2012 4:20 am
Posts: 114

Offline
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


 Profile  
 
 Post subject: Re: Analogue values on the screen
PostPosted: Tue Mar 20, 2012 10:14 am 

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

Offline
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 792 times ]

_________________
Best Regards,

Beijer Electronics, Inc.
Skylar Walker | Applications Engineer
 Profile  
 
 Post subject: Re: Analogue values on the screen
PostPosted: Fri Jun 08, 2012 2:53 am 

Joined: Fri Jan 27, 2012 4:20 am
Posts: 114

Offline
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


 Profile  
 
 Post subject: Re: Analogue values on the screen
PostPosted: Fri Jun 08, 2012 6:57 am 

Joined: Tue Mar 13, 2012 9:53 am
Posts: 644

Offline
Hi Waldemar,

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


Code:
      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.
      }


Attachment:
Snap 2012-06-08 at 07.54.47.png
Snap 2012-06-08 at 07.54.47.png [ 146.39 KiB | Viewed 703 times ]

Attachment:
Snap 2012-06-08 at 07.55.03.png
Snap 2012-06-08 at 07.55.03.png [ 58.77 KiB | Viewed 703 times ]

_________________
Best Regards,
Mark Monroe

Beijer Electronics, Inc. | Applications Engineer


 Profile  
 
 Post subject: Re: Analogue values on the screen
PostPosted: Mon Jun 11, 2012 3:47 am 

Joined: Fri Jan 27, 2012 4:20 am
Posts: 114

Offline
Works fine. Thank You very much Mark.


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC - 7 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron