0

I'm working on a project with RightWON Configuration Suite. I use structured text to code and create functions (UDFB). My problem is that when I start the simulation, I get an error message telling me that there are inputs expected on the line where my function is called.

Here are my variables:

enter image description here

Here is the main code:

nombre_power_source_on := 1;
gd1_synchro := FALSE;
gd2_synchro := FALSE;
mgset_synchro := FALSE;

result := MasterSlaveFunction(nombre_power_source_on, gd1_synchro, gd2_synchro, mgset_synchro);

gd1_sm := result.gd1_sm;
gd2_sm := result.gd2_sm;
mgset_sm := result.mgset_sm;

Here is the MasterSlaveFunction function:

IF nombre_power_source_on <= 1 THEN
    gd1_sm := 1;
    gd2_sm := 1;
    mgset_sm := 1;
ELSE
    IF gd1_synchro = TRUE THEN
        gd2_sm := 0;
        mgset_sm := 0;
    ELSIF gd2_synchro = TRUE THEN
        gd1_sm := 0;
        mgset_sm := 0;
    ELSIF mgset_synchro = TRUE THEN
        gd1_sm := 0;
        gd2_sm := 0;
    END_IF;
END_IF;

And here are the inputs and outputs of the function:

enter image description here

Simon F.-Smith
  • 781
  • 3
  • 8
  • Maybe it is because the name of the input parameter is the same as your variable name. What if you try `MasterSlaveFunction(nombre_power_source_on:=nombre_power_source_on , gd1_synchro:=gd1_synchro, ... )`? – Roald Aug 16 '22 at 13:32
  • @Roald It did not work but thank you for the idea. I also tried to change the variables names for them to be different and it's not working either. – Simon F.-Smith Aug 16 '22 at 15:01
  • What type is returned by the `MasterSlaveFunction` function? I couldn't identify it in the code, because it looks like the `return` variable is of type `MasterSlaveFunction`, however this is the name of the function, but it might not be what your function explicitly returns (this doesn't sound right anyway) . – dwpessoa Aug 17 '22 at 10:57
  • @dwpessoa The function returns 3 variables of int type. I'm new to this language, I thought I could maybe do something like `gd1_sm, gd2_sm, mgset_sm := MasterSlaveFunction(inputs here)` but it's not working. It seems like I have to put the return in 1 variable (here it's `result`) even if I have 3 variables to return. – Simon F.-Smith Aug 17 '22 at 12:25

0 Answers0