SmartConnector Forum
Schneider Electric support forum about SmartConnector applications for integration of other building management systems (BMS) into EcoStruxure Building Operation.
Posted: 2018-05-02 03:06 AM
Link copied. Please paste this link to share this article on your social media post.
I have a long running processor that relies upon the values in ProcessorValues. I also have a custom setValueProcessor that updates these PV values. Every 5 seconds the processor asks for the current values, this has been updated by the setValueProcessor but the copy of the PV values my processor gets is from when the process started.
How can I force the method below to get the database instance of PV values rather than a cached instance?
protected ProcessorValue FindOrCreateProcessorValue(string key, string group = null, string aggregate = null)
{
var pv = this.ProcessorValueSource.Items.FirstOrDefault(x => x.Key == key && (group == null || x.Group == group) && (aggregate == null || x.Aggregate == aggregate));
if (pv == null)
{
pv = new ProcessorValue
{
Key = key,
Group = group,
Aggregate = aggregate,
};
ProcessorValueSource.Add(pv);
ProcessorValueSource.Save();
}
return pv;
}
Link copied. Please paste this link to share this article on your social media post.
You don't need to call the object factory.Simply calling DisposeOfProcessorValueDataSource() from your Processor is sufficient.
ProcessorValueSource is lazy loaded when it is next needed.
Link copied. Please paste this link to share this article on your social media post.
Hi James!
Good question, I took a look at the source, and it looks as though you should be able to refresh your processor values source by setting it to a new instance of IProcessorValueDataSource. Try the below:
this.ProcessorValueSource = MongooseObjectFactory.Current.GetInstance<IProcessorValueDataSource>();
Regards,
-Jeff
Link copied. Please paste this link to share this article on your social media post.
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.