Issue in SVPublisher_ASDU_setSmpRate
I am trying to generate 4000 samples per second by setting sample mod to samples per second and then specifying 4000 samples per second to be generated.
SVPublisher_ASDU_setSmpMod (asdu1, IEC61850_SV_SMPMOD_SAMPLES_PER_SECOND);
SVPublisher_ASDU_setSmpRate (asdu1, 4000);
However, upon execution, the programme generates samples per second randomly rather than 4000 samples per second.
It sends one message when you call SVPublisher_publish. So the code that is calling SVPublisher_publish is responsible to ensure the sample rate. SVPublisher_ASDU_setSmpRate only set the value in the SV message header.
Thank you for your response.
My purpose to see these commands is to define the sample rate of 4000 samples per second and for that purpose, I am using SVPublisher_ASDU_setSmpRate. However, upon using that command, I am unable to achieve the desired sample rate of 4000 samples per second. Could you please comment on how to achieve the desired sample rate? Thank you.
You have to ensure that you call SVPublisher_publish in the frequency required by your sampling rate and the number of samples per ASDU. On a linux system you can approximate this with calling usleep and tweaking the wait time between SVPublisher_publish calls. This might work for a prototype. But for a production solution you would need some kind of RTOS integration.