/
simres.html
903 lines (834 loc) · 62.8 KB
/
simres.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>modelicares.simres — ModelicaRes v0.8.0 Documentation</title>
<link rel="stylesheet" href="_static/sphinxdoc.css" type="text/css" />
<link rel="stylesheet" href="_static/pygments.css" type="text/css" />
<script type="text/javascript">
var DOCUMENTATION_OPTIONS = {
URL_ROOT: '',
VERSION: '0.8.0',
COLLAPSE_INDEX: false,
FILE_SUFFIX: '.html',
HAS_SOURCE: true
};
</script>
<script type="text/javascript" src="_static/jquery.js"></script>
<script type="text/javascript" src="_static/underscore.js"></script>
<script type="text/javascript" src="_static/doctools.js"></script>
<script type="text/javascript" src="_static/copybutton.js"></script>
<link rel="search" type="application/opensearchdescription+xml"
title="Search within ModelicaRes v0.8.0 Documentation"
href="_static/opensearch.xml"/>
<link rel="shortcut icon" href="_static/favicon.ico"/>
<link rel="top" title="ModelicaRes v0.8.0 Documentation" href="index.html" />
<link rel="next" title="modelicares.linres" href="linres.html" />
<link rel="prev" title="modelicares" href="modelicares.html" />
<meta name="description" content="Python module to set up, plot, and analyze Modelica simulations">
<meta name="keywords" content="Modelica, Python, plot, results, simulation, experiment">
</head>
<body>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
accesskey="I">index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="linres.html" title="modelicares.linres"
accesskey="N">next</a> |</li>
<li class="right" >
<a href="modelicares.html" title="modelicares"
accesskey="P">previous</a> |</li>
<li><a href="index.html">ModelicaRes v0.8.0 Documentation</a> »</li>
</ul>
</div>
<div class="sphinxsidebar">
<div class="sphinxsidebarwrapper">
<p class="logo"><a href="index.html">
<img class="logo" src="_static/logo.gif" alt="Logo"/>
</a></p>
<h3><a href="index.html">Table Of Contents</a></h3>
<ul class="current">
<li class="toctree-l1"><a class="reference internal" href="loadres.html"><tt class="docutils literal"><span class="pre">loadres</span></tt></a></li>
<li class="toctree-l1"><a class="reference internal" href="modelicares.html"><tt class="docutils literal"><span class="pre">modelicares</span></tt></a></li>
<li class="toctree-l1 current"><a class="current reference internal" href=""><tt class="docutils literal"><span class="pre">modelicares.simres</span></tt></a></li>
<li class="toctree-l1"><a class="reference internal" href="linres.html"><tt class="docutils literal"><span class="pre">modelicares.linres</span></tt></a></li>
<li class="toctree-l1"><a class="reference internal" href="multi.html"><tt class="docutils literal"><span class="pre">modelicares.multi</span></tt></a></li>
<li class="toctree-l1"><a class="reference internal" href="exps.html"><tt class="docutils literal"><span class="pre">modelicares.exps</span></tt></a></li>
<li class="toctree-l1"><a class="reference internal" href="exps.doe.html"><tt class="docutils literal"><span class="pre">modelicares.exps.doe</span></tt></a></li>
<li class="toctree-l1"><a class="reference internal" href="texunit.html"><tt class="docutils literal"><span class="pre">modelicares.texunit</span></tt></a></li>
<li class="toctree-l1"><a class="reference internal" href="base.html"><tt class="docutils literal"><span class="pre">modelicares.base</span></tt></a></li>
</ul>
<div id="searchbox" style="display: none">
<h3>Quick search</h3>
<form class="search" action="search.html" method="get">
<input type="text" name="q" />
<input type="submit" value="Go" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
<p class="searchtip" style="font-size: 90%">
Enter search terms or a module, class or function name.
</p>
</div>
<script type="text/javascript">$('#searchbox').show(0);</script>
</div>
</div>
<div class="document">
<div class="documentwrapper">
<div class="bodywrapper">
<div class="body">
<div class="section" id="module-modelicares.simres">
<span id="modelicares-simres"></span><h1><a class="reference internal" href="#module-modelicares.simres" title="modelicares.simres"><tt class="xref py py-mod docutils literal"><span class="pre">modelicares.simres</span></tt></a><a class="headerlink" href="#module-modelicares.simres" title="Permalink to this headline">¶</a></h1>
<p>Load, analyze, and plot results from <a class="reference external" href="http://www.modelica.org/">Modelica</a> simulations.</p>
<dl class="class">
<dt id="modelicares.simres.Info">
<em class="property">class </em><tt class="descclassname">modelicares.simres.</tt><tt class="descname">Info</tt><a class="headerlink" href="#modelicares.simres.Info" title="Permalink to this definition">¶</a></dt>
<dd><p>Shortcuts to the “get” methods in <a class="reference internal" href="#modelicares.simres.SimRes" title="modelicares.simres.SimRes"><tt class="xref py py-class docutils literal"><span class="pre">SimRes</span></tt></a></p>
<dl class="method">
<dt id="modelicares.simres.Info.FV">
<tt class="descname">FV</tt><big>(</big><em>names</em>, <em>f=<function <lambda> at 0xabc7cdc></em><big>)</big><a class="headerlink" href="#modelicares.simres.Info.FV" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for <a class="reference internal" href="#modelicares.simres.SimRes.get_FV" title="modelicares.simres.SimRes.get_FV"><tt class="xref py py-meth docutils literal"><span class="pre">SimRes.get_FV()</span></tt></a></p>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.Info.IV">
<tt class="descname">IV</tt><big>(</big><em>names</em>, <em>f=<function <lambda> at 0xabc7c6c></em><big>)</big><a class="headerlink" href="#modelicares.simres.Info.IV" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for <a class="reference internal" href="#modelicares.simres.SimRes.get_IV" title="modelicares.simres.SimRes.get_IV"><tt class="xref py py-meth docutils literal"><span class="pre">SimRes.get_IV()</span></tt></a></p>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.Info.description">
<tt class="descname">description</tt><big>(</big><em>names</em><big>)</big><a class="headerlink" href="#modelicares.simres.Info.description" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for <a class="reference internal" href="#modelicares.simres.SimRes.get_description" title="modelicares.simres.SimRes.get_description"><tt class="xref py py-meth docutils literal"><span class="pre">SimRes.get_description()</span></tt></a></p>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.Info.displayUnit">
<tt class="descname">displayUnit</tt><big>(</big><em>names</em><big>)</big><a class="headerlink" href="#modelicares.simres.Info.displayUnit" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for <a class="reference internal" href="#modelicares.simres.SimRes.get_displayUnit" title="modelicares.simres.SimRes.get_displayUnit"><tt class="xref py py-meth docutils literal"><span class="pre">SimRes.get_displayUnit()</span></tt></a></p>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.Info.indices_wi_times">
<tt class="descname">indices_wi_times</tt><big>(</big><em>names</em>, <em>t_1=None</em>, <em>t_2=None</em><big>)</big><a class="headerlink" href="#modelicares.simres.Info.indices_wi_times" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for <a class="reference internal" href="#modelicares.simres.SimRes.get_indices_wi_times" title="modelicares.simres.SimRes.get_indices_wi_times"><tt class="xref py py-meth docutils literal"><span class="pre">SimRes.get_indices_wi_times()</span></tt></a></p>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.Info.times">
<tt class="descname">times</tt><big>(</big><em>names</em>, <em>i=slice(0</em>, <em>None</em>, <em>None)</em>, <em>f=<function <lambda> at 0xabc7d4c></em><big>)</big><a class="headerlink" href="#modelicares.simres.Info.times" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for <a class="reference internal" href="#modelicares.simres.SimRes.get_times" title="modelicares.simres.SimRes.get_times"><tt class="xref py py-meth docutils literal"><span class="pre">SimRes.get_times()</span></tt></a></p>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.Info.unit">
<tt class="descname">unit</tt><big>(</big><em>names</em><big>)</big><a class="headerlink" href="#modelicares.simres.Info.unit" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for <a class="reference internal" href="#modelicares.simres.SimRes.get_unit" title="modelicares.simres.SimRes.get_unit"><tt class="xref py py-meth docutils literal"><span class="pre">SimRes.get_unit()</span></tt></a></p>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.Info.values">
<tt class="descname">values</tt><big>(</big><em>names</em>, <em>i=slice(0</em>, <em>None</em>, <em>None)</em>, <em>f=<function <lambda> at 0xabc7df4></em><big>)</big><a class="headerlink" href="#modelicares.simres.Info.values" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for <a class="reference internal" href="#modelicares.simres.SimRes.get_values" title="modelicares.simres.SimRes.get_values"><tt class="xref py py-meth docutils literal"><span class="pre">SimRes.get_values()</span></tt></a></p>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.Info.values_at_times">
<tt class="descname">values_at_times</tt><big>(</big><em>names</em>, <em>times</em>, <em>f=<function <lambda> at 0xabc7e64></em><big>)</big><a class="headerlink" href="#modelicares.simres.Info.values_at_times" title="Permalink to this definition">¶</a></dt>
<dd><p>Alias for <a class="reference internal" href="#modelicares.simres.SimRes.get_description" title="modelicares.simres.SimRes.get_description"><tt class="xref py py-meth docutils literal"><span class="pre">SimRes.get_description()</span></tt></a></p>
</dd></dl>
</dd></dl>
<dl class="class">
<dt id="modelicares.simres.SimRes">
<em class="property">class </em><tt class="descclassname">modelicares.simres.</tt><tt class="descname">SimRes</tt><big>(</big><em>fname='dsres.mat'</em>, <em>constants_only=False</em><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes" title="Permalink to this definition">¶</a></dt>
<dd><p>Bases: <tt class="xref py py-class docutils literal"><span class="pre">object</span></tt></p>
<p>Base class for <a class="reference external" href="http://www.modelica.org/">Modelica</a>-based simulation results and methods to analyze
those results</p>
<p>On initialization, load <a class="reference external" href="http://www.modelica.org/">Modelica</a> simulation results from a
MATLAB<sup>®</sup> file in Dymola<sup>®</sup> format.</p>
<p><strong>Arguments:</strong></p>
<ul>
<li><p class="first"><em>fname</em>: Name of the file (may include the path)</p>
<blockquote>
<div><p>The file extension (‘.mat’) is optional.</p>
</div></blockquote>
</li>
<li><p class="first"><em>constants_only</em>: <em>True</em>, if only the variables from the first data
table should be loaded</p>
<blockquote>
<div><p>The first data table typically contains all of the constants,
parameters, and variables that don’t vary. If only that
information is needed, it will save some time and memory to set
<em>constants_only</em> to <em>True</em>.</p>
</div></blockquote>
</li>
</ul>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
</pre></div>
</div>
<dl class="method">
<dt id="modelicares.simres.SimRes.__call__">
<tt class="descname">__call__</tt><big>(</big><em>names</em>, <em>action=<function get_values at 0xabc7e2c></em>, <em>*args</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.__call__" title="Permalink to this definition">¶</a></dt>
<dd><p>Upon a call to an instance of <a class="reference internal" href="#modelicares.simres.SimRes" title="modelicares.simres.SimRes"><tt class="xref py py-class docutils literal"><span class="pre">SimRes</span></tt></a>, call a method on
variable(s) given their name(s)</p>
<p><strong>Arguments</strong>:</p>
<ul>
<li><p class="first"><em>names</em>: String or (possibly nested) list of strings of the variable
names</p>
</li>
<li><p class="first"><em>action</em>: Method for retrieving information about the variable(s)</p>
<blockquote>
<div><p>The default is <a class="reference internal" href="#modelicares.simres.SimRes.get_values" title="modelicares.simres.SimRes.get_values"><tt class="xref py py-meth docutils literal"><span class="pre">get_values()</span></tt></a>. <em>action</em> may be a list or
tuple, in which case the return value is a list or tuple.</p>
</div></blockquote>
</li>
<li><p class="first"><em>*args</em>, <em>**kwargs</em>: Additional arguments for <em>action</em></p>
</li>
</ul>
<p><strong>Examples:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares.simres</span> <span class="kn">import</span> <span class="n">SimRes</span><span class="p">,</span> <span class="n">Info</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="go"># Values of a single variable</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="p">(</span><span class="s">'L.v'</span><span class="p">)</span>
<span class="go">array([ 0.00000000e+00, ... -2.53528625e-01], dtype=float32)</span>
<span class="gp">>>> </span><span class="c"># This is equivalent to:</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">get_values</span><span class="p">(</span><span class="s">'L.v'</span><span class="p">)</span>
<span class="go">array([ 0.00000000e+00, ... -2.53528625e-01], dtype=float32)</span>
<span class="go"># Values of a list of variables</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="p">([</span><span class="s">'L.L'</span><span class="p">,</span> <span class="s">'C1.C'</span><span class="p">],</span> <span class="n">SimRes</span><span class="o">.</span><span class="n">get_description</span><span class="p">)</span>
<span class="go">['Inductance', 'Capacitance']</span>
<span class="gp">>>> </span><span class="c"># This is equivalent to:</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">get_description</span><span class="p">([</span><span class="s">'L.L'</span><span class="p">,</span> <span class="s">'C1.C'</span><span class="p">])</span>
<span class="go">['Inductance', 'Capacitance']</span>
<span class="go"># Other attributes</span>
<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="s">"The final value of </span><span class="si">%s</span><span class="s"> is </span><span class="si">%.3f</span><span class="s"> </span><span class="si">%s</span><span class="s">."</span> <span class="o">%</span>
<span class="gp">... </span> <span class="n">sim</span><span class="p">(</span><span class="s">'L.i'</span><span class="p">,</span> <span class="p">(</span><span class="n">Info</span><span class="o">.</span><span class="n">description</span><span class="p">,</span> <span class="n">Info</span><span class="o">.</span><span class="n">FV</span><span class="p">,</span> <span class="n">Info</span><span class="o">.</span><span class="n">unit</span><span class="p">)))</span>
<span class="go">The final value of Current flowing from pin p to pin n is 2.049 A.</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.__contains__">
<tt class="descname">__contains__</tt><big>(</big><em>name</em><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.__contains__" title="Permalink to this definition">¶</a></dt>
<dd><p>Test if a variable is present in the simulation results.</p>
<p><strong>Arguments</strong>:</p>
<ul class="simple">
<li><em>name</em>: Name of variable</li>
</ul>
<p><strong>Example</strong>:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="c"># 'L.v' is a valid variable name:</span>
<span class="gp">>>> </span><span class="s">'L.v'</span> <span class="ow">in</span> <span class="n">sim</span>
<span class="go">True</span>
<span class="gp">>>> </span><span class="c"># but 'x' is not:</span>
<span class="gp">>>> </span><span class="s">'x'</span> <span class="ow">not</span> <span class="ow">in</span> <span class="n">sim</span>
<span class="go">True</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.__getitem__">
<tt class="descname">__getitem__</tt><big>(</big><em>names</em><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.__getitem__" title="Permalink to this definition">¶</a></dt>
<dd><p>Upon accessing a variable name within an instance of
<a class="reference internal" href="#modelicares.simres.SimRes" title="modelicares.simres.SimRes"><tt class="xref py py-class docutils literal"><span class="pre">SimRes</span></tt></a>, return its values</p>
<p><strong>Arguments</strong>:</p>
<ul class="simple">
<li><em>names</em>: String or (possibly nested) list of strings of the variable
names</li>
</ul>
<p><strong>Examples:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="p">[</span><span class="s">'L.v'</span><span class="p">]</span>
<span class="go">array([ 0.00000000e+00, ... -2.53528625e-01], dtype=float32)</span>
<span class="gp">>>> </span><span class="c"># This is equivalent to:</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">get_values</span><span class="p">(</span><span class="s">'L.v'</span><span class="p">)</span>
<span class="go">array([ 0.00000000e+00, ... -2.53528625e-01], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.__len__">
<tt class="descname">__len__</tt><big>(</big><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.__len__" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the number of variables in the simulation.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="s">"There are </span><span class="si">%i</span><span class="s"> variables in the </span><span class="si">%s</span><span class="s"> simulation."</span> <span class="o">%</span>
<span class="gp">... </span> <span class="p">(</span><span class="nb">len</span><span class="p">(</span><span class="n">sim</span><span class="p">),</span> <span class="n">sim</span><span class="o">.</span><span class="n">fbase</span><span class="p">))</span>
<span class="go">There are 62 variables in the ChuaCircuit simulation.</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.__repr__">
<tt class="descname">__repr__</tt><big>(</big><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.__repr__" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a formal description of the <a class="reference internal" href="#modelicares.simres.SimRes" title="modelicares.simres.SimRes"><tt class="xref py py-class docutils literal"><span class="pre">SimRes</span></tt></a> instance.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span>
<span class="go">SimRes('...ChuaCircuit.mat')</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.__str__">
<tt class="descname">__str__</tt><big>(</big><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.__str__" title="Permalink to this definition">¶</a></dt>
<dd><p>Return an informal description of the <a class="reference internal" href="#modelicares.simres.SimRes" title="modelicares.simres.SimRes"><tt class="xref py py-class docutils literal"><span class="pre">SimRes</span></tt></a> instance.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="k">print</span><span class="p">(</span><span class="n">sim</span><span class="p">)</span>
<span class="go">Modelica simulation results from "...ChuaCircuit.mat"</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.browse">
<tt class="descname">browse</tt><big>(</big><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.browse" title="Permalink to this definition">¶</a></dt>
<dd><p>Launch a variable browser.</p>
<p>When a variable is selected, the right panel shows its attributes and
a simple plot of the variable over time. Variable names can be dragged
and dropped into a text editor.</p>
<p>There are no arguments or return values.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">browse</span><span class="p">()</span>
</pre></div>
</div>
<a class="reference internal image-reference" href="_images/browse.png"><img alt="variable browser" src="_images/browse.png" style="width: 743.4px; height: 364.5px;" /></a>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.get_FV">
<tt class="descname">get_FV</tt><big>(</big><em>names</em>, <em>f=<function <lambda> at 0xabc7cdc></em><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.get_FV" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the final value(s) of variable(s).</p>
<p><strong>Arguments:</strong></p>
<ul class="simple">
<li><em>names</em>: String or (possibly nested) list of strings of variable
names</li>
<li><em>f</em>: Function that should be applied to the value(s) (default is
identity)</li>
</ul>
<p>If <em>names</em> is a string, then the output will be an array of values. If
<em>names</em> is a (optionally nested) list of strings, then the output will
be a (nested) list of arrays.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">get_FV</span><span class="p">(</span><span class="s">'L.v'</span><span class="p">)</span>
<span class="go">-0.25352862</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.get_IV">
<tt class="descname">get_IV</tt><big>(</big><em>names</em>, <em>f=<function <lambda> at 0xabc7c6c></em><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.get_IV" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the initial values of variable(s).</p>
<p><strong>Arguments:</strong></p>
<ul class="simple">
<li><em>names</em>: String or (possibly nested) list of strings of the variable
names</li>
<li><em>f</em>: Function that should be applied to the value(s) (default is
identity)</li>
</ul>
<p>If <em>names</em> is a string, then the output will be a single value. If
<em>names</em> is a (optionally nested) list of strings, then the output will
be a (nested) list of values.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">get_IV</span><span class="p">(</span><span class="s">'L.v'</span><span class="p">)</span>
<span class="go">0.0</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.get_description">
<tt class="descname">get_description</tt><big>(</big><em>names</em><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.get_description" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the description(s) of trajectory variable(s).</p>
<p><strong>Arguments:</strong></p>
<ul>
<li><p class="first"><em>names</em>: Name(s) of the variable(s) from which to get the
description(s)</p>
<blockquote>
<div><p>This may be a string or (possibly nested) list of strings
representing the names of the variables.</p>
</div></blockquote>
</li>
</ul>
<p>If <em>names</em> is a string, then the output will be a single description.
If <em>names</em> is a (optionally nested) list of strings, then the output
will be a (nested) list of descriptions.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">get_description</span><span class="p">(</span><span class="s">'L.v'</span><span class="p">)</span>
<span class="go">'Voltage drop between the two pins (= p.v - n.v)'</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.get_displayUnit">
<tt class="descname">get_displayUnit</tt><big>(</big><em>names</em><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.get_displayUnit" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the <a class="reference external" href="http://www.modelica.org/">Modelica</a> <em>displayUnit</em> attribute(s) of trajectory
variable(s).</p>
<p><strong>Arguments:</strong></p>
<ul>
<li><p class="first"><em>names</em>: Name(s) of the variable(s) from which to get the display
unit(s)</p>
<blockquote>
<div><p>This may be a string or (possibly nested) list of strings
representing the names of the variables.</p>
</div></blockquote>
</li>
</ul>
<p>If <em>names</em> is a string, then the output will be a single display unit.
If <em>names</em> is a (optionally nested) list of strings, then the output
will be a (nested) list of display units.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">get_displayUnit</span><span class="p">(</span><span class="s">'G.T_heatPort'</span><span class="p">)</span>
<span class="go">'degC'</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.get_indices_wi_times">
<tt class="descname">get_indices_wi_times</tt><big>(</big><em>names</em>, <em>t_1=None</em>, <em>t_2=None</em><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.get_indices_wi_times" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the widest index pair(s) for which the time of signal(s) is
within given limits.</p>
<p><strong>Arguments:</strong></p>
<ul class="simple">
<li><em>names</em>: String or (possibly nested) list of strings of the variable
names</li>
<li><em>t_1</em>: Lower bound of time</li>
<li><em>t_2</em>: Upper bound of time</li>
</ul>
<p>If <em>names</em> is a string, then the output will be an array of values. If
<em>names</em> is a (optionally nested) list of strings, then the output will
be a (nested) list of arrays.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">get_indices_wi_times</span><span class="p">(</span><span class="s">'L.v'</span><span class="p">,</span> <span class="n">t_1</span><span class="o">=</span><span class="mi">500</span><span class="p">,</span> <span class="n">t_2</span><span class="o">=</span><span class="mi">2000</span><span class="p">)</span>
<span class="go">(104, 412)</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.get_times">
<tt class="descname">get_times</tt><big>(</big><em>names</em>, <em>i=slice(0</em>, <em>None</em>, <em>None)</em>, <em>f=<function <lambda> at 0xabc7d4c></em><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.get_times" title="Permalink to this definition">¶</a></dt>
<dd><p>Return vector(s) of the sample times of variable(s).</p>
<p><strong>Arguments:</strong></p>
<ul>
<li><p class="first"><em>names</em>: String or (possibly nested) list of strings of the variable
names</p>
</li>
<li><p class="first"><em>i</em>: Index (-1 for last), list of indices, or slice of the time(s) to
return</p>
<blockquote>
<div><p>By default, all times are returned.</p>
</div></blockquote>
</li>
<li><p class="first"><em>f</em>: Function that should be applied to all times (default is
identity)</p>
</li>
</ul>
<p>If <em>names</em> is a string, then the output will be an array of times. If
<em>names</em> is a (optionally nested) list of strings, then the output will
be a (nested) list of arrays.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">get_times</span><span class="p">(</span><span class="s">'L.v'</span><span class="p">)</span>
<span class="go">array([ 0. , ... 2500. ], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.get_unit">
<tt class="descname">get_unit</tt><big>(</big><em>names</em><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.get_unit" title="Permalink to this definition">¶</a></dt>
<dd><p>Return the <em>unit</em> attribute(s) of trajectory variable(s).</p>
<p><strong>Arguments:</strong></p>
<ul>
<li><p class="first"><em>names</em>: Name(s) of the variable(s) from which to get the unit(s)</p>
<blockquote>
<div><p>This may be a string or (possibly nested) list of strings
representing the names of the variables.</p>
</div></blockquote>
</li>
</ul>
<p>If <em>names</em> is a string, then the output will be a single unit. If
<em>names</em> is a (optionally nested) list of strings, then the output will
be a (nested) list of units.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">get_unit</span><span class="p">(</span><span class="s">'L.v'</span><span class="p">)</span>
<span class="go">'V'</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.get_values">
<tt class="descname">get_values</tt><big>(</big><em>names</em>, <em>i=slice(0</em>, <em>None</em>, <em>None)</em>, <em>f=<function <lambda> at 0xabc7df4></em><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.get_values" title="Permalink to this definition">¶</a></dt>
<dd><p>Return vector(s) of the values of the samples of variable(s).</p>
<p>If there is only a single value, then it is repeated (to support
plotting).</p>
<p><strong>Arguments:</strong></p>
<ul>
<li><p class="first"><em>names</em>: String or (possibly nested) list of strings of the variable
names</p>
</li>
<li><p class="first"><em>i</em>: Index (-1 for last), list of indices, or slice of the values(s)
to return</p>
<blockquote>
<div><p>By default, all values are returned.</p>
</div></blockquote>
</li>
<li><p class="first"><em>f</em>: Function that should be applied to all values (default is
identity)</p>
</li>
</ul>
<p>If <em>names</em> is a string, then the output will be an array of values. If
<em>names</em> is a (optionally nested) list of strings, then the output will
be a (nested) list of arrays.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">get_values</span><span class="p">(</span><span class="s">'L.v'</span><span class="p">)</span>
<span class="go">array([ 0.00000000e+00, ... -2.53528625e-01], dtype=float32)</span>
</pre></div>
</div>
<p>If the variable cannot be found, then possible matches are listed:</p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">get_values</span><span class="p">([</span><span class="s">'L.vv'</span><span class="p">])</span>
<span class="go">L.vv is not a valid variable name.</span>
<span class="go">Did you mean one of these?</span>
<span class="go"> L.v</span>
<span class="go"> L.p.v</span>
<span class="go"> L.n.v</span>
</pre></div>
</div>
<p>The other <em>get_</em>* methods also give this message when a variable cannot
be found.</p>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.get_values_at_times">
<tt class="descname">get_values_at_times</tt><big>(</big><em>names</em>, <em>times</em>, <em>f=<function <lambda> at 0xabc7e64></em><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.get_values_at_times" title="Permalink to this definition">¶</a></dt>
<dd><p>Return vector(s) of the values of the samples of variable(s) (at
optionally given times).</p>
<p><strong>Arguments:</strong></p>
<ul class="simple">
<li><em>names</em>: String or (possibly nested) list of strings of the variable
names</li>
<li><em>times</em>: Scalar, numeric list, or a numeric array of the times from
which to pull samples</li>
<li><em>f</em>: Function that should be applied to all values (default is
identity)</li>
</ul>
<p>If <em>names</em> is a string, then the output will be an array of values. If
<em>names</em> is a (optionally nested) list of strings, then the output will
be a (nested) list of arrays.</p>
<p>If <em>times</em> is not provided, all of the samples will be returned. If
necessary, the values will be interpolated over time. The function <em>f</em>
is applied before interpolation.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">get_values_at_times</span><span class="p">(</span><span class="s">'L.v'</span><span class="p">,</span> <span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">2000</span><span class="p">])</span>
<span class="go">array([ 0. , 0.15459341])</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.glob">
<tt class="descname">glob</tt><big>(</big><em>pattern</em><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.glob" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of variable names that match <em>pattern</em>.</p>
<p>Patterns are Unix shell style:</p>
<ul class="simple">
<li>matches everything</li>
</ul>
<p>? matches any single character
[seq] matches any character in seq
[!seq] matches any char not in seq</p>
<p>The matches are case-sensitive.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">glob</span><span class="p">(</span><span class="s">'L.p*'</span><span class="p">)</span>
<span class="go">[u'L.p.i', u'L.p.v']</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.keys">
<tt class="descname">keys</tt><big>(</big><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.keys" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of all variable names.</p>
<p>This is the same as <a class="reference internal" href="#modelicares.simres.SimRes.names" title="modelicares.simres.SimRes.names"><tt class="xref py py-meth docutils literal"><span class="pre">names()</span></tt></a> and <a class="reference internal" href="#modelicares.simres.SimRes.variables" title="modelicares.simres.SimRes.variables"><tt class="xref py py-meth docutils literal"><span class="pre">variables()</span></tt></a>.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">keys</span><span class="p">()</span>
<span class="go">[u'L.p.i', u'Ro.alpha', ... u'Ro.LossPower']</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.names">
<tt class="descname">names</tt><big>(</big><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.names" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of all variable names.</p>
<p>This is the same as <a class="reference internal" href="#modelicares.simres.SimRes.keys" title="modelicares.simres.SimRes.keys"><tt class="xref py py-meth docutils literal"><span class="pre">keys()</span></tt></a> and <a class="reference internal" href="#modelicares.simres.SimRes.variables" title="modelicares.simres.SimRes.variables"><tt class="xref py py-meth docutils literal"><span class="pre">variables()</span></tt></a>.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">names</span><span class="p">()</span>
<span class="go">[u'L.p.i', u'Ro.alpha', ... u'Ro.LossPower']</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.nametree">
<tt class="descname">nametree</tt><big>(</big><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.nametree" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a tree of all variable names with respect to the path names.</p>
<p>The tree represents the structure of the <a class="reference external" href="http://www.modelica.org/">Modelica</a> model. It is
returned as a nested dictionary. The keys are the path elements and
the values are sub-dictionaries or variable names.</p>
<p>There are no arguments.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">nametree</span><span class="p">()</span>
<span class="go">{u'G': {u'G': u'G.G', ... u'n': {u'i': u'G.n.i', u'v': u'G.n.v'}, ...}, u'L': {...}, ...}</span>
</pre></div>
</div>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.plot">
<tt class="descname">plot</tt><big>(</big><em>ynames1=</em><span class="optional">[</span><span class="optional">]</span>, <em>ylabel1=None</em>, <em>legends1=</em><span class="optional">[</span><span class="optional">]</span>, <em>leg1_kwargs={'loc': 'best'}</em>, <em>ax1=None</em>, <em>ynames2=</em><span class="optional">[</span><span class="optional">]</span>, <em>ylabel2=None</em>, <em>legends2=</em><span class="optional">[</span><span class="optional">]</span>, <em>leg2_kwargs={'loc': 'best'}</em>, <em>ax2=None</em>, <em>xname='Time'</em>, <em>xlabel=None</em>, <em>title=None</em>, <em>label='xy'</em>, <em>incl_prefix=False</em>, <em>suffix=None</em>, <em>use_paren=True</em>, <em>**kwargs</em><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.plot" title="Permalink to this definition">¶</a></dt>
<dd><p>Plot data as points and/or curves in 2D Cartesian coordinates.</p>
<p><strong>Arguments:</strong></p>
<ul>
<li><p class="first"><em>ynames1</em>: Names of variables for the primary y axis</p>
<blockquote>
<div><p>If any names are invalid, then they will be skipped.</p>
</div></blockquote>
</li>
<li><p class="first"><em>ylabel1</em>: Label for the primary y axis</p>
<blockquote>
<div><p>If <em>ylabel1</em> is <em>None</em> (default) and all of the variables have the
same <a class="reference external" href="http://www.modelica.org/">Modelica</a> description string, then the common description
will be used. Use ‘’ for no label.</p>
</div></blockquote>
</li>
<li><p class="first"><em>legends1</em>: List of legend entries for variables assigned to the
primary y axis</p>
<blockquote>
<div><p>If <em>legends1</em> is an empty list ([]), ynames1 will be used. If
<em>legends1</em> is <em>None</em> and all of the variables on the primary axis
have the same unit, then no legend will be shown.</p>
</div></blockquote>
</li>
<li><p class="first"><em>leg1_kwargs</em>: Dictionary of keyword arguments for the primary legend</p>
</li>
<li><p class="first"><em>ax1</em>: Primary y axes</p>
<blockquote>
<div><p>If <em>ax1</em> is not provided, then axes will be created in a new
figure.</p>
</div></blockquote>
</li>
<li><p class="first"><em>ynames2</em>, <em>ylabel2</em>, <em>legends2</em>, <em>leg2_kwargs</em>, and <em>ax2</em>: Similar
to <em>ynames1</em>, <em>ylabel1</em>, <em>legends1</em>, <em>leg1_kwargs</em>, and <em>ax1</em> but
for the secondary y axis</p>
</li>
<li><p class="first"><em>xname</em>: Name of the x-axis data</p>
</li>
<li><p class="first"><em>xlabel</em>: Label for the x axis</p>
<blockquote>
<div><p>If <em>xlabel</em> is <em>None</em> (default), the variable’s <a class="reference external" href="http://www.modelica.org/">Modelica</a>
description string will be applied. Use ‘’ for no label.</p>
</div></blockquote>
</li>
<li><p class="first"><em>title</em>: Title for the figure</p>
<blockquote>
<div><p>If <em>title</em> is <em>None</em> (default), then the title will be the base
filename. Use ‘’ for no title.</p>
</div></blockquote>
</li>
<li><p class="first"><em>label</em>: Label for the figure (ignored if ax is provided)</p>
<blockquote>
<div><p>This will be used as a base filename if the figure is saved.</p>
</div></blockquote>
</li>
<li><p class="first"><em>incl_prefix</em>: If <em>True</em>, prefix the legend strings with the base
filename of the class.</p>
</li>
<li><p class="first"><em>suffix</em>: String that will be added at the end of the legend entries</p>
</li>
<li><p class="first"><em>use_paren</em>: Add parentheses around the suffix</p>
</li>
<li><p class="first"><em>**kwargs</em>: Propagated to <tt class="xref py py-meth docutils literal"><span class="pre">base.plot()</span></tt> (and thus to
<tt class="xref py py-meth docutils literal"><span class="pre">matplotlib.pyplot.plot()</span></tt>)</p>
<blockquote>
<div><p>If both y axes are used (primary and secondary), then the <em>dashes</em>
argument is ignored. The curves on the primary axis will be solid
and the curves on the secondary axis will be dotted.</p>
</div></blockquote>
</li>
</ul>
<p><strong>Returns:</strong></p>
<ol class="arabic simple">
<li><em>ax1</em>: Primary y axes</li>
<li><em>ax2</em>: Secondary y axes</li>
</ol>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span><span class="p">,</span> <span class="n">saveall</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">plot</span><span class="p">(</span><span class="n">ynames1</span><span class="o">=</span><span class="s">'L.i'</span><span class="p">,</span> <span class="n">ylabel1</span><span class="o">=</span><span class="s">"Current"</span><span class="p">,</span>
<span class="gp">... </span> <span class="n">ynames2</span><span class="o">=</span><span class="s">'L.der(i)'</span><span class="p">,</span> <span class="n">ylabel2</span><span class="o">=</span><span class="s">"Derivative of current"</span><span class="p">,</span>
<span class="gp">... </span> <span class="n">title</span><span class="o">=</span><span class="s">"Chua Circuit"</span><span class="p">,</span> <span class="n">label</span><span class="o">=</span><span class="s">'examples/ChuaCircuit'</span><span class="p">)</span>
<span class="go">(<matplotlib.axes._subplots.AxesSubplot object at 0x...>, <matplotlib.axes._subplots.AxesSubplot object at 0x...>)</span>
<span class="gp">>>> </span><span class="n">saveall</span><span class="p">()</span>
<span class="go">Saved examples/ChuaCircuit.pdf</span>
<span class="go">Saved examples/ChuaCircuit.png</span>
</pre></div>
</div>
<a class="reference internal image-reference" href="_images/ChuaCircuit.png"><img alt="plot of Chua circuit" src="_images/ChuaCircuit.png" style="width: 543.9px; height: 329.7px;" /></a>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.sankey">
<tt class="descname">sankey</tt><big>(</big><em>names=[], times=[0], n_rows=1, title=None, subtitles=[], label='sankey', margin_left=0.05, margin_right=0.05, margin_bottom=0.05, margin_top=0.1, wspace=0.1, hspace=0.25, **kwargs</em><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.sankey" title="Permalink to this definition">¶</a></dt>
<dd><p>Create a figure with Sankey diagram(s).</p>
<p><strong>Arguments:</strong></p>
<ul>
<li><p class="first"><em>names</em>: List of names of the flow variables</p>
</li>
<li><p class="first"><em>times</em>: List of times at which the data should be sampled</p>
<blockquote>
<div><p>If multiple times are given, then subfigures will be generated,
each with a Sankey diagram.</p>
</div></blockquote>
</li>
<li><p class="first"><em>n_rows</em>: Number of rows of (sub)plots</p>
</li>
<li><p class="first"><em>title</em>: Title for the figure</p>
<blockquote>
<div><p>If <em>title</em> is <em>None</em> (default), then the title will be “Sankey
Diagram of <em>fbase</em>”, where <em>fbase</em> is the base filename of the
data. Use ‘’ for no title.</p>
</div></blockquote>
</li>
<li><p class="first"><em>subtitles</em>: List of subtitles (i.e., titles for each subplot)</p>
<blockquote>
<div><p>If not provided, “t = xx s” will be used, where <em>xx</em> is the time
of each entry. “(initial)” or “(final)” is appended if
appropriate.</p>
</div></blockquote>
</li>
<li><p class="first"><em>label</em>: Label for the figure</p>
<blockquote>
<div><p>This will be used as the base filename if the figure is saved.</p>
</div></blockquote>
</li>
<li><p class="first"><em>margin_left</em>: Left margin</p>
</li>
<li><p class="first"><em>margin_right</em>: Right margin</p>
</li>
<li><p class="first"><em>margin_bottom</em>: Bottom margin</p>
</li>
<li><p class="first"><em>margin_top</em>: Top margin</p>
</li>
<li><p class="first"><em>wspace</em>: The amount of width reserved for blank space between
subplots</p>
</li>
<li><p class="first"><em>hspace</em>: The amount of height reserved for white space between
subplots</p>
</li>
<li><p class="first"><em>**kwargs</em>: Additional arguments for <tt class="xref py py-class docutils literal"><span class="pre">matplotlib.sankey.Sankey</span></tt></p>
</li>
</ul>
<p><strong>Returns:</strong></p>
<ol class="arabic simple">
<li>List of <tt class="xref py py-class docutils literal"><span class="pre">matplotlib.sankey.Sankey</span></tt> instances of the subplots</li>
</ol>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span><span class="p">,</span> <span class="n">saveall</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ThreeTanks'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sankeys</span> <span class="o">=</span> <span class="n">sim</span><span class="o">.</span><span class="n">sankey</span><span class="p">(</span><span class="n">label</span><span class="o">=</span><span class="s">'examples/ThreeTanks'</span><span class="p">,</span>
<span class="gp">... </span> <span class="n">title</span><span class="o">=</span><span class="s">"Sankey Diagrams of Modelica.Fluid.Examples.Tanks.ThreeTanks"</span><span class="p">,</span>
<span class="gp">... </span> <span class="n">times</span><span class="o">=</span><span class="p">[</span><span class="mi">0</span><span class="p">,</span> <span class="mi">50</span><span class="p">,</span> <span class="mi">100</span><span class="p">,</span> <span class="mi">150</span><span class="p">],</span> <span class="n">n_rows</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">format</span><span class="o">=</span><span class="s">'</span><span class="si">%.1f</span><span class="s"> '</span><span class="p">,</span>
<span class="gp">... </span> <span class="n">names</span><span class="o">=</span><span class="p">[</span><span class="s">'tank1.ports[1].m_flow'</span><span class="p">,</span> <span class="s">'tank2.ports[1].m_flow'</span><span class="p">,</span>
<span class="gp">... </span> <span class="s">'tank3.ports[1].m_flow'</span><span class="p">],</span>
<span class="gp">... </span> <span class="n">labels</span><span class="o">=</span><span class="p">[</span><span class="s">'Tank 1'</span><span class="p">,</span> <span class="s">'Tank 2'</span><span class="p">,</span> <span class="s">'Tank 3'</span><span class="p">],</span>
<span class="gp">... </span> <span class="n">orientations</span><span class="o">=</span><span class="p">[</span><span class="o">-</span><span class="mi">1</span><span class="p">,</span> <span class="mi">0</span><span class="p">,</span> <span class="mi">1</span><span class="p">],</span>
<span class="gp">... </span> <span class="n">scale</span><span class="o">=</span><span class="mf">0.100</span><span class="p">,</span> <span class="n">margin</span><span class="o">=</span><span class="mi">6</span><span class="p">,</span> <span class="n">offset</span><span class="o">=</span><span class="mf">1.5</span><span class="p">,</span>
<span class="gp">... </span> <span class="n">pathlengths</span><span class="o">=</span><span class="mi">2</span><span class="p">,</span> <span class="n">trunklength</span><span class="o">=</span><span class="mi">10</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">saveall</span><span class="p">()</span>
<span class="go">Saved examples/ThreeTanks.pdf</span>
<span class="go">Saved examples/ThreeTanks.png</span>
</pre></div>
</div>
<a class="reference internal image-reference" href="_images/ThreeTanks.png"><img alt="Sankey digarams of three-tank model" src="_images/ThreeTanks.png" style="width: 526.4px; height: 340.9px;" /></a>
</dd></dl>
<dl class="method">
<dt id="modelicares.simres.SimRes.variables">
<tt class="descname">variables</tt><big>(</big><big>)</big><a class="headerlink" href="#modelicares.simres.SimRes.variables" title="Permalink to this definition">¶</a></dt>
<dd><p>Return a list of all variable names.</p>
<p>This is the same as <a class="reference internal" href="#modelicares.simres.SimRes.keys" title="modelicares.simres.SimRes.keys"><tt class="xref py py-meth docutils literal"><span class="pre">keys()</span></tt></a> and <a class="reference internal" href="#modelicares.simres.SimRes.names" title="modelicares.simres.SimRes.names"><tt class="xref py py-meth docutils literal"><span class="pre">names()</span></tt></a>.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares</span> <span class="kn">import</span> <span class="n">SimRes</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">sim</span><span class="o">.</span><span class="n">variables</span><span class="p">()</span>
<span class="go">[u'L.p.i', u'Ro.alpha', ... u'Ro.LossPower']</span>
</pre></div>
</div>
</dd></dl>
</dd></dl>
<dl class="function">
<dt id="modelicares.simres.merge_times">
<tt class="descclassname">modelicares.simres.</tt><tt class="descname">merge_times</tt><big>(</big><em>times_list</em><big>)</big><a class="headerlink" href="#modelicares.simres.merge_times" title="Permalink to this definition">¶</a></dt>
<dd><p>Merge a list of multiple time vectors into one vector.</p>
<p><strong>Example:</strong></p>
<div class="highlight-python"><div class="highlight"><pre><span class="gp">>>> </span><span class="kn">from</span> <span class="nn">modelicares.simres</span> <span class="kn">import</span> <span class="n">SimRes</span><span class="p">,</span> <span class="n">merge_times</span>
<span class="gp">>>> </span><span class="n">sim</span> <span class="o">=</span> <span class="n">SimRes</span><span class="p">(</span><span class="s">'examples/ChuaCircuit.mat'</span><span class="p">)</span>
<span class="gp">>>> </span><span class="n">times_list</span> <span class="o">=</span> <span class="n">sim</span><span class="o">.</span><span class="n">get_times</span><span class="p">([</span><span class="s">'L.v'</span><span class="p">,</span> <span class="s">'G.T_heatPort'</span><span class="p">])</span>
<span class="gp">>>> </span><span class="n">merge_times</span><span class="p">(</span><span class="n">times_list</span><span class="p">)</span>
<span class="go">array([ 0. , ... 2500. ], dtype=float32)</span>
</pre></div>
</div>
</dd></dl>
</div>
</div>
</div>
</div>
<div class="clearer"></div>
</div>
<div class="related">
<h3>Navigation</h3>
<ul>
<li class="right" style="margin-right: 10px">
<a href="genindex.html" title="General Index"
>index</a></li>
<li class="right" >
<a href="py-modindex.html" title="Python Module Index"
>modules</a> |</li>
<li class="right" >
<a href="linres.html" title="modelicares.linres"
>next</a> |</li>
<li class="right" >
<a href="modelicares.html" title="modelicares"
>previous</a> |</li>
<li><a href="index.html">ModelicaRes v0.8.0 Documentation</a> »</li>
</ul>
</div>
<div class="footer">
© Copyright 2012-2013, Kevin Davies, Georgia Tech Research Corporation.
Last updated on Aug 06, 2013.
Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> 1.1.3.
</div>
</body>
</html>