Welcome Guest ( Login | Register )



All times are UTC - 7 hours [ DST ]



Post new topic Reply to topic  [ 9 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: 6

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 1381 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: 44

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: 6

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: 6

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 1356 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: 44

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: 44

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 1355 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  
 
 Post subject: Re: how to retrieve a value in a tag and transfer in another
PostPosted: Thu Jun 21, 2018 11:28 am 

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

Offline
Hi, after some time to manipulate Ix developer, and made some change. the program seems to work fine.

finaly, my tag where the total power was stored, was never reset at the end of the month. so i created a new tag (IndexMonth) where i stored the Max value of the previous month and used this value to calculate the next month :

the script is like that:

case 1:
DecMaxValue.Value = MonthMaxValue.Value-IndexMonthMaxValue.Value;
IndexMonthValue.Value=MonthMaxValue.Value;
break;

But now i have an other problem, when i transfert the updated program or when i restart the panel, the month values and the index value are set to "0".

I don't understand why, i used the this parameters "int32", "non volatile"

could you explain me why this values are set to "0" each time i restart the panel
Maybe there is something to set or the script to change?

thanks for your help.
yannick


 Profile  
 
 Post subject: Re: how to retrieve a value in a tag and transfer in another
PostPosted: Fri Jun 22, 2018 1:23 am 

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

Offline
Finally after a lot of test and change the month value stay at each program transfert.
all but not the previous month. i'm explain:

actually, i'm in the case 6 (june)
so with this code, when i transfert the program, i'have "0" in "Index Mois" and "Mai"
M34ConsoMai.Value = MonthMaxValueM34.Value-IndexPreviousMonthM34.Value;
IndexPreviousMonthM34.Value = MonthMaxValueM34.Value;
break;

If i clear the second line (IndexPreviousMonthM34.Value = MonthMaxValueM34.Value)
i have "Index Moi" That stay at 8 and "Mai" that show "-8"

Why??


Attachments:
mai screen.jpg
mai screen.jpg [ 273.95 KiB | Viewed 1269 times ]
 Profile  
 
 Post subject: Re: how to retrieve a value in a tag and transfer in another
PostPosted: Mon Jun 25, 2018 3:20 am 

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

Offline
me again,

i manipulated a lot this weekend.

and now, it's seems to stay only one problem, when i transfert the program to the HMI, the program seems to consider that the month has changed and does the calculation of the previous month.
is it possible to tell the script to ignore the first month change?

thanks
yannick


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