Dynamic Attribute update

Hi All,

A Java DS has a command which creates dynamic attributes (Attribute Name: Dynamic). However, I am not able to write values to this dynamically created attribute.
On Contrary if we create dynamic attributes (Attribute Name: Dynamic1) from init_device() then the value is updated.

Please find the code below:

@Command(name = "CreateDy", inTypeDesc = "", outTypeDesc = "")
	public void CreateDy() throws DevFailed {
		xlogger.entry();
		/*—– PROTECTED REGION ID(DynamicAttrClass.createDy) ENABLED START —–*/

		// Put command code here
		//createDyAttr1();
		SubArrayDyAttr d1 = new SubArrayDyAttr("Dynamic");
		d1.setValue(new AttributeValue("Helo", AttrQuality.ATTR_WARNING));
		
		dynamicManager.addAttribute(d1);
		//System.out.println("d1.getValue(): " + d1.getValue().getValue());
		
		
		
		System.out.println("Dynamic Attribute Created");
		/*—– PROTECTED REGION END —–*/ // DynamicAttrClass.createDy
		xlogger.exit();
	}
[s][/s]
Regards,
TCS_GMRT
Hi TCS_GMRT team,

I think the polling is enabled for the dynamic attribute. This should result in the value of the attribute getting polled at regular intervals and stored in the Cache. But somehow this is not happening for the dynamic attributes created outside of the init_device() method.

To confirm, please do the following
1. Remove polling for the dynamically created attribute
2. Source for the device is set to CACHE_DEV by default. Set it to DEV. (Snapshot attached for reference).
3. Create the dynamic attribute.
4. Check if the value is getting reflected on the ATKPanel or not.

I presume you enabled the polling for events. If above findings are correct then remove polling for the attributes and push the change events from the code.

Please note that this is a workaround and not the solution. I'm not able to figure out the reason as to why the value of an attribute created dynamically outside the init_device() method is not getting cached. TANGO experts may be able to answer it.

However, it is suggested to create dynamic attributes in the init_device() method.

Regards,
Vatsal Trivedi
Thanks Vatsal, Will try and get back.
Regards,
TCS_GMRT
This issue has been solved offline here is the summary of the solution.

There was no problem creating dynamic attributes in the command of a Java server. On the contrary two bugs were found:


1. Bug in user code returning a non-initialised value from the read dynamic attribute.
2. Bug in the JTango library of dynamic attributes not being polled when they return a non-initialised value

The second bug has been fixed by this PR: https://github.com/tango-controls/JTango/pull/43

The new release which fixes this problem is available here: https://bintray.com/tango-controls/maven/JTango/9.3.4

Thanks to Continuous Integration + Pascal + Igor for this prompt bug fix!
Thanks for the early & prompt reply. Help is much appreciated.
Regards,
TCS_GMRT
 
Register or login to create to post a reply.