OMOptim not loading whole Modelica library[MSL] - modelica

I am trying to use OMOptim for the first time.
I want to run optimisation for code written in openmodelica that includes the following:
Modelica.Blocks.Sources.TimeTable solarThermal(table = [0:30:10800,100:10:3700]);
Modelica.Blocks.Sources.TimeTable solar(table = [0:30:10800,200:10:3800]);
Modelica.Blocks.Sources.TimeTable heatDemand(table = [0,450;3600,470;7200,400;10800,500]);
Modelica.Blocks.Sources.TimeTable electricityDemand(table =
[0,300;3600,500;7200,400;10800,300]);
I defined in settings of omoptim that path to modelica library is C:/OpenModelica1.9.1Beta1/lib/omlibrary/Modelica 3.2.1/package.mo where TimeTable is located. Then I go Models=> Load Modelica Library.
But when it tries to load it, I get tons of error messages like this:
OMC : isClass(Modelica.SIunits.LossAngle)
[18:46:32] false
[18:46:32] OMC : isClass(Modelica.SIunits.Conductance)
[18:46:32] false
[18:46:32] OMC : isClass(Modelica.SIunits.Admittance)
[18:46:32] false
[18:46:32] OMC : isClass(Modelica.SIunits.ModulusOfAdmittance)
[18:46:32] false
[18:46:32] OMC : isClass(Modelica.SIunits.Susceptance)
[18:46:32] false
[18:46:32] OMC : isClass(Modelica.SIunits.InstantaneousPower)
[18:46:32] false
[18:46:32] OMC : isClass(Modelica.SIunits.ActivePower)
[18:46:32] false
...
It loads something like 50% of library. It doesn't load TimeTable library which I need. Am I doing something wrong and how can I solve this?
Thanks!

The Modelica Standard Library has dependences to ModelicaServices. So you need also to load Modelica 3.2.1/ModelicaServices/package.mo.

I suspect your issue is that the Modelica path should be set to:
C:/OpenModelica1.9.1Beta1/lib/omlibrary
Although, strangely, I thought it was automatically set to that. But perhaps OMOptim or your scripts change that.
In other words, don't point it to the package.mo file and don't point it to Modelica 3.2.1. Point it to the directory that contains the Modelica 3.2.1 folder.
I hope that helps.

Related

JRHtmlExporter is deprecated now 6.15.X jasper. How to define the IS_USING_IMAGES_TO_ALIGN?

I replaced the usage of this class with JRHtmlExporter to HtmlExporter.
When I build my java file i got below error cannot find symbol IS_USING_IMAGES_TO_ALIGN
MY CODE IS:
exporter.setParameter(JRHtmlExporterParameter.IS_USING_IMAGES_TO_ALIGN, new Boolean("false"));
What is equivalent function?
You need to remove this setting since it's not supported anymore (it's false by default), for more information see:
How to set IS_USING_IMAGES_TO_ALIGN in HtmlExporter in Java ? by lucianc staff of jasper-reports
The new HtmlExporter does not support using images for alignment. So you no longer need to set IS_USING_IMAGES_TO_ALIGN to false, it is false by default.

How to retrieve Handle of a State block ? Matlab

I'm actually trying to build a Stateflow with Matlab code
I would like to know if it's possible to retrieve the Handle of a State block. I tried to use get_param() :
state_handle = get_param('System/Chart/State_ON', 'Handle');
But it returns me :
No block called 'State_ON' could be found.
Is there another solution to get Handle using the name of the state?
Edit : i found and post a solution
Ok after many research there are 2 solutions :
For version R2017b and after
StateHandle = StateFinder(Chart Handle)
For versions before R2017b
state_handle = ch.find('-isa','Stateflow.State','-and','Name', 'State_ON');

Graphhopper disable instructions

I'm using Leaflet Routing Machine libraries for routes in my project and a Graphhopper server. When inspecting network in my browser the library always gets a response from the graphhopper server with a parameter "instructions" as true but i don't use instructions in my project, how can i disable it ?
Looking at the source code for the Graphhopper backend for Leaflet Routing Machine, I read this:
var computeInstructions =
/* Instructions are always needed,
since we do not have waypoint indices otherwise */
true,
...
return baseUrl + L.Util.getParamString(L.extend({
instructions: computeInstructions,
...
You might want to get a local copy of that code, change the value of the computeInstructions variable, and see if everything works as expected, or if everything (or at least waypoint display) breaks as #Liedman indicated in the source code comments.
i found out a solution, in my code; in the options of the L.Routing.Control object
i added :
router: L.Routing.graphHopper('', {
urlParameters : {
instructions : false
}
})
and it's working fine

How to dictate a global variable in specific karma test block

I'm trying to write a test in Karma for a react/webpack application that tests conditionals depending on global variable __CLIENT__ being false or not.
How do I go about making it true for one it block, and then false for another? I tried setting global.__CLIENT__, but the console.logs from my module return true regardless of what I try to set it to in my tests.
How do I do this, hopefully in a way that keeps just one file and can be dictated in each test case. That avoids the karma.conf....
Probably won't help you now but maybe for others:
you need to create global.js file for example and within karma webpack files add it at the start of "files"
files: [
'./tests/global-variables.js',
{pattern: 'src/**/*-spec.js', watch: false}
],
And within global-variables.js:
var global = {
___CLIENT___: "some data"
}
Good luck!

Dojo layer don't includes all essentials

I have a sample script which uses
dojo.require("dojo.parser");
dojo.require("dijit.layout.BorderContainer");
dojo.require("dijit.layout.ContentPane");
dojo.require("dijit.layout.TabContainer");
dojo.require("dojox.grid.DataGrid");
dojo.require("dijit.Tree");
dojo.require("dojo.data.ItemFileReadStore");
I want to create a minified build of dojo, so I use this profile
dependencies = {
stripConsole : "normal",
selectorEngine : "acme",
optimize : "closure",
layerOptimize : "closure",
cssOptimize : "comments.keepLines",
mini : true,
internStrings : true,
localeList : "en-us",
releaseName : "dojo.custom",
action : "release",
optimize : "shrinksafe",
layerOptimize : "shrinksafe",
layers : [
{
name : "dojo.js",
dependencies : [
"dojo.parser",
"dojo.data.ItemFileReadStore",
"dojox.grid.DataGrid",
"dijit.layout.BorderContainer",
"dijit.layout.ContentPane",
"dijit.layout.TabContainer",
"dijit.Tree"
]
}
],
prefixes: [ [ "dijit", "../dijit" ], [ "dojox", "../dojox" ] ]
}
Yes, builder compile huge dojo.js file which I include in my html page, but still there is MANY xhr requests. System loads scripts which I don't use explicitly. Here's a screenshot
Interesting.
Are you sure the browser is successfully finding and loading the compressed version?
The browser is looking for _base.js which should definitely already be baked into that file.
Update
Tommi - dojo.js layer is always built by the build system, you don't have to explicitly declare it. I'm not sure what the effect will be of you explicitly declaring it along with dependencies. This might work, but it might not. Maybe the dependencies are overridding the normal dojo.js contents.
What I normally do is just let the system build dojo.js and then create a layer that has all the dijit/dojox stuff that I may want, and deploy that. I also usually create a 3rd separate file with my custom stuff in it.
I would try that. The key I think is to make a separate layer from dojo.js. (But still include the normal dojo.js in your page).