Skip to content

Instantly share code, notes, and snippets.

@thorade
thorade / QIdent.mo
Created August 10, 2016 11:20
Modelica example model that uses QIdent variable names
within ;
model QIdent
model mySubModel
parameter Integer myIn = 5;
parameter Integer '\'' = 1;
parameter Integer '\"' = 2;
parameter Integer '\?' = 3;
parameter Integer '\\' = 4;
parameter Integer '\a' = 5;
@thorade
thorade / .bibtoolrsc
Created May 23, 2016 07:09
Resource file for bibtool. Just place it in the same directory as the references.bib file.
# define input and output files
input references.bib
output.file references.bib
# load additional resource files
resource braces
# pretty printing options in alphabetical order
key.format = short
preserve.keys=on
@thorade
thorade / csvRenderTest.csv
Last active July 28, 2017 11:51
a csv file that does or does not render nicely
idealPower1 sref idealPower2 href
-6.5 1070.87088109004 5.5 222086.733729488
-6 976.4088521783 5 193358.166908212
-7 1165.33291000178 6 250815.300550764
-6.12487106244427 1000 5.11559631799783 200000
@thorade
thorade / StackoverflowArray.mo
Last active November 18, 2015 16:21
Access array elements from string argument in Modelica
package StackoverflowArray
record Dictionary "key value pair"
parameter String name "Unique name key";
parameter Real[:] c "coefficients";
end Dictionary;
function getIdx
input String key="B";
input Dictionary[2] dict={Dictionary(name="A", c={1,2,3}), Dictionary(name="B", c={4,5,6,7})};
output Integer idx;
@thorade
thorade / SurfaceToAir.mo
Last active October 21, 2015 13:48
testing syntax highlighting
within ;
model SurfaceToAir "cool model"
Modelica.Electrical.Analog.Basic.Resistor inRes[3,3];
Modelica.Electrical.Analog.Basic.Resistor outRes[3,3];
equation
for j in 1:3 loop
for k in 1:3 loop
if inRes[j,k].R > 0 then
outRes[j,k].R = Modelica.Math.cos(inRes[j,k].R - inRes[k,j].R);
@thorade
thorade / gFooBar.mo
Created October 15, 2015 18:54
for testing Modelica syntax
within ;
record gTest
parameter Real foo;
parameter Real gfoo;
parameter Real bar;
parameter Integer gbar;
end gTest;
@thorade
thorade / Mini_Thermal.mo
Last active October 15, 2015 12:09
for testing Modelica syntax highlight
within Modelica.Thermal;
package HeatTransfer
"Library of 1-dimensional heat transfer with lumped elements"
annotation (version="1.1", versionDate="2005-06-13",
preferedView="info", Icon(
Polygon(points=[-54, -6; -61, -7; -75, -15; -79, -24; -80, -34; -78, -42;
-73, -49; -64, -51; -57, -51; -47, -50; -41, -43; -38, -35; -40,
-27; -40, -20; -42, -13; -47, -7; -54, -5; -54, -6], style(color=10,
fillColor=8)),
@thorade
thorade / Rotational_Mini.mo
Last active October 14, 2015 10:38
for testing Modelica Atom grammar
within Modelica.Mechanics;
package Rotational "Library to for rotational systems"
extends Modelica.Icons.Package;
class FlangeConnectors "Flange Connectors"
extends Modelica.Icons.Information;
annotation (DocumentationClass=true, Documentation(info="<html>
<p>
A flange is described by the connector class Interfaces.
</p>
@thorade
thorade / ENCO_testing.mo
Last active August 29, 2015 14:21
code for investigating Dymola encoding problems
within ;
model ENCO_testing "code for investigating Dymola encoding problems"
Real TempC "Temperature in °C";
parameter Real someNumber "description string german üöäß";
Integer greekInt=4 "description string greek αβδεηζμθ";
// a comment with math symbols: °²³~µ
equation
TempC = if greekInt > 3 then someNumber*5 else someNumber/3;
end ENCO_testing;
@thorade
thorade / trigger_type.mo
Created April 14, 2015 14:09
a Modelica enumeration
type trigger_type=enumeration(
event_trig "Event",
cyclic_trig "Cyclic",
cyclic_event_trig "Cyclic + Event",
initial_trig "At Start only",
terminal_trig "At Stop only") "Use as trigger";