## 1169 Reputation

11 years, 206 days

My role is to help customers better exploit our tools. I’ve worked in selling, supporting and marketing maths and simulation software for all my professional career.

I’m fascinated by the full breadth and range of application of Maple. From financial mathematics and engineering to probability and calculus, I’m always impressed by what our users do with our tools.

However much I strenuously deny it, I’m a geek at heart. My first encounter with Maple was as an undergraduate when I used it to symbolically solve the differential equations that described the heat transfer in a series of stirred tanks. My colleagues brute-forced the problem with a numerical solution in Fortran (but they got the marks because that was the point of the course). I’ve since dramatized the process in a worksheet, and never fail to bore people with the story behind it.

I was born, raised and spent my formative years in England’s second city, Birmingham. I graduated with a degree in Chemical Engineering from The University of Nottingham, and after completing a PhD in Fluid Dynamics at Herriot-Watt University in Edinburgh, I started working for Adept Scientific – Maplesoft’s partner in the UK.

## The Tire Library only models motion on f...

The Tire Library only models motion on flat surfaces.

Samir

## Check out this post and this application...

Check out this post and this application for some modeling tips. On an initial reading, your system appears tractable.

Break down the problem into two parts.  Consider each section (for insulation 1 and insulation 2) separately. For each section you need three PDEs (one each for the temperature profile of the liquid in the pipe, the steel pipe wall, and the insulation).

Consider a section dx, and perform a heat balance for the liquid in the pipe, the tube wall and the insulation.

For the liquid in the pipe you'll have terms for the accumulation of heat, heat supplied by liquid flowing in and heat supplied by liquid flowing out, and heat transfer to the tube wall.

For the steel tube wall, you'll have terms for the accumulation of heat, heat flowing into and out of adjacent tube wall sections (Fourier Law), heat transfered from the tube-side liquid and heat exiting to the insulation.

For the insulation, you'll have terms for the accumulation of heat, heat flowing into and out of adjacent insulation sections (Fourier Law), heat entering from the steel wall, and heat exiting to the cold water

Samir

## Examine the non-linear spring-mass-dampe...

Examine the non-linear spring-mass-damper model that ships with MapleSim.  It demonstrates how you can vary spring and damping constants during a simulation.

Samir

## As far as I understand, variable time de...

As far as I understand, variable time delay (in a manner meaningful for dynamic simulation) requires support for delay differential equations. This is scheduled for a future version of MapleSim

Samir

## If you simpy want to drive the MapleSim ...

If you simpy want to drive the MapleSim model from the data generated by the hardware equipment, then

• Save the data from your hardware system into a text file,
• and then reference the data in an interpolation component (Signal Blocks > Interpolation Tables)

Samir

## I've used the Sockets package to send em...

I've succesfully used the Sockets package to send emails from a Maple worksheet.  You'll need a locally installed SMTP server (I've used QK SMTP Server and Free SMTP Server but other tools are available)

Once you have an SMTP server running and accepting messages from localhost on port 25, execute the following code in a Maple worksheet (changing the references to my email address and message body, of course)

with(Sockets):
sid:=Open("localhost",25 ):
Write(sid,"HELO localhost\n"):
Write(sid,"MAIL FROM:<myemail@maplesoft.com>\n"):
Write(sid,"RCPT TO:<toemail@maplesoft.com>\n"):
Write(sid,"DATA\n"):
Write(sid,"From: ""Samir Khan"" <myemail@maplesoft.com>\nTo: ""Samir Khan"" <toemail@maplesoft.com>\nSubject: Email From Maple\n\nThis is the body of the email. I'm sending an email from Maple!\n\n.\n"):
Write(sid,"QUIT\n"):

This works perfectly when I try this from the Maplesoft office with an email succesfully received (after making the appropriate changes to myemail and toemail), but not with my home ISP. I'm not an expert in these matters so I can't tell you why.

Samir

## The behaviour of the Code Edit region is...

The behaviour of the Code Edit region is by design.  ?CodeEditRegion explains that when the region is collapsed,

...all but the first line of the procedure will be suppressed. The first line of the procedure displays to the right of the icon. A comment may be included before the procedure to display a descriptive heading instead of the first line of the procedure. To suppress the full procedure, insert a pound character (#) on its own line before the procedure

Samir

## @arctica  Here's quick and dirty tr...

Here's a quick and dirty translation of 5.2.pdf to Maple.

I haven't done any detailed checking or used units - this was just a first pass conversion

## The heat loss Q would be...

The heat loss Q would be proportional to delta T.  It wouldn't be constant.

The box will lose heat by conduction to the outside world

A better model may be to connect the following blocks together.

Fixed Temperature - Thermal Conductor - Heat Capacitor

Samir

## Assuming that the data from...

1) Assuming that the data from the procedure is assinged to str, then the following hacky code lifted from the Stock Import worksheet works (which was incidently written at 3am in the morning during a thunderstorm - hence the hackiness)

strLength := StringTools[Length](str):
str2 := StringTools[SubString](str, start .. strLength):
newlines := StringTools[SearchAll]("\n", str2):
days := nops([newlines]):
commas := StringTools[SearchAll](",", str2):
pos := sort([1, commas, newlines, StringTools[Length](str2)]):
data := Matrix(days, 7):
k := 1:
for i to days do
for j to 7 do
if k < nops(pos) then
str3 := StringTools[SubString](str2, pos[k] .. pos[k+1]):
strAscii := convert(str3, bytes):
strAscii := remove(has, strAscii, 10):
strAscii := remove(has, strAscii, 44):
strAscii := remove(has, strAscii, 13):
strAscii := remove(has, strAscii, 34):
strClean := convert(strAscii, bytes):
if j <> 1 then
data[i, j] := parse(strClean)
else
data[i, j] := strClean
end if;
k := k+1
end if
end do
end do:
data;

Samir

## Ivar, One way of doing this...

Ivar,

One way of doing this is in a Maple document attached to a MapleSim model.

* Let say that you have a MapleSim model that returns 4 plots

* Attach say the Equations template to the MapleSim model

*Scroll to the bottom and execute the following commands

> theModel := GetProperty(Simulation0, system);

the following command returns an array; the first column is time, and the remaing columns are all probe values.
> data := RunSimulation(theModel, output = datapoint, returnTimeData);

Hence to plot the first probe value against time for the whole range (assuming 200 points in total)
> plotdata := [seq([data[i, 1], data[i, 2]], i = 1 .. 200)];
> pointplot(plotdata);

To plot all the probes over a specific time range
> plotdata := seq(pointplot([seq([data[i, 1], data[i, j]], i = 150 .. 175)], connect = true), j = 2 .. 5);
> display(Array([plotdata]));

Please see the attached MapleSim model for a worked example, and let us know if you have any questions.

## method=branchandbound...

Add method=branchandbound to the GlobalSolve command, i.e.