Skip to content

Instantly share code, notes, and snippets.

model SimpleCarModel
extends Modelica.Icons.Example;
inner Modelica.Mechanics.MultiBody.World world(animateGravity = false) annotation(Placement(transformation(extent = {{-40, 40}, {-20, 60}}, rotation = 0, origin = {-40, -70}), visible = true));
Modelica.Mechanics.MultiBody.Joints.Prismatic prismatic(animation = false) annotation(Placement(visible = true, transformation(origin = {-20, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Mechanics.MultiBody.Forces.WorldForce force(animation = false) annotation(Placement(visible = true, transformation(origin = {-30, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Constant const annotation(Placement(visible = true, transformation(origin = {-70, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Constant const1 annotation(Placement(visible = true, transformation(origin = {-70, 10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Ramp ramp(duration = 2,
@Foadsf
Foadsf / FreeCAD_macro_test1_20170412.py
Created April 13, 2017 13:40
the FreeCAD python macro/script creates 3 boxes and then fuses two
test1 = App.newDocument("Test1")
cylinder=test1.addObject("Part::Box","Cylinder")
cylinder.Height = '20 mm'
cylinder.Width = '5 mm'
cylinder.Length = '40 mm'
myvec = App.Vector(5,0,5)
myvec_2 = App.Vector(0,0,0)
@Foadsf
Foadsf / FreeCAD_macro_test2_20170412.py
Created April 13, 2017 13:44
this FreeCAD puthon script/macro creates 3 boxes, fuses two of them together, and then try to cut the fusion out of the bigger box (but it fails)
print("flag 1")
test1 = App.newDocument("Test1")
cylinder=test1.addObject("Part::Box","Cylinder")
cylinder.Height = '20 mm'
cylinder.Width = '5 mm'
cylinder.Length = '40 mm'
test1 = App.newDocument("Test1")
cylinder=test1.addObject("Part::Box","Cylinder")
cylinder.Height = '20 mm'
cylinder.Width = '5 mm'
cylinder.Length = '40 mm'
myvec = App.Vector(5,0,5)
myvec_2 = App.Vector(0,0,0)
@Foadsf
Foadsf / code.c
Created May 24, 2017 22:21
Blinking LED using PIC Microcontroller following this youtube tutorial: https://www.youtube.com/watch?v=FBQSKTVNg4I
#include <16f877.h>
#fuses HS,NOWDT,NOLVP,NOPROTECT
#USE delay (clock=20M)
void main(){
while(1){
output_high(PIN_B0);
delay_ms(1000);
@Foadsf
Foadsf / multibody_Coulomb_static_friction.mo
Last active August 9, 2017 20:51
modeling multi-body Coulomb static friction in Modelica language
model multibody_Coulomb_static_friction
//constants
parameter Real muk=1.0;
parameter Real mus=1.3;
parameter Real m1=1.0;
parameter Real m2=2.0;
parameter Real m3=3.0;
parameter Real Fn12=1.0;
parameter Real Fn23=2.0;
@Foadsf
Foadsf / thermophysicalProperties
Created January 31, 2018 02:16
OpenFOAM, thermophysicalProperties, sonicFoam, butane
// OpenFOAM, thermophysicalProperties, sonicFoam, butane --> OP: https://www.researchgate.net/post/Do_you_know_what_are_the_best_thermophysical_settings_for_sonicFoam_solver_to_simulate_a_process_with_butane_gas
FoamFile
{
version 2.0;
format ascii;
class dictionary;
location "constant";
object thermophysicalProperties;
}
@Foadsf
Foadsf / step.m
Last active February 21, 2018 17:32
Solving Navier-Stokes equations for a steady-state compressible viscous flow in a 2D axisymmetric step
lc = 0.03;
rc = 0.01;
xp = 0.01;
c = 0.005;
rp = rc - c;
lp = lc - xp;
T0 = 300;
eta0 = 1.846*10^-5;
P1 = 6*10^5 ;
P0 = 10^5;
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Foadsf
Foadsf / data.csv
Last active May 6, 2018 14:11
custom functionfit in libreoffice calc
x y
10 0.197084039
30 0.182641149
50 0.179242834
100 0.203031108
150 0.180092409
200 0.163100779
300 0.163100779
400 0.169897437
600 0.169897437