I would like to control the system using Petri Net logic. Petri Nets should be vizualized on the PC. PC is connected to Arduino and controlled system is connected to Arduino of course. Controlled system would be of discrete event or hybrid character.
You can see that the places of Petri net are connected to actuator. So when the token is in the place - the actuator turn on. So in our case - when the token is in the place - the specific pin on Arduino or function is executed.
I think that this is possile to do with ModelPlug library. (Or do you have better idea?)
But in SystemModeler it produces for example this error:
Building "PNlib.Examples.ConTest.Speed" as experiment "Speed 1" started at 14:29:23
Error: [:0:0-0:0]Error occurred while flattening model PNlib.Examples.ConTest.Speed
Error: [C:/Users/erikn_000/Documents/PNlib-1.1/PNlib/Blocks/enablingOutCon.mo:59:9-59:71]Failed to elaborate expression: enablingProb[remTAout[1:nremTAout]].
Warning: [:0:0-0:0]In component P2.enableOut, in relation arcWeightSum == 0.0, == on Real numbers is only allowed inside functions.
Warning: [:0:0-0:0]In component P2.enableIn, in relation arcWeight[i] == 0.0, == on Real numbers is only allowed inside functions.
Warning: [:0:0-0:0]In component P2.enableIn, in relation arcWeightSum == 0.0, == on Real numbers is only allowed inside functions.
Warning: [:0:0-0:0]In component P1.enableOut, in relation arcWeight[i] == 0.0, == on Real numbers is only allowed inside functions.
Warning: [:0:0-0:0]In component P1.enableOut, in relation arcWeightSum == 0.0, == on Real numbers is only allowed inside functions.
Warning: [:0:0-0:0]In component P1.enableIn, in relation arcWeight[i] == 0.0, == on Real numbers is only allowed inside functions.
Warning: [:0:0-0:0]In component P1.enableIn, in relation arcWeightSum == 0.0, == on Real numbers is only allowed inside functions.
Error: No executable generated C:/Users/ERIKN_~1/AppData/Local/Temp/sme.4.0.1_1440332963_41.exe
Error: No settings file generated C:/Users/ERIKN_~1/AppData/Local/Temp/sme.4.0.1_1440332963_41_init.sim
Do you have any ideas how to complete my project? Do you think that it is possible to relative simply fix this PNlib library?
Thank you very much!
Thank you for your answer. PNlib is much better because it supports hybrid Petri nets with discrete and continuous places (transitions). This is quite important for my research project.
Try again with a clone of the source from github (i.e. not the 1.1 release), that particular error seems to be fixed a couple of months ago: Fix == on Real numbers (it’s a modelling error it’s not allowed todo == on Reals in Modelica outside of functions).
Error: [:0:0-0:0]Error occurred while flattening model PNlib.Examples.ConTest.Speed
Error: [C:/Users/erikn_000/Documents/PNlib-master/PNlib/Blocks/enablingOutCon.mo:60:9-60:71]Failed to elaborate expression: enablingProb[remTAout[1:nremTAout]].
Thank you, I used the most recent version directly from GitHub. Now I am receiving this error.
One of the creators of PNlib solved this error by this:
Original Statement:
sumEnablingProbTAout := sum(enablingProb[remTAout[1:nremTAout]]); //enabling probability sum of all active output transitions
Substituted statement:
sumEnablingProbTAout := 0;
for i in 1:nremTAout loop
temp_j := remTAout[i];
sumEnablingProbTAout := sumEnablingProbTAout+enablingProb[temp_j]; //enabling probability sum of all active output transitions
end for;
Now I have error (model checking runs OK):
Building "PNlib.Examples.ConTest.Speed" as experiment "Speed 1" started at 15:21:00
Error: [:0:0-0:0]Error building simulator. Build log:
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
"cl" /MT /EHa /I"C:\Program Files (x86)\Wolfram Research\SystemModeler 4.1\include" /I"C:\Program Files (x86)\Wolfram Research\SystemModeler 4.1\include\platform\win32\VS2010" /I"C:\Program Files (x86)\Wolfram Research\SystemModeler 4.1\include\fmil" /I"E:/PNlib-master-upr/PNlib/Examples/ConTest" sme.4.1.0_1441113660_15724.cpp /link /LIBPATH:"C:\Program Files (x86)\Wolfram Research\SystemModeler 4.1\lib\win32\VS2010" /LIBPATH:"E:\PNlib-master-upr\PNlib\Examples\ConTest" sim.lib c_runtime.lib mmcom.lib lapack.lib superlu_4.3.lib blas.lib f2c.lib c_common.lib expat.lib sundials_cvodes.lib sundials_kinsol.lib sundials_nvecserial.lib fmi1_import_runtime.lib fmi2_import_runtime.lib fmilib.lib modelicautil.lib winmm.lib wsock32.lib user32.lib shlwapi.lib /OUT:"sme.4.1.0_1441113660_15724.exe"
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
sme.4.1.0_1441113660_15724.cpp
sme.4.1.0_1441113660_15724.cpp(2653) : error C2675: unary '!' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(2692) : error C2675: unary '!' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(3983) : error C2065: '$$P2$_enableOut$_cumEnablingProb$B1$b' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(3992) : error C2065: '$$P2$_enableOut$_cumEnablingProb' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(4028) : error C2065: '$$P2$_enableOut$_TEout' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(4053) : error C2065: '$$P2$_enableOut$_cumEnablingProb$B1$b' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(4062) : error C2065: '$$P2$_enableOut$_cumEnablingProb' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(4072) : error C2065: '$$P2$_enableOut$_cumEnablingProb' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(4218) : error C2676: binary '&&' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(4227) : error C2675: unary '!' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(4304) : error C2676: binary '&&' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(4313) : error C2675: unary '!' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(4441) : error C2676: binary '&&' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(4455) : error C2675: unary '!' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(4624) : error C2676: binary '&&' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(4906) : error C2676: binary '&&' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(4909) : error C2676: binary '&&' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(5007) : error C2676: binary '&&' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(5021) : error C2675: unary '!' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(5198) : error C2676: binary '&&' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(5207) : error C2675: unary '!' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(5311) : error C2676: binary '&&' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(5325) : error C2675: unary '!' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(5494) : error C2676: binary '&&' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5758) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5761) : error C2065: '$i1_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5765) : error C2065: '$i3_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5770) : error C2065: '$i18_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5770) : error C2065: '$i18_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5770) : error C2065: '$i18_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5770) : error C2065: '$i18_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5770) : error C2065: '$i18_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5770) : error C2065: '$i18_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5770) : error C2065: '$i18_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5770) : error C2065: '$i18_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5770) : error C2065: '$i18_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5773) : error C2065: '$i17_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5773) : error C2065: '$i17_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5773) : error C2065: '$i17_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5773) : error C2065: '$i17_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5773) : error C2065: '$i17_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5773) : error C2065: '$i17_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5773) : error C2065: '$i17_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5773) : error C2065: '$i17_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5773) : error C2065: '$i17_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5776) : error C2065: '$i17_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5776) : error C2065: '$i17_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5776) : error C2065: '$i17_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5776) : error C2065: '$i17_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5776) : error C2065: '$i17_i' : undeclared identifier
sme.4.1.0_1441113660_15724.cpp(5776) : fatal error C1003: error count exceeds 100; stopping compilation
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
Error: No executable generated C:/Users/Erik/AppData/Local/Temp/sme.4.1.0_1441113660_15724.exe
I tried also very model and there is an error, too:
Building "PNlib.Examples.ConTest.SingleTC" as experiment "SingleTC 1" started at 13:32:45
Error: [:0:0-0:0]Error building simulator. Build log:
Setting environment for using Microsoft Visual Studio 2010 x86 tools.
Microsoft (R) Program Maintenance Utility Version 10.00.30319.01
Copyright (C) Microsoft Corporation. All rights reserved.
"cl" /MT /EHa /I"C:\Program Files (x86)\Wolfram Research\SystemModeler 4.1\include" /I"C:\Program Files (x86)\Wolfram Research\SystemModeler 4.1\include\platform\win32\VS2010" /I"C:\Program Files (x86)\Wolfram Research\SystemModeler 4.1\include\fmil" /I"E:/PNlib-master-upr/PNlib/Examples/ConTest" sme.4.1.0_1441279965_15636.cpp /link /LIBPATH:"C:\Program Files (x86)\Wolfram Research\SystemModeler 4.1\lib\win32\VS2010" /LIBPATH:"E:\PNlib-master-upr\PNlib\Examples\ConTest" sim.lib c_runtime.lib mmcom.lib lapack.lib superlu_4.3.lib blas.lib f2c.lib c_common.lib expat.lib sundials_cvodes.lib sundials_kinsol.lib sundials_nvecserial.lib fmi1_import_runtime.lib fmi2_import_runtime.lib fmilib.lib modelicautil.lib winmm.lib wsock32.lib user32.lib shlwapi.lib /OUT:"sme.4.1.0_1441279965_15636.exe"
Microsoft (R) 32-bit C/C++ Optimizing Compiler Version 16.00.30319.01 for 80x86
Copyright (C) Microsoft Corporation. All rights reserved.
sme.4.1.0_1441279965_15636.cpp
sme.4.1.0_1441279965_15636.cpp(661) : error C2675: unary '!' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441279965_15636.cpp(724) : error C2675: unary '!' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\BIN\cl.EXE"' : return code '0x2'
Stop.
Error: No executable generated C:/Users/Erik/AppData/Local/Temp/sme.4.1.0_1441279965_15636.exe
Do you think it is compiler or library related error?
I am receiving similar error also with 4.2 version and Visual Studio 2015 compiler. Where should I start to search the error?
Thank you for your answer.
sme.4.1.0_1441279965_15636.cpp(661) : error C2675: unary '!' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
sme.4.1.0_1441279965_15636.cpp(724) : error C2675: unary '!' : 'boolean_array' does not define this operator or a conversion to a type acceptable to the predefined operator
If soo, I guess it’s the code generation that has problem with an applying not to an array of booleans, you could try to replace it with the following Modelica function to avoid the problem.
function arrayNot
input Boolean b[:];
output Boolean res[size(b, 1)];
algorithm
for i in 1:size(b,1) loop
res[i] := not b[i];
end for;
end arrayNot;
My team fixed some errors. Systemmodeler cannot handle operators ‘not’, ‘and’ and ‘or’ for boolean arrays. Solution is quite simple, you just have to substitute all occurrence of mentioned operators with functions, e.g:
replace:
Unfortunately System Modeler version 4.2 shows an error with this updated version of PNlib when we run example ConTest.SingleTc . Version 4.0.1 is Ok.
Do you have an idea how to show an extended log for this error?