Steam Engine


Really interesting structure, that fits the definition "made of faeces and sticks"
Unfortunately the fabricator don't have money for new pressure gauge, so he should be careful in his experiments.

Getting Started with Scilab

1. Install and run Scilab (it is available in Ubuntu Software Center)
2. Type scinotes or  go to Applications-->SciNotes

//scalar variables
a=1+1
//expression
b=3+a^2

//Output
// show string variable in messagebox

sometext='variable b='+string(b)
messagebox(sometext)

//get current directory
path1=pwd()

//change current directory
//to where current file is saved
//at first save it as 'test'

pathname = get_absolute_file_path('test.sce')
chdir(pathname)

//get current directory again
path2=pwd()


//print sometext as output
print('out.txt',sometext)


//argument of a function
x=[-5:0.1:3]

//now the function
function y=f(x)
    if x>=0 then
        y=x^2
    else
        y=-x
    end
endfunction
//plot it
plot(x,f)


//Let's try arrays
c=[1,1;-2,3]
d=[5;2]

//solve linear system c x = d
//variant1, via Matrix Inverse

c1=c^(-1)
x1=c1*d

//variant2, very simple
x2=
c\d

//let's get and show 1-st element of array x2
messagebox(string(x2(1)))

//let's get 2nd column of array 'c'
cc=c(:,2)














https://youtu.be/N2gRYx5r5Xg


The example below shows to to build simple electrical circuit with xcos (scicos)

 https://youtu.be/d2FLcBLUub4













Next simple example shows simple hydraulic circuit





Arduino + Small DC motor

This little engine has the ability to buzz.
You can manage the level with command like

analogWrite(motorPin, speed);

where speed is 0 to 255 means level.

I am using details from Starter Kit
Mosfet transistors [IRF520], (to manage voltage for motor)
1N4007 diod (for protection)
TFK-280SA-22125 MOTOR (6V DC)

See the circuit below (click to enlarge)































//Arduino code (google examples for more details)

const int motorPin =  9; // the number of the motor pin

int switchState = 0;  // variable for reading the switch's status

void setup() {
  // initialize the motor pin as an output:
  pinMode(motorPin, OUTPUT);
  Serial.begin(9600);
  while (! Serial);
  Serial.println("Speed 0 to 255");
}


void loop()
{
  if (Serial.available())
  {
    int speed = Serial.parseInt();
    if (speed >= 0 && speed <= 255)
    {
      analogWrite(motorPin, speed);
    }
  }
}



Connect arduino usb to computer, open terminal emulator (ubuntu) and allow this device to run:
sudo chmod a+rw /dev/ttyACM0

Upload the sketch (see the code above) and open Tools>Serial Monitor
Type any value from 0 to 255 into command line














At 255 it is running at full speed and buzzes very fine. 100 is slower. 50 is very slow. At 30 it stuck.

Unfortunately I don't have propeller now, and can't make this test more interesting. You may google for lessons, where it is combined with temperature sensor for PID control.
 https://youtu.be/CP_ZifhiC-U









Scilab - ODE Second order (mass on spring with damping and external force)

debug

// diff equation
// m*y'' = m*g-c*y-r*y'+u(t)

m=1
g=9.81
r=1
c=15

Tm=6
y0=-4
v0=0

function ft=u(t)
    ft=500*sin(t*5*2*%pi)
endfunction

function wf=w(t)
    wf=Wm*sin(t*fw*2*%pi)
endfunction

function dz=f(t,y)
    dz=[y(2),g-c*y(1)/m-r*y(2)/m+u(t)/m]
endfunction


z0=[y0;v0];t0=0;t=0:Tm/1000:Tm;
y=ode(z0,t0,t,f)

y1=y(1,:)
plot(t,y1)



Arduino UNO + TMP36 temperature sensor + Scilab

1. Create circuit with TMP36 sensor (google for examples)
 



2. Connect arduino to computer via USB port (it is for data exchange and power). In Ubuntu 14 you should allow this device. Open terminal and run

sudo chmod a+rw /dev/ttyACM0

note 'ttyACM0' is optional. You may need to change this line.
In arduino software check for:  Tools>Port

3. Install and run arduino software. Create new sketch (google for details):


int outputpin= 0;

void setup()
{
Serial.begin(9600);
}

//main loop
void loop()
{
int rawvoltage= analogRead(outputpin);

float volts= (rawvoltage/1024.0) * 5;
float celsius= (volts-0.5)*100;
Serial.println(celsius);

delay(1000);

}


Go to Sketch > Upload.
Go Tools > Serial Monitor to see output (Temperature, degrees C, each 1 sec)















4. SciLab  > Applications > Module Manager - ATOMS > Real Time > Serial Communication Toolbox for Scilab

Install it and re-run scilab

5. Type Scinotes or go to Applications > SciNotes

Create code like (read help for details and commands):

n=300 // plot 300 data points from serial port "/dev/ttyACM0"
h=openserial("/dev/ttyACM0","9600,n,8,1")
i=1;
while i<=n
data(i) = strtod(readserial(h)); // char to number
plot(i,data(i),'b-o'); // real time plot
drawnow(); // show data
i=i+1;
end


And run it (arduino monitor should be closed).
You will see output in real time. Scilab is getting string output (temperature) and transfer it to the numbers.














SciLab/Xcos also has special tool for Arduino. You may google videos on youtube for that.

https://youtu.be/HZ88d_n7Q5M



SciLab ODE second order

Example #1
Cantilever beam under the concentrated moment


code
_______________________________________

debug
M=1
EJ=50
L=49.9
function dz=f(x,y)
dz=[y(2),(M/EJ)*(1+(y(2))^2)^1.5]
endfunction

z0=[0;0];x0=0;x=0:L/100:L;
y=ode(z0,x0,x,f)

