// Some code samples // to check if the applied style is correct within foo.bar; // Let's check some class with a quoted identifier final encapsulated partial operator record 'Quoted record "whatever"' "Quoted record" /* Few imports */ import Foo.Bar "Foo import" annotation(ignore = false); import Baz = Foo.Baz; import Bar.*; import Bark.{Foo,Bar, Baz}; import Ark.{ Bar, Baz}; // Some extension extends .Bark.Bark() annotation(); // Now some other class specifiers! inner outer record Inner=der(.Foo.Baz, Foo,bar) "Der?"; redeclare final inner package Foo = input Foo.Bar[1,2](x=2+3) "Foo"; protected // Now protected section flow constant Foo.Baz Bar=2, Baar; parameter Real Foo(start=2, fixed=false), Bar if false; annotation(Icon()); end 'Quoted record "whatever"'; // Now some model! final partial model FooModel "Foo model" extends .Bark.Bark(break connect(a.b ,c),break Baz, anotherUselessVar = break); // Some conditional expressions parameter Real[1] foo = if bar then 2 elseif baz then 3 else 4; Integer[1, 3, 4] bar =if true then 1 elseif baz<2 then 3 else 2; Real smallest=(Modelica.Math.Vectors.sort({4,2,5,1}))[1]; protected // Here we have two comments /* And they are separated with a single blank line */ String A = toString([2.12,-4.34;-2.56, - 1.67] ); SI.Length[3] 'length of "whatever"'(start = 0, min = -1, max = 1, nominal=0) = { 1* 0.25 for i in 1 : 3}; public redeclare Foo x(y=z) = Bar annotation (Placement( transformation( extent={{-20,-10},{20,10}},rotation=90, origin={-98,4}), iconTransformation(extent={{-40,-10},{40,10}}, rotation=90, origin={-68,0}))); initial equation if foo == Types.Dynamics.FixedInitial then bar = bar_start; elseif foo == Types.Dynamics.SteadyStateInitial then der(bar) = 0; end if; equation a = -b*c "Equation"; x* ( -y) =2^z / (m- n); foo =if bar then 0 else 3; foo = bar(x,y=y,z=baz( a, b)); /* If-else blocks */ if foo then // comment bar = baz * bar; else bar = 0;// another end if; if a 0 and u2 > 0 and u3 > 0 and u4 > 0; y := u1 > 0 or u2 > 0 or u3 > 0 or u4 > 0; Modelica.Utilities.Streams.print( "foo" + "bar" + "baz"); end Bar; // And some enums type Foo=enumeration(Foo1, foo2) "foo enum"; type Foo=enumeration(Foo1, foo2) "foo enum"; type Foo=enumeration(Foo1 "foo1", foo2) "foo enum with description of one element";