Figure 1 shows the generated C code of a part of k1visetmxp before (left) and after (right) fixing the problem.
As shown in the highlight line, the input to the 16th bit of bit2word was "sum4" instead of a proper input signal. "sum4" is a summation of yaw contorl signals from ASC, ADS, and BPC. And the 16th bit is assigned to switch the coil driver input as Drive-In or Test-In for the control signal on 4-9 pin. So the model-compile script generated a very nice code which disabled the output to one coil when yaw control signal became non-zero value.
I tried to modify the conversion script from the matlab code to the C code as shown below. After this modification, real-time models were re-compiled and worked fine.
--- Bit2Word.pm.bak 2016-11-09 09:33:17.000000000 +0900
+++ Bit2Word.pm 2023-12-09 18:25:19.000000000 +0900
@@ -75,7 +75,7 @@ sub frontEndCode {
for (0 .. $::partInCnt[$i]-2) {
$calcExp .= "\t$::fromExp[$_],\n";
}
- $calcExp .= "\t$::fromExp[$partInCnt[$i]-1]\n";
+ $calcExp .= "\t$::fromExp[$::partInCnt[$i]-1]\n";
$calcExp .= "};\n";
$calcExp .= "\L$::xpartName[$i] = 0;\n";
$calcExp .= "for (ii = 0; ii < $::partInCnt[$i]; ii++)\n{\n";