smartgridadsc / OpenPLC61850

OpenPLC61850, an extension of OpenPLC compatible with the IEC 61850 MMS protocol
GNU General Public License v3.0
44 stars 17 forks source link

Question #1

Open marcostdgl opened 2 years ago

marcostdgl commented 2 years ago

Hey,

is there any way to get in touch with you, to ask a few questions? I'm actually trying to figure out the concept because i wanted to connect my OpenPLC61850 with another IED and i don't really understand how to.

Would be really glad if you'd message me, regards marco

wenshei commented 2 years ago

Hi Marco

I couldn't reply to your email for some reason, so I'm writing it here.

To start using OpenPLC61850, you need to prepare these files:

  1. IEC 61131-3 PLC program
  2. ICD files

For 1, you can follow the instructions in the original OpenPLC to create the PLC program (https://www.openplcproject.com/reference/basics/first-project) and then upload it (https://www.openplcproject.com/reference/basics/upload) to OpenPLC61850.

As for 2, do you have an ICD file for the Phoenix bus coupler you mentioned in the email? An example of ICD file can be found in "webserver/scl_client_files".

marcostdgl commented 2 years ago

Hey wenshei,

I've used OpenPLC a while so I think i got the basic knowledge. But I don't know where I can find or get the ICD-File for my Coupler. I just found one that seems pretty raw without any GGIO or anything, and i couldn't use it for OpenPLC61850, so it didn't connect with it. Do you know where to get or how to configure this file? Otherwise I just have a SCD-file, but I think that's not the one i need.

What about the server-scl file? Can I use the one which is inyour project included or do i have to configure my own? Which changes do i have to make if I use it in my Project?

Sorry for this many questions, but I was trying for few days to figure out and couldn't achieve very much. regards, Marco

marcostdgl commented 2 years ago

ied01.txt

That's the file i use

wenshei commented 2 years ago

ied01.txt

That's the file i use

This file seems usable, but you will need to make some modifications to it.

OpenPLC61850 communicates with IEDs in the form of MMS reports, so the IEDs should be set up to send the MMS reports containing your dataset. OpenPLC61850 parses the ICD file to get the information necessary (e.g IP address, RCBs, datasets, etc.) to connect to the IED and configure the RCB to start receiving MMS reports. From what I saw in your file, there are no RCBs, so I'm not sure if your coupler supports sending MMS reports.

Next, you will also need to add <Private> child elements to the data attributes that are included in the dataset of each report. This is done as described here (section 3.2) and in the following image. This step is needed so that it can create a mapping between your PLC program variables and the IEC61850 data attributes. This mapping is used to write the report data into the PLC memory.

image\

Also, I realized that this step about <Private> elements was not in the README, so I'm sorry if it led to some confusion.

What about the server-scl file? Can I use the one which is inyour project included or do i have to configure my own? Which changes do i have to make if I use it in my Project?

You only need to have a "server-scl" file if you intend on running a IEC61850 server on OpenPLC61850. The default one in webserver/scl_server_files cannot be used since you have your own PLC program. You will have to create your own server model.

marcostdgl commented 2 years ago

ied01_2.txt Thanks for your quick answer! I'd also have this file, which looks bit similar. Where do you see that the Coupler don't support sending MMS reports? (Is there a way to test if the Coupler supports it?) Do i have to put in a nested private element for every variable i'm using?

wenshei commented 2 years ago

ied01_2.txt

There should be a <ReportControl> element which is used to configure the RCB. This new file has it.

Where do you see that the Coupler don't support sending MMS reports? (Is there a way to test if the Coupler supports it?)

I was making a guess. Maybe you can read documentation on your coupler, or try connecting your coupler with other IEC61850 client software, and try to receive reports first

Do i have to put in a nested private element for every variable i'm using?

You only need to use nested <Private> elements if the data attribute is part of a structure (e.g. Oper contains "sub data attributes" like Oper.ctlVal, so in order to map Oper.ctlVal correctly, you need the nested <Private> elements).

marcostdgl commented 2 years ago

image So I already got to the point that i can now see the ".Oper.ctlVal X", but in csv my Datamapping on the Coupler looks like this: image

I think that i missed out some parts. The Template lines were added default so i didn't do anything for that. Can you help me out putting the last things together?

Update: So my line already looks pretty good now: IED_1LDevice/.SPCS01.Oper.ctlval

But I think that the GGIO1.CO in between is needed.. I don't know where i missed it out and can't find any difference to your scl

wenshei commented 2 years ago

But I think that the GGIO1.CO in between is needed.. I don't know where i missed it out and can't find any difference to your scl

Could you try pulling from the repository again? We pushed a fix a few days ago for the code which creates the map file, so it may create the map file correctly now.

Also, in the map file screenshot, I see a few Xs. If the X is after an RCB, then it means that the dataset is not found for the RCB. Else, it means that it did not find a variable inside the IEC61131-3 program with the name indicated in the Value attribute of the <Property> child of <Private> element.

marcostdgl commented 2 years ago

After Pulling it doesn't even show me the line: IED_1LDevice/.SPCS01.Oper.ctlval X

About the X's: I didn't make a PLC Programm yet, i first wanted to create the icd file, that it's mapped right

Can you maybe show me how you would edit the file above "ied01_2.txt" to get any mapping work? Or maybe try it on your OpenPLC61850, because i really don't get any further. I actually don't know why it doesn't work. That's the file after editing some stuff: ied01.txt

wenshei commented 2 years ago

That's the file after editing some stuff: ied01.txt

Hi Marco, I have edited your file here ied01_edited.txt and it worked for me. image

There are two parts that I have edited:

  1. In your original file, the <LN> elements were children of <LN0>, which should not be the case. They should be siblings instead, with <LDevice> as their parent.
  2. The <Private> element should be a child of <DA> .
marcostdgl commented 2 years ago

Hi wenshei,

thank you! Now i get an Errorcode when i want to start the PLC: " Fail to get RCB[0] values (code: 22)"

Update1: I already added a vairable which name is ied01control as it is set in the value Attribute. Before the error above it also sends "Invalid mapping for IED_1LDevice1/GGIO1.SPCSO1.Oper.ctlVal" in the Runtime Logs.

Update2: Okay now i fixed the issue with the two Errorcodes, but there is one more which says Failed to setup reporting. I think/hope thats the last issue i need to handle.

Update3: Honestly i put some Log-Messages into the iec61850client.cpp-file: image

In the Logs I can see that the "ied.rcb_dataset_list" has a size of one before it's entering the first for-Loop. Then it enters the first Loop, but when I want to Output the reportvector.size() It's 0. in the ied.rcb_dataset_list.at(j) there's nothing in it, but i don't understand why there isn't anything.

Update4: I added these Template things again, which I'm not really sure about what they are for. It looks now like this: image

I now get in the second Loop as well, but now i get these errors again: image

I really don't know what to do about it.

wenshei commented 2 years ago

We are using libiec61850, so you should refer to here for the error codes. In this case, code 22 is IED_ERROR_OBJECT_DOES_NOT_EXIST, which indicates that the IEC 61850 model in your coupler does not actually have the RCB for OpenPLC61850 to connect to.

I suggest you use another IEC61850 client to examine the model of your coupler first (e.g. IEDExplorer).