I wanted to know how to get list of in-built pipeline arguments in Data Fusion Pipeline ?
I am not able to find them anywhere on the documentation as well as on the internet.
As discussed, logicalStartTime is the only argument added by the system.
To get some parameter even those added by the system its recommended using macros that allow placeholders for properties that are unknown at configure time but are known and provided at runtime. For logicalStartTime we have the pre-defined macro named Logical Start Time Function that can be used like below:
${logicalStartTime([timeFormat[,offset [,timezone])}
Where:
timeFormat: Time format string, in the format of a Java SimpleDateFormat
offset: An offset of time before the actual logical start time
timezone: Timezone to be used for the logical start time
The documentations shows us an example:
For example, suppose the logical start time of a pipeline run is
2016-01-01T00:00:00 and this macro is provided:
${logicalStartTime(yyyy-MM-dd'T'HH-mm-ss,1d-4h+30m)}
The format is
yyyy-MM-dd'T'HH-mm-ss and the offset is 1d-4h+30m before the logical
start time. This means the macro will be replaced with
2015-12-31T03:30:00, since the offset translates to 20.5 hours. The
entire macro evaluates to 20.5 hours before midnight of January 1,
2016.
Related
Is there a way for a PLC program to know its own cycle time?
As a workaround, I can just add a persistent variable or a constant to tell it manually, but that's obviously error prone.
To add to Jakob's answer - you can also use GETCURTASKINDEXEX function (Infosys) instead of GETCURTASKINDEX FB. This way you don't have to instantiate it.
_TaskInfo[GETCURTASKINDEXEX()].CycleTime
Will return cycle time as multiples of 100ns (UDINT)
UDINT_TO_LREAL(_TaskInfo[GETCURTASKINDEXEX()].CycleTime) / 10_000_000
Will return cycle time as seconds (LREAL)
For TwinCAT3 this is available in PlcTaskSystemInfo (variable CycleTime).
Combine it with the FB GETCURTASKINDEX to get the data you want.
See one example (though not cycle-time, but still same FB) here at AllTwinCAT.
This is not directly an answer to your question, but can be used to determine the Cycle time.
I like to use the Time() function. It returns a value of data type TIME. It does not represent an absolute time, but can be used to calculate the time between two calls to Time(). In this way you can calculate the Cycle time.
I use it in function blocks (FB) where timing is critical. In this way the FB knows when it was lastly called instead of assuming that it is being run each scan. Even if I or another user of my FB "forgets" to call the FB each scan, the FB still delivers correct outputs.
You can find info on Time() using this link. There is also a function called LTime() which returns a value of data type LTIME, but it seems that Beckhoff did not bother to document this function.
I am working on an evacuation process project and would like to know if its possible to acquire a dataset for text or a variable from main and run in parameter variation experiment (for 100 runs) while storing/saving it after every iteration. This text keeps changing every time the simulation runs because the number of people able to escape during evacuation is different. An alarm (event) goes off and it triggers another event (event1), this then updates the text that counts the number of people in the building.
stopCounting of type boolean is false and peopleRemaining of type long
getPeopleInsideCount() comes from my function
The code I tried using in After experiment run for parameter variation experiment is
iteration3++;
dataset2.add(iteration3,(double)Long.parseLong(root.text2.getText()));
I understand that this code is unable to read the text from the main as a dataset. I have run the simulation in main and the text updates while also noticing that the peopleRemaining variable follows the number in text. Maybe it is possible to obtain variable in a dataset?
please learn to use the AnyLogic help as well. There, you will learn that a Dataset object only stores numbers. Also, a text object has only text as a String. They are not compatible.
You will want to store your evacuation number in a variable of type Int, name it myEvacNumber. So in addition of showing it in your text, you must manually store it in that variable. Best do that at the end of your evacuation ;-)
Then in your experiment in the "after simulation run" codebox, you can access it and store it into your dataset using
dataset.add(root.myEvacNumber);
Note that this will store the value that was in that variable at the very end of each simulation run!
I'm currently using the AOP Library meldjs and I would like to record timing for the new advised functions. As one can notice, function validateRegistration is the first one to be called and the functions below it are the remaining functions called from it, function checkLengths has the same scenario and they are the only functions which are not advised by meldjs (because their full name is shown and the other advised functions have the word advised in their name).
To record the time that function checkLengths took to execute should I take note of the time near it which is 0 ms self time and 3.1 ms total time? Or should I add all of the timings of the functions which were called from it, i.e. for total time I add 3.1(for checkLengths), followed by 3.1, 1.6, 1.6, 1.6, 1.5, 1.5, 0.1 and 0.1.
Any help would be greatly appreciated, I've searched for any sort of clues so that I could confirm what I should do but couldn't find what I was looking for.
Suppose I have a function which has, say 5 inputs: say f(z,t1,t2,t3,t4). I want to do optimization using lsqnolin, i.e. min f(z,t1,t2,t3,t4). However, I have the following request:
User can determine which variables t1,t2,t3,t4 to be optimized. When user input 3 to the program, it means that I need to fix t4 while z,t1,t2,t3 can be changed to get the minimum value. If user input 2 to the program, it means that I need to fix t3,t4 while z,t1,t2 can be changed to get the minimum value.
I understand I can use conditional statement, but in my program, the function can have 20 inputs or even more. What's more, my program accept input [z,t1,t2,t3,t4] at the same time. What I find online require optimization of variables [z,t1,t2,t3,t4] at the same time, but not a particular variable to be fixed.
when reading Ada.Real_Time.Clock right after power-up it shows a value that isn't close to zero and sometimes even negative.
As far as I know Ada.Real_Time.Clock suppose to reset on power-up.
How can I reset Ada.Real_Time.Clock?
Thanks.
The Ada 2005 LRM declares that "real time is defined to be the physical time as observed in the external environment. [emphasis added--MC]
"It is not specified by the language whether the time values are synchronized with any standard time reference. For example, E can correspond to the time of system initialization or it can correspond to the epoch of some time standard." (D.8[18-19])
As it states, Ada does not require that "E", the start of the epoch serving as the "zero time" for real-time Time values, correspond to any particular starting point; it's left up to the compiler implementer.
Whatever specific numeric values you observe for the instances of Time you're seeing, whether near or far from zero, positive or negative, are dependent solely on the compiler implementer's choice of E, how it represents times values, and how it correspondingly implements the real-time capability.
Therefore you should avoid writing code that depends on specific, knowable values of Time, nor code that requires Time values to be intimately manipulable.
Real_Time.Time values should be considered abstract quantities.
Agreeing with Marc. While I have seen some platforms that use time since boot (particularly on Intel platforms, where I think they like to use the processor's iteration counter), that is entirely up to the compiler vendor.
If you need something like "time since startup" and your platform isn't giving you that, then the thing to do would be to grab Real_Time.Clock when you start up, and subtract that value from all further reads from Real_Time.Clock.
You can look at exactly what facilites are defined for the Real_Time package, including all the LRM sections Marc was quoting you, at its LRM page here.
It was long ago but if it helps someone...
I reseted the clock by writing 0 to the time base registers of the MCU.
That's a lovely explanation, but what if someone is trying to write unit tests against code which implements the real_Time clock? For instance, I know that my function foo does an internal comparison against Ada.Real_Time.Clock to check for time spans. Before executing foo with the appropriate inputs I want to reset the clock to force foo down a specific path internally and verify the resulting out parameter has changed.
return_value := foo;
assert (return_value = path1, "tested foo path1");
Reset_Clock;
return_value := foo;
assert (return_value = path2, "tested foo path2");