Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: how to retrieve a value in a tag and transfer in another tag
PostPosted: Mon Jun 04, 2018 8:44 am 

Joined: Mon Jun 04, 2018 8:15 am
Posts: 3

Offline
HI,I need your help to complete a program.
I need to retrieve a value from a tag at a T time that is constantly changing (Conso of the month).
this value goes back to zero every 1st of the month. I must therefore recover the max value of the month.
this value must be put in the Tag of the corresponding month (January, February, ...)
I tried with the scheduler to retrieve this value and put it in another tag (June), but the value is displayed at 1.
so I need your help to solve this problem, could you help me over it.

so How to pick a value a at T time in a tag and set this value in another Tag (june per example)?
this tag(june) is not used in a controller, it only used for display
thanks for your help
yannick


Attachments:
Sans titre.jpg
Sans titre.jpg [ 133.46 KiB | Viewed 70 times ]
 Profile  
 
 Post subject: Re: how to retrieve a value in a tag and transfer in another
PostPosted: Wed Jun 06, 2018 9:30 am 
User avatar

Joined: Thu Nov 16, 2017 3:32 pm
Posts: 34

Offline
I would use the SystemTagMonth and check the value changes on that one and your KWh tag. I would write something like this:


Code:
void MyValue_ValueChange(System.Object sender, Core.Api.DataSource.ValueChangedEventArgs e)
      {
         if(MyValue.Value > MonthMaxValue.Value)
         {
            MonthMaxValue.Value = MyValue.Value;
         }
      }
      
      void SystemTagMonth_ValueChange(System.Object sender, Core.Api.DataSource.ValueChangedEventArgs e)
      {
         switch(SystemTagMonth.Value)
         {
            //When the month value changes, set the highest value to the previous month max value
            case 1:
               DecMaxValue.Value = MonthMaxValue.Value;
               break;
            case 2:
               JanMaxValue.Value = MonthMaxValue.Value;
               break;
            case 3:
               FebMaxValue.Value = MonthMaxValue.Value;
               break;
            case 4:
               MarMaxValue.Value = MonthMaxValue.Value;
               break;
            case 5:
               AprMaxValue.Value = MonthMaxValue.Value;
               break;
            case 6:
               MayMaxValue.Value = MonthMaxValue.Value;
               break;
            case 7:
               JunMaxValue.Value = MonthMaxValue.Value;
               break;
            case 8:
               JulMaxValue.Value = MonthMaxValue.Value;               
               break;
            case 9:
               AugMaxValue.Value = MonthMaxValue.Value;
               break;
            case 10:
               SepMaxValue.Value = MonthMaxValue.Value;
               break;
            case 11:
               OctMaxValue.Value = MonthMaxValue.Value;
               break;
            case 12:
               NovMaxValue.Value = MonthMaxValue.Value;
               break;      
         }
         
         //Once the MonthMaxValue has been stored to the correct month, reset its value for the new month
         MonthMaxValue.Value = 0;
         
      }




_________________
iX Quick Links:
iX Reference Manual: http://beijerinc.com/download/index.php?id=ix/referencemanual
iX Video Tutorials: https://www.beijerelectronics.com/en/Products/software/ix-hmi-software/Vimeo___video___page


 Profile  
 
 Post subject: Re: how to retrieve a value in a tag and transfer in another
PostPosted: Wed Jun 06, 2018 3:39 pm 

Joined: Mon Jun 04, 2018 8:15 am
Posts: 3

Offline
Hi Mr Russ, thanks for your help.
i'm very beginner in script and trying to understand.

MyValue = that's the tag of my "conso mois"
and each DecMaxValue, JanMaxValue... refer to my tags december, janvier...
?

MonthMaxValue, Month is define by the systemTagMonth ?

so if i understand well, i have to rename my months tags with DecMaxValue, JanTagvalue.... or replace those words with the tags names of my choice in the script?

Do i have to create the tag "SystemTagMonth" in my tag list?

and last question, does the tag SystemTagWeek exist?

thanks a lot
yannick


 Profile  
 
 Post subject: Re: how to retrieve a value in a tag and transfer in another
PostPosted: Mon Jun 11, 2018 2:00 pm 

Joined: Mon Jun 04, 2018 8:15 am
Posts: 3

Offline
hi, i have a script error when i'm compil this one:
CS0103: le nom "MyValue" n'existe pas dans le contexte actuel.

sorry, but i'm really a beginner in script.

thanks


Attachments:
Sans titre.png
Sans titre.png [ 286.32 KiB | Viewed 45 times ]
 Profile  
 
 Post subject: Re: how to retrieve a value in a tag and transfer in another
PostPosted: Mon Jun 11, 2018 2:40 pm 
User avatar

Joined: Thu Nov 16, 2017 3:32 pm
Posts: 34

Offline
Oh, sorry for the confusion, that script I provided should be placed on the Tags Script page. You have it on the ConsoAspiration script page.

_________________
iX Quick Links:
iX Reference Manual: http://beijerinc.com/download/index.php?id=ix/referencemanual
iX Video Tutorials: https://www.beijerelectronics.com/en/Products/software/ix-hmi-software/Vimeo___video___page


 Profile  
 
 Post subject: Re: how to retrieve a value in a tag and transfer in another
PostPosted: Mon Jun 11, 2018 2:49 pm 
User avatar

Joined: Thu Nov 16, 2017 3:32 pm
Posts: 34

Offline
Also once its on the Tags Script page, make sure you either name your tags the same as what is in the script or change the script to match your tags and you will need to hook up the event handlers for the SystemTagMonth_ValueChange and the MyValue_ValueChange. See below:

Attachment:
store-highest-montly-value.png
store-highest-montly-value.png [ 89.9 KiB | Viewed 44 times ]

_________________
iX Quick Links:
iX Reference Manual: http://beijerinc.com/download/index.php?id=ix/referencemanual
iX Video Tutorials: https://www.beijerelectronics.com/en/Products/software/ix-hmi-software/Vimeo___video___page


 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 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: