Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Notifications
Login / Register
Community
Community
Notifications
close
  • Forums
  • Knowledge Center
  • Events & Webinars
  • Ideas
  • Blogs
Help
Help
  • Explore Community
  • Get Started
  • Ask the Community
  • How-To & Best Practices
  • Contact Support
Login / Register
Sustainability
Sustainability

Join our "Ask Me About" community webinar on May 20th at 9 AM CET and 5 PM CET to explore cybersecurity and monitoring for Data Center and edge IT. Learn about market trends, cutting-edge technologies, and best practices from industry experts.
Register and secure your Critical IT infrastructure

CustomSetValuesProcessor doesn't update the value of SetupProcessor

SmartConnector Forum

Schneider Electric support forum about SmartConnector applications for integration of other building management systems (BMS) into EcoStruxure Building Operation.

cancel
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
Showing results for 
Show  only  | Search instead for 
Did you mean: 
  • Home
  • Schneider Electric Community
  • EcoStruxure Building
  • SmartConnector
  • SmartConnector Forum
  • CustomSetValuesProcessor doesn't update the value of SetupProcessor
Options
  • Subscribe to RSS Feed
  • Mark Topic as New
  • Mark Topic as Read
  • Float this Topic for Current User
  • Bookmark
  • Subscribe
  • Mute
  • Printer Friendly Page
Invite a Co-worker
Send a co-worker an invite to the portal.Just enter their email address and we'll connect them to register. After joining, they will belong to the same company.
You have entered an invalid email address. Please re-enter the email address.
This co-worker has already been invited to the Exchange portal. Please invite another co-worker.
Please enter email address
Send Invite Cancel
Invitation Sent
Your invitation was sent.Thanks for sharing Exchange with your co-worker.
Send New Invite Close
Top Experts
User Count
JeffBowman
Sisko JeffBowman Sisko
164
ardak
ardak Schneider Alumni (Retired)
34
sesa180908_brid
Commander sesa180908_brid Commander
34
mike_meirovitz
Commander mike_meirovitz
21
View All
Related Products
product field
Schneider Electric
Smart Connector

Invite a Colleague

Found this content useful? Share it with a Colleague!

Invite a Colleague Invite
Solved Go to Solution
Back to SmartConnector Forum
Solved
Sabrina_Merelli
Lieutenant Sabrina_Merelli Lieutenant
Lieutenant

Posted: ‎2021-02-15 01:11 AM . Last Modified: ‎2021-02-15 03:52 AM

0 Likes
1
1200
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-02-15 01:11 AM

CustomSetValuesProcessor doesn't update the value of SetupProcessor

Dear Community,

I have a problem with the implementation of the CustomSetValueProcessor and the SetValue function:

when I update the value from the Workstation I see the correct value in the CustomSetValueProcessor in my logs, but in the SetupProcessor I don't see the updated value.

 

I followed what has been done in the developer guide: I created the class CustomEwsServiceHost, with my CustomSetValueProcessor and the SetValue function.

 

 

Spoiler

protected override ResultType SetValue(ValueTypeStateless item)

        {

            log.Debug("[CARDPROGRAMMERPROCESSOR UPDATE] Changed item " + item.Id + " to " + item.Value);

           

            string errorMessage = "";

            Utility.MakeDataServedUncertain(DataAdapter, item.Id, item.Value, out errorMessage);

 

            log.Debug("[CARDPROGRAMMERPROCESSOR UPDATE] MakeDataServedUncertain DONE:"+ errorMessage);

 

            return base.SetValue(item);

        }

 

Created the function MakeDataServerdUncertain that updates the value in the dataAdapter and verifies to have update it correctly

 

 

Spoiler

public static bool MakeDataServedUncertain(EwsServerDataAdapter adapter, string itemID, string itemValue, out string ErrorMessage)

        {

            bool result = true;

            ErrorMessage = "";

            try

            {

                switch (itemID)

                {

                    case EWSServerNames.WriteCardIDX:

                    case EWSServerNames.ReadCardIDX:

                        adapter.ModifyValueItemValue(itemID, Convert.ToBoolean(Convert.ToInt32(itemValue)), EwsValueStateEnum.Good);

                        var currentWriteValue = adapter.ValueItems.FirstOrDefault(x => x.AlternateId == EWSServerNames.WriteCardIDX);

                        ErrorMessage = "modified correctly!"+ currentWriteValue.Value;

                        break;

                    case EWSServerNames.CardNumberIDX:

                    case EWSServerNames.PlantCodeIDX:

                        adapter.ModifyValueItemValue(itemID, Convert.ToInt32(itemValue), EwsValueStateEnum.Uncertain);

                        break;

                    case EWSServerNames.ExpirationDateIDX:

                        adapter.ModifyValueItemValue(itemID, Convert.ToDateTime(itemValue), EwsValueStateEnum.Uncertain);

                        break;

                    default:

                        break;

                }               

            }

            catch (Exception ex)

            {

                ErrorMessage = ex.Message;

                result = false;

            }

 

            return result;

        }

 

In the SetupProcessor I call the function CheckReadWriteCommand which periodically (every 2 seconds) re-reads the value of the item WriteCard and in case it's true it will write the card:

 

 

Spoiler

private void CheckReadWriteCommand()

        {

            try

            {

                while (continueExecution && !IsCancellationRequested)

                {                   

                    var currentWriteValue = DataAdapter.ValueItems.FirstOrDefault(x => x.AlternateId == EWSServerNames.WriteCardIDX);

 

                    if (currentWriteValue == null)

                    {

                        log.Debug("[CARDPROGRAMMERPROCESSOR UPDATE] Write card idx not found");

                    }

                   

                    log.Debug("[CARDPROGRAMMERPROCESSOR UPDATE] CheckReadWriteCommand: New value of currentWriteValue = " + currentWriteValue.Value + " [last modified: " + currentWriteValue.LastModified + "]");

// if true write the card

                    System.Threading.Thread.Sleep(2000);

                }

            }

            catch (Exception ex)

            {

                log.Error("[CARDPROGRAMMERPROCESSOR UPDATE] CheckReadWriteCommand: error: " + ex.Message);

            }

        }

 

Nonetheless when I write the WriteCard value to true from the Workstation I see the correct variation of the value in the CustomSetValuesProcessor, but not in the SetupProcessor: there the value is always the previous one. The only way to see the value updated is to restart the processor, that reupload the values from the EWSServer.

 

In the logs I see:

2021-02-11 11:40:01.7725,[CARDPROGRAMMERPROCESSOR UPDATE] CheckReadWriteCommand: New value of currentWriteValue = False [last modified: 11/02/2021 10:39:20], //dato letto periodicamente dal SetupProcessor

2021-02-11 11:40:01.8833,[CARDPROGRAMMERPROCESSOR UPDATE] Changed item WriteCard to 1, //informazione che vedo nel CustomSetValuesProcessor

2021-02-11 11:40:01.9451,[CARDPROGRAMMERPROCESSOR UPDATE] MakeDataServedUncertain DONE:modified correctly!True, //conferma nel CustomSetValuesProcessor della modifica del valore nell’item del dataAdapter

2021-02-11 11:40:03.7769,[CARDPROGRAMMERPROCESSOR UPDATE] CheckReadWriteCommand: New value of currentWriteValue = False [last modified: 11/02/2021 10:39:20], //dato letto periodicamente dal SetupProcessor

 

 

My doubts are: the 2 adapters (CustomSetValueProcessor and SetupProcessor) are effectively the same adapter? Or they are 2 distinct adapters?

Why I cant propagate the modifies from one to the other?

I have to manage manually, with some events, the passage of the data from the CustomSetValuesProcessor to the SetupProcessor?

 

Many thanks to who helps me!!

Sabrina

 

 

 

  • Thumbnail of Smart Connector
    Schneider Electric
    Smart Connector
View products (1)
Tags (1)
  • Tags:
  • english
Reply
  • All forum topics
  • Previous Topic
  • Next Topic

Accepted Solutions
JeffBowman
Sisko JeffBowman Sisko
Sisko

Posted: ‎2021-02-16 10:54 AM

4 Likes
0
1184
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-02-16 10:54 AM

Hi Sabrina,

 

If I understand correctly, you have a setup processor that implements an infinite loop (in that you are not utilizing Smart Connector schedules to run on an interval). In this case, I am assuming that the EwsServerDataAdapter class you have is instantiated once and reused in the infinite loop. If this is the case, and you are not instantiating a new instance, you need to call .CreateDatabaseContext() on the DataAdapter before reading the values. The description for this method is:

 

“Will regenerate the database contexts this adapter is connected to.  You only need to call this if you know that objects may have been modified by another process (WHICH IN YOUR CASE YOU KNOW THEY ARE BY THE CUSTOM SET VALUES). All pending changes will be lost.”

 

However, while the above will work in your infinite loop code, what I would suggest in this case, as it seems like there is no real need for an infinite loop in this scenario, is to setup your Setup Processor to run on a schedule in the Smart Connector portal instead. That way the processor will automatically ‘restart’ every x seconds.  In general this is the preferred way to develop processors as it is enough in the majority of cases.

 

Please let me know if you have any questions.

 

Best Regards,

 

-Jeff

See Answer In Context

Tags (1)
  • Tags:
  • english
Reply
Reply 1
JeffBowman
Sisko JeffBowman Sisko
Sisko

Posted: ‎2021-02-16 10:54 AM

4 Likes
0
1185
  • Mark as New
  • Bookmark
  • Subscribe
  • Mute
  • Subscribe to RSS Feed
  • Permalink
  • Print
  • Email to a Friend
  • Report Inappropriate Content

Link copied. Please paste this link to share this article on your social media post.

‎2021-02-16 10:54 AM

Hi Sabrina,

 

If I understand correctly, you have a setup processor that implements an infinite loop (in that you are not utilizing Smart Connector schedules to run on an interval). In this case, I am assuming that the EwsServerDataAdapter class you have is instantiated once and reused in the infinite loop. If this is the case, and you are not instantiating a new instance, you need to call .CreateDatabaseContext() on the DataAdapter before reading the values. The description for this method is:

 

“Will regenerate the database contexts this adapter is connected to.  You only need to call this if you know that objects may have been modified by another process (WHICH IN YOUR CASE YOU KNOW THEY ARE BY THE CUSTOM SET VALUES). All pending changes will be lost.”

 

However, while the above will work in your infinite loop code, what I would suggest in this case, as it seems like there is no real need for an infinite loop in this scenario, is to setup your Setup Processor to run on a schedule in the Smart Connector portal instead. That way the processor will automatically ‘restart’ every x seconds.  In general this is the preferred way to develop processors as it is enough in the majority of cases.

 

Please let me know if you have any questions.

 

Best Regards,

 

-Jeff

Tags (1)
  • Tags:
  • english
Reply
Preview Exit Preview

never-displayed

You must be signed in to add attachments

never-displayed

 
To The Top!

Forums

  • APC UPS Data Center Backup Solutions
  • EcoStruxure IT
  • EcoStruxure Geo SCADA Expert
  • Metering & Power Quality
  • Schneider Electric Wiser

Knowledge Center

Events & webinars

Ideas

Blogs

Get Started

  • Ask the Community
  • Community Guidelines
  • Community User Guide
  • How-To & Best Practice
  • Experts Leaderboard
  • Contact Support
Brand-Logo
Subscribing is a smart move!
You can subscribe to this board after you log in or create your free account.
Forum-Icon

Create your free account or log in to subscribe to the board - and gain access to more than 10,000+ support articles along with insights from experts and peers.

Register today for FREE

Register Now

Already have an account? Login

Terms & Conditions Privacy Notice Change your Cookie Settings © 2025 Schneider Electric

This is a heading

With achievable small steps, users progress and continually feel satisfaction in task accomplishment.

Usetiful Onboarding Checklist remembers the progress of every user, allowing them to take bite-sized journeys and continue where they left.

of