I have integrated "Gurux.DLMS.cpp-master/GuruxDLMSClientExample" in my project. This application reads information periodically (interval basis like every 1 second or 2 seconds) from the meter. I want to test this client application with 1000+ actual devices but I have only 2 devices. Can I use "Gurux.DLMS.cpp-master/GuruxDLMSServerExample" application instead of actual device without any challenges?
Problem is that example server is different than your meter. Better abroach is if you use Gurux.DLMS.Simulator to simulate your meters. Then you can create your meters easily.
Can I create this type of meter as an image attached in this message?
I mean, according to image, I can read all instantaneous profile parameter using only single OBIS code(1.0.94.91.0.255) same for block profile (1.0.99.1.0.255) and daily profile (1.0.99.2.0.255).
I am trying to simulate my real meter with the fallowing arguments as mentioned below but I am facing error with "Invalid parameter: WRAPPER". Kindly check my command arguments.
The command-line parameter for the WRAPPER at the moment is -w. You don't need the WRAPPER. -w is enough. You can get a list from the command line parameters if you run the app without arguments.
The authentication level is defined when you create the simulated meter and read it. You can't change the authentication level at the moment when you run the simulated devices.
So if you want to create low authenticated devices you can connect to the meter using Low authentication and then save results as low.xml. If you want to simulate High authenticated meters, connect to the meter using a High authentication level, and save result as High.xml.
I have done same as explained you. I have created low.xml file with below command.
D:\Drivers\DLMS\DLMS_Simulator>Gurux.DLMS.Simulator.Net.exe -d India -r ln -a Low -P admin1 -c 32 -w -h 10.14.126.246 -p 4059 -o low.xml -t Verbose
Then,
I have run simulated meters through below command-
D:\Drivers\DLMS\DLMS_Simulator>Gurux.DLMS.Simulator.Net.exe -d India -r ln -a Low -P admin1 -c 32 -w -p 1000 -x low.xml -t Verbose -N 10
DLMS WRAPPER Logical Name simulator start in ports 1000-1009.
Associations:
Low authentication, password
But, Whenever I am trying to connect simulated meter through DLMSDirector, then I am getting this message "Connection is permanently rejected. Authentication failure". Kindly find the attached screen shot of DLMSDirector for connection parameters.
Can you send this XML file to me by email? That is the only way to solve this because it works with our meters.
You can get my email address from here: https://www.gurux.fi/AboutUs
Now, I am able to connect to the created device. I have a question regarding profile generics objects. Actually, The requirement is that my client application reads only profile generics objects i.e. Nameplate-Profile, Instantaneous-profile, block-profile, daily-profile, and all events profile. But in the created devices, there is no any buffered data as shown in the attached picture.
So kindly help me regarding-
(1) How will I store the buffer data into above profiles?
(2) How will I update data of these (except name-plate) profile in interval basis?
-> Instantaneous profile will update at every second?
-> block profile will update at every 5/15 minutes?
-> daily profile will update daily at mid night?
-> and all events will update at occurrence of an event?
(3) How will I update clock at every second level?
Because every user has different needs it's not possible to make an app that fills all the requirements. The idea is that you can modify the simulator for your needs.
The current implementation doesn't read profile generic buffer, because it might take a very long time.
We are planning how to update profile generic buffer values and it's planned to release at the beginning of next month. You can add dynamic values in PreRead to the buffer.
There is a new version where you can overwrite the password with -P parameter.
Clock is also updated dynamically. Command line parameters are updated.
-w is replaced with -i WRAPPER
I am facing challenges to simulate meter with latest version. I have build C# code of "Gurux.DLMS.Simulator.Net" and got file (Gurux.DLMS.Simulator.Net.exe) Version 1.0.0.0.
I have created simulator template "low.xml" successfully using below mentioned command.
------------------------
Gurux.DLMS.Simulator.Net.exe -d India -r ln -a Low -P lnt1 -c 32 -i WRAPPER -h 10.14.126.238 -p 4059 -o low.xml -t Verbose
------------------------
Now I use above templet "low.xml" to create 10 simulated meters using below mentioned command.
----------------------
Gurux.DLMS.Simulator.Net.exe -d India -r ln -a Low -P lnt1 -c 32 -i WRAPPER -p 1000 -x low.xml -t Verbose -N 10
----------------------
Then I get below message
"DLMS WRAPPER Logical Name simulator start in ports 1000-1009"
NOTE: I am not getting Associations (Like Low authentication, password etc.) related response using above command.
Apart from this whenever I try to connect the simulated meters using DLMSDirector client app, then getting the below message.
---------------------------
GXDLMSDirector
---------------------------
No connection could be made because the target machine actively refused it
---------------------------
OK
---------------------------
I will email the created "low.xml" file to you. Kindly check where is the correction needed.
"No connection could be made because the target machine actively refused it" means that your port number is wrong in GXDLMSDirector. If should be in range: 1000-1009.
I tried with the latest version. I have created simulator template "Low_new.xml" successfully.
I am also able to create meters using below command.
---------------------------------------
Gurux.DLMS.Simulator.Net.exe -d India -r ln -a Low -P lnt1 -c 32 -i WRAPPER -p 1000 -x low_new.xml -t Verbose -N 5
DLMS WRAPPER Logical Name simulator start in ports 1000-1004.
Client address: 32, Server address: 1
Associations:
Low authentication, password lnt1
---------------------------------------
But whenever I try to connect with created meters using DLMSDirector client, then below pop message appears-
--------------------------------------
Gurux GXDLMSDirector
---------------------------
You need to read Association view to see all objects what the meter can offer. Do you want to do it now?
---------------------------
Yes No Cancel
---------------------------
I select Yes, Than below error pop message appears-
---------------------------
GXDLMSDirector
---------------------------
GetObjects failed. Access Error : Device reports Read-Write denied.
---------------------------
OK
---------------------------
So I am unable to read association of created meters (Ports 1000 to 1004)
Do you want to add new capture objects (columns) or add new rows? If you want to add rows, you can just press the Capture button in GXDLMSDirector and it will save current values to the buffer.
I am trying to read profile-generic object from simulated meter using GXDLMSDirector but unable to get any row.
Actually, the requirement is whenever I will read from simulated meter for any profile-generic object ( like instantaneous, block, daily, events, billing, scalars etc.) the request data row should fetch from simulated meter and appear in GXDLMSDirector. The requested rows could be a data set I mean multiple rows for block, daily, events and billing profile.
The simulator doesn't read the profile generic buffers at the moment because it will take so long time. I need to think if there can be a parameter that reads all the data from the meter. You can do this by yourself. Find GetProfileGenerics and read buffer like this:
public void GetProfileGenerics()
{
//Find profile generics register objects and read them.
foreach (GXDLMSObject it in Client.Objects.GetObjects(ObjectType.ProfileGeneric))
{
foreach (int pos in (it as IGXDLMSBase).GetAttributeIndexToRead(true))
{
try
{
if ((it.GetAccess(pos) & AccessMode.Read) != 0)
{
object val = Read(it, pos);
ShowValue(val, pos);
}
}
catch (Exception ex)
{
Console.WriteLine("Error! " + it.GetType().Name + " " + it.Name + "Index: " + pos + " " + ex.Message);
Console.WriteLine(ex.ToString());
}
}
}
Thanks a lot for suggesting me for how to read all profile-generics data which is stored at meter.
But if I want to read buffer data of current date-time from a simulated meter, then how will I update particular profile buffer?
For Block and daily profile:
Actually, my current actual meter record block-profile buffer at every 5 minute and daily-profile buffer at every mid night. Then how will I update the buffer of block-profile (at every 5 Minute) and daily-profile (every day at mid night) into simulated meter?
For instantaneous profile:
Whenever client app send command to read instantaneous profile from simulated meter, then a row buffer row with current date-time should be appear in GXDLMSDirector. Then how will I update this at simulated meter?
You need to handle this in PreAction. Check that object type is ProfileGeneric and the logical name is correct. Then update data that you want to. For instantaneous profile you need only update date-and time.
This implementation will keep all the profile generic data on the memory and it will handle read by range and entry automatically.
You can make a timer and call capture method of profile generic. It will add a new row to the buffer.
Could you share a C# example for update instantaneous profile buffer?
I have added below mentioned line in preRead for instantaneous profile.
-------------------
//Update instantaneous-profile of the profile-generics object when client asks it.
if ((it.Target is GXDLMSProfileGeneric ip) && (it.Target.LogicalName == "1.0.94.91.0.255") && it.Index == 2)
{
ip.SetValues(2, BufferValues); // how to set buffer values here?
}
---------------------
As suggested, I have tried the below mentioned code but unable to fetch the data of instantaneous-profile buffer from the simulated meter. The GXDLMSDirector client shows below mentioned message-
---------------------------
GXDLMSDirector
---------------------------
Failed to receive reply from the device in given time.
---------------------------
OK
---------------------------
CODE-
----------------------
protected override void PreRead(ValueEventArgs[] args)
{
foreach (ValueEventArgs it in args)
{
if (Trace > TraceLevel.Warning)
{
System.Diagnostics.Debug.WriteLine("PreRead {0}:{1}", it.Target.LogicalName, it.Index);
}
//Update date-time of the clock object when client asks it.
if ((it.Target is GXDLMSClock c) && it.Index == 2)
{
c.Time = c.Now();
}
//Update profile-generic object when client asks it.
if ((it.Target is GXDLMSProfileGeneric ip) && (it.Target.LogicalName == "1.0.94.91.0.255") && it.Index == 2)
{
int addr = it.Settings.ClientAddress;
ip.Capture(clients[addr]);
}
}
}
protected override void PostAction(ValueEventArgs[] args)
{
foreach (ValueEventArgs it in args)
{
//Update profile-generic object when client asks it.
if ((it.Target is GXDLMSProfileGeneric ip) && (it.Target.LogicalName == "1.0.94.91.0.255") && it.Index == 2)
{
//Update CaptureObjects (Ex. clock) here. Value are copy to the buffer.
}
}
}
As suggested, I have tried to update the instantaneous-profile buffer in this "protected override void PostAction(ValueEventArgs[] args)" method but whenever I read instantaneous-profile object using GXDLMSCDierctor client, then breakpoint (in debug mode) is not hitting into the "PostAction()" method.
So please suggest how could I update the buffer of any profile object?
My simple requirement is that I want to read profile-generics object(any instantaneous, block, daily, billing or events) using GXDLMSDirector client, then how will I update the buffer of simulated meter so that the fetched row/rows could appear in the client side.
Read doesn't add a new row. You must invoke the Capture from the GXDLMSDirector. There must be a clock on the capture objects. This will do what you want to.
protected override void PreAction(ValueEventArgs[] args)
{
foreach (ValueEventArgs it in args)
{
if (Trace > TraceLevel.Warning)
{
System.Diagnostics.Debug.WriteLine("PreAction {0}:{1}", it.Target.LogicalName, it.Index);
if ((it.Target is GXDLMSProfileGeneric pg) && it.Index == 2)
{
//Update clock for profile-generic object when capture is invoked.
foreach (GXKeyValuePair<GXDLMSObject, GXDLMSCaptureObject> co in pg.CaptureObjects)
{
if ((co.Key is GXDLMSClock clock) && co.Value.AttributeIndex == 2)
{
clock.Time = clock.Now();
}
}
}
}
}
}
As you have suggested me I did but still fail to achieve my requirement. I know little c#. I am comfortable with c++. Please help me regarding the same. I would like to share my requirement once again. I have to read profile-generics objects from the simulated meter using my client application.
#For clock object-
I am able to read clock object from actual or simulated meter using my client(The code mentioned below).
# For instantaneous profile object-
I am able to read instantaneous profile object from actual meter but fail to read from simulated meter using below mentioned client code. Then, How do I modify the simulator so that I could read instantaneous-profile object using below mentioned code?
Please share a C# example of simulator for update values of instantaneous profile object.
What is the problem? Is readCaptureObjects failed or read buffer (attribute index #2)?
You should be able to read Instantaneous Profile object like this.
Hi Pradson,
Hi Pradson,
Problem is that example server is different than your meter. Better abroach is if you use Gurux.DLMS.Simulator to simulate your meters. Then you can create your meters easily.
https://www.gurux.fi/Gurux.DLMS.Simulator
BR,
Mikko
HI Mikko,
HI Mikko,
Thanks for your reply.
Can I create this type of meter as an image attached in this message?
I mean, according to image, I can read all instantaneous profile parameter using only single OBIS code(1.0.94.91.0.255) same for block profile (1.0.99.1.0.255) and daily profile (1.0.99.2.0.255).
Kindly suggest.
Thanks & Regards,
Pradson
Hi Pradson,
Hi Pradson,
Yes, you can. The simulated meter looks exactly the same as the real one.
BR,
Mikko
Thanks a lot Mikko.
Thanks a lot Mikko.
HI Mikko,
HI Mikko,
Kindly explain the use and content of the file "simulator_template.xml" for below mentioned command.
Gurux.DLMS.Simulator.Net.exe -p 1000 -x simulator_template.xml -t Verbose -N 10
Thanks & Regards,
Pradson
Hi Pradson,
Hi Pradson,
Run Gurux.DLMS.Simulator.Net.exe from the command line. It will describe all the parameters when you run it without parameters.
BR,
Mikko
Hi Mikko,
Thank you
HI Mikko,
HI Mikko,
I am trying to simulate my real meter with the fallowing arguments as mentioned below but I am facing error with "Invalid parameter: WRAPPER". Kindly check my command arguments.
-----------------------------------------------------------
D:\Drivers\DLMS\DLMS_Simulator>Gurux.DLMS.Simulator.Net.exe -d India -r ln -a Low -c 20 -p xxxx -w WRAPPER -h 10.14.126.246 -p 4059 -x simulator_template.xml -t Verbose -N 10
Invalid parameter: WRAPPER
D:\Drivers\DLMS\DLMS_Simulator>
-----------------------------------------------------------
I want to simulate meters exactly as shown in attached image. Please send me the exact command string for the same asap.
Thanks & Regards,
Pradson
Hi,
Hi,
The command-line parameter for the WRAPPER at the moment is -w. You don't need the WRAPPER. -w is enough. You can get a list from the command line parameters if you run the app without arguments.
BR,
Mikko
Hi,
Hi,
I have used only "-w" as suggested by you. I got this "Input string was not in a correct format." error.
as mentioned below.
Kindly check.
---------------
D:\Drivers\DLMS\DLMS_Simulator>Gurux.DLMS.Simulator.Net.exe -d India -r ln -a Low -c 20 -p xxxx -w -h 10.14.126.246 -p 4059 -x simulator_template.xml -t Verbose -N 10
Input string was not in a correct format.
------------------
Thanks,
Pradson
Hi,
Hi,
Remove this:
-p xxxx
You have added port later or change it to the -P if it's a password.
BR,
Mikko
HI Mikko,
HI Mikko,
I am facing challenges to simulate my meter.
The scenario is that-
I have connected an energy meter to my computer through Ethernet cable (Or LAN network). I want to simulate exactly same meter.
I have created a simulator template from the below mentioned command.
D:\Drivers\DLMS\DLMS_Simulator>Gurux.DLMS.Simulator.Net.exe -d India -r ln -a Low -P admin1 -c 32 -w -h 10.14.126.248 -p 4059 -o simulator_template.xml -t Verbose
----
----
----------------------------------------------------------
Simulator template is created: simulator_template.xml
Now I run below mentioned command-
D:\Drivers\DLMS\DLMS_Simulator>Gurux.DLMS.Simulator.Net.exe -d India -r ln -a Low -P admin1 -c 32 -w -h 10.14.126.248 -p 4059 -x simulator_template.xml -t Verbose -N 10
DLMS WRAPPER Logical Name simulator start in ports 4059-4068.
Associations:
Without authentication.
----------------------
My question is that when I passed Low authentication, then why I am getting without authentication message?
and after that whenever I connect DLMSDirector to a meter ( which created from the above command), then unable to connect from above parameter.
Kindly clear me where is the mistake from my end asap?
Thanks,
Pradson
Hi Pradson,
Hi Pradson,
The authentication level is defined when you create the simulated meter and read it. You can't change the authentication level at the moment when you run the simulated devices.
So if you want to create low authenticated devices you can connect to the meter using Low authentication and then save results as low.xml. If you want to simulate High authenticated meters, connect to the meter using a High authentication level, and save result as High.xml.
BR,
Mikko
Thanks a lot MIkko for your
Thanks a lot MIkko for your kind help.
I have done same as explained you. I have created low.xml file with below command.
D:\Drivers\DLMS\DLMS_Simulator>Gurux.DLMS.Simulator.Net.exe -d India -r ln -a Low -P admin1 -c 32 -w -h 10.14.126.246 -p 4059 -o low.xml -t Verbose
Then,
I have run simulated meters through below command-
D:\Drivers\DLMS\DLMS_Simulator>Gurux.DLMS.Simulator.Net.exe -d India -r ln -a Low -P admin1 -c 32 -w -p 1000 -x low.xml -t Verbose -N 10
DLMS WRAPPER Logical Name simulator start in ports 1000-1009.
Associations:
Low authentication, password
But, Whenever I am trying to connect simulated meter through DLMSDirector, then I am getting this message "Connection is permanently rejected. Authentication failure". Kindly find the attached screen shot of DLMSDirector for connection parameters.
Please correct me.
Thanks,
Pradson
Kindly reply for the same
Kindly reply for the same asap.
Thanks.
Hi,
Hi,
Open your xml-file and check client address and MechanismId.
They should be:
<ClientSAP>32</ClientSAP>
<MechanismId>1</MechanismId>
BR,
Mikko
Hi,
Hi,
Yes, both values are in xml file. What should be the next step?
Hi,
Hi,
Can you send this XML file to me by email? That is the only way to solve this because it works with our meters.
You can get my email address from here:
https://www.gurux.fi/AboutUs
BR,
Mikko
BR,
Mikko
Hi Mikko,
Hi Mikko,
I have sent Low.xml file to you. Kindly check and revert asap.
Thanks,
Pradson
Hi Mikko,
Hi Mikko,
As suggested,
I have shared Low.xml file with subject "Simulator Low level issue". Kindly check.
Thanks,
Pradson
Hi,
Hi,
Your password is empty in the xml file. You can't give overwrite the password at the moment in the simulator, but I'll add it to the worklist.
Open low.xml and find this:
<Secret />
Replace it with a password:
<Secret>61 64 6D 69 6E 31 20</Secret>
Now you can connect.
BR,
Mikko
Hi Mikko,
Hi Mikko,
Thanks a lot for your response.
Now, I am able to connect to the created device. I have a question regarding profile generics objects. Actually, The requirement is that my client application reads only profile generics objects i.e. Nameplate-Profile, Instantaneous-profile, block-profile, daily-profile, and all events profile. But in the created devices, there is no any buffered data as shown in the attached picture.
So kindly help me regarding-
(1) How will I store the buffer data into above profiles?
(2) How will I update data of these (except name-plate) profile in interval basis?
-> Instantaneous profile will update at every second?
-> block profile will update at every 5/15 minutes?
-> daily profile will update daily at mid night?
-> and all events will update at occurrence of an event?
(3) How will I update clock at every second level?
Thanks & Regards,
Pradson
Hi,
Hi,
Because every user has different needs it's not possible to make an app that fills all the requirements. The idea is that you can modify the simulator for your needs.
The current implementation doesn't read profile generic buffer, because it might take a very long time.
We are planning how to update profile generic buffer values and it's planned to release at the beginning of next month. You can add dynamic values in PreRead to the buffer.
You can get a short idea from here:
https://gurux.fi/Gurux.DLMS.Server
Update values in PreRead method. I'll ask to add an example of how to update the date-time of the clock object.
BR,
Mikko
Hi,
Hi,
There is a new version where you can overwrite the password with -P parameter.
Clock is also updated dynamically. Command line parameters are updated.
-w is replaced with -i WRAPPER
BR,
Mikko
Hi Mikko,
Hi Mikko,
Hope you are doing well.
I am facing challenges to simulate meter with latest version. I have build C# code of "Gurux.DLMS.Simulator.Net" and got file (Gurux.DLMS.Simulator.Net.exe) Version 1.0.0.0.
I have created simulator template "low.xml" successfully using below mentioned command.
------------------------
Gurux.DLMS.Simulator.Net.exe -d India -r ln -a Low -P lnt1 -c 32 -i WRAPPER -h 10.14.126.238 -p 4059 -o low.xml -t Verbose
------------------------
Now I use above templet "low.xml" to create 10 simulated meters using below mentioned command.
----------------------
Gurux.DLMS.Simulator.Net.exe -d India -r ln -a Low -P lnt1 -c 32 -i WRAPPER -p 1000 -x low.xml -t Verbose -N 10
----------------------
Then I get below message
"DLMS WRAPPER Logical Name simulator start in ports 1000-1009"
NOTE: I am not getting Associations (Like Low authentication, password etc.) related response using above command.
Apart from this whenever I try to connect the simulated meters using DLMSDirector client app, then getting the below message.
---------------------------
GXDLMSDirector
---------------------------
No connection could be made because the target machine actively refused it
---------------------------
OK
---------------------------
I will email the created "low.xml" file to you. Kindly check where is the correction needed.
Thanks & Regards,
Pradson
Hi Pradson,
Hi Pradson,
"No connection could be made because the target machine actively refused it" means that your port number is wrong in GXDLMSDirector. If should be in range: 1000-1009.
BR,
Mikko
Hi Mikko,
Hi Mikko,
I am using same range as I have given in command.
I am sharing the screenshot of connection parameter. Kindly check.
Thanks
Hi,
Hi,
There was a bug in Logical name serialization. Get the latest version and read the meter again.
BR,
Mikko
Hi Mikko,
Hi Mikko,
I tried with the latest version. I have created simulator template "Low_new.xml" successfully.
I am also able to create meters using below command.
---------------------------------------
Gurux.DLMS.Simulator.Net.exe -d India -r ln -a Low -P lnt1 -c 32 -i WRAPPER -p 1000 -x low_new.xml -t Verbose -N 5
DLMS WRAPPER Logical Name simulator start in ports 1000-1004.
Client address: 32, Server address: 1
Associations:
Low authentication, password lnt1
---------------------------------------
But whenever I try to connect with created meters using DLMSDirector client, then below pop message appears-
--------------------------------------
Gurux GXDLMSDirector
---------------------------
You need to read Association view to see all objects what the meter can offer. Do you want to do it now?
---------------------------
Yes No Cancel
---------------------------
I select Yes, Than below error pop message appears-
---------------------------
GXDLMSDirector
---------------------------
GetObjects failed. Access Error : Device reports Read-Write denied.
---------------------------
OK
---------------------------
So I am unable to read association of created meters (Ports 1000 to 1004)
Kindly suggest.
Thanks
Pradson
Hi Mikko,
Hi Mikko,
I am awaiting for your response.
Thanks & Regards,
Pradson
Hi Pradson,
Hi Pradson,
I try to find the reason for this, but nothing found so far.
BR,
Mikko
Hi,
Hi,
This is fixed. Get the latest version.
BR,
Mikko
Hi Mikko,
Hi Mikko,
Thanks a lot for reply.
I have tried with the latest one. Now it is working fine.
How will I update the profile-generic buffer for block, daily, instantaneous, events and nameplate profiles? Could you share one example for the same?
Thanks & Regards,
Pradson
Hi Pradson,
Hi Pradson,
Do you want to add new capture objects (columns) or add new rows? If you want to add rows, you can just press the Capture button in GXDLMSDirector and it will save current values to the buffer.
BR,
Mikko
Hi Mikko,
Hi Mikko,
I am trying to read profile-generic object from simulated meter using GXDLMSDirector but unable to get any row.
Actually, the requirement is whenever I will read from simulated meter for any profile-generic object ( like instantaneous, block, daily, events, billing, scalars etc.) the request data row should fetch from simulated meter and appear in GXDLMSDirector. The requested rows could be a data set I mean multiple rows for block, daily, events and billing profile.
Kindly suggest how should achieve the same.
Thanks & Regards,
Pradosn
Hi Pradosn,
Hi Pradosn,
The simulator doesn't read the profile generic buffers at the moment because it will take so long time. I need to think if there can be a parameter that reads all the data from the meter. You can do this by yourself. Find GetProfileGenerics and read buffer like this:
public void GetProfileGenerics()
{
//Find profile generics register objects and read them.
foreach (GXDLMSObject it in Client.Objects.GetObjects(ObjectType.ProfileGeneric))
{
foreach (int pos in (it as IGXDLMSBase).GetAttributeIndexToRead(true))
{
try
{
if ((it.GetAccess(pos) & AccessMode.Read) != 0)
{
object val = Read(it, pos);
ShowValue(val, pos);
}
}
catch (Exception ex)
{
Console.WriteLine("Error! " + it.GetType().Name + " " + it.Name + "Index: " + pos + " " + ex.Message);
Console.WriteLine(ex.ToString());
}
}
}
BR,
Mikko
Hi Mikko,
Hi Mikko,
Thanks a lot for suggesting me for how to read all profile-generics data which is stored at meter.
But if I want to read buffer data of current date-time from a simulated meter, then how will I update particular profile buffer?
For Block and daily profile:
Actually, my current actual meter record block-profile buffer at every 5 minute and daily-profile buffer at every mid night. Then how will I update the buffer of block-profile (at every 5 Minute) and daily-profile (every day at mid night) into simulated meter?
For instantaneous profile:
Whenever client app send command to read instantaneous profile from simulated meter, then a row buffer row with current date-time should be appear in GXDLMSDirector. Then how will I update this at simulated meter?
Kindly suggest?
Thanks & Regards,
Pradson
Hi Pradson,
Hi Pradson,
You need to handle this in PreAction. Check that object type is ProfileGeneric and the logical name is correct. Then update data that you want to. For instantaneous profile you need only update date-and time.
This implementation will keep all the profile generic data on the memory and it will handle read by range and entry automatically.
You can make a timer and call capture method of profile generic. It will add a new row to the buffer.
BR,
Mikko
Hi Mikko,
Hi Mikko,
Is "Gurux.DLMS.Simulator" available in C++?
If yes, please share that link.
Thanks,
Pradson
Hi Pradson,
Hi Pradson,
Not yet, but it's in progress. I hope that it can be released in October.
BR,
Mikko
Hi Mikko,
Hi Mikko,
Thanks for reply.
Could you share a C# example for update instantaneous profile buffer?
I have added below mentioned line in preRead for instantaneous profile.
-------------------
//Update instantaneous-profile of the profile-generics object when client asks it.
if ((it.Target is GXDLMSProfileGeneric ip) && (it.Target.LogicalName == "1.0.94.91.0.255") && it.Index == 2)
{
ip.SetValues(2, BufferValues); // how to set buffer values here?
}
---------------------
Thanks & Regards,
Pradson
Hi Pradson,
Hi Pradson,
When you call Capture method it will loop capture objects and copy all current values to the buffer. Like this:
ip.Capture();
BR,
Mikko
HI Mikko,
HI Mikko,
As suggested, I have tried the below mentioned code but unable to fetch the data of instantaneous-profile buffer from the simulated meter. The GXDLMSDirector client shows below mentioned message-
---------------------------
GXDLMSDirector
---------------------------
Failed to receive reply from the device in given time.
---------------------------
OK
---------------------------
CODE-
----------------------
protected override void PreRead(ValueEventArgs[] args)
{
foreach (ValueEventArgs it in args)
{
if (Trace > TraceLevel.Warning)
{
System.Diagnostics.Debug.WriteLine("PreRead {0}:{1}", it.Target.LogicalName, it.Index);
}
//Update date-time of the clock object when client asks it.
if ((it.Target is GXDLMSClock c) && it.Index == 2)
{
c.Time = c.Now();
}
//Update profile-generic object when client asks it.
if ((it.Target is GXDLMSProfileGeneric ip) && (it.Target.LogicalName == "1.0.94.91.0.255") && it.Index == 2)
{
int addr = it.Settings.ClientAddress;
ip.Capture(clients[addr]);
}
}
}
----------------------
Kindly suggest once.
Thanks & Regards,
Pradson
Hi Mikko,
Hi Mikko,
I am awaiting for your response.
Thanks & Regards,
Pradson
Hi,
Hi,
You can capture current values like this:
protected override void PostAction(ValueEventArgs[] args)
{
foreach (ValueEventArgs it in args)
{
//Update profile-generic object when client asks it.
if ((it.Target is GXDLMSProfileGeneric ip) && (it.Target.LogicalName == "1.0.94.91.0.255") && it.Index == 2)
{
//Update CaptureObjects (Ex. clock) here. Value are copy to the buffer.
}
}
}
BR,
Mikko
Thanks Mikko,
Thanks Mikko,
As suggested, I have tried to update the instantaneous-profile buffer in this "protected override void PostAction(ValueEventArgs[] args)" method but whenever I read instantaneous-profile object using GXDLMSCDierctor client, then breakpoint (in debug mode) is not hitting into the "PostAction()" method.
So please suggest how could I update the buffer of any profile object?
My simple requirement is that I want to read profile-generics object(any instantaneous, block, daily, billing or events) using GXDLMSDirector client, then how will I update the buffer of simulated meter so that the fetched row/rows could appear in the client side.
Thanks & Regards,
Pradson
Hi,
Hi,
Read doesn't add a new row. You must invoke the Capture from the GXDLMSDirector. There must be a clock on the capture objects. This will do what you want to.
protected override void PreAction(ValueEventArgs[] args)
{
foreach (ValueEventArgs it in args)
{
if (Trace > TraceLevel.Warning)
{
System.Diagnostics.Debug.WriteLine("PreAction {0}:{1}", it.Target.LogicalName, it.Index);
if ((it.Target is GXDLMSProfileGeneric pg) && it.Index == 2)
{
//Update clock for profile-generic object when capture is invoked.
foreach (GXKeyValuePair<GXDLMSObject, GXDLMSCaptureObject> co in pg.CaptureObjects)
{
if ((co.Key is GXDLMSClock clock) && co.Value.AttributeIndex == 2)
{
clock.Time = clock.Now();
}
}
}
}
}
}
BR,
Mikko
Hi Mikko,
Hi Mikko,
As you have suggested me I did but still fail to achieve my requirement. I know little c#. I am comfortable with c++. Please help me regarding the same. I would like to share my requirement once again. I have to read profile-generics objects from the simulated meter using my client application.
#For clock object-
I am able to read clock object from actual or simulated meter using my client(The code mentioned below).
# For instantaneous profile object-
I am able to read instantaneous profile object from actual meter but fail to read from simulated meter using below mentioned client code. Then, How do I modify the simulator so that I could read instantaneous-profile object using below mentioned code?
Please share a C# example of simulator for update values of instantaneous profile object.
Client app code
//###############################################################
/************************* read clock object ************************************/
CGXDLMSClock* objClock = new CGXDLMSClock("0.0.1.0.0.255");
std::string sValues_Cl;
if ((ret = comm.Read(objClock, 2, sValues_Cl)) != 0) {
printf("Clock-> error[%s] failed to read clock object. \n", CGXDLMSConverter::GetErrorMessage(ret));
}
//********************* Read Instantaneous Profile object ***********************
CGXDLMSProfileGeneric* objIP = new CGXDLMSProfileGeneric("1.0.94.91.0.255");
ret = 0;
std::string sCapObj_IP;
if ((ret = comm.Read(objIP, 3, sCapObj_IP)) != 0)
{
printf("IP-capObj-> error[%s] failed to readCaptureObjects. \n", CGXDLMSConverter::GetErrorMessage(ret));
}
std::string sValues_IP;
if ((ret = comm.Read(objIP, 2, sValues_IP)) != 0) {
printf("IP-obj-> error[%s] failed to read register. \n", CGXDLMSConverter::GetErrorMessage(ret));
}
//###############################################################
Hi Mikko,
Hi Mikko,
Kindly reply. I am awaiting for solution.
Thanks & Regards,
Pradson
Hi Pradson,
Hi Pradson,
What is the problem? Is readCaptureObjects failed or read buffer (attribute index #2)?
You should be able to read Instantaneous Profile object like this.
BR,
Mikko