Integration Using MATLAB: Exploring General Information, Initializing the MATLAB Server, and Testing the MATLAB Connection in Innoslate's MATLAB Toolkit Integration
Sections Available in MATLAB Integration
Function | Description |
---|---|
General Information | Learn an overview of the MATLAB Toolkit Integration in Innoslate, understanding the commands of integration with the platform. |
Initializing MATLAB Server | Learn how to initialize the MATLAB Server within Innoslate, establishing a connection between the two platforms for data exchange and collaboration. |
Add Environment Variables | Add Environment Variables in the OS for integration. |
Testing MATLAB Connection | Learn the steps to test the connection between Innoslate and MATLAB integration toolkit, ensuring a reliable and stable connection. |
General Information
For the integration of MATLAB/Simulink and Innoslate, a Java Web Application (JWA) software tool was developed. The JWA tool creates the interface between the two software systems. The JWA tool can be installed on any server, may be packaged in the same installation package as Innoslate, and runs out of the same browser that Innoslate does. The JWA processes data requests from Innoslate and integrates these requests into a MATLAB Environment.
JWA needs to be placed in the C:\Innoslate\apache-tomcat\webapps folder. Then the following environment variables are needed to be added to the Path:
- C:\Program Files\MATLAB\R2020b\bin
- C:\Program Files\MATLAB\R2020b\bin\win64
Note the version of MATLAB will differ based on what version of MATLAB that is installed on the system.
Updating MATLAB engine.jar file in JWA:
In the lib folder of the JWA there is an engine.jar file. This file is specific to the version of MATLAB that you have installed. The default version is R2020b. This file version will need to match your MATLAB version. After copying over the engine.jar file, Innoslate will need to be restarted.
Lib file path:
- C:\Innoslate4\apache-tomcat\webapps\integrations\WEB-INF\lib
Engine.jar file path for MATLAB:
- C:\Program Files\MATLAB\R2020b\extern\engines\java\jar
Note the path of MATLAB will differ based on what version of MATLAB that is installed on the system.
Simulator MATLAB JWA URL:
In the simulator in the settings tab there is a field where you can add the MATLAB JWA URL.
Ex: http://localhost:8080/integrations/MatlabServlet
JAVASCRIPTS Commands:
get: function (parameter, evaluation, filePath)
post: function (parameter, evaluation, filePath)
- parameter: this variable represents a variable within the MATLAB Environment; it is able to have or not have a value associated with it.
- evaluation: this variable is obtained from a request sent to the JWA. It represents an evaluation to evaluate within MATLAB Environment.
- filePath: this variable is a file path or directory. The variable is obtained from a request sent to JWA.
In the simulator script to access the MATLAB function used the MATLAB variable:
Ex: x = Matlab.get(“x”);
Ex: Matlab.post(null, “x + y”, null);
File Path Example:
The file path is location to where scripts is located
The name of the script is test.m with a function of test(x) in the script.
1. Post Request:
Evaluate function without saving results to parameter:
var x =Matlab.post(null, test(5), “C:\Users\John\Documents”);
To Evaluate function and save to a parameter:
Matlab.post(“y”, test(5), “C:\Users\John\Documents”);
2. Get Request:
Evaluate function without saving results to parameter:
var x = Matlab.get(null, test(8), “C:\Users\John\Documents”);
To Evaluate function and save to a parameter:
Matlab.get(“y”, test(8), “C:\Users\John\Documents”);
Initializing MATLAB Server
1. Click on the Windows icon at the left hand corner of the desktop.
2. Select the Settings and go to Accounts
3. Click on Other Users
Some environments may need the following steps 4-9. More current versions of Matlab integration configurations will allow Windows users to be independent of usernames within Matlab. If you are using a more current version, you may skip straight to step 10. If you'd like more on this, please email Support.
4. Click Add someone else to this PC
5. Another way to access “lusrmgr” window
-
- Enter lusrmgr.msc in the search bar
- Click on the lusrmgr.msc
6. On the lusrmgr.msc window select Users
7. Right Click on desired Users and click on Properties
-
- The User (John Doe) will be the one to run start up Innoslate
8. Click on tab Member Of
9. Make sure that the User is member of Users and Administration
-
- If User is not members of both then exit screen and click on Groups
- Under Groups right click Users and select Properties
- Click the Add… button
- Enter User’s name into box
- Click on Check Names
- After clicking Check Names the name should change to the following
- Disclosure: the label in front of the User is the name of server
10. Apply all changes and exit. Go to Windows and search for Services.
11. In Services, stop Innoslate from running by right clicking on Innoslate and select Stop
12. Right Click on Innoslate and select Properties
13. Click on Log On tab
14. Click on circle next to This account and then click Browse-
- Disclosure: Erase the Original Password and use the Login Password of the User instead
15. On the same window, click Apply then OK
16. Start Innoslate
Add Environment Variables
A total of three environment variables are needed to ensure the integration will work.
- Navigate to ‘Control Panel > System and Security > System’ and click on ‘Advanced System Settings’ on the left.
- Click on ‘Environmental Variables’ button at the bottom of pop-up.
3. Under the ‘Systems Variables’ click on Variable ‘Path’ then press the ‘Edit’ button.
4. Ensure that both of the following are listed, add if necessary by pressing ’New’ button on the right side and adding the path:
i. {Matlab Root Directory}/R2018a/bin
ii. {Matlab Root Directory}/R2018a/bin/win64
Testing MATLAB Connection
1. Ensure the MATLAB Account and User are similar
-
- Check MATLAB account to ensure the proper User is login
2. Go to URL set up for Innoslate(http://localhost:8080/) and check the homepage appears
3. In separate tab, go to URL: http://localhost:8080/integrations/
4. On the page right click and select Inspect
5. A window will appear on the top left, click on the Console tab
6. Going to insert a simple math Problem for both POST Request And GET Request-
- GET Request in the Evaluation type “ 4+4” and press GET button
- POST Request in the Evaluation type “ 4+4” and press Post button
7. Under File Path field there should be message that appears “Output ans =8”
8. On the console window there should have the message that appears to be “ans = 8”
9. If an error message pops up instead of the “8” please get a message from the error message and send it back to SPEC Innovations.
To continue learning about Enterprise User Guides, Click Here.
(Next Article: STK API Integration)