Main

APM MATLAB Interface Documentation

Main.MatlabFunctions History

Hide minor edits - Show changes to output

January 17, 2013, at 12:19 AM by 69.169.188.188 -
Changed lines 28-30 from:
* [[http://apmonitor.com/apm_html/t0_load.m.html|t0_load.m - Load a restart file]]
to:
* [[http://apmonitor.com/apm_html/t0_load.m.html|t0_load.m - Load a restart file]]

Note: Some older versions of MATLAB cannot run the ''apm_web_var.m'' or ''apm_web.m'' script.  This script automatically launches the web-viewer for display of the solution results.  If this is the case, comments in the script give instructions on a work-around.
January 16, 2013, at 11:58 PM by 69.169.188.188 -
Changed lines 5-6 from:
!!!!
to:
!!!! APM MATLAB Functions
Changed lines 9-82 from:
----

(:html:)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<title>Exported from Notepad++</title>
<style type="text/css">
span {
font-family: 'Courier New';
font-size: 10pt;
color: #000000;
}
.sc0 {
}
.sc1 {
color: #008000;
}
.sc4 {
font-weight: bold;
color: #0000FF;
}
.sc5 {
color: #808080;
}
.sc6 {
font-weight: bold;
color: #000080;
}
.sc7 {
}
</style>
</head>
<body>
<div style="float: left; white-space: pre; line-height: 1; background: #FFFFFF; "><span class="sc1">% APM Web-Interface Command</span><span class="sc0">
</span><span class="sc1">%</span><span class="sc0">
</span><span class="sc1">% response = apm(server,app,command)</span><span class="sc0">
</span><span class="sc1">%</span><span class="sc0">
</span><span class="sc1">% This function sends a command to the APM server with</span><span class="sc0">
</span><span class="sc1">%  the following arguments:</span><span class="sc0">
</span><span class="sc1">%</span><span class="sc0">
</span><span class="sc1">%  server = address of server</span><span class="sc0">
</span><span class="sc1">%      app = application name</span><span class="sc0">
</span><span class="sc1">%  command = instruction or line sent</span><span class="sc0">
</span><span class="sc1">% </span><span class="sc0">
</span><span class="sc1">% Some commands are:</span><span class="sc0">
</span><span class="sc1">%  solve    : solve the model on the server</span><span class="sc0">
</span><span class="sc1">%  clear all : clear the application and all files</span><span class="sc0">
</span><span class="sc1">%  clear apm : clear just the model file (apm)</span><span class="sc0">
</span><span class="sc1">%  clear csv : clear just the data file (csv)</span><span class="sc0">
</span><span class="sc1">%  info {FV,MV,SV,CV}, {name} : create interface to variable </span><span class="sc0">
</span><span class="sc1">%  ss.t0 {values} : load ss.t0 (restart file)</span><span class="sc0">
</span><span class="sc1">%  csva {contents} : add contents to the data file (csv)</span><span class="sc0">
</span><span class="sc1">%  csv {line} : add one line to the data file (csv)  </span><span class="sc0">
</span><span class="sc1">%  apm {contents} : add to apm file without carriage return</span><span class="sc0">
</span><span class="sc1">%  {otherwise} : add line to apm file</span><span class="sc0">
</span><span class="sc4">function</span><span class="sc0"> </span><span class="sc7">response</span><span class="sc0"> </span><span class="sc6">=</span><span class="sc0"> </span><span class="sc7">apm</span><span class="sc6">(</span><span class="sc7">server</span><span class="sc6">,</span><span class="sc7">app</span><span class="sc6">,</span><span class="sc7">aline</span><span class="sc6">)</span><span class="sc0">

    </span><span class="sc1">% Web-server URL base</span><span class="sc0">
    </span><span class="sc7">url_base</span><span class="sc0"> </span><span class="sc6">=</span><span class="sc0"> </span><span class="sc6">[</span><span class="sc7">deblank</span><span class="sc6">(</span><span class="sc7">server</span><span class="sc6">)</span><span class="sc0"> </span><span class="sc5">'/online/apm_line.php'</span><span class="sc6">];</span><span class="sc0">

    </span><span class="sc1">% Send request to web-server</span><span class="sc0">
    </span><span class="sc7">params</span><span class="sc0"> </span><span class="sc6">=</span><span class="sc0"> </span><span class="sc6">{</span><span class="sc5">'p'</span><span class="sc6">,</span><span class="sc7">app</span><span class="sc6">,</span><span class="sc5">'a'</span><span class="sc6">,</span><span class="sc7">aline</span><span class="sc6">};</span><span class="sc0">
    </span><span class="sc7">response</span><span class="sc0"> </span><span class="sc6">=</span><span class="sc0"> </span><span class="sc7">urlread</span><span class="sc6">(</span><span class="sc7">url_base</span><span class="sc6">,</span><span class="sc5">'get'</span><span class="sc6">,</span><span class="sc7">params</span><span class="sc6">);</span><span class="sc0">

    </span><span class="sc1">% remove newline characters from response</span><span class="sc0">
    </span><span class="sc7">newline</span><span class="sc0"> </span><span class="sc6">=</span><span class="sc0"> </span><span class="sc7">sprintf</span><span class="sc6">(</span><span class="sc5">'\r'</span><span class="sc6">);</span><span class="sc0">
    </span><span class="sc7">response</span><span class="sc0"> </span><span class="sc6">=</span><span class="sc0"> </span><span class="sc7">strrep</span><span class="sc6">(</span><span class="sc7">response</span><span class="sc6">,</span><span class="sc7">newline</span><span class="sc6">,</span><span class="sc5">''</span><span class="sc6">);</span><span class="sc0">
</span></div></body>
</html>
(:htmlend:)

----
to:
* [[http://apmonitor.com/apm_html/apm.m.html|apm.m - Send commands to the server]]
* [[http://apmonitor.com/apm_html/apm_app.m.html|apm_app.m - Load model and data files]]
* [[http://apmonitor.com/apm_html/apm_details.m.html|apm_details.m - Retrieve application details]]
* [[http://apmonitor.com/apm_html/apm_get.m.html|apm_get.m - Retrieve a file from the server]]
* [[http://apmonitor.com/apm_html/apm_info.m.html|apm_info.m - Classify a parameter or variable]]
* [[http://apmonitor.com/apm_html/apm_load.m.html|apm_load.m - Load model file]]
* [[http://apmonitor.com/apm_html/apm_meas.m.html|apm_meas.m - Specify a measurement]]
* [[http://apmonitor.com/apm_html/apm_option.m.html|apm_option.m - Set an option]]
* [[http://apmonitor.com/apm_html/apm_sol.m.html|apm_sol.m - Retrieve the solution]]
* [[http://apmonitor.com/apm_html/apm_solve.m.html|apm_solve.m - ODE / DAE Integrator]]
* [[http://apmonitor.com/apm_html/apm_tag.m.html|apm_tag.m - Retrieve an option]]
* [[http://apmonitor.com/apm_html/apm_web.m.html|apm_web.m - Open a web interface to the dashboard]]
* [[http://apmonitor.com/apm_html/apm_web_root.m.html|apm_web_root.m - Open a web interface to the root directory]]
* [[http://apmonitor.com/apm_html/apm_web_var.m.html|apm_web_var.m - Open a web interface to the variable values]]
* [[http://apmonitor.com/apm_html/csv_data.m.html|csv_data.m - Load a data (csv) file locally]]
* [[http://apmonitor.com/apm_html/csv_element.m.html|csv_element.m - Retrieve an element from loaded csv data]]
* [[http://apmonitor.com/apm_html/csv_load.m.html|csv_load.m - Load data file]]
* [[http://apmonitor.com/apm_html/csv_lookup.m.html|csv_lookup.m - Retrieve the column number for a variable]]
* [[http://apmonitor.com/apm_html/parse.m.html|parse.m - Parse line given a delimiter]]
* [[http://apmonitor.com/apm_html/t0_load.m.html|t0_load.m - Load a restart file]]
January 16, 2013, at 11:22 PM by 69.169.188.188 -
Added lines 1-82:
(:title APM MATLAB Interface Documentation:)
(:keywords MATLAB, APM MATLAB, nonlinear, model, predictive control, differential, algebraic, modeling language:)
(:description The APM MATLAB interface enhances the numerical capabilities for optimization, simulation, estimation, and control:)

!!!!

The following MATLAB functions are available in the '''apm''' folder available by downloading the [[Main/MATLAB|APM MATLAB toolbox]].

----

(:html:)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/1999/REC-html401-19991224/strict.dtd">
<html>
<head>
<META http-equiv=Content-Type content="text/html; charset=UTF-8">
<title>Exported from Notepad++</title>
<style type="text/css">
span {
font-family: 'Courier New';
font-size: 10pt;
color: #000000;
}
.sc0 {
}
.sc1 {
color: #008000;
}
.sc4 {
font-weight: bold;
color: #0000FF;
}
.sc5 {
color: #808080;
}
.sc6 {
font-weight: bold;
color: #000080;
}
.sc7 {
}
</style>
</head>
<body>
<div style="float: left; white-space: pre; line-height: 1; background: #FFFFFF; "><span class="sc1">% APM Web-Interface Command</span><span class="sc0">
</span><span class="sc1">%</span><span class="sc0">
</span><span class="sc1">% response = apm(server,app,command)</span><span class="sc0">
</span><span class="sc1">%</span><span class="sc0">
</span><span class="sc1">% This function sends a command to the APM server with</span><span class="sc0">
</span><span class="sc1">%  the following arguments:</span><span class="sc0">
</span><span class="sc1">%</span><span class="sc0">
</span><span class="sc1">%  server = address of server</span><span class="sc0">
</span><span class="sc1">%      app = application name</span><span class="sc0">
</span><span class="sc1">%  command = instruction or line sent</span><span class="sc0">
</span><span class="sc1">% </span><span class="sc0">
</span><span class="sc1">% Some commands are:</span><span class="sc0">
</span><span class="sc1">%  solve    : solve the model on the server</span><span class="sc0">
</span><span class="sc1">%  clear all : clear the application and all files</span><span class="sc0">
</span><span class="sc1">%  clear apm : clear just the model file (apm)</span><span class="sc0">
</span><span class="sc1">%  clear csv : clear just the data file (csv)</span><span class="sc0">
</span><span class="sc1">%  info {FV,MV,SV,CV}, {name} : create interface to variable </span><span class="sc0">
</span><span class="sc1">%  ss.t0 {values} : load ss.t0 (restart file)</span><span class="sc0">
</span><span class="sc1">%  csva {contents} : add contents to the data file (csv)</span><span class="sc0">
</span><span class="sc1">%  csv {line} : add one line to the data file (csv)  </span><span class="sc0">
</span><span class="sc1">%  apm {contents} : add to apm file without carriage return</span><span class="sc0">
</span><span class="sc1">%  {otherwise} : add line to apm file</span><span class="sc0">
</span><span class="sc4">function</span><span class="sc0"> </span><span class="sc7">response</span><span class="sc0"> </span><span class="sc6">=</span><span class="sc0"> </span><span class="sc7">apm</span><span class="sc6">(</span><span class="sc7">server</span><span class="sc6">,</span><span class="sc7">app</span><span class="sc6">,</span><span class="sc7">aline</span><span class="sc6">)</span><span class="sc0">

    </span><span class="sc1">% Web-server URL base</span><span class="sc0">
    </span><span class="sc7">url_base</span><span class="sc0"> </span><span class="sc6">=</span><span class="sc0"> </span><span class="sc6">[</span><span class="sc7">deblank</span><span class="sc6">(</span><span class="sc7">server</span><span class="sc6">)</span><span class="sc0"> </span><span class="sc5">'/online/apm_line.php'</span><span class="sc6">];</span><span class="sc0">

    </span><span class="sc1">% Send request to web-server</span><span class="sc0">
    </span><span class="sc7">params</span><span class="sc0"> </span><span class="sc6">=</span><span class="sc0"> </span><span class="sc6">{</span><span class="sc5">'p'</span><span class="sc6">,</span><span class="sc7">app</span><span class="sc6">,</span><span class="sc5">'a'</span><span class="sc6">,</span><span class="sc7">aline</span><span class="sc6">};</span><span class="sc0">
    </span><span class="sc7">response</span><span class="sc0"> </span><span class="sc6">=</span><span class="sc0"> </span><span class="sc7">urlread</span><span class="sc6">(</span><span class="sc7">url_base</span><span class="sc6">,</span><span class="sc5">'get'</span><span class="sc6">,</span><span class="sc7">params</span><span class="sc6">);</span><span class="sc0">

    </span><span class="sc1">% remove newline characters from response</span><span class="sc0">
    </span><span class="sc7">newline</span><span class="sc0"> </span><span class="sc6">=</span><span class="sc0"> </span><span class="sc7">sprintf</span><span class="sc6">(</span><span class="sc5">'\r'</span><span class="sc6">);</span><span class="sc0">
    </span><span class="sc7">response</span><span class="sc0"> </span><span class="sc6">=</span><span class="sc0"> </span><span class="sc7">strrep</span><span class="sc6">(</span><span class="sc7">response</span><span class="sc6">,</span><span class="sc7">newline</span><span class="sc6">,</span><span class="sc5">''</span><span class="sc6">);</span><span class="sc0">
</span></div></body>
</html>
(:htmlend:)

----