-
Notifications
You must be signed in to change notification settings - Fork 1
/
hack_ferkl.mo
583 lines (578 loc) · 29.9 KB
/
hack_ferkl.mo
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
within ;
package hack_ferkl
model spojeni
replaceable package Blood =
Physiolibrary.Media.BloodBySiggaardAndersen annotation(choicesAllMatching=True);
replaceable package Air =
Physiolibrary.Media.Air annotation(choicesAllMatching=True);
parameter Physiolibrary.Types.Frequency RR=0.286
"Respiration rate";
parameter Physiolibrary.Types.Volume TV=0.0005
"Tidal volume";
parameter Physiolibrary.Types.Volume DV=0.00015
"Dead space volume";
//parameter Physiolibrary.Types.Fraction FlungShunt(start=0.02);
parameter Physiolibrary.Types.HydraulicConductance C_shunt=
1.250102626409427e-07*((0.02*(1/3)));
// parameter Physiolibrary.Types.HydraulicConductance C_perf=1.250102626409427e-07
//*((1 - 0.02)*(1/3));
parameter Integer NA = 10 "pocet alveolarnich jednotek";
parameter Physiolibrary.Types.HydraulicConductance C_totalVentilace=
1.019716212977928e-05*((1/1.5));
parameter Physiolibrary.Types.HydraulicConductance C_totalCirkulace=
1.250102626409427e-07*(1/3*(1 - 0.02));
Physiolibrary.Fluid.Sources.PressureSource pressureSource(redeclare package
Medium = Physiolibrary.Media.Air)
annotation (Placement(transformation(extent={{-138,-30},{-118,-10}})));
Physiolibrary.Fluid.Components.VolumePump DeadSpace(
redeclare package Medium = Physiolibrary.Media.Air,
useSolutionFlowInput=true,
SolutionFlow=DV*RR)
annotation (Placement(transformation(extent={{-2,-30},{18,-10}})));
Physiolibrary.Fluid.Sources.VolumeOutflowSource volumeOutflowSource(
useSolutionFlowInput=true,
SolutionFlow=TV*RR, redeclare package Medium = Physiolibrary.Media.Air)
annotation (Placement(transformation(extent={{-10,-10},{10,10}},
rotation=0,
origin={116,-20})));
Physiolibrary.Fluid.Components.VolumePump srdceP(
redeclare package Medium = Blood,
useSolutionFlowInput=true,
SolutionFlow(displayUnit="l/min") = 8.3333333333333e-05) annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=90,
origin={-62,-184})));
Physiolibrary.Fluid.Components.VolumePump SrdceL(
redeclare package Medium = Blood,
useSolutionFlowInput=true,
SolutionFlow(displayUnit="l/min") = 8.3333333333333e-05) annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={78,-156})));
Physiolibrary.Fluid.Components.Resistor resistor1(redeclare package Medium
= Blood, Resistance=7999343.2449*((7*20)/8))
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={36,-250})));
Physiolibrary.Fluid.Components.ElasticVessel PlicArterie(
redeclare package Medium = Blood,
volume_start(displayUnit="l") = 0.00038,
Compliance(displayUnit="ml/mmHg") = 3.6002955640592e-08,
ZeroPressureVolume(displayUnit="l") = 0.0003,
nPorts=3) annotation (Placement(transformation(extent={{-80,-114},{-60,-94}})));
Physiolibrary.Fluid.Components.ElasticVessel PlicVena(
redeclare package Medium = Blood,
volume_start(displayUnit="l") = 0.0004,
Compliance(displayUnit="ml/mmHg") = 7.5006157584566e-08,
ZeroPressureVolume(displayUnit="l") = 0.0004,
nPorts=3) annotation (Placement(transformation(extent={{48,-124},{68,-104}})));
Physiolibrary.Fluid.Components.ElasticVessel Arterie(
redeclare package Medium = Blood,
useSubstances=true,
volume_start(displayUnit="l") = 0.00085,
Compliance(displayUnit="ml/mmHg") = 2.6627185942521e-08,
ZeroPressureVolume(displayUnit="l") = 0.00045,
nPorts=4) annotation (Placement(transformation(extent={{66,-258},{86,-236}})));
Physiolibrary.Fluid.Components.ElasticVessel Veny(
redeclare package Medium = Blood,
volume_start(displayUnit="l") = 0.00325,
Compliance(displayUnit="ml/mmHg") = 6.1880080007267e-07,
ZeroPressureVolume(displayUnit="l") = 0.00295,
nPorts=3)
annotation (Placement(transformation(extent={{-70,-260},{-50,-240}})));
Physiolibrary.Fluid.Sensors.FlowMeasure flowMeasure2(redeclare package
Medium =
Blood) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={56,-188})));
Physiolibrary.Fluid.Sensors.PressureMeasure TlakPlicVeny(redeclare package
Medium = Blood)
annotation (Placement(transformation(extent={{92,-124},{112,-104}})));
Physiolibrary.Fluid.Sensors.PressureMeasure TlakPlicArterie(redeclare
package Medium =
Blood)
annotation (Placement(transformation(extent={{-136,-168},{-116,-148}})));
Physiolibrary.Fluid.Sensors.PressureMeasure TlakVeny(redeclare package
Medium =
Blood)
annotation (Placement(transformation(extent={{-142,-254},{-122,-234}})));
Physiolibrary.Fluid.Sensors.PressureMeasure TlakArterie(redeclare package
Medium = Blood)
annotation (Placement(transformation(extent={{96,-248},{116,-228}})));
Physiolibrary.Types.Constants.HydraulicConductanceConst hydraulicConductance(k=
1.250102626409427e-07*(5/4))
annotation (Placement(transformation(extent={{132,-114},{140,-106}})));
Modelica.Blocks.Math.Product product1 annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={120,-140})));
Physiolibrary.Types.Constants.HydraulicConductanceConst hydraulicConductance1(k=
1.250102626409427e-07*(5/4))
annotation (Placement(transformation(extent={{-152,-204},{-144,-196}})));
Modelica.Blocks.Math.Product product2 annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-116,-206})));
Physiolibrary.Fluid.Components.Resistor resistor2(redeclare package Medium
= Blood, Resistance=7999343.2449*(20/8)) annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={-14,-250})));
Physiolibrary.Fluid.Components.ElasticVessel elasticVessel(
redeclare package Medium = Physiolibrary.Media.BloodBySiggaardAndersen,
useSubstances=true,
volume_start(displayUnit="l") = 0.0003,
Compliance(displayUnit="ml/mmHg") = 3.0002463033826e-08,
ZeroPressureVolume(displayUnit="l") = 0.0002,
nPorts=5) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=90,
origin={10,-306})));
Physiolibrary.Fluid.Sensors.PressureMeasure TlakKapilaryTelo(redeclare
package Medium = Blood)
annotation (Placement(transformation(extent={{-28,-292},{-8,-272}})));
Chemical.Sources.SubstanceInflowT CO2_left1(
SubstanceFlow(displayUnit="mmol/min") = 0.00020566666666667,
redeclare package stateOfMatter = Chemical.Interfaces.IdealGas,
substanceData=Chemical.Substances.CarbonDioxide_gas()) annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={78,-320})));
Chemical.Sources.SubstanceOutflow O2_left1(useSubstanceFlowInput=false,
SubstanceFlow(displayUnit="mmol/min") = 0.00025666666666667) annotation (
Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={-70,-308})));
Physiolibrary.Fluid.Sensors.PartialPressure pO2_tissue(
redeclare package stateOfMatter = Chemical.Interfaces.IdealGas,
substanceData=Chemical.Substances.Oxygen_gas(),
redeclare package Medium = Physiolibrary.Media.BloodBySiggaardAndersen)
annotation (Placement(transformation(extent={{-72,-364},{-52,-344}})));
Physiolibrary.Fluid.Sensors.PartialPressure pCO2_tissue(
redeclare package stateOfMatter = Chemical.Interfaces.IdealGas,
substanceData=Chemical.Substances.CarbonDioxide_gas(),
redeclare package Medium = Physiolibrary.Media.BloodBySiggaardAndersen)
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={86,-362})));
Physiolibrary.Fluid.Components.Conductor shunt(redeclare package Medium =
Blood, Conductance(displayUnit="l/(cmH2O.s)") = C_shunt)
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={12,-146})));
AlveolarniJednotka alveolarniJednotka[NA](
redeclare package Blood = Blood,
C_ventilace=ones(NA)*(C_totalVentilace/NA),
C_cirkulace=ones(NA)*(C_totalCirkulace/NA))
annotation (Placement(transformation(rotation=0,
extent={{-10,-74},{10,-54}})));
Physiolibrary.Types.Constants.HydraulicConductanceConst
hydraulicConductance2(k(displayUnit="ml/(kPa.min)") = 2.5e-07)
annotation (Placement(transformation(extent={{128,-210},{136,-202}})));
Physiolibrary.Types.Constants.PressureConst pressure(k(displayUnit="kPa")
= 4800)
annotation (Placement(transformation(extent={{134,-250},{142,-242}})));
Modelica.Blocks.Math.Add add(k1=-1)
annotation (Placement(transformation(extent={{176,-284},{196,-264}})));
Modelica.Blocks.Math.Product product3 annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=90,
origin={198,-212})));
Physiolibrary.Fluid.Sensors.PartialPressure partialPressure(
redeclare package stateOfMatter = Chemical.Interfaces.IdealGas,
substanceData=Chemical.Substances.CarbonDioxide_gas(),
redeclare package Medium = Physiolibrary.Media.BloodBySiggaardAndersen)
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={122,-276})));
Modelica.Blocks.Math.Max max1 annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=90,
origin={184,-128})));
Modelica.Blocks.Sources.Constant const(k=0)
annotation (Placement(transformation(extent={{92,-200},{112,-180}})));
Physiolibrary.Types.Constants.VolumeConst volume(k(displayUnit="l") =
0.00035) annotation (Placement(transformation(
extent={{-4,-4},{4,4}},
rotation=180,
origin={112,74})));
Physiolibrary.Types.Constants.FrequencyConst frequency(k=
0.01666666666666667*(50/(2 - 0.35))) annotation (Placement(
transformation(
extent={{-4,-4},{4,4}},
rotation=180,
origin={176,52})));
Modelica.Blocks.Math.Division division annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={134,28})));
Modelica.Blocks.Math.Add TidalVolume annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={80,34})));
Modelica.Blocks.Math.Product RespirationRate annotation (Placement(
transformation(
extent={{-10,-10},{10,10}},
rotation=180,
origin={38,48})));
Physiolibrary.Types.Constants.VolumeConst DeadSpaceVolume(k=DV)
annotation (Placement(transformation(extent={{-88,54},{-80,62}})));
Modelica.Blocks.Math.Product product5 annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={10,16})));
equation
connect(DeadSpace.q_out, volumeOutflowSource.q_in) annotation (Line(
points={{18,-20},{106,-20}},
color={127,0,0},
thickness=0.5));
connect(pressureSource.y, DeadSpace.q_in) annotation (Line(
points={{-118,-20},{-2,-20}},
color={127,0,0},
thickness=0.5));
connect(srdceP.q_out,PlicArterie. q_in[1]) annotation (Line(
points={{-62,-174},{-62,-102.267},{-70.1,-102.267}},
color={127,0,0},
thickness=0.5));
connect(SrdceL.q_in,PlicVena. q_in[1]) annotation (Line(
points={{78,-146},{78,-138},{42,-138},{42,-112.267},{57.9,-112.267}},
color={127,0,0},
thickness=0.5));
connect(srdceP.q_in,Veny. q_in[1]) annotation (Line(
points={{-62,-194},{-62,-248.267},{-60.1,-248.267}},
color={127,0,0},
thickness=0.5));
connect(SrdceL.q_out, flowMeasure2.q_in) annotation (Line(
points={{78,-166},{78,-172},{56,-172},{56,-178}},
color={127,0,0},
thickness=0.5));
connect(flowMeasure2.q_out, Arterie.q_in[1]) annotation (Line(
points={{56,-198},{50,-198},{50,-212},{75.9,-212},{75.9,-244.855}},
color={127,0,0},
thickness=0.5));
connect(TlakPlicVeny.q_in,PlicVena. q_in[2]) annotation (Line(
points={{98,-120},{98,-136},{74,-136},{74,-138},{34,-138},{34,-114},{
57.9,-114}},
color={127,0,0},
thickness=0.5));
connect(TlakArterie.q_in,Arterie. q_in[2]) annotation (Line(
points={{102,-244},{92,-244},{92,-248},{75.9,-248},{75.9,-246.285}},
color={127,0,0},
thickness=0.5));
connect(TlakVeny.q_in,Veny. q_in[2]) annotation (Line(
points={{-136,-250},{-74,-250},{-74,-236},{-62,-236},{-62,-246},{-60.1,
-246},{-60.1,-250}},
color={127,0,0},
thickness=0.5));
connect(TlakPlicArterie.q_in,PlicArterie. q_in[2]) annotation (Line(
points={{-130,-164},{-130,-174},{-78,-174},{-78,-120},{-62,-120},{-62,
-104},{-70.1,-104}},
color={127,0,0},
thickness=0.5));
connect(TlakPlicVeny.pressure,product1. u2)
annotation (Line(points={{108,-118},{120,-118},{120,-128},{114,-128}},
color={0,0,127}));
connect(hydraulicConductance.y,product1. u1) annotation (Line(points={{141,-110},
{148,-110},{148,-122},{134,-122},{134,-120},{126,-120},{126,-128}},
color={0,0,127}));
connect(product1.y,SrdceL. solutionFlow) annotation (Line(points={{120,-151},{
120,-162},{85,-162},{85,-156}},
color={0,0,127}));
connect(hydraulicConductance1.y,product2. u1) annotation (Line(points={{-143,-200},
{-128,-200}}, color={0,0,127}));
connect(TlakVeny.pressure,product2. u2) annotation (Line(points={{-126,-248},{
-122,-248},{-122,-212},{-128,-212}},
color={0,0,127}));
connect(product2.y,srdceP. solutionFlow) annotation (Line(points={{-105,-206},
{-94,-206},{-94,-202},{-69,-202},{-69,-184}}, color={0,0,127}));
connect(Veny.q_in[3],resistor2. q_out) annotation (Line(
points={{-60.1,-251.733},{-50,-251.733},{-50,-252},{-24,-252},{-24,-250}},
color={127,0,0},
thickness=0.5));
connect(resistor1.q_in,Arterie. q_in[3]) annotation (Line(
points={{46,-250},{75.9,-250},{75.9,-247.715}},
color={127,0,0},
thickness=0.5));
connect(elasticVessel.q_in[1],resistor2. q_in) annotation (Line(
points={{7.92,-306.1},{7.92,-250},{-4,-250}},
color={127,0,0},
thickness=0.5));
connect(TlakKapilaryTelo.q_in,elasticVessel. q_in[2]) annotation (Line(
points={{-22,-288},{-22,-294},{8.96,-294},{8.96,-306.1}},
color={127,0,0},
thickness=0.5));
connect(CO2_left1.port_b, elasticVessel.substances[3]) annotation (Line(
points={{68,-320},{50,-320},{50,-314},{10,-314},{10,-316}}, color={158,
66,200}));
connect(O2_left1.port_a, elasticVessel.substances[2]) annotation (Line(points={{-60,
-308},{10,-308},{10,-316}}, color={158,66,200}));
connect(O2_left1.port_a, pO2_tissue.port_a) annotation (Line(points={{-60,-308},
{-38,-308},{-38,-354},{-52,-354}}, color={158,66,200}));
connect(pO2_tissue.referenceFluidPort, elasticVessel.q_in[3]) annotation (
Line(
points={{-62,-363.8},{-50,-363.8},{-50,-358},{-2,-358},{-2,-294},{8,-294},
{8,-302},{10,-302},{10,-306.1}},
color={127,0,0},
thickness=0.5));
connect(pCO2_tissue.referenceFluidPort, elasticVessel.q_in[4]) annotation (
Line(
points={{86,-371.8},{11.04,-371.8},{11.04,-306.1}},
color={127,0,0},
thickness=0.5));
connect(CO2_left1.port_b, pCO2_tissue.port_a) annotation (Line(points={{68,-320},
{50,-320},{50,-362},{96,-362}}, color={158,66,200}));
connect(resistor1.q_out, elasticVessel.q_in[5]) annotation (Line(
points={{26,-250},{12.08,-250},{12.08,-306.1}},
color={127,0,0},
thickness=0.5));
connect(shunt.q_in, PlicArterie.q_in[3]) annotation (Line(
points={{2,-146},{-48,-146},{-48,-105.733},{-70.1,-105.733}},
color={127,0,0},
thickness=0.5));
connect(shunt.q_out, PlicVena.q_in[3]) annotation (Line(
points={{22,-146},{28,-146},{28,-115.733},{57.9,-115.733}},
color={127,0,0},
thickness=0.5));
for i in 1:NA loop
connect(alveolarniJednotka[i].q_out,
volumeOutflowSource. q_in) annotation (Line(
points={{8,-54},{8,-44},{86,-44},{86,-20},{106,-20}},
color={127,0,0},
thickness=0.5));
connect(pressureSource.y,alveolarniJednotka[i].q_in)
annotation (Line(
points={{-118,-20},{-50,-20},{-50,-56},{-10,-56}},
color={127,0,0},
thickness=0.5));
connect(alveolarniJednotka[i].q_out1,
PlicVena. q_in[3]) annotation (Line(
points={{6,-74},{6,-115.733},{57.9,-115.733}},
color={127,0,0},
thickness=0.5));
connect(alveolarniJednotka[i].q_in1,
PlicArterie. q_in[3]) annotation (Line(
points={{-6,-74},{-6,-88},{-86,-88},{-86,-120},{-62,-120},{-62,-105.733},
{-70.1,-105.733}},
color={127,0,0},
thickness=0.5));
end for;
connect(partialPressure.partialPressure, add.u2) annotation (Line(points={{
132,-276},{150,-276},{150,-282},{174,-282},{174,-280}}, color={0,0,
127}));
connect(pressure.y, add.u1) annotation (Line(points={{143,-246},{174,-246},
{174,-268}}, color={0,0,127}));
connect(add.y, product3.u2) annotation (Line(points={{197,-274},{204,-274},
{204,-224}}, color={0,0,127}));
connect(hydraulicConductance2.y, product3.u1) annotation (Line(points={{137,
-206},{146,-206},{146,-208},{174,-208},{174,-238},{192,-238},{192,
-224}}, color={0,0,127}));
connect(partialPressure.referenceFluidPort, Arterie.q_in[4]) annotation (
Line(
points={{122,-266.2},{114,-266.2},{114,-264},{75.9,-264},{75.9,-249.145}},
color={127,0,0},
thickness=0.5));
connect(partialPressure.port_a, Arterie.substances[3]) annotation (Line(
points={{112,-276},{96,-276},{96,-272},{66,-272},{66,-247}}, color={
158,66,200}));
connect(const.y, max1.u2) annotation (Line(points={{113,-190},{142,-190},{
142,-150},{190,-150},{190,-140}}, color={0,0,127}));
connect(product3.y, max1.u1) annotation (Line(points={{198,-201},{198,-148},
{178,-148},{178,-140}}, color={0,0,127}));
connect(max1.y, volumeOutflowSource.solutionFlow) annotation (Line(points={
{184,-117},{184,-2},{116,-2},{116,-13}}, color={0,0,127}));
connect(frequency.y, division.u2) annotation (Line(points={{171,52},{156,52},
{156,34},{146,34}}, color={0,0,127}));
connect(volume.y, TidalVolume.u2) annotation (Line(points={{107,74},{98,74},
{98,48},{100,48},{100,40},{92,40}}, color={0,0,127}));
connect(division.y, TidalVolume.u1) annotation (Line(points={{123,28},{116,
28},{116,24},{92,24},{92,28}}, color={0,0,127}));
connect(RespirationRate.u2, division.u1) annotation (Line(points={{50,54},{
50,112},{218,112},{218,22},{146,22}}, color={0,0,127}));
connect(TidalVolume.y, RespirationRate.u1)
annotation (Line(points={{69,34},{50,34},{50,42}}, color={0,0,127}));
connect(RespirationRate.y, product5.u1) annotation (Line(points={{27,48},{
20,48},{20,36},{16,36},{16,28}}, color={0,0,127}));
connect(DeadSpaceVolume.y, product5.u2) annotation (Line(points={{-79,58},{
-46,58},{-46,52},{4,52},{4,28}}, color={0,0,127}));
connect(product5.y, DeadSpace.solutionFlow) annotation (Line(points={{10,5},
{10,-4},{10,-13},{8,-13}}, color={0,0,127}));
connect(max1.y, division.u1) annotation (Line(points={{184,-117},{184,22},{
146,22}}, color={0,0,127}));
annotation (
Diagram(coordinateSystem(extent={{-200,-400},{240,200}})),
Icon(coordinateSystem(extent={{-200,-400},{240,200}})));
end spojeni;
model AlveolarniJednotka
Physiolibrary.Fluid.Components.ElasticVessel Alveoly(
redeclare package Medium = Physiolibrary.Media.Air,
useSubstances=true,
volume_start(displayUnit="l") = 0.0016,
Compliance(displayUnit="ml/mmHg") = 6.0004926067653e-07,
ZeroPressureVolume(displayUnit="l") = 0.0013,
ExternalPressure(displayUnit="mmHg") = 100791.72488574,
nPorts=3) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=90,
origin={-6,90})));
Physiolibrary.Fluid.Sensors.PressureMeasure TlakAlveoly(redeclare package
Medium = Physiolibrary.Media.Air)
annotation (Placement(transformation(extent={{122,56},{142,76}})));
Physiolibrary.Fluid.Sensors.FlowMeasure flowMeasure(redeclare package
Medium =
Physiolibrary.Media.Air)
annotation (Placement(transformation(extent={{38,100},{58,120}})));
Physiolibrary.Fluid.Sensors.FlowMeasure flowMeasure1(redeclare package
Medium =
Physiolibrary.Media.Air)
annotation (Placement(transformation(extent={{-46,100},{-26,120}})));
Physiolibrary.Fluid.Components.Conductor conductor(redeclare package Medium =
Physiolibrary.Media.Air, Conductance(displayUnit="l/(cmH2O.s)")=
C_ventilace)
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={-80,112})));
Chemical.Components.GasSolubility O2(KC=1e-4)
annotation (Placement(transformation(extent={{-34,30},{-14,50}})));
Chemical.Components.GasSolubility CO2(KC=1e-4)
annotation (Placement(transformation(extent={{0,28},{20,48}})));
Physiolibrary.Fluid.Sensors.PartialPressure pO2(
redeclare package stateOfMatter = Chemical.Interfaces.IdealGas,
substanceData=Chemical.Substances.Oxygen_gas(),
redeclare package Medium = Physiolibrary.Media.BloodBySiggaardAndersen)
annotation (Placement(transformation(extent={{-88,36},{-68,56}})));
Physiolibrary.Fluid.Sensors.PartialPressure pCO2(
redeclare package stateOfMatter = Chemical.Interfaces.IdealGas,
substanceData=Chemical.Substances.CarbonDioxide_gas(),
redeclare package Medium = Physiolibrary.Media.BloodBySiggaardAndersen)
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=0,
origin={70,38})));
Physiolibrary.Fluid.Components.Conductor conductor1(
redeclare package Medium =
Blood, Conductance=C_cirkulace*(8/7))
annotation (Placement(transformation(extent={{-24,-98},{-4,-78}})));
Physiolibrary.Fluid.Components.Conductor conductor2(
redeclare package Medium =
Blood, Conductance=C_cirkulace*8)
annotation (Placement(transformation(extent={{26,-96},{46,-76}})));
Physiolibrary.Fluid.Components.ElasticVessel elasticVessel1(
redeclare package Medium = Physiolibrary.Media.BloodBySiggaardAndersen,
useSubstances=true,
volume_start(displayUnit="l") = 0.00015,
Compliance(displayUnit="ml/mmHg") = 3.0002463033826e-08,
ZeroPressureVolume(displayUnit="l") = 0.0001,
nPorts=4) annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=270,
origin={8,-40})));
Physiolibrary.Fluid.Sensors.PressureMeasure TlakKapilaryPlice(redeclare
package Medium = Blood)
annotation (Placement(transformation(extent={{42,-44},{62,-24}})));
replaceable package Blood =
Physiolibrary.Media.BloodBySiggaardAndersen annotation(choicesAllMatching=True);
//parameter Physiolibrary.Types.HydraulicConductance C_perf=1.250102626409427e-07
// *((1 - 0.02)*(1/3));
parameter Physiolibrary.Types.HydraulicConductance C_ventilace(
displayUnit="l/(cmH2O.s)")=1.019716212977928e-05*((1/1.5));
parameter Physiolibrary.Types.HydraulicConductance C_cirkulace=
1.250102626409427e-07*(1/3);
Physiolibrary.Fluid.Interfaces.FluidPort_a q_in(redeclare package Medium =
Physiolibrary.Media.Air) annotation (Placement(transformation(rotation=0,
extent={{-112.5,95.5},{-87.5,118.5}})));
Physiolibrary.Fluid.Interfaces.FluidPort_b q_out(redeclare package Medium =
Physiolibrary.Media.Air) annotation (Placement(transformation(rotation=0,
extent={{112.5,118.5},{137.5,141.5}})));
Physiolibrary.Fluid.Interfaces.FluidPort_a q_in1(redeclare package Medium =
Blood) annotation (Placement(transformation(rotation=0, extent={{-62.5,-111.5},
{-37.5,-88.5}})));
Physiolibrary.Fluid.Interfaces.FluidPort_b q_out1(redeclare package Medium =
Blood) annotation (Placement(transformation(rotation=0, extent={{87.5,-111.5},
{112.5,-88.5}})));
Physiolibrary.Fluid.Components.Resistor resistor1(redeclare package Medium =
Physiolibrary.Media.Air, Resistance=1/C_ventilace)
annotation (Placement(transformation(extent={{84,100},{104,120}})));
equation
connect(TlakAlveoly.q_in,Alveoly. q_in[1]) annotation (Line(
points={{128,60},{128,50},{86,50},{86,89.9},{-7.73333,89.9}},
color={127,0,0},
thickness=0.5));
connect(flowMeasure.q_in,Alveoly. q_in[2]) annotation (Line(
points={{38,110},{6,110},{6,89.9},{-6,89.9}},
color={127,0,0},
thickness=0.5));
connect(flowMeasure1.q_out,Alveoly. q_in[3]) annotation (Line(
points={{-26,110},{6,110},{6,89.9},{-4.26667,89.9}},
color={127,0,0},
thickness=0.5));
connect(flowMeasure1.q_in,conductor. q_out) annotation (Line(
points={{-46,110},{-62,110},{-62,112},{-70,112}},
color={127,0,0},
thickness=0.5));
connect(Alveoly.substances[1],O2. gas_port) annotation (Line(points={{-6,80},{
-6,56},{-24,56},{-24,50}}, color={158,66,200}));
connect(Alveoly.substances[2],CO2. gas_port) annotation (Line(points={{-6,80},
{-6,58},{10,58},{10,48}}, color={158,66,200}));
connect(TlakKapilaryPlice.q_in,elasticVessel1. q_in[1]) annotation (Line(
points={{48,-40},{48,-58},{12,-58},{12,-39.9},{9.95,-39.9}},
color={127,0,0},
thickness=0.5));
connect(O2.liquid_port,elasticVessel1. substances[2])
annotation (Line(points={{-24,30},{-24,-30},{8,-30}}, color={158,66,200}));
connect(CO2.liquid_port,elasticVessel1. substances[3])
annotation (Line(points={{10,28},{8,28},{8,-30}}, color={158,66,200}));
connect(pO2.referenceFluidPort,elasticVessel1. q_in[2]) annotation (Line(
points={{-78,36.2},{-80,36.2},{-80,46},{-78,46},{-78,-8},{-80,-8},{-80,-39.9},
{8.65,-39.9}},
color={127,0,0},
thickness=0.5));
connect(pCO2.referenceFluidPort,elasticVessel1. q_in[2]) annotation (Line(
points={{70,28.2},{70,-18},{26,-18},{26,-39.9},{8.65,-39.9}},
color={127,0,0},
thickness=0.5));
connect(O2.liquid_port,pO2. port_a) annotation (Line(points={{-24,30},{-24,8},
{-46,8},{-46,46},{-68,46}}, color={158,66,200}));
connect(CO2.liquid_port,pCO2. port_a) annotation (Line(points={{10,28},{8,28},
{8,10},{44,10},{44,38},{80,38}}, color={158,66,200}));
connect(conductor1.q_out, elasticVessel1.q_in[3]) annotation (Line(
points={{-4,-88},{14,-88},{14,-39.9},{7.35,-39.9}},
color={127,0,0},
thickness=0.5));
connect(conductor2.q_in, elasticVessel1.q_in[4]) annotation (Line(
points={{26,-86},{14,-86},{14,-39.9},{6.05,-39.9}},
color={127,0,0},
thickness=0.5));
connect(q_in, conductor.q_in) annotation (Line(points={{-100,107},{-96,107},{-96,
112},{-90,112}}, color={127,0,0}));
connect(q_in1, conductor1.q_in) annotation (Line(points={{-50,-100},{-50,-88},
{-24,-88}}, color={127,0,0}));
connect(q_out1, conductor2.q_out) annotation (Line(points={{100,-100},{100,
-86},{46,-86}}, color={127,0,0}));
connect(flowMeasure.q_out, resistor1.q_in) annotation (Line(
points={{58,110},{84,110}},
color={127,0,0},
thickness=0.5));
connect(resistor1.q_out, q_out) annotation (Line(
points={{104,110},{114,110},{114,112},{125,112},{125,130}},
color={127,0,0},
thickness=0.5));
annotation (
Diagram(coordinateSystem(extent={{-100,-100},{150,130}})),
Icon(coordinateSystem(extent={{-100,-100},{150,130}})));
end AlveolarniJednotka;
annotation (uses(
Physiolibrary(version="3.0.0-alpha8"),
Modelica(version="4.0.0"),
Chemical(version="1.4.0")));
end hack_ferkl;