Error: Unexpected MATLAB expression. "MATLAB:m missing operator"
5 views (last 30 days)
Show older comments
Hi I linked MATLAB with ModeFrontier. When I run the my code in MATLAB I get correct result but when using ModeFrontier I get the following error: Error: Unexpected MATLAB expression. "MATLAB:m missing operator" this my code where SP_MATLAB is a mex fortran file that is without any error when running in MATALB.
x=0;
L1 = L + x;
B1 = B + x;
T1 = T + x;
Z1 = Z + x;
EAR1 = EAR + x;
DIA1 = DIA + x;
RPM1 = RPM + x;
PDR1 = PDR + x;
% L=25.0;B=3.5;T=1.5;
% Z=5;EAR=0.5;DIA=1.75;RPM=250.0;PDR=0.83;
[RW,ETA]=SP_MATLAB(L1,B1,T1,Z1,EAR1,DIA1,RPM1,PDR1);
[EDITED, Jan, error message moved from the answers section:]
10:57:21:029 DESIGN STARTED 00297
10:57:21:173 WARNING Error Design Outputs set to NaN!
10:57:21:173 DESIGN FAILED 00297 ELAPSED TIME = 0h:0m:0.145s
Date & Time Event Argument
Fri, 04 November 2016
10:57:21:895 PROCESS STARTED 00302 (00000-00999, Design Data)
10:57:21:899 JOB STARTED Matlab11, job_out, job_err, jvm_out, jvm_err, Input Data, Dir
10:57:21:906 MESSAGE Matlab11: Process requested
10:57:21:915 MESSAGE Matlab11: Process obtained
10:57:21:937 MESSAGE Matlab11: Running locally
10:57:22:024 ERROR java.lang.Exception: Error: Unexpected MATLAB expression.MATLAB:m_missing_operator
10:57:22:030 ERROR Matlab11: RemoteException occurred in server thread; nested exception is: java.rmi.RemoteException: java.lang.Exception: Error: Unexpected MATLAB expression.MATLAB:m_missing_operator; nested exception is: java.util.concurrent.ExecutionException: java.lang.Exception: Error: Unexpected MATLAB expression.MATLAB:m_missing_operator
java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
java.rmi.RemoteException: java.lang.Exception:
Error: Unexpected MATLAB expression.
10:57:28:131 DESIGNS GROUP COMPLETED 00000-00999 (COMPLETED=0, FAILED=100) ELAPSED TIME = 0h:0m:56.601s
10:57:28:217 SCHEDULING COMPLETED (COMPLETED=0, FAILED=100) ELAPSED TIME = 0h:0m:56.811s
3 Comments
Jan
on 4 Nov 2016
@iman AHMADI: Please post all details belonging to a question is the section for the question, not as an answer. Thanks.
Answers (3)
Jan
on 4 Nov 2016
The error message does not contain the contents of the failing line - what a pitty. The problem might be in the calling sequence of the Matlab code, but the code itself looks strange also: What is "L", "B", "T" and "Z"? This cannot run without problems inside Matlab, except if these symbols are functions without inputs. The same for "EAR", "DIA", "RPM" and "PDR".
2 Comments
Victor Cesconetto
on 19 Jan 2020
Hi, I have the same error now, 4 years later. Did you solve the problem??
5 Comments
Victor Cesconetto
on 16 Apr 2020
I just stopped using functions. If you work with normal .m matlab codes, it will work normally.
LAUREL ASIMIEA
on 17 Apr 2020
hello victor okay here is more details on my problem.
like the guy above I am coupling matlab code to modeFRONTIER. In the modeFORNTIER environment i input my matlab script and connect the necessary input and output variables to other components in modeFRONTIER. My matlab script takes in input variables from modeFRONTIER and runs a calculation that gives both scalar and matrix(vector) outputs back to modeFRONITER.
The script works fine when i run it in the matlab environment. However, when i run it through modeFRONTIER i get the error. After investigating (i.e. looking through the files generated by modeFRONTIER) i noticed that the scalar ouput variables are obtained by modeFRONTIER with no issues, but modeFRONTIER is having a problem obtained the matrix output variables.
Here is the code
format short g
actual_inj_law = load('inj10mm3.dat'); %injection law for 10mm^3 fuel quantity
time_law = actual_inj_law(:,1); %time of the injection law
fuel_law = actual_inj_law(:,2); %fuel flowrate of the injection law
act_inj_p = 1200*10^6; %actual fuel injection pressure
des_inj_p = 1200*10^6; %desired fuel injection pressure
total_fuel_quant = trapz(time_law,fuel_law); %old fuel quantity injected
fuel_law_max = max(fuel_law); %max fuel flowrate of old profile
fuel_law_max_points = find(fuel_law == max(fuel_law)); %index from 0 to old profile max fuel flowrate
%SECTION 1:
%The desired injected quantity for 1st injection (p1)
x1 = time_law(1: fuel_law_max_points); %time values from 0 to max fuel flowrate
y1 = fuel_law(1: fuel_law_max_points); %fuel values from 0 to max fuel flowrate
des_fuel_quant_p1 = p1_vfp * total_fuel_quant; %desired fuel quantity for 1st injection
qq_p1 = x1(1); %start time of old injection profile
x1y1 = x1.*y1; %product of time & fuel columns
%Fuel quantity nearest to desired quantity in p1 is predicted here.
%PART 1:
%Creation of the new profile rise slope. Variables are denoted by r.
%r1 is error between desired and closest value. r2 is closest value index
[r1, r2] = min(abs((y1.*(x1-qq_p1)) - des_fuel_quant_p1));
r4 = time_law(1:r2); %time values from 0 to closest quantity time
r5 = fuel_law(1:r2); %fuel values from 0 to closest quantity fuel
r3 = r5(end); %last fuel value
r7 = length(r4);
r6 = time_law(end); %last time value
%PART 2:
%Creation of the new profile fall slope. Variables are denoted by f.
x2 = time_law(fuel_law_max_points:end); %time values from max fuel flowrate to end
y2 = fuel_law(fuel_law_max_points:end); %fuel values from max fuel flowrate to end
f1 = length(x2);
f2 = length(y2);
x2y2= x2.*y2;
f3 = min(abs(y2 -r3));
%f4 is error between desired and closest value. f5 is closest value index
[f4, f5] = min(abs(y2 - r3));
hh = y2(f5);
%the new fall slope fuel values are obtained & joined to the new rise side
%fuel values.
f6 = y2(f5+1:end);
f7 = length(f6);
f8 = x2(f5+1:end);
f9 = length(f8);
f10 = f9 + r7;
f12 = time_law(1 :f10);
%e = length(f12);
new_fuel_law_p1 = [r5;f6];
new_time_law_p1 = f12;
%ee = length(new_fuel_law_p1);
%ff = length(new_time_law_p1);
%g = flip(x8);
%SECTION 2:
%The desired injected quantity for 2nd injection (p2)
des_fuel_quant_p2 = total_fuel_quant - des_fuel_quant_p1; %desired fuel quantity for 2nd injection
%The following steps are the same as steps above but for 2nd injection
xx1 = time_law(1:fuel_law_max_points);
yy1 = fuel_law(1:fuel_law_max_points);
qq_p2 = xx1(1);
%PART 1
[rr1, rr2] = min(abs((yy1.*(xx1-qq_p2)) - des_fuel_quant_p2));
rr4 = time_law(1:rr2);
rr5 = fuel_law(1:rr2);
rr3 = rr5(end);
rr7 = length(rr4);
rr6 = time_law(end);
%PART 2
xx2 = time_law(fuel_law_max_points:end);
yy2 = fuel_law(fuel_law_max_points:end);
ff1 = length(xx2);
ff2 = length(yy2);
ff3 = min(abs(yy2 - rr3));
[ff4,ff5] = min(abs(yy2 -rr3));
ff6 = yy2(ff5+1:end);
ff7 = length(ff6);
ff8 = xx2(ff5+1:end);
ff9 = length(ff8);
ff10 = ff9 + rr7;
ff12 = time_law(1:ff10);
new_fuel_law_p2 = [rr5;ff6];
new_time_law_p2 = ff12;
zz = dwell + new_time_law_p2; % 1.111 is the dwell value from modeFRONTIER
%SECTION 3:
%PART1:
%Plots from the calculations in section 1 & 2
figure(1)
plot(new_time_law_p1,new_fuel_law_p1, 'r') %plot of p1 profile
hold on
plot(time_law,fuel_law, 'b')
figure (2)
plot(new_time_law_p2,new_fuel_law_p2, 'g') %plot of p2 profile
hold on
plot(time_law,fuel_law, 'b') %plot of old profile
figure (3)
plot(new_time_law_p1,new_fuel_law_p1, 'r')
hold on
plot(zz,new_fuel_law_p2, 'g')
hold on
plot(time_law, fuel_law, 'b')
%PART2:
%Outputs to FIRE .ssf file via modeFRONTIER
%Fire requires the following injection paramters:
rpm = 1500; %engine speed
%1st Injection: p1_quantity, SoIp1, EoIp1, new_time_law_p1 &
% new_fuel_law_p1.
p1_quantity = des_fuel_quant_p1; %1st injection quantity
p1_q = p1_quantity/6 %quantity in each nozzle hole
%SoI_p1 = ??;
last_time_p1 = new_time_law_p1(end); %last time value of 1st injection in us
last_time_p1_CA = (last_time_p1/1000) * 6 * rpm; %last time value of 1st injection in CA
p1_time_law_CA = (new_time_law_p1/1000) * 6 * rpm; %1st injection time law in CA
p1_time_values = p1_time_law_CA %1st injection time values
p1_fuel_values = new_fuel_law_p1 %1st injection fuel values
p1_length = length(p1_time_values)
%2nd Injection: p2_quantity, SoI_p2, EoI_p2, new_time_law_p2(i.e. zz) &
% new_fuel_law_p2
p2_quantity = des_fuel_quant_p2; %2nd injection quantity
p2_q = p2_quantity/6 %quantity in each nozzle
%SoI_p2 = ??;
last_time_p2 = zz(end); %last time value of 2nd injection in us
last_time_p2_CA = (last_time_p2/1000) * 6 * rpm; %last time value of 2nd injection in CA
p2_time_law_CA = (zz/1000) * 6 *rpm; %2nd injection time law in CA
p2_time_values = p2_time_law_CA %2nd injection time values
p2_fuel_values = new_fuel_law_p2 %2nd injection fuel vlaues
p2_length = length(p2_time_values)
here p1_vfp and dwell are the input variables from modeFRONTIER to matlab
p1_q, p1_time_values are scalar and vector output variables from matlab to modeFRONTIER.
Here is the error i get from the jvm.log file
Apr 16, 2020 4:28:29 AM it.esteco.procint.engine.AbstractJob toErrLog
SEVERE: null
java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: Missing value for output variable p1_fuel_values, class [D
at it.esteco.jobagent.integration.StaIntegrationJob.awaitFuture(StaIntegrationJob.java:39)
at it.esteco.jobagent.integration.StaIntegrationJob.startJob(StaIntegrationJob.java:57)
at it.esteco.procint.engine.DefaultJob.startProcess(DefaultJob.java:270)
at it.esteco.procint.engine.DefaultJob$DefaultProcessLifecycle.run(DefaultJob.java:423)
at it.esteco.procint.engine.DefaultJob.runJob(DefaultJob.java:148)
at it.esteco.procint.engine.AbstractRunnableJob.run(AbstractRunnableJob.java:39)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
Caused by: it.esteco.jobagent.integration.IntegrationJobException: java.lang.IllegalArgumentException: Missing value for output variable p1_fuel_values, class [D
at it.esteco.integration.matlab.job.MatlabIntegration.start(MatlabIntegration.java:131)
... 4 more
Caused by: java.lang.IllegalArgumentException: Missing value for output variable p1_fuel_values, class [D
at it.esteco.integration.matlab.job.MatlabIntegration.getOutputVariables(MatlabIntegration.java:226)
at it.esteco.integration.matlab.job.MatlabIntegration.start(MatlabIntegration.java:127)
... 4 more
Caused by: com.jacob.com.ComFailException: Invoke of: getFullMatrix
Source:
Description:
at com.jacob.com.Dispatch.invokev(Native Method)
at com.jacob.com.Dispatch.invokev(Dispatch.java:625)
at it.esteco.jacob.JacobDispatch.callMethod(JacobDispatch.java:51)
at it.esteco.activex.ActiveXAdapter.callMethod(ActiveXAdapter.java:50)
at it.esteco.integration.matlab.job.win.MatlabApplication.getFullMatrix(MatlabApplication.java:27)
at it.esteco.integration.matlab.job.win.MatlabWin.getUncheckedMatrix(MatlabWin.java:295)
at it.esteco.integration.matlab.job.win.MatlabWin.getUncheckedArray(MatlabWin.java:277)
at it.esteco.integration.matlab.job.win.MatlabWin.getArray(MatlabWin.java:273)
at it.esteco.integration.matlab.job.MatlabIntegration.getOutputVariables(MatlabIntegration.java:215)
... 5 more
my email address is laurel.laurenzo@yahoo.com. You can email me
Thank you for any help
Ran Sha
on 9 Nov 2020
If anyone ever sees this.
I had the same issue.
what solved it for me, is to make sure that if you use EXE files, put them in a folder that is in one of the folders that the PATH varible points to.
For some reason modeFrontier doesn't read exe files if they're not there.
Also, make sure you open modeFrontier as an Admin.
0 Comments
See Also
Categories
Find more on Software Development Tools in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!