RikRealization
Dear OpenPLC community. When trying to start the PLC simulation (build my code) I get the following errors:
ompiling IEC Program into C code...
"C:\Users\rikvd\OpenPLC_Editor\matiec\iec2c.exe" -f -l -p -I "C:\Users\rikvd\OpenPLC_Editor\matiec\lib" -T "C:\CO2Zero\Programs\Main10CusFunTotlyDelt\build" "C:\CO2Zero\Programs\Main10CusFunTotlyDelt\build\plc.st"
exited with status 1 (pid 36556)
derivative_st.txt:17-7..17-17: error: invalid input variable(s) declaration.
in file included from file standard_FB.txt:37
included from file C:\Users\rikvd\OpenPLC_Editor\matiec\lib/ieclib.txt:32
derivative_st.txt:25-38..25-43: error: invalid parameter(s) defined in function invocation of ST expression.
in file included from file standard_FB.txt:37
included from file C:\Users\rikvd\OpenPLC_Editor\matiec\lib/ieclib.txt:32
integral_st.txt:17-7..17-17: error: invalid input variable(s) declaration.
in file included from file standard_FB.txt:39
included from file C:\Users\rikvd\OpenPLC_Editor\matiec\lib/ieclib.txt:32
integral_st.txt:25-53..25-58: error: invalid parameter(s) defined in function invocation of ST expression.
in file included from file standard_FB.txt:39
included from file C:\Users\rikvd\OpenPLC_Editor\matiec\lib/ieclib.txt:32
pid_st.txt:21-7..21-17: error: invalid input variable(s) declaration.
in file included from file standard_FB.txt:40
included from file C:\Users\rikvd\OpenPLC_Editor\matiec\lib/ieclib.txt:32
pid_st.txt:31-45..31-49: error: invalid expression in ST formal parameter assignment.
in file included from file standard_FB.txt:40
included from file C:\Users\rikvd\OpenPLC_Editor\matiec\lib/ieclib.txt:32
pid_st.txt:32-47..32-51: error: invalid expression in ST formal parameter assignment.
in file included from file standard_FB.txt:40
included from file C:\Users\rikvd\OpenPLC_Editor\matiec\lib/ieclib.txt:32
ramp_st.txt:16-7..16-17: error: invalid input variable(s) declaration.
in file included from file standard_FB.txt:41
included from file C:\Users\rikvd\OpenPLC_Editor\matiec\lib/ieclib.txt:32
ramp_st.txt:30-22..30-26: error: invalid expression after '+' in ST expression.
in file included from file standard_FB.txt:41
included from file C:\Users\rikvd\OpenPLC_Editor\matiec\lib/ieclib.txt:32
9 error(s) found in C:\Users\rikvd\OpenPLC_Editor\matiec\lib/ieclib.txt. Bailing out!
Error : IEC to C compiler returned 1
PLC code generation failed !
 
I have attempted many things to fix it:
  • Removing all unconnected function blocks (which I usually place to mark things as todo), like the PID and RAMP block
  • Making sure all actions refer to a variable instead of being inline after copying
  • Removing the OSCAT custom functions
  • Updated the file
  • Making sure every function block has an input
  • Removing the unconnected powerrails which I use to make the code neat
Unfortunately, to no prevail and I have no idea how to fix it besides starting all over again. I would be happy to get you guys input. I have attached the program here, sorry for the messy code in advance
Reply 0 0
thiagoralves
I took a look at your project, and it seems that there are several errors in it that ultimately cause the compiler to crash at a random location. I guess the compiler could have a better compilation error message to help the user pinpoint the error better, but while we don't have that, perhaps the best way for you to debug this is to create a new project on another OpenPLC window (you can open OpenPLC twice), and then copy each function block one by one to your new project. You will need to have at least something on your main program for the project to compile. Keep something very simple on your main program, like LocalVar0 := 1. Since your blocks depend on each other, I would recommend copying the ones that don't depend on anything and then traverse the hierarchy from bottom up.
 
I started doing this, and found out that on your CO2Storing_Compressing POU you have some variables that aren't defined anywhere: Reactor_SurfaceTemperature_set_lower_limit, Reactor_SurfaceTemperature_reading, and Reactor_SurfaceTemperature_set_upper_limit. By doing that you will be able to, little by little, fix all your mistakes. Then once you get the most of it compiling, you can bring back the main program and you will be done.
Reply 0 0
thiagoralves
By the way, if I haven't made it clear on my previous post, you can copy/paste POUs from one editor to another. You don't have to redraw everything. Just right click the POU and select "Copy POU". Then on the other editor window, right click on the project tree and select "Paste POU".
Reply 0 0
RikRealization
Hey Tiago, thanks for your detailed description of the recommended approach! I got it working again. It turned out a few variables were not defined due to having copied blocks individually which does not add them to the POU variable list.
Thank you for you amazing involvement and development. You just go another Patreon 🙂
Reply 0 0
thiagoralves
That’s awesome. Thanks for your support @RikRealization
Reply 0 0
Reply