We are working on the server example 2 of Gurux.dlms.c. Yesterday, you did a release and you updated the server example 2 by merging the "exampleserver.c" and "connection.c" of GuruxDLMSServerExample2 into "main.c".
After testing the new code, we have some questions that will maybe lead to a misunderstanding or bugs report:
- First of all, this part below in the while loop of the main function are still not clear to us, if you can explain more what you intended to do? We still do not know how the executeTime is calculated. In fact, each 30 seconds the if condition below is true and trigger the svr_run that trigger the send push action continuously without knowing the impact on the client side or even how to receive these send messages on the GXDLMSDirector.
"uint32_t start = time_current();
if (executeTime <= start)
{
svr_run(&settings, start, &executeTime);
if (executeTime != -1)
{
printf("%lu seconds before next invoke.\r\n", executeTime - start);
}
}"
- Concerning the single action scheduler that are supposed to trigger the desired script based on the execution time, it is not working like expected. (discussion: Time driven interface classes: Single Action Scheduler)
In fact, we added through the GXDLMSDirector the execution time in the single action scheduler object to trigger the connection or disconnection of the meter (by triggering the methods of the disconnect control object). But when it reached the introduced time, it did nothing.
- Finally, concerning the event log (profile generic object), it is obviously intended to store the event number and the time on which the event occurred like asked. But the values stored in the buffer of the event log are not logic and repetitive (check the picture below).
It is maybe link to the fact that we are triggering all the time the svr_run in the while loop that are triggering the handleEventLogActions that are capturing wrong data to the Event log continuously.
If you please can help us in these matters above by giving us more information and explanation or fixing if their are bugs.
When you call svr_run it goes throw all push and Action Schedule objects and some other objects and finds smallest time he invoke is called. Basically you can sleep the difference and run svr_run again.
Sleep is good if you are using own thread for that and want to save battery.
Your values look strange. What compiler you are using?
Concerning the compiler, we are using Visual studio 2019 C.
Thank you for the explanation concerning the svr_run function, it is well understood.
Our concern resides now in the svr_run -> svr_handleSingleActionSchedule. In that function, we are supposed to collect the execution time introduced through the GXDLMSDirector. Based on the execution time the server will know if it is time to trigger the desired script or not. We realized that the execution time is saved in the "gxtime* s" variable. Afterwards, the variable s is passed as the argument number 5 (gxtime* start) in the function svr_invoke where some comparisons are made. The script is sometimes triggered randomly but not on the time introduced and wanted.
We are not able to understand what is happening and why the action scheduler is not acting like desired. If you please can check it again especially the functions listed above and explain to us in case it was a bug or not the logic and the purpose of these functions (svr_handleSingleActionSchedule and especially the svr_invoke function and its arguments check the picture).
I downloaded the latest example from Github like you asked and ran it without any changes. We used a public client to connect with the server example 2 through TCP and we tried to read the event log. Unfortunately, the Event log values are still wrong and not logic at all like you can see in the picture below.
When i tried to read the load profile with recording period, it was empty. We captured some values then read it. The time and values are perfectly right (check the picture below).
The issue of the wrong values concerns only the event log and maybe it is linked to the file "events.raw" where the values are saved automatically.
Hi,
Hi,
When you call svr_run it goes throw all push and Action Schedule objects and some other objects and finds smallest time he invoke is called. Basically you can sleep the difference and run svr_run again.
Sleep is good if you are using own thread for that and want to save battery.
Your values look strange. What compiler you are using?
BR,
Mikko
Hi,
Hi,
Concerning the compiler, we are using Visual studio 2019 C.
Thank you for the explanation concerning the svr_run function, it is well understood.
Our concern resides now in the svr_run -> svr_handleSingleActionSchedule. In that function, we are supposed to collect the execution time introduced through the GXDLMSDirector. Based on the execution time the server will know if it is time to trigger the desired script or not. We realized that the execution time is saved in the "gxtime* s" variable. Afterwards, the variable s is passed as the argument number 5 (gxtime* start) in the function svr_invoke where some comparisons are made. The script is sometimes triggered randomly but not on the time introduced and wanted.
We are not able to understand what is happening and why the action scheduler is not acting like desired. If you please can check it again especially the functions listed above and explain to us in case it was a bug or not the logic and the purpose of these functions (svr_handleSingleActionSchedule and especially the svr_invoke function and its arguments check the picture).
Hi,
Hi,
Can you get the latest example from Github and run it without changes? I wonder why your Event log values are wrong.
BR,
Mikko
Hi,
Hi,
I downloaded the latest example from Github like you asked and ran it without any changes. We used a public client to connect with the server example 2 through TCP and we tried to read the event log. Unfortunately, the Event log values are still wrong and not logic at all like you can see in the picture below.
Best regards,
Lara Wakim
Hi,
Hi,
We can't repeat this. What is your Windows version? Is that 32 or 64 bit Windows?
BR,
Mikko
Hi,
Hi,
We have a 64 bit Windows.
When i tried to read the load profile with recording period, it was empty. We captured some values then read it. The time and values are perfectly right (check the picture below).
The issue of the wrong values concerns only the event log and maybe it is linked to the file "events.raw" where the values are saved automatically.
Best regards,
Lara Wakim.
Hi,
Hi,
We can now repeat this. We'll check what is the reason why this is happening.
BR,
Mikko
Hi,
Hi,
We tested the new release "Profile generic improved for server example" and it worked perfectly like desired.
Thank you much appreciated.
Best Regards,
Lara Wakim
Hi Lara,
Hi Lara,
Thanks for let me know.
BR,
Mikko