Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 07:10 Go to next message
joy woo is currently offline joy wooFriend
Messages: 195
Registered: May 2019
Senior Member
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 06:55 Go to previous messageGo to next message
Barry Dowdeswell is currently offline Barry DowdeswellFriend
Messages: 33
Registered: November 2018
Member
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 07:00]

Report message to a moderator

Re: force value for composite fb doesn't work [message #1840058 is a reply to message #1839917] Tue, 06 April 2021 08:37 Go to previous messageGo to next message
joy woo is currently offline joy wooFriend
Messages: 195
Registered: May 2019
Senior Member
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 08:38]

Report message to a moderator

Re: force value for composite fb doesn't work [message #1840059 is a reply to message #1840058] Tue, 06 April 2021 08:52 Go to previous messageGo to next message
Barry Dowdeswell is currently offline Barry DowdeswellFriend
Messages: 33
Registered: November 2018
Member
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 09:00 Go to previous messageGo to next message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1213
Registered: January 2014
Senior Member
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 09:42 Go to previous messageGo to next message
joy woo is currently offline joy wooFriend
Messages: 195
Registered: May 2019
Senior Member
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 20:14 Go to previous message
Alois Zoitl is currently offline Alois ZoitlFriend
Messages: 1213
Registered: January 2014
Senior Member
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:Running forte on 64-bit Raspberry Pi 4 running Ubuntu 20.04.2 LTS
Next Topic:Memory problem with freertos+lwip
Goto Forum:
  


Current Time: Sun May 16 15:27:35 GMT 2021

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

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

Back to the top