plot(x,y)

_______________________________________

result is 1/4 of circle (curve of constant curvature - blue)
'y' is the vector in the code above, it is why we have 2 curves (solution and derivative)

Dealing With CalculiX. Main principles.



What is CalculiX?

CalculiX is two programs

CCX - solver

CGX - Pre-PostProcessor

CCX looks like as one binary file (in Windows it is ccx.exe). If you will try to run it as usual (by double-click) nothing will  happen. CCX is console application with text file interface. At first you should create text file (File.INP) with mesh, named groups and input (boundary conditions) applied.
After that you can run solver from terminal emulator "ccx file". CCX will read text file and make calculation. The result will be many text files stored at the same folder. For example .FRD file will contain all results (as you will order in File.INP)

What is CGX? CGX is pre-postprcessor. What you can do with CGX?
You can run input file for preprocessing (to see and check groups of nodes, element faces and elements).
You can apply some boundary conditions (for example pressure or film coefficient for convection) with using "send" card in CGX.

When calculation is finished, you can run .FRD file for the postprocessing (to check stress, displacements and etc).

Salome-Platform And Salome-MECA

What is Salome? It is powerful open-source CAD/Mesher, developed by EDF (Electricity of France). There is a simple reason why it is open, because there are no reasons to make it proprietary. The goal of development is to design and build industrial things, which is much more expensive and important than possible income that can be obtained from proprietary software. Also the normal proportion for salespersons/developers in software industry is 9 to 1 (not any software, even perfect can be sold easily). You can take part in usage and testing and submit your issues to developer. Salome is mainly for Linux but there is experimental Windows version.

What is Salome-MECA? It is Salome-Platfrom + Code_Aster FEA package. Salome-MECA is for Linux only. There is a special Linux distribution (64 bit), called Caelinux  that combines Salome-MECA and other open-source software for engineers. You may get .ISO file from official website, from SF.NET or using this link: https://yadi.sk/d/nfKAyCsdmWME7   (md5sum fa8f1d551f0ad9ccfdb295367fc9e9cf  for caelinux2013.zip)

See all files at this shared folder: https://yadi.sk/d/Uwq053wjmWMKk

Installation:

1) Salome For Windows: download archive (from here or from official website)
Unzip it onto C:\   and double-click salome_run.bat file.
Link for old 32-bit version.

2) Salome-MECA For Linux 64 bit.
Download it from here:
http://www.code-aster.org/V2/spip.php?article303
(sometimes this link doesn't work)

Or use link below:
Salome-MECA 2015-2 (64bit) https://yadi.sk/d/XJg2pWAbkag2h
md5sum A78EAE0B1937F06CED8E7F570B05F94B

also you may get older versions (2013-2014)  
Salome-MECA 2013-1 64 bit Linux:   https://yadi.sk/d/bWAa9Ft2mZS7J

The reason why older versions can be required is that many Code_Aster  books and examples has been created for older version of Code_Aster (v10). Some commands can be changed and the old sample will require some changes in the newer versions.

Installation of Salome-MECA under Linux is very simple (because it is generally portable software). Untar archive into any folder, and ./...run it from terminal.
The process is shown in this video: https://youtu.be/sOwKyyN7Cv0

3) Caelinux Distribution. 
Under windows you can try VirtualBox or programs like that. Google for "how to install 64 bit under virtualbox" if you're going to use 64 bit. Some extra actions can be required. In this case Linux will work as normal windows program at separate window.
If you want to install it as normal fully functional OS, google for "install linux from ISO". If you have separate flash stick, use UNetBootin from SF.NET (or similar programs) to make and run it in live mode (without installation). Also you can install linux onto usb flash drive or SSD and use it from there.

How to get started?
Salome has perfect help system in English. There are video lessons at this channel https://www.youtube.com/user/calculix09
(the series of about 40 lessons from simple examples to complex models will give you good understanding of how it works).

Lesson 1 - Basic Of Salome. Extrusion: https://youtu.be/OEmWAjE_gmY
Lesson 2 - Boss and Cut Extrusion: https://youtu.be/KV13aabdLck
(bodies will be merged when you use this option)
...
Lesson 5 - Extrusion Along Path: https://youtu.be/Akppa6PwDdY
Lesson 6 - Body Of Revolution: https://youtu.be/CxpwX07m96E
Lesson 7 - Boolean Cut: https://youtu.be/LnzA0hR_JlA
...
Lesson 11 - Thicken Of Shell: https://youtu.be/NO39yV6cEVM
...
Lesson 21 - Basic Of Python Scripting: https://youtu.be/bQVxKBf37Xo
...
Lesson 29 - Code_Aster + Eficas: https://youtu.be/XNWv7N-tZzY
...
Lesson 34 - Hexahedron(i,j,k): https://youtu.be/hqjpZ4w0CUs
Lesson 35. Hexadralization With Submesh Input.  https://youtu.be/twwsa5nt16s
...
Lesson 37 - Mixed mesh (Submesh):  https://youtu.be/btGVTKxFT9I
Lesson 38 - Radial mesh: https://youtu.be/5vezL1SvChM

Many other lessons for Salome can be found on this channel.

What you can do with Salome in general? You can build any geometry (bodies and shells) and export it into STEP/IGES standard formats. Salome is little bit less efficient in terms of productivity than Solidworks or other feature-based software but you can do the same things just slower.
What else you can do with Salome? You can prepare mesh with named groups (to apply boundary conditions) and export it into many mesh formats (like .UNV, .MED, etc) or you can use Code-Aster to make calculation inside Salome-MECA.

Open meshers are less productive than commercial ones, but it do the same thing (just little bit more sensitive to your skills and experience).

There are many programs and services (like SimScale) use opensource libraries and can be used along with Salome.