Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 / 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 / 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 / .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 / 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 / CheckBlackBodySkyTemperature.json
Created March 1, 2017 14:09
how does github render json files?
{
"last-generated":"2016-01-05",
"statistics-simulation":
{
"numerical Jacobians": "0",
"nonlinear": " ",
"linear": " "
},
"cheSkyBlaBodTem.TOut":[203.160003662109375, 204.55979922562482897774, 205.95959478914028295549, 207.35940561143956983869, 208.759201174953403779, 210.15899647774065783778, 211.55880756076996362935, 212.95860286355485868626, 214.35839868781062023118, 215.7581934691326068787, 217.15800455215000397402, 218.55780037640107593688, 219.95759620066124284676, 221.35740728366954499506, 222.75720206500062658961, 224.15699684634077470946, 225.55679371351186546235, 226.95660375359562976882, 228.35639853494487283569, 229.75619540210686864157, 231.15600544219063294804, 232.55580230935717622742, 233.95559709070187182078, 235.35539187202840594182, 236.75520399796124593195, 238.154998779296875, 239.55479564651344048798, 240.95460360067531269124, 242.35440046789187817922, 243.7541973351084436672, 245.15400528927031587045, 246.55380215648688135843, 247.95359902370344684641, 249.35339171917630096686,
{
"last-generated":"2017-02-18",
"statistics-simulation":
{
"numerical Jacobians": "0",
"nonlinear": "1",
"linear": " "
},
"TBlaSkyIrr.TBlaSky":[249.006866455078125, 248.7608642578125, 248.6545867919921875, 248.7099761962890625, 248.948028564453125, 249.4293365478515625, 250.1275634765625, 250.8524322509765625, 251.4170379638671875, 251.731109619140625, 251.988922119140625, 252.1937408447265625, 252.3288421630859375, 252.379974365234375, 252.3680572509765625, 252.337371826171875, 252.332275390625, 252.39727783203125, 252.546112060546875, 252.7234039306640625, 252.865631103515625, 252.911865234375, 252.911865234375, 252.911865234375, 252.911865234375, 252.911865234375, 252.911865234375, 252.911865234375, 252.911865234375, 252.911865234375, 252.7743988037109375, 252.317779541015625, 251.66259765625, 250.9373626708984375, 250.0076904296875, 248.39581298828125, 246.731658935546875, 245.77337646484375, 246.053466796875, 246.5491943359375, 247.04193115234375, 247.5317535400390625, 248.0186767578125, 248.502