smartgridadsc / OpenPLC61850

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

OpenPLC not starting #4

Closed marcolucc closed 11 months ago

marcolucc commented 1 year ago

Hello, I'm tring to get OpenPLC61850 working. I've tried two approaches: with and without docker. Same result OpenPLC doesn't go in "running mode".

I tried compiling for the hardware again, it compiled succesfully:


Generating C files...
POUS.c
POUS.h
LOCATED_VARIABLES.h
VARIABLES.csv
Config0.c
Config0.h
Res0.c
Moving Files...
Compiling for Linux
Generating object files...
Generating glueVars...
Generating mapping file for IEC61850 client function

ST file: ../st_files/blank_program.st
SCL files: ../scl_client_files/ied01.icd ../scl_client_files/ied02.icd 
Outfile: iecclient.map

Parsing ST file
Parsing SCL file../scl_client_files/ied01.icd
Parsing SCL file../scl_client_files/ied02.icd
Mapping done, exit

Generating mapping file for IEC61850 server function

ST file: ../st_files/blank_program.st
SCL files: ../scl_server_files/scl.icd 
Outfile: iecserver.map

Parsing ST file
Parsing SCL file../scl_server_files/scl.icd
Mapping done, exit

Generating static_model...
Picked up _JAVA_OPTIONS: -Dawt.useSystemAAFontSettings=on -Dswing.aatext=true
Select ICD File ../scl_server_files/scl.icd
parse data type templates ...
parse IED section ...
parse communication section ...
Found connectedAP W1 for IED TestServer
print report instance 01
print report instance 02
print report instance 03
print report instance 04
print report instance 05
print report instance 01
print report instance 02
print report instance 03
print report instance 04
print report instance 05
print report instance 01
print report instance 02
print report instance 03
print report instance 04
print report instance 05
print report instance 01
print report instance 02
print report instance 03
print report instance 04
print report instance 05
Compiling main program...
Compilation finished successfully! ```

The following is the error 

``` OpenPLC Runtime starting...
Skipping configuration of Slave Devices (mbconfig.cfg file not found)
Interactive Server: Listening on port 43628
Interactive Server: waiting for new client...
Warning: Persistent Storage file not found
Setting main thread priority to RT
WARNING: Failed to set main thread to real-time priority
Locking main thread memory
Getting current time
Enabling IEC61850 on port 102
Interactive Server: Client accepted! Creating thread for the new client ID: 7...
Interactive Server: waiting for new client...
Interactive Server: Thread created for client ID: 7
Interactive Server: Client accepted! Creating thread for the new client ID: 8...
Interactive Server: client ID: 7 has closed the connection
Terminating interactive server connections
Interactive Server: waiting for new client...
Interactive Server: Client accepted! Creating thread for the new client ID: 7...
Interactive Server: Thread created for client ID: 8
Interactive Server: waiting for new client...
Interactive Server: Thread created for client ID: 7
Interactive Server: client ID: 8 has closed the connection
Terminating interactive server connections
Interactive Server: client ID: 7 has closed the connection
Terminating interactive server connections
127.0.0.1 - - [16/Nov/2023 13:48:50] "GET /runtime_logs HTTP/1.1" 200 -
Interactive Server: Client accepted! Creating thread for the new client ID: 7...
Interactive Server: waiting for new client...
Interactive Server: Thread created for client ID: 7
Issued start_iec61850() command to start on port: 102
Interactive Server: client ID: 7 has closed the connection
Openning database
Terminating interactive server connections
Enabling Modbus on port 502
Starting IEC61850SERVER
Starting IEC61850CLIENT
Invalid mapping for IED01LogicalDevice/GGIO1.AnIn1.mag.f
Invalid mapping for IED01LogicalDevice/GGIO2.SPC1.Oper.ctlVal
Invalid mapping for IED02LogicalDevice/GGIO1.AnIn1.mag.f
Invalid mapping for IED02LogicalDevice/GGIO2.SPC1.Oper.ctlVal
mapping done
Setting control handler for TestServerLogicalDevice/GGIO2.SPCSO
Setting control handler for TestServerLogicalDevice/GGIO3.SPCSO
Setting control handler for TestServerLogicalDevice/GGIO5.SPCSO
Setting control handler for TestServerLogicalDevice/GGIO6.SPCSO
Setting control handler for TestServerLogicalDevice/GGIO8.SPCSO
Setting control handler for TestServerLogicalDevice/GGIO9.SPCSO
Setting control handler for TestServerLogicalDevice/GGIO11.SPCSO
Setting control handler for TestServerLogicalDevice/GGIO12.SPCSO
Setting control handler for TestServerLogicalDevice/GGIO15.SPCSO1
Setting control handler for TestServerLogicalDevice/GGIO15.SPCSO2
terminate called after throwing an instance of 'std::out_of_range'
  what():  basic_string::substr: __pos (which is 3) > this->size() (which is 1)
OpenPLC Runtime is not running. Error: [Errno 104] Connection reset by peer
Enabling DNP3 on port 20000
Enabling EtherNet/IP on port 44818
Disabling Persistent Storage
persistent.file removed! ```

Has anyone else faced my same issue?
I've updated the Dockerfile since the one provided with the repository wasn't working:

``` ARG UBUNTU_VERSION=16.04
FROM ubuntu:$UBUNTU_VERSION
ARG PYTHON_VERSION=2.7.9
RUN apt-get update \
  && apt-get install -y sudo wget gcc make openssl libffi-dev libgdbm-dev libsqlite3-dev libssl-dev zlib1g-dev \
  && apt-get clean
WORKDIR /tmp/
RUN wget https://www.python.org/ftp/python/$PYTHON_VERSION/Python-$PYTHON_VERSION.tgz \
  && tar --extract -f Python-$PYTHON_VERSION.tgz \
  && cd ./Python-$PYTHON_VERSION/ \
  && ./configure --with-ensurepip=install --enable-optimizations --prefix=/usr/local \
  && make && make install \
  && cd ../ \
  && rm -r ./Python-$PYTHON_VERSION*
COPY . /workdir
RUN cd /workdir && ./install.sh docker
WORKDIR /workdir
CMD tail -f /dev/null ```
wenshei commented 12 months ago

terminate called after throwing an instance of 'std::out_of_range' what(): basic_string::substr: __pos (which is 3) > this->size() (which is 1)

Hi, from this line, I think the problem is likely caused by a bug, which caused it to crash. Can you send the contents of the file "iecserver.map"?

marcolucc commented 12 months ago

MONITOR TestServerLogicalDevice/GGIO1.SPCSO1.stVal X MONITOR TestServerLogicalDevice/GGIO1.SPCSO2.stVal X MONITOR TestServerLogicalDevice/GGIO1.SPCSO3.stVal X MONITOR TestServerLogicalDevice/GGIO1.SPCSO4.stVal X MONITOR TestServerLogicalDevice/GGIO1.DPCSO.stVal X CONTROL TestServerLogicalDevice/GGIO2.SPCSO.Oper.ctlVal X CONTROL TestServerLogicalDevice/GGIO3.SPCSO.Oper.ctlVal X MONITOR TestServerLogicalDevice/GGIO4.SPCSO1.stVal X MONITOR TestServerLogicalDevice/GGIO4.SPCSO2.stVal X MONITOR TestServerLogicalDevice/GGIO4.SPCSO3.stVal X MONITOR TestServerLogicalDevice/GGIO4.SPCSO4.stVal X MONITOR TestServerLogicalDevice/GGIO4.SPCSO5.stVal X MONITOR TestServerLogicalDevice/GGIO4.DPCSO.stVal X CONTROL TestServerLogicalDevice/GGIO5.SPCSO.Oper.ctlVal X CONTROL TestServerLogicalDevice/GGIO6.SPCSO.Oper.ctlVal X MONITOR TestServerLogicalDevice/GGIO7.SPCSO1.stVal X MONITOR TestServerLogicalDevice/GGIO7.SPCSO2.stVal X MONITOR TestServerLogicalDevice/GGIO7.SPCSO3.stVal X MONITOR TestServerLogicalDevice/GGIO7.SPCSO4.stVal X MONITOR TestServerLogicalDevice/GGIO7.DPCSO.stVal X CONTROL TestServerLogicalDevice/GGIO8.SPCSO.Oper.ctlVal X CONTROL TestServerLogicalDevice/GGIO9.SPCSO.Oper.ctlVal X MONITOR TestServerLogicalDevice/GGIO10.SPCSO1.stVal X MONITOR TestServerLogicalDevice/GGIO10.SPCSO2.stVal X MONITOR TestServerLogicalDevice/GGIO10.SPCSO3.stVal X MONITOR TestServerLogicalDevice/GGIO10.SPCSO4.stVal X MONITOR TestServerLogicalDevice/GGIO10.DPCSO.stVal X CONTROL TestServerLogicalDevice/GGIO11.SPCSO.Oper.ctlVal X CONTROL TestServerLogicalDevice/GGIO12.SPCSO.Oper.ctlVal X MONITOR TestServerLogicalDevice/GGIO13.SPCSO1.stVal X MONITOR TestServerLogicalDevice/GGIO13.SPCSO2.stVal X MONITOR TestServerLogicalDevice/GGIO13.SPCSO3.stVal X MONITOR TestServerLogicalDevice/GGIO13.SPCSO4.stVal X MONITOR TestServerLogicalDevice/GGIO13.SPCSO5.stVal X MONITOR TestServerLogicalDevice/GGIO13.SPCSO6.stVal X MONITOR TestServerLogicalDevice/GGIO13.SPCSO7.stVal X MONITOR TestServerLogicalDevice/GGIO13.SPCSO8.stVal X CONTROL TestServerLogicalDevice/GGIO15.SPCSO1.Oper.ctlVal X CONTROL TestServerLogicalDevice/GGIO15.SPCSO2.Oper.ctlVal X MONITOR TestServerLogicalDevice/GGIO14.SPCSO1.stVal X MONITOR TestServerLogicalDevice/GGIO14.SPCSO2.stVal X MONITOR TestServerLogicalDevice/GGIO16.SPCSO1.stVal X MONITOR TestServerLogicalDevice/GGIO16.SPCSO2.stVal X MONITOR TestServerLogicalDevice/GGIO16.SPCSO3.stVal X MONITOR TestServerLogicalDevice/GGIO16.SPCSO4.stVal X MONITOR TestServerLogicalDevice/GGIO16.SPCSO5.stVal X MONITOR TestServerLogicalDevice/GGIO16.SPCSO6.stVal X MONITOR TestServerLogicalDevice/GGIO16.SPCSO7.stVal X MONITOR TestServerLogicalDevice/GGIO17.AnIn1.instMag X MONITOR TestServerLogicalDevice/GGIO17.AnIn2.instMag X MONITOR TestServerLogicalDevice/GGIO17.AnIn3.instMag X MONITOR TestServerLogicalDevice/GGIO17.AnIn4.instMag X MONITOR TestServerLogicalDevice/GGIO17.AnIn5.instMag X MONITOR TestServerLogicalDevice/GGIO17.AnIn6.instMag X MONITOR TestServerLogicalDevice/GGIO17.AnIn7.instMag X MONITOR TestServerLogicalDevice/GGIO17.AnIn8.instMag X MONITOR TestServerLogicalDevice/GGIO17.AnIn9.instMag X MONITOR TestServerLogicalDevice/GGIO18.AnIn1.instMag X MONITOR TestServerLogicalDevice/GGIO18.AnIn2.instMag X MONITOR TestServerLogicalDevice/GGIO18.AnIn3.instMag X MONITOR TestServerLogicalDevice/GGIO18.AnIn4.instMag X MONITOR TestServerLogicalDevice/GGIO18.AnIn5.instMag X MONITOR TestServerLogicalDevice/GGIO18.AnIn6.instMag X MONITOR TestServerLogicalDevice/GGIO18.AnIn7.instMag X MONITOR TestServerLogicalDevice/GGIO18.AnIn8.instMag X MONITOR TestServerLogicalDevice/GGIO18.AnIn9.instMag X I want to point out that It's a fresh install of OpenPLC61850, I haven't modified anything.

wenshei commented 11 months ago

I have pushed the fix. It should run without crashing now, but there will be quite some errors appearing in the log, since the configuration (SCL and ST files) in the repo are not properly configured. You can refer to the previous issue #1.