Skip to main content



      Home
Home » Eclipse Projects » 4DIAC - Framework for Distributed Industrial Automation and Control » force value for composite fb doesn't work
force value for composite fb doesn't work [message #1839746] Sat, 27 March 2021 03:10 Go to next message
Eclipse UserFriend
i t use the logic of single fb, so can't force the value
Re: force value for composite fb doesn't work [message #1839917 is a reply to message #1839746] Thu, 01 April 2021 02:55 Go to previous messageGo to next message
Eclipse UserFriend
Hello Joy.
Are you trying to read a static parameter into a Basic Function Block that is inside a Composite Function Block? That usually works as long as there is an event linked to the parameter. I have attached an image of one of my blocks below. The INIT event is linked to the parameter pickup_voltage. When INIT is fired, then the parameter is read in correctly.

The second image shows the configuration of the parameters in 4diac

Is that what you are trying to do?
Kind regards,
Barry

[Updated on: Thu, 01 April 2021 03:00] by Moderator

Re: force value for composite fb doesn't work [message #1840058 is a reply to message #1839917] Tue, 06 April 2021 04:37 Go to previous messageGo to next message
Eclipse UserFriend
Not exactly what i want, when it's running, i double clcik the composite fb, and add all the fbs to watch, then i right click one di of fb, want to set another new value, but it doesn''t work.
i think this logic of composite force value is missing

[Updated on: Tue, 06 April 2021 04:38] by Moderator

Re: force value for composite fb doesn't work [message #1840059 is a reply to message #1840058] Tue, 06 April 2021 04:52 Go to previous messageGo to next message
Eclipse UserFriend
Hi Joy,
I think the FB Test functionality in the 4diac IDE is only designed to test Basic Function Blocks, not Composite Function Blocks or SIFBs.

Alois or another forum member may be able to confirm that for us. I do a lot of my testing by putting cout print functions in the C++ code. I have learnt to read the execution chain from the inside. I find it a lot easier to see what is going on that way.
Re: force value for composite fb doesn't work [message #1840062 is a reply to message #1840059] Tue, 06 April 2021 05:00 Go to previous messageGo to next message
Eclipse UserFriend
It should be possible to watch values of CFB instances. And I thought also forcing should be possible. Over the weekend I have heavily reworked the code for the Instance viewers. When this code is merged I will also look into the forcing inside of CFBs.

@Barry: I don't think he meant the tester. Unfortunately I'm also way to often debug the C++ code directly. But we are working to make debugging in 4diac IDE better.
Re: force value for composite fb doesn't work [message #1840064 is a reply to message #1840062] Tue, 06 April 2021 05:42 Go to previous messageGo to next message
Eclipse UserFriend
I have already debugged the code, it's exactly a bug
EMGMResponse CResource::writeValue(forte::core::TNameIdentifier &paNameList, const CIEC_STRING & paValue, bool paForce){
EMGMResponse retVal = e_NO_SUCH_OBJECT;

CStringDictionary::TStringId portName = paNameList.back();
paNameList.popBack();

forte::core::TNameIdentifier::CIterator runner(paNameList.begin());

CFunctionBlock *fb = this;
if(paNameList.size() >= 1){
//this is not an identifier for the resource interface
fb = getContainedFB(runner); // the last entry is the input name therefore reduce list here by one
}

if((0 != fb) && (runner.isLastEntry())){
CIEC_ANY *var = fb->getVar(&portName, 1);
if(0 != var){
// 0 is not supported in the fromString method
if((paValue.length() > 0) && (paValue.length() == var->fromString(paValue.getValue()))){
//if we cannot parse the full value the value is not valid
if(paForce){
var->setForced(true);
CDataConnection *con = fb->getDOConnection(portName);
if(0 != con){
//if we have got a connection it was a DO mirror the forced value there
CCriticalRegion criticalRegion(m_oResDataConSync);
con->writeData(var);
}
}
retVal = e_RDY;
}
else{
retVal = e_BAD_PARAMS;
}
}
}
return retVal;
}


the highlight part didn't consider the Hierarchical fb in composite (especially composite fb in composite fb)
Re: force value for composite fb doesn't work [message #1840101 is a reply to message #1840064] Tue, 06 April 2021 16:14 Go to previous message
Eclipse UserFriend
Thanks for pointing that out. The getFB() method in the monitoring class is doing it correctly. The right solution would be to move that method to the resource and use it everywhere. Can you please file a bug.
Previous Topic:compile with utils and rt_events
Next Topic:Memory problem with freertos+lwip
Goto Forum:
  


Current Time: Wed Jul 30 16:06:05 EDT 2025

Powered by FUDForum. Page generated in 0.03622 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top