|
|
|
|
|
|
Re: Writing CSV File Using CSVWriter [message #1823206 is a reply to message #1823205] |
Sun, 22 March 2020 17:16 |
|
Hi, to add to Jose's observation: I function block MUST NOT BLOCK!! As we can clearly see in your screenshot you have one two input event occurences (i.e., one to each: INIT, REQ) and then many output events. However the CVS writer does not get even a single input event delivered (except for the INIT). This is a clear sign that there is an issue within your pv_v2.
|
|
|
|
Re: Writing CSV File Using CSVWriter [message #1823274 is a reply to message #1823268] |
Tue, 24 March 2020 08:14 |
|
This is not a valid IEC 614999 ECC. IEC 61499 clearly states that the invocation of an FB caused by an input event has to be algorithmic and end in a short amount of time. Furthermore IEC 61499 will not update any FB inputs without an input event so your algorithms will work on the same data all the time. In order that your algorithm works you need to close the loop outside of the FB (e.g., with an E_CYCLE FB regularly triggering the calculations).
If you wonder why this is the case: IEC 61499 targets reactive real-time systems. In such systems blocking operations are not permitted. this is similar to PLC programming with IEC 61131-3. There you have an implicit execution invocation from tasks (mostly cyclic). But in both you always have to react.
|
|
|
|
Re: Writing CSV File Using CSVWriter [message #1823509 is a reply to message #1823500] |
Fri, 27 March 2020 18:49 |
|
First of all please note that your 0.99s E_Cycle runs not on 0.99s it runs on 0ms because 0.99s is not a correct Time literal.
Secondly, the CVS_WRITER block will not close the file until you send it a second INIT event with QI set to false. This follows the IEC 61499 rules for SIFBs where an INIT(QI=TRUE) means initialization (in our case open file) INIT(QI=FALSE) means de-initialization (in our case close the file). Depending on your operating system and C library it may take some time until the data writen by the CVS_WRITER is arriving in your file.
In your left-case where you are writing a value very 1ms this happens much earlier then on the left where you are writing only every second. But eventually also here data will be in the file. To be perfectly sure and correct you should close the file (i.e., INIT(QI=FALSE)) when you are done with your writing.
|
|
|
|
|
Re: Writing CSV File Using CSVWriter [message #1823576 is a reply to message #1823575] |
Sun, 29 March 2020 12:29 |
|
In principle yes. However your results may vary a lot depending on the OS you are using.
In 4diac FORTE you can set the CMake option FORTE_TicksPerSecond (you can find it in the advanced section). Be increasing this number you may get a higher resolution for your E_CYCLES. Please be aware that this also greatly increases CPU resources consumed by the timer handling code in 4diac FORTE. If you only have one or two such high demanding timed events it may makes sense to write own SIFBs for that part.
BR,
Alois
|
|
|
|
|
|
|
|
|
Re: Writing CSV File Using CSVWriter [message #1823586 is a reply to message #1823585] |
Sun, 29 March 2020 17:00 |
|
Unfortunately there is not much documentation. The best documentation on the operations and architecture of 4diac FORTE is still in my book "Real-time Execution of IEC 61499". What you need to do is to develop an external event handler which provides the timed events. The external event handler would wake up your FB for generating the according output events. You can use the timer handler and E_CYCLE as an example for how to get started.
But first I think you need to find out means of getting high precision timing in C/C++. I would even recommend some experiments without 4diac FORTE first.
|
|
|
|
Powered by
FUDForum. Page generated in 0.04937 seconds