summaryrefslogtreecommitdiff
path: root/Simulator/Flowsheet_12jac.c
blob: ee57508341f5d3cc830a69d960488e8d55487981 (plain)
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
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
1136
1137
1138
1139
1140
1141
1142
1143
1144
1145
1146
1147
1148
1149
1150
1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
1186
1187
1188
1189
1190
1191
1192
1193
1194
1195
1196
1197
1198
1199
1200
1201
1202
1203
1204
1205
1206
1207
1208
1209
1210
1211
1212
1213
1214
1215
1216
1217
1218
1219
1220
1221
1222
1223
1224
1225
1226
1227
1228
1229
1230
1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
1345
1346
1347
1348
1349
1350
1351
1352
1353
1354
1355
1356
/* Jacobians */
#include "Flowsheet_model.h"
#include "Flowsheet_12jac.h"

int Flowsheet_initialAnalyticJacobianNLSJac12(void* inData, threadData_t *threadData)
{
  TRACE_PUSH
  DATA* data = ((DATA*)inData);
  int index = Flowsheet_INDEX_JAC_NLSJac12;
  const int colPtrIndex[1+5] = {0,3,3,3,3,4};
  const int rowIndex[16] = {2,3,4,0,3,4,1,2,4,0,1,2,0,2,3,4};
  int i = 0;
  
  data->simulationInfo->analyticJacobians[index].sizeCols = 5;
  data->simulationInfo->analyticJacobians[index].sizeRows = 5;
  data->simulationInfo->analyticJacobians[index].sizeTmpVars = 8;
  data->simulationInfo->analyticJacobians[index].seedVars = (modelica_real*) calloc(5,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].resultVars = (modelica_real*) calloc(5,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].tmpVars = (modelica_real*) calloc(8,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex = (unsigned int*) malloc((5+1)*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.index = (unsigned int*) malloc(16*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.numberOfNoneZeros = 16;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols = (unsigned int*) malloc(5*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.maxColors = 5;
  data->simulationInfo->analyticJacobians[index].jacobian = NULL;
  
  /* write lead index of compressed sparse column */
  memcpy(data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex, colPtrIndex, (5+1)*sizeof(int));
  
  for(i=2;i<5+1;++i)
    data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex[i] += data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex[i-1];
  
  /* call sparse index */
  memcpy(data->simulationInfo->analyticJacobians[index].sparsePattern.index, rowIndex, 16*sizeof(int));
  
  /* write color array */
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[4] = 1;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[3] = 2;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[2] = 3;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[1] = 4;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[0] = 5;
  TRACE_POP
  return 0;
}

int Flowsheet_initialAnalyticJacobianNLSJac11(void* inData, threadData_t *threadData)
{
  TRACE_PUSH
  DATA* data = ((DATA*)inData);
  int index = Flowsheet_INDEX_JAC_NLSJac11;
  const int colPtrIndex[1+5] = {0,3,3,3,3,4};
  const int rowIndex[16] = {0,1,4,1,3,4,2,3,4,0,1,2,0,1,2,4};
  int i = 0;
  
  data->simulationInfo->analyticJacobians[index].sizeCols = 5;
  data->simulationInfo->analyticJacobians[index].sizeRows = 5;
  data->simulationInfo->analyticJacobians[index].sizeTmpVars = 8;
  data->simulationInfo->analyticJacobians[index].seedVars = (modelica_real*) calloc(5,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].resultVars = (modelica_real*) calloc(5,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].tmpVars = (modelica_real*) calloc(8,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex = (unsigned int*) malloc((5+1)*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.index = (unsigned int*) malloc(16*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.numberOfNoneZeros = 16;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols = (unsigned int*) malloc(5*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.maxColors = 5;
  data->simulationInfo->analyticJacobians[index].jacobian = NULL;
  
  /* write lead index of compressed sparse column */
  memcpy(data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex, colPtrIndex, (5+1)*sizeof(int));
  
  for(i=2;i<5+1;++i)
    data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex[i] += data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex[i-1];
  
  /* call sparse index */
  memcpy(data->simulationInfo->analyticJacobians[index].sparsePattern.index, rowIndex, 16*sizeof(int));
  
  /* write color array */
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[4] = 1;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[3] = 2;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[2] = 3;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[1] = 4;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[0] = 5;
  TRACE_POP
  return 0;
}

int Flowsheet_initialAnalyticJacobianNLSJac10(void* inData, threadData_t *threadData)
{
  TRACE_PUSH
  DATA* data = ((DATA*)inData);
  int index = Flowsheet_INDEX_JAC_NLSJac10;
  const int colPtrIndex[1+5] = {0,3,3,3,4,3};
  const int rowIndex[16] = {1,2,3,1,3,4,0,2,3,0,1,2,3,0,1,4};
  int i = 0;
  
  data->simulationInfo->analyticJacobians[index].sizeCols = 5;
  data->simulationInfo->analyticJacobians[index].sizeRows = 5;
  data->simulationInfo->analyticJacobians[index].sizeTmpVars = 8;
  data->simulationInfo->analyticJacobians[index].seedVars = (modelica_real*) calloc(5,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].resultVars = (modelica_real*) calloc(5,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].tmpVars = (modelica_real*) calloc(8,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex = (unsigned int*) malloc((5+1)*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.index = (unsigned int*) malloc(16*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.numberOfNoneZeros = 16;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols = (unsigned int*) malloc(5*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.maxColors = 5;
  data->simulationInfo->analyticJacobians[index].jacobian = NULL;
  
  /* write lead index of compressed sparse column */
  memcpy(data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex, colPtrIndex, (5+1)*sizeof(int));
  
  for(i=2;i<5+1;++i)
    data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex[i] += data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex[i-1];
  
  /* call sparse index */
  memcpy(data->simulationInfo->analyticJacobians[index].sparsePattern.index, rowIndex, 16*sizeof(int));
  
  /* write color array */
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[4] = 1;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[3] = 2;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[2] = 3;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[1] = 4;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[0] = 5;
  TRACE_POP
  return 0;
}

int Flowsheet_initialAnalyticJacobianNLSJac9(void* inData, threadData_t *threadData)
{
  TRACE_PUSH
  DATA* data = ((DATA*)inData);
  int index = Flowsheet_INDEX_JAC_NLSJac9;
  const int colPtrIndex[1+5] = {0,3,4,3,3,3};
  const int rowIndex[16] = {0,3,4,0,1,3,4,2,3,4,1,2,4,0,1,3};
  int i = 0;
  
  data->simulationInfo->analyticJacobians[index].sizeCols = 5;
  data->simulationInfo->analyticJacobians[index].sizeRows = 5;
  data->simulationInfo->analyticJacobians[index].sizeTmpVars = 8;
  data->simulationInfo->analyticJacobians[index].seedVars = (modelica_real*) calloc(5,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].resultVars = (modelica_real*) calloc(5,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].tmpVars = (modelica_real*) calloc(8,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex = (unsigned int*) malloc((5+1)*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.index = (unsigned int*) malloc(16*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.numberOfNoneZeros = 16;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols = (unsigned int*) malloc(5*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.maxColors = 5;
  data->simulationInfo->analyticJacobians[index].jacobian = NULL;
  
  /* write lead index of compressed sparse column */
  memcpy(data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex, colPtrIndex, (5+1)*sizeof(int));
  
  for(i=2;i<5+1;++i)
    data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex[i] += data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex[i-1];
  
  /* call sparse index */
  memcpy(data->simulationInfo->analyticJacobians[index].sparsePattern.index, rowIndex, 16*sizeof(int));
  
  /* write color array */
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[4] = 1;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[3] = 2;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[2] = 3;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[1] = 4;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[0] = 5;
  TRACE_POP
  return 0;
}

int Flowsheet_initialAnalyticJacobianLSJac8(void* inData, threadData_t *threadData)
{
  TRACE_PUSH
  DATA* data = ((DATA*)inData);
  int index = Flowsheet_INDEX_JAC_LSJac8;
  const int colPtrIndex[1+1] = {0,1};
  const int rowIndex[1] = {0};
  int i = 0;
  
  data->simulationInfo->analyticJacobians[index].sizeCols = 1;
  data->simulationInfo->analyticJacobians[index].sizeRows = 1;
  data->simulationInfo->analyticJacobians[index].sizeTmpVars = 2;
  data->simulationInfo->analyticJacobians[index].seedVars = (modelica_real*) calloc(1,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].resultVars = (modelica_real*) calloc(1,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].tmpVars = (modelica_real*) calloc(2,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex = (unsigned int*) malloc((1+1)*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.index = (unsigned int*) malloc(1*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.numberOfNoneZeros = 1;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols = (unsigned int*) malloc(1*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.maxColors = 1;
  data->simulationInfo->analyticJacobians[index].jacobian = NULL;
  
  /* write lead index of compressed sparse column */
  memcpy(data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex, colPtrIndex, (1+1)*sizeof(int));
  
  for(i=2;i<1+1;++i)
    data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex[i] += data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex[i-1];
  
  /* call sparse index */
  memcpy(data->simulationInfo->analyticJacobians[index].sparsePattern.index, rowIndex, 1*sizeof(int));
  
  /* write color array */
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[0] = 1;
  TRACE_POP
  return 0;
}

int Flowsheet_initialAnalyticJacobianLSJac5(void* inData, threadData_t *threadData)
{
  TRACE_PUSH
  DATA* data = ((DATA*)inData);
  int index = Flowsheet_INDEX_JAC_LSJac5;
  const int colPtrIndex[1+1] = {0,1};
  const int rowIndex[1] = {0};
  int i = 0;
  
  data->simulationInfo->analyticJacobians[index].sizeCols = 1;
  data->simulationInfo->analyticJacobians[index].sizeRows = 1;
  data->simulationInfo->analyticJacobians[index].sizeTmpVars = 2;
  data->simulationInfo->analyticJacobians[index].seedVars = (modelica_real*) calloc(1,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].resultVars = (modelica_real*) calloc(1,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].tmpVars = (modelica_real*) calloc(2,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex = (unsigned int*) malloc((1+1)*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.index = (unsigned int*) malloc(1*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.numberOfNoneZeros = 1;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols = (unsigned int*) malloc(1*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.maxColors = 1;
  data->simulationInfo->analyticJacobians[index].jacobian = NULL;
  
  /* write lead index of compressed sparse column */
  memcpy(data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex, colPtrIndex, (1+1)*sizeof(int));
  
  for(i=2;i<1+1;++i)
    data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex[i] += data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex[i-1];
  
  /* call sparse index */
  memcpy(data->simulationInfo->analyticJacobians[index].sparsePattern.index, rowIndex, 1*sizeof(int));
  
  /* write color array */
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[0] = 1;
  TRACE_POP
  return 0;
}

int Flowsheet_initialAnalyticJacobianLSJac2(void* inData, threadData_t *threadData)
{
  TRACE_PUSH
  DATA* data = ((DATA*)inData);
  int index = Flowsheet_INDEX_JAC_LSJac2;
  const int colPtrIndex[1+1] = {0,1};
  const int rowIndex[1] = {0};
  int i = 0;
  
  data->simulationInfo->analyticJacobians[index].sizeCols = 1;
  data->simulationInfo->analyticJacobians[index].sizeRows = 1;
  data->simulationInfo->analyticJacobians[index].sizeTmpVars = 2;
  data->simulationInfo->analyticJacobians[index].seedVars = (modelica_real*) calloc(1,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].resultVars = (modelica_real*) calloc(1,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].tmpVars = (modelica_real*) calloc(2,sizeof(modelica_real));
  data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex = (unsigned int*) malloc((1+1)*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.index = (unsigned int*) malloc(1*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.numberOfNoneZeros = 1;
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols = (unsigned int*) malloc(1*sizeof(int));
  data->simulationInfo->analyticJacobians[index].sparsePattern.maxColors = 1;
  data->simulationInfo->analyticJacobians[index].jacobian = NULL;
  
  /* write lead index of compressed sparse column */
  memcpy(data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex, colPtrIndex, (1+1)*sizeof(int));
  
  for(i=2;i<1+1;++i)
    data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex[i] += data->simulationInfo->analyticJacobians[index].sparsePattern.leadindex[i-1];
  
  /* call sparse index */
  memcpy(data->simulationInfo->analyticJacobians[index].sparsePattern.index, rowIndex, 1*sizeof(int));
  
  /* write color array */
  data->simulationInfo->analyticJacobians[index].sparsePattern.colorCols[0] = 1;
  TRACE_POP
  return 0;
}
int Flowsheet_initialAnalyticJacobianA(void* inData, threadData_t *threadData)
{
  TRACE_PUSH
  TRACE_POP
  return 1;
}
int Flowsheet_initialAnalyticJacobianB(void* inData, threadData_t *threadData)
{
  TRACE_PUSH
  TRACE_POP
  return 1;
}
int Flowsheet_initialAnalyticJacobianC(void* inData, threadData_t *threadData)
{
  TRACE_PUSH
  TRACE_POP
  return 1;
}
int Flowsheet_initialAnalyticJacobianD(void* inData, threadData_t *threadData)
{
  TRACE_PUSH
  TRACE_POP
  return 1;
}


/*
 equation index: 573
 type: SIMPLE_ASSIGN
 Heater1._xvapout._$pDERNLSJac12._dummyVarNLSJac12 = -MaterialStream2_xliqSeedNLSJac12
 */
void Flowsheet_eqFunction_573(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,573};
  $PHeater1$Pxvapout$P$pDERNLSJac12$PdummyVarNLSJac12 = (-$PMaterialStream2_xliqSeedNLSJac12);
  TRACE_POP
}

/*
 equation index: 574
 type: SIMPLE_ASSIGN
 MaterialStream2._F_p._3._$pDERNLSJac12._dummyVarNLSJac12 = -100.0 * MaterialStream2_xliqSeedNLSJac12
 */
void Flowsheet_eqFunction_574(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,574};
  $PMaterialStream2$PF_p$P3$P$pDERNLSJac12$PdummyVarNLSJac12 = (-100.0) * ($PMaterialStream2_xliqSeedNLSJac12);
  TRACE_POP
}

/*
 equation index: 575
 type: SIMPLE_ASSIGN
 MaterialStream2._F_p._2._$pDERNLSJac12._dummyVarNLSJac12 = 100.0 * MaterialStream2_xliqSeedNLSJac12
 */
void Flowsheet_eqFunction_575(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,575};
  $PMaterialStream2$PF_p$P2$P$pDERNLSJac12$PdummyVarNLSJac12 = (100.0) * ($PMaterialStream2_xliqSeedNLSJac12);
  TRACE_POP
}

/*
 equation index: 576
 type: SIMPLE_ASSIGN
 $res._1._$pDERNLSJac12._dummyVarNLSJac12 = if Heater1.Pout >= MaterialStream2.Pbubl then MaterialStream2_x_pc_2_2SeedNLSJac12 else if Heater1.Pout >= MaterialStream2.Pdew then MaterialStream2_x_pc_3_1SeedNLSJac12 + MaterialStream2_x_pc_3_2SeedNLSJac12 else MaterialStream2_x_pc_3_2SeedNLSJac12
 */
void Flowsheet_eqFunction_576(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,576};
  modelica_boolean tmp0;
  modelica_boolean tmp1;
  modelica_boolean tmp2;
  modelica_real tmp3;
  tmp0 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[146] /* MaterialStream2._Pbubl variable */);
  tmp2 = (modelica_boolean)tmp0;
  if(tmp2)
  {
    tmp3 = $PMaterialStream2_x_pc_2_2SeedNLSJac12;
  }
  else
  {
    tmp1 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[147] /* MaterialStream2._Pdew variable */);
    tmp3 = (tmp1?$PMaterialStream2_x_pc_3_1SeedNLSJac12 + $PMaterialStream2_x_pc_3_2SeedNLSJac12:$PMaterialStream2_x_pc_3_2SeedNLSJac12);
  }
  $P$res$P1$P$pDERNLSJac12$PdummyVarNLSJac12 = tmp3;
  TRACE_POP
}

/*
 equation index: 577
 type: SIMPLE_ASSIGN
 $res._2._$pDERNLSJac12._dummyVarNLSJac12 = if Heater1.Pout >= MaterialStream2.Pbubl then MaterialStream2_x_pc_3_1SeedNLSJac12 else if Heater1.Pout >= MaterialStream2.Pdew then MaterialStream2_x_pc_3_1SeedNLSJac12 - MaterialStream2.K_c[1] * MaterialStream2_x_pc_2_1SeedNLSJac12 else MaterialStream2_x_pc_2_1SeedNLSJac12
 */
void Flowsheet_eqFunction_577(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,577};
  modelica_boolean tmp4;
  modelica_boolean tmp5;
  modelica_boolean tmp6;
  modelica_real tmp7;
  tmp4 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[146] /* MaterialStream2._Pbubl variable */);
  tmp6 = (modelica_boolean)tmp4;
  if(tmp6)
  {
    tmp7 = $PMaterialStream2_x_pc_3_1SeedNLSJac12;
  }
  else
  {
    tmp5 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[147] /* MaterialStream2._Pdew variable */);
    tmp7 = (tmp5?$PMaterialStream2_x_pc_3_1SeedNLSJac12 - ((data->localData[0]->realVars[141] /* MaterialStream2._K_c[1] variable */) * ($PMaterialStream2_x_pc_2_1SeedNLSJac12)):$PMaterialStream2_x_pc_2_1SeedNLSJac12);
  }
  $P$res$P2$P$pDERNLSJac12$PdummyVarNLSJac12 = tmp7;
  TRACE_POP
}

/*
 equation index: 578
 type: SIMPLE_ASSIGN
 $res._3._$pDERNLSJac12._dummyVarNLSJac12 = if Heater1.Pout >= MaterialStream2.Pbubl then MaterialStream2_x_pc_2_1SeedNLSJac12 else if Heater1.Pout >= MaterialStream2.Pdew then MaterialStream2_x_pc_2_2SeedNLSJac12 + DIVISION(MaterialStream2.x_pc[1,2] * Heater1.xvapout.$pDERNLSJac12.dummyVarNLSJac12 * (-1.0 + MaterialStream2.K_c[2]), (1.0 + Heater1.xvapout * (-1.0 + MaterialStream2.K_c[2])) ^ 2.0) else MaterialStream2_x_pc_3_1SeedNLSJac12
 */
void Flowsheet_eqFunction_578(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,578};
  modelica_boolean tmp8;
  modelica_boolean tmp9;
  modelica_real tmp10;
  modelica_boolean tmp11;
  modelica_real tmp12;
  modelica_boolean tmp13;
  modelica_real tmp14;
  tmp8 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[146] /* MaterialStream2._Pbubl variable */);
  tmp13 = (modelica_boolean)tmp8;
  if(tmp13)
  {
    tmp14 = $PMaterialStream2_x_pc_2_1SeedNLSJac12;
  }
  else
  {
    tmp9 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[147] /* MaterialStream2._Pdew variable */);
    tmp11 = (modelica_boolean)tmp9;
    if(tmp11)
    {
      tmp10 = 1.0 + (data->localData[0]->realVars[9] /* Heater1._xvapout variable */) * (-1.0 + data->localData[0]->realVars[142] /* MaterialStream2._K_c[2] variable */);
      tmp12 = $PMaterialStream2_x_pc_2_2SeedNLSJac12 + DIVISION_SIM((data->localData[0]->realVars[173] /* MaterialStream2._x_pc[1,2] variable */) * (($PHeater1$Pxvapout$P$pDERNLSJac12$PdummyVarNLSJac12) * (-1.0 + data->localData[0]->realVars[142] /* MaterialStream2._K_c[2] variable */)),(tmp10 * tmp10),"(1.0 + Heater1.xvapout * (-1.0 + MaterialStream2.K_c[2])) ^ 2.0",equationIndexes);
    }
    else
    {
      tmp12 = $PMaterialStream2_x_pc_3_1SeedNLSJac12;
    }
    tmp14 = tmp12;
  }
  $P$res$P3$P$pDERNLSJac12$PdummyVarNLSJac12 = tmp14;
  TRACE_POP
}

/*
 equation index: 579
 type: SIMPLE_ASSIGN
 $res._4._$pDERNLSJac12._dummyVarNLSJac12 = if Heater1.Pout >= MaterialStream2.Pbubl then MaterialStream2.F_p.3.$pDERNLSJac12.dummyVarNLSJac12 else if Heater1.Pout >= MaterialStream2.Pdew then MaterialStream2_x_pc_3_2SeedNLSJac12 - MaterialStream2.K_c[2] * MaterialStream2_x_pc_2_2SeedNLSJac12 else MaterialStream2.F_p.2.$pDERNLSJac12.dummyVarNLSJac12
 */
void Flowsheet_eqFunction_579(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,579};
  modelica_boolean tmp15;
  modelica_boolean tmp16;
  modelica_boolean tmp17;
  modelica_real tmp18;
  tmp15 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[146] /* MaterialStream2._Pbubl variable */);
  tmp17 = (modelica_boolean)tmp15;
  if(tmp17)
  {
    tmp18 = $PMaterialStream2$PF_p$P3$P$pDERNLSJac12$PdummyVarNLSJac12;
  }
  else
  {
    tmp16 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[147] /* MaterialStream2._Pdew variable */);
    tmp18 = (tmp16?$PMaterialStream2_x_pc_3_2SeedNLSJac12 - ((data->localData[0]->realVars[142] /* MaterialStream2._K_c[2] variable */) * ($PMaterialStream2_x_pc_2_2SeedNLSJac12)):$PMaterialStream2$PF_p$P2$P$pDERNLSJac12$PdummyVarNLSJac12);
  }
  $P$res$P4$P$pDERNLSJac12$PdummyVarNLSJac12 = tmp18;
  TRACE_POP
}

/*
 equation index: 580
 type: SIMPLE_ASSIGN
 $res._5._$pDERNLSJac12._dummyVarNLSJac12 = if Heater1.Pout >= MaterialStream2.Pbubl then MaterialStream2_x_pc_3_2SeedNLSJac12 else if Heater1.Pout >= MaterialStream2.Pdew then MaterialStream2_x_pc_2_1SeedNLSJac12 + DIVISION(MaterialStream2.x_pc[1,1] * Heater1.xvapout.$pDERNLSJac12.dummyVarNLSJac12 * (-1.0 + MaterialStream2.K_c[1]), (1.0 + Heater1.xvapout * (-1.0 + MaterialStream2.K_c[1])) ^ 2.0) else MaterialStream2_x_pc_2_2SeedNLSJac12
 */
void Flowsheet_eqFunction_580(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,580};
  modelica_boolean tmp19;
  modelica_boolean tmp20;
  modelica_real tmp21;
  modelica_boolean tmp22;
  modelica_real tmp23;
  modelica_boolean tmp24;
  modelica_real tmp25;
  tmp19 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[146] /* MaterialStream2._Pbubl variable */);
  tmp24 = (modelica_boolean)tmp19;
  if(tmp24)
  {
    tmp25 = $PMaterialStream2_x_pc_3_2SeedNLSJac12;
  }
  else
  {
    tmp20 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[147] /* MaterialStream2._Pdew variable */);
    tmp22 = (modelica_boolean)tmp20;
    if(tmp22)
    {
      tmp21 = 1.0 + (data->localData[0]->realVars[9] /* Heater1._xvapout variable */) * (-1.0 + data->localData[0]->realVars[141] /* MaterialStream2._K_c[1] variable */);
      tmp23 = $PMaterialStream2_x_pc_2_1SeedNLSJac12 + DIVISION_SIM((data->localData[0]->realVars[172] /* MaterialStream2._x_pc[1,1] variable */) * (($PHeater1$Pxvapout$P$pDERNLSJac12$PdummyVarNLSJac12) * (-1.0 + data->localData[0]->realVars[141] /* MaterialStream2._K_c[1] variable */)),(tmp21 * tmp21),"(1.0 + Heater1.xvapout * (-1.0 + MaterialStream2.K_c[1])) ^ 2.0",equationIndexes);
    }
    else
    {
      tmp23 = $PMaterialStream2_x_pc_2_2SeedNLSJac12;
    }
    tmp25 = tmp23;
  }
  $P$res$P5$P$pDERNLSJac12$PdummyVarNLSJac12 = tmp25;
  TRACE_POP
}
int Flowsheet_functionJacNLSJac12_column(void* inData, threadData_t *threadData)
{
  TRACE_PUSH

  DATA* data = ((DATA*)inData);
  int index = Flowsheet_INDEX_JAC_NLSJac12;
  Flowsheet_eqFunction_573(data, threadData);

  Flowsheet_eqFunction_574(data, threadData);

  Flowsheet_eqFunction_575(data, threadData);

  Flowsheet_eqFunction_576(data, threadData);

  Flowsheet_eqFunction_577(data, threadData);

  Flowsheet_eqFunction_578(data, threadData);

  Flowsheet_eqFunction_579(data, threadData);

  Flowsheet_eqFunction_580(data, threadData);
  
  TRACE_POP
  return 0;
}

/*
 equation index: 515
 type: SIMPLE_ASSIGN
 Heater1._xvapin._$pDERNLSJac11._dummyVarNLSJac11 = -MaterialStream1_xliqSeedNLSJac11
 */
void Flowsheet_eqFunction_515(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,515};
  $PHeater1$Pxvapin$P$pDERNLSJac11$PdummyVarNLSJac11 = (-$PMaterialStream1_xliqSeedNLSJac11);
  TRACE_POP
}

/*
 equation index: 516
 type: SIMPLE_ASSIGN
 MaterialStream1._F_p._3._$pDERNLSJac11._dummyVarNLSJac11 = -100.0 * MaterialStream1_xliqSeedNLSJac11
 */
void Flowsheet_eqFunction_516(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,516};
  $PMaterialStream1$PF_p$P3$P$pDERNLSJac11$PdummyVarNLSJac11 = (-100.0) * ($PMaterialStream1_xliqSeedNLSJac11);
  TRACE_POP
}

/*
 equation index: 517
 type: SIMPLE_ASSIGN
 MaterialStream1._F_p._2._$pDERNLSJac11._dummyVarNLSJac11 = 100.0 * MaterialStream1_xliqSeedNLSJac11
 */
void Flowsheet_eqFunction_517(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,517};
  $PMaterialStream1$PF_p$P2$P$pDERNLSJac11$PdummyVarNLSJac11 = (100.0) * ($PMaterialStream1_xliqSeedNLSJac11);
  TRACE_POP
}

/*
 equation index: 518
 type: SIMPLE_ASSIGN
 $res._1._$pDERNLSJac11._dummyVarNLSJac11 = if 101325.0 >= MaterialStream1.Pbubl then MaterialStream1.F_p.3.$pDERNLSJac11.dummyVarNLSJac11 else if 101325.0 >= MaterialStream1.Pdew then MaterialStream1_x_pc_3_2SeedNLSJac11 - MaterialStream1.K_c[2] * MaterialStream1_x_pc_2_2SeedNLSJac11 else MaterialStream1.F_p.2.$pDERNLSJac11.dummyVarNLSJac11
 */
void Flowsheet_eqFunction_518(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,518};
  modelica_boolean tmp26;
  modelica_boolean tmp27;
  modelica_boolean tmp28;
  modelica_real tmp29;
  tmp26 = GreaterEq(101325.0,data->localData[0]->realVars[58] /* MaterialStream1._Pbubl variable */);
  tmp28 = (modelica_boolean)tmp26;
  if(tmp28)
  {
    tmp29 = $PMaterialStream1$PF_p$P3$P$pDERNLSJac11$PdummyVarNLSJac11;
  }
  else
  {
    tmp27 = GreaterEq(101325.0,data->localData[0]->realVars[59] /* MaterialStream1._Pdew variable */);
    tmp29 = (tmp27?$PMaterialStream1_x_pc_3_2SeedNLSJac11 - ((data->localData[0]->realVars[53] /* MaterialStream1._K_c[2] variable */) * ($PMaterialStream1_x_pc_2_2SeedNLSJac11)):$PMaterialStream1$PF_p$P2$P$pDERNLSJac11$PdummyVarNLSJac11);
  }
  $P$res$P1$P$pDERNLSJac11$PdummyVarNLSJac11 = tmp29;
  TRACE_POP
}

/*
 equation index: 519
 type: SIMPLE_ASSIGN
 $res._2._$pDERNLSJac11._dummyVarNLSJac11 = if 101325.0 >= MaterialStream1.Pbubl then MaterialStream1_x_pc_3_2SeedNLSJac11 else if 101325.0 >= MaterialStream1.Pdew then MaterialStream1_x_pc_2_1SeedNLSJac11 + DIVISION(MaterialStream1.x_pc[1,1] * Heater1.xvapin.$pDERNLSJac11.dummyVarNLSJac11 * (-1.0 + MaterialStream1.K_c[1]), (1.0 + Heater1.xvapin * (-1.0 + MaterialStream1.K_c[1])) ^ 2.0) else MaterialStream1_x_pc_2_2SeedNLSJac11
 */
void Flowsheet_eqFunction_519(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,519};
  modelica_boolean tmp30;
  modelica_boolean tmp31;
  modelica_real tmp32;
  modelica_boolean tmp33;
  modelica_real tmp34;
  modelica_boolean tmp35;
  modelica_real tmp36;
  tmp30 = GreaterEq(101325.0,data->localData[0]->realVars[58] /* MaterialStream1._Pbubl variable */);
  tmp35 = (modelica_boolean)tmp30;
  if(tmp35)
  {
    tmp36 = $PMaterialStream1_x_pc_3_2SeedNLSJac11;
  }
  else
  {
    tmp31 = GreaterEq(101325.0,data->localData[0]->realVars[59] /* MaterialStream1._Pdew variable */);
    tmp33 = (modelica_boolean)tmp31;
    if(tmp33)
    {
      tmp32 = 1.0 + (data->localData[0]->realVars[8] /* Heater1._xvapin variable */) * (-1.0 + data->localData[0]->realVars[52] /* MaterialStream1._K_c[1] variable */);
      tmp34 = $PMaterialStream1_x_pc_2_1SeedNLSJac11 + DIVISION_SIM((data->localData[0]->realVars[85] /* MaterialStream1._x_pc[1,1] variable */) * (($PHeater1$Pxvapin$P$pDERNLSJac11$PdummyVarNLSJac11) * (-1.0 + data->localData[0]->realVars[52] /* MaterialStream1._K_c[1] variable */)),(tmp32 * tmp32),"(1.0 + Heater1.xvapin * (-1.0 + MaterialStream1.K_c[1])) ^ 2.0",equationIndexes);
    }
    else
    {
      tmp34 = $PMaterialStream1_x_pc_2_2SeedNLSJac11;
    }
    tmp36 = tmp34;
  }
  $P$res$P2$P$pDERNLSJac11$PdummyVarNLSJac11 = tmp36;
  TRACE_POP
}

/*
 equation index: 520
 type: SIMPLE_ASSIGN
 $res._3._$pDERNLSJac11._dummyVarNLSJac11 = if 101325.0 >= MaterialStream1.Pbubl then MaterialStream1_x_pc_2_2SeedNLSJac11 else if 101325.0 >= MaterialStream1.Pdew then MaterialStream1_x_pc_3_1SeedNLSJac11 + MaterialStream1_x_pc_3_2SeedNLSJac11 else MaterialStream1_x_pc_3_2SeedNLSJac11
 */
void Flowsheet_eqFunction_520(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,520};
  modelica_boolean tmp37;
  modelica_boolean tmp38;
  modelica_boolean tmp39;
  modelica_real tmp40;
  tmp37 = GreaterEq(101325.0,data->localData[0]->realVars[58] /* MaterialStream1._Pbubl variable */);
  tmp39 = (modelica_boolean)tmp37;
  if(tmp39)
  {
    tmp40 = $PMaterialStream1_x_pc_2_2SeedNLSJac11;
  }
  else
  {
    tmp38 = GreaterEq(101325.0,data->localData[0]->realVars[59] /* MaterialStream1._Pdew variable */);
    tmp40 = (tmp38?$PMaterialStream1_x_pc_3_1SeedNLSJac11 + $PMaterialStream1_x_pc_3_2SeedNLSJac11:$PMaterialStream1_x_pc_3_2SeedNLSJac11);
  }
  $P$res$P3$P$pDERNLSJac11$PdummyVarNLSJac11 = tmp40;
  TRACE_POP
}

/*
 equation index: 521
 type: SIMPLE_ASSIGN
 $res._4._$pDERNLSJac11._dummyVarNLSJac11 = if 101325.0 >= MaterialStream1.Pbubl then MaterialStream1_x_pc_3_1SeedNLSJac11 else if 101325.0 >= MaterialStream1.Pdew then MaterialStream1_x_pc_3_1SeedNLSJac11 - MaterialStream1.K_c[1] * MaterialStream1_x_pc_2_1SeedNLSJac11 else MaterialStream1_x_pc_2_1SeedNLSJac11
 */
void Flowsheet_eqFunction_521(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,521};
  modelica_boolean tmp41;
  modelica_boolean tmp42;
  modelica_boolean tmp43;
  modelica_real tmp44;
  tmp41 = GreaterEq(101325.0,data->localData[0]->realVars[58] /* MaterialStream1._Pbubl variable */);
  tmp43 = (modelica_boolean)tmp41;
  if(tmp43)
  {
    tmp44 = $PMaterialStream1_x_pc_3_1SeedNLSJac11;
  }
  else
  {
    tmp42 = GreaterEq(101325.0,data->localData[0]->realVars[59] /* MaterialStream1._Pdew variable */);
    tmp44 = (tmp42?$PMaterialStream1_x_pc_3_1SeedNLSJac11 - ((data->localData[0]->realVars[52] /* MaterialStream1._K_c[1] variable */) * ($PMaterialStream1_x_pc_2_1SeedNLSJac11)):$PMaterialStream1_x_pc_2_1SeedNLSJac11);
  }
  $P$res$P4$P$pDERNLSJac11$PdummyVarNLSJac11 = tmp44;
  TRACE_POP
}

/*
 equation index: 522
 type: SIMPLE_ASSIGN
 $res._5._$pDERNLSJac11._dummyVarNLSJac11 = if 101325.0 >= MaterialStream1.Pbubl then MaterialStream1_x_pc_2_1SeedNLSJac11 else if 101325.0 >= MaterialStream1.Pdew then MaterialStream1_x_pc_2_2SeedNLSJac11 + DIVISION(MaterialStream1.x_pc[1,2] * Heater1.xvapin.$pDERNLSJac11.dummyVarNLSJac11 * (-1.0 + MaterialStream1.K_c[2]), (1.0 + Heater1.xvapin * (-1.0 + MaterialStream1.K_c[2])) ^ 2.0) else MaterialStream1_x_pc_3_1SeedNLSJac11
 */
void Flowsheet_eqFunction_522(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,522};
  modelica_boolean tmp45;
  modelica_boolean tmp46;
  modelica_real tmp47;
  modelica_boolean tmp48;
  modelica_real tmp49;
  modelica_boolean tmp50;
  modelica_real tmp51;
  tmp45 = GreaterEq(101325.0,data->localData[0]->realVars[58] /* MaterialStream1._Pbubl variable */);
  tmp50 = (modelica_boolean)tmp45;
  if(tmp50)
  {
    tmp51 = $PMaterialStream1_x_pc_2_1SeedNLSJac11;
  }
  else
  {
    tmp46 = GreaterEq(101325.0,data->localData[0]->realVars[59] /* MaterialStream1._Pdew variable */);
    tmp48 = (modelica_boolean)tmp46;
    if(tmp48)
    {
      tmp47 = 1.0 + (data->localData[0]->realVars[8] /* Heater1._xvapin variable */) * (-1.0 + data->localData[0]->realVars[53] /* MaterialStream1._K_c[2] variable */);
      tmp49 = $PMaterialStream1_x_pc_2_2SeedNLSJac11 + DIVISION_SIM((data->localData[0]->realVars[86] /* MaterialStream1._x_pc[1,2] variable */) * (($PHeater1$Pxvapin$P$pDERNLSJac11$PdummyVarNLSJac11) * (-1.0 + data->localData[0]->realVars[53] /* MaterialStream1._K_c[2] variable */)),(tmp47 * tmp47),"(1.0 + Heater1.xvapin * (-1.0 + MaterialStream1.K_c[2])) ^ 2.0",equationIndexes);
    }
    else
    {
      tmp49 = $PMaterialStream1_x_pc_3_1SeedNLSJac11;
    }
    tmp51 = tmp49;
  }
  $P$res$P5$P$pDERNLSJac11$PdummyVarNLSJac11 = tmp51;
  TRACE_POP
}
int Flowsheet_functionJacNLSJac11_column(void* inData, threadData_t *threadData)
{
  TRACE_PUSH

  DATA* data = ((DATA*)inData);
  int index = Flowsheet_INDEX_JAC_NLSJac11;
  Flowsheet_eqFunction_515(data, threadData);

  Flowsheet_eqFunction_516(data, threadData);

  Flowsheet_eqFunction_517(data, threadData);

  Flowsheet_eqFunction_518(data, threadData);

  Flowsheet_eqFunction_519(data, threadData);

  Flowsheet_eqFunction_520(data, threadData);

  Flowsheet_eqFunction_521(data, threadData);

  Flowsheet_eqFunction_522(data, threadData);
  
  TRACE_POP
  return 0;
}

/*
 equation index: 422
 type: SIMPLE_ASSIGN
 Heater1._xvapin._$pDERNLSJac10._dummyVarNLSJac10 = -MaterialStream1_xliqSeedNLSJac10
 */
void Flowsheet_eqFunction_422(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,422};
  $PHeater1$Pxvapin$P$pDERNLSJac10$PdummyVarNLSJac10 = (-$PMaterialStream1_xliqSeedNLSJac10);
  TRACE_POP
}

/*
 equation index: 423
 type: SIMPLE_ASSIGN
 MaterialStream1._F_p._3._$pDERNLSJac10._dummyVarNLSJac10 = -100.0 * MaterialStream1_xliqSeedNLSJac10
 */
void Flowsheet_eqFunction_423(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,423};
  $PMaterialStream1$PF_p$P3$P$pDERNLSJac10$PdummyVarNLSJac10 = (-100.0) * ($PMaterialStream1_xliqSeedNLSJac10);
  TRACE_POP
}

/*
 equation index: 424
 type: SIMPLE_ASSIGN
 MaterialStream1._F_p._2._$pDERNLSJac10._dummyVarNLSJac10 = 100.0 * MaterialStream1_xliqSeedNLSJac10
 */
void Flowsheet_eqFunction_424(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,424};
  $PMaterialStream1$PF_p$P2$P$pDERNLSJac10$PdummyVarNLSJac10 = (100.0) * ($PMaterialStream1_xliqSeedNLSJac10);
  TRACE_POP
}

/*
 equation index: 425
 type: SIMPLE_ASSIGN
 $res._1._$pDERNLSJac10._dummyVarNLSJac10 = if 101325.0 >= MaterialStream1.Pbubl then MaterialStream1_x_pc_2_2SeedNLSJac10 else if 101325.0 >= MaterialStream1.Pdew then MaterialStream1_x_pc_3_1SeedNLSJac10 + MaterialStream1_x_pc_3_2SeedNLSJac10 else MaterialStream1_x_pc_3_2SeedNLSJac10
 */
void Flowsheet_eqFunction_425(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,425};
  modelica_boolean tmp52;
  modelica_boolean tmp53;
  modelica_boolean tmp54;
  modelica_real tmp55;
  tmp52 = GreaterEq(101325.0,data->localData[0]->realVars[58] /* MaterialStream1._Pbubl variable */);
  tmp54 = (modelica_boolean)tmp52;
  if(tmp54)
  {
    tmp55 = $PMaterialStream1_x_pc_2_2SeedNLSJac10;
  }
  else
  {
    tmp53 = GreaterEq(101325.0,data->localData[0]->realVars[59] /* MaterialStream1._Pdew variable */);
    tmp55 = (tmp53?$PMaterialStream1_x_pc_3_1SeedNLSJac10 + $PMaterialStream1_x_pc_3_2SeedNLSJac10:$PMaterialStream1_x_pc_3_2SeedNLSJac10);
  }
  $P$res$P1$P$pDERNLSJac10$PdummyVarNLSJac10 = tmp55;
  TRACE_POP
}

/*
 equation index: 426
 type: SIMPLE_ASSIGN
 $res._2._$pDERNLSJac10._dummyVarNLSJac10 = if 101325.0 >= MaterialStream1.Pbubl then MaterialStream1_x_pc_2_1SeedNLSJac10 else if 101325.0 >= MaterialStream1.Pdew then MaterialStream1_x_pc_2_2SeedNLSJac10 + DIVISION(MaterialStream1.x_pc[1,2] * Heater1.xvapin.$pDERNLSJac10.dummyVarNLSJac10 * (-1.0 + MaterialStream1.K_c[2]), (1.0 + Heater1.xvapin * (-1.0 + MaterialStream1.K_c[2])) ^ 2.0) else MaterialStream1_x_pc_3_1SeedNLSJac10
 */
void Flowsheet_eqFunction_426(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,426};
  modelica_boolean tmp56;
  modelica_boolean tmp57;
  modelica_real tmp58;
  modelica_boolean tmp59;
  modelica_real tmp60;
  modelica_boolean tmp61;
  modelica_real tmp62;
  tmp56 = GreaterEq(101325.0,data->localData[0]->realVars[58] /* MaterialStream1._Pbubl variable */);
  tmp61 = (modelica_boolean)tmp56;
  if(tmp61)
  {
    tmp62 = $PMaterialStream1_x_pc_2_1SeedNLSJac10;
  }
  else
  {
    tmp57 = GreaterEq(101325.0,data->localData[0]->realVars[59] /* MaterialStream1._Pdew variable */);
    tmp59 = (modelica_boolean)tmp57;
    if(tmp59)
    {
      tmp58 = 1.0 + (data->localData[0]->realVars[8] /* Heater1._xvapin variable */) * (-1.0 + data->localData[0]->realVars[53] /* MaterialStream1._K_c[2] variable */);
      tmp60 = $PMaterialStream1_x_pc_2_2SeedNLSJac10 + DIVISION_SIM((data->localData[0]->realVars[86] /* MaterialStream1._x_pc[1,2] variable */) * (($PHeater1$Pxvapin$P$pDERNLSJac10$PdummyVarNLSJac10) * (-1.0 + data->localData[0]->realVars[53] /* MaterialStream1._K_c[2] variable */)),(tmp58 * tmp58),"(1.0 + Heater1.xvapin * (-1.0 + MaterialStream1.K_c[2])) ^ 2.0",equationIndexes);
    }
    else
    {
      tmp60 = $PMaterialStream1_x_pc_3_1SeedNLSJac10;
    }
    tmp62 = tmp60;
  }
  $P$res$P2$P$pDERNLSJac10$PdummyVarNLSJac10 = tmp62;
  TRACE_POP
}

/*
 equation index: 427
 type: SIMPLE_ASSIGN
 $res._3._$pDERNLSJac10._dummyVarNLSJac10 = if 101325.0 >= MaterialStream1.Pbubl then MaterialStream1.F_p.3.$pDERNLSJac10.dummyVarNLSJac10 else if 101325.0 >= MaterialStream1.Pdew then MaterialStream1_x_pc_3_2SeedNLSJac10 - MaterialStream1.K_c[2] * MaterialStream1_x_pc_2_2SeedNLSJac10 else MaterialStream1.F_p.2.$pDERNLSJac10.dummyVarNLSJac10
 */
void Flowsheet_eqFunction_427(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,427};
  modelica_boolean tmp63;
  modelica_boolean tmp64;
  modelica_boolean tmp65;
  modelica_real tmp66;
  tmp63 = GreaterEq(101325.0,data->localData[0]->realVars[58] /* MaterialStream1._Pbubl variable */);
  tmp65 = (modelica_boolean)tmp63;
  if(tmp65)
  {
    tmp66 = $PMaterialStream1$PF_p$P3$P$pDERNLSJac10$PdummyVarNLSJac10;
  }
  else
  {
    tmp64 = GreaterEq(101325.0,data->localData[0]->realVars[59] /* MaterialStream1._Pdew variable */);
    tmp66 = (tmp64?$PMaterialStream1_x_pc_3_2SeedNLSJac10 - ((data->localData[0]->realVars[53] /* MaterialStream1._K_c[2] variable */) * ($PMaterialStream1_x_pc_2_2SeedNLSJac10)):$PMaterialStream1$PF_p$P2$P$pDERNLSJac10$PdummyVarNLSJac10);
  }
  $P$res$P3$P$pDERNLSJac10$PdummyVarNLSJac10 = tmp66;
  TRACE_POP
}

/*
 equation index: 428
 type: SIMPLE_ASSIGN
 $res._4._$pDERNLSJac10._dummyVarNLSJac10 = if 101325.0 >= MaterialStream1.Pbubl then MaterialStream1_x_pc_3_2SeedNLSJac10 else if 101325.0 >= MaterialStream1.Pdew then MaterialStream1_x_pc_2_1SeedNLSJac10 + DIVISION(MaterialStream1.x_pc[1,1] * Heater1.xvapin.$pDERNLSJac10.dummyVarNLSJac10 * (-1.0 + MaterialStream1.K_c[1]), (1.0 + Heater1.xvapin * (-1.0 + MaterialStream1.K_c[1])) ^ 2.0) else MaterialStream1_x_pc_2_2SeedNLSJac10
 */
void Flowsheet_eqFunction_428(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,428};
  modelica_boolean tmp67;
  modelica_boolean tmp68;
  modelica_real tmp69;
  modelica_boolean tmp70;
  modelica_real tmp71;
  modelica_boolean tmp72;
  modelica_real tmp73;
  tmp67 = GreaterEq(101325.0,data->localData[0]->realVars[58] /* MaterialStream1._Pbubl variable */);
  tmp72 = (modelica_boolean)tmp67;
  if(tmp72)
  {
    tmp73 = $PMaterialStream1_x_pc_3_2SeedNLSJac10;
  }
  else
  {
    tmp68 = GreaterEq(101325.0,data->localData[0]->realVars[59] /* MaterialStream1._Pdew variable */);
    tmp70 = (modelica_boolean)tmp68;
    if(tmp70)
    {
      tmp69 = 1.0 + (data->localData[0]->realVars[8] /* Heater1._xvapin variable */) * (-1.0 + data->localData[0]->realVars[52] /* MaterialStream1._K_c[1] variable */);
      tmp71 = $PMaterialStream1_x_pc_2_1SeedNLSJac10 + DIVISION_SIM((data->localData[0]->realVars[85] /* MaterialStream1._x_pc[1,1] variable */) * (($PHeater1$Pxvapin$P$pDERNLSJac10$PdummyVarNLSJac10) * (-1.0 + data->localData[0]->realVars[52] /* MaterialStream1._K_c[1] variable */)),(tmp69 * tmp69),"(1.0 + Heater1.xvapin * (-1.0 + MaterialStream1.K_c[1])) ^ 2.0",equationIndexes);
    }
    else
    {
      tmp71 = $PMaterialStream1_x_pc_2_2SeedNLSJac10;
    }
    tmp73 = tmp71;
  }
  $P$res$P4$P$pDERNLSJac10$PdummyVarNLSJac10 = tmp73;
  TRACE_POP
}

/*
 equation index: 429
 type: SIMPLE_ASSIGN
 $res._5._$pDERNLSJac10._dummyVarNLSJac10 = if 101325.0 >= MaterialStream1.Pbubl then MaterialStream1_x_pc_3_1SeedNLSJac10 else if 101325.0 >= MaterialStream1.Pdew then MaterialStream1_x_pc_3_1SeedNLSJac10 - MaterialStream1.K_c[1] * MaterialStream1_x_pc_2_1SeedNLSJac10 else MaterialStream1_x_pc_2_1SeedNLSJac10
 */
void Flowsheet_eqFunction_429(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,429};
  modelica_boolean tmp74;
  modelica_boolean tmp75;
  modelica_boolean tmp76;
  modelica_real tmp77;
  tmp74 = GreaterEq(101325.0,data->localData[0]->realVars[58] /* MaterialStream1._Pbubl variable */);
  tmp76 = (modelica_boolean)tmp74;
  if(tmp76)
  {
    tmp77 = $PMaterialStream1_x_pc_3_1SeedNLSJac10;
  }
  else
  {
    tmp75 = GreaterEq(101325.0,data->localData[0]->realVars[59] /* MaterialStream1._Pdew variable */);
    tmp77 = (tmp75?$PMaterialStream1_x_pc_3_1SeedNLSJac10 - ((data->localData[0]->realVars[52] /* MaterialStream1._K_c[1] variable */) * ($PMaterialStream1_x_pc_2_1SeedNLSJac10)):$PMaterialStream1_x_pc_2_1SeedNLSJac10);
  }
  $P$res$P5$P$pDERNLSJac10$PdummyVarNLSJac10 = tmp77;
  TRACE_POP
}
int Flowsheet_functionJacNLSJac10_column(void* inData, threadData_t *threadData)
{
  TRACE_PUSH

  DATA* data = ((DATA*)inData);
  int index = Flowsheet_INDEX_JAC_NLSJac10;
  Flowsheet_eqFunction_422(data, threadData);

  Flowsheet_eqFunction_423(data, threadData);

  Flowsheet_eqFunction_424(data, threadData);

  Flowsheet_eqFunction_425(data, threadData);

  Flowsheet_eqFunction_426(data, threadData);

  Flowsheet_eqFunction_427(data, threadData);

  Flowsheet_eqFunction_428(data, threadData);

  Flowsheet_eqFunction_429(data, threadData);
  
  TRACE_POP
  return 0;
}

/*
 equation index: 368
 type: SIMPLE_ASSIGN
 Heater1._xvapout._$pDERNLSJac9._dummyVarNLSJac9 = -MaterialStream2_xliqSeedNLSJac9
 */
void Flowsheet_eqFunction_368(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,368};
  $PHeater1$Pxvapout$P$pDERNLSJac9$PdummyVarNLSJac9 = (-$PMaterialStream2_xliqSeedNLSJac9);
  TRACE_POP
}

/*
 equation index: 369
 type: SIMPLE_ASSIGN
 MaterialStream2._F_p._3._$pDERNLSJac9._dummyVarNLSJac9 = -100.0 * MaterialStream2_xliqSeedNLSJac9
 */
void Flowsheet_eqFunction_369(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,369};
  $PMaterialStream2$PF_p$P3$P$pDERNLSJac9$PdummyVarNLSJac9 = (-100.0) * ($PMaterialStream2_xliqSeedNLSJac9);
  TRACE_POP
}

/*
 equation index: 370
 type: SIMPLE_ASSIGN
 MaterialStream2._F_p._2._$pDERNLSJac9._dummyVarNLSJac9 = 100.0 * MaterialStream2_xliqSeedNLSJac9
 */
void Flowsheet_eqFunction_370(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,370};
  $PMaterialStream2$PF_p$P2$P$pDERNLSJac9$PdummyVarNLSJac9 = (100.0) * ($PMaterialStream2_xliqSeedNLSJac9);
  TRACE_POP
}

/*
 equation index: 371
 type: SIMPLE_ASSIGN
 $res._1._$pDERNLSJac9._dummyVarNLSJac9 = if Heater1.Pout >= MaterialStream2.Pbubl then MaterialStream2.F_p.3.$pDERNLSJac9.dummyVarNLSJac9 else if Heater1.Pout >= MaterialStream2.Pdew then MaterialStream2_x_pc_3_2SeedNLSJac9 - MaterialStream2.K_c[2] * MaterialStream2_x_pc_2_2SeedNLSJac9 else MaterialStream2.F_p.2.$pDERNLSJac9.dummyVarNLSJac9
 */
void Flowsheet_eqFunction_371(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,371};
  modelica_boolean tmp78;
  modelica_boolean tmp79;
  modelica_boolean tmp80;
  modelica_real tmp81;
  tmp78 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[146] /* MaterialStream2._Pbubl variable */);
  tmp80 = (modelica_boolean)tmp78;
  if(tmp80)
  {
    tmp81 = $PMaterialStream2$PF_p$P3$P$pDERNLSJac9$PdummyVarNLSJac9;
  }
  else
  {
    tmp79 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[147] /* MaterialStream2._Pdew variable */);
    tmp81 = (tmp79?$PMaterialStream2_x_pc_3_2SeedNLSJac9 - ((data->localData[0]->realVars[142] /* MaterialStream2._K_c[2] variable */) * ($PMaterialStream2_x_pc_2_2SeedNLSJac9)):$PMaterialStream2$PF_p$P2$P$pDERNLSJac9$PdummyVarNLSJac9);
  }
  $P$res$P1$P$pDERNLSJac9$PdummyVarNLSJac9 = tmp81;
  TRACE_POP
}

/*
 equation index: 372
 type: SIMPLE_ASSIGN
 $res._2._$pDERNLSJac9._dummyVarNLSJac9 = if Heater1.Pout >= MaterialStream2.Pbubl then MaterialStream2_x_pc_2_2SeedNLSJac9 else if Heater1.Pout >= MaterialStream2.Pdew then MaterialStream2_x_pc_3_1SeedNLSJac9 + MaterialStream2_x_pc_3_2SeedNLSJac9 else MaterialStream2_x_pc_3_2SeedNLSJac9
 */
void Flowsheet_eqFunction_372(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,372};
  modelica_boolean tmp82;
  modelica_boolean tmp83;
  modelica_boolean tmp84;
  modelica_real tmp85;
  tmp82 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[146] /* MaterialStream2._Pbubl variable */);
  tmp84 = (modelica_boolean)tmp82;
  if(tmp84)
  {
    tmp85 = $PMaterialStream2_x_pc_2_2SeedNLSJac9;
  }
  else
  {
    tmp83 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[147] /* MaterialStream2._Pdew variable */);
    tmp85 = (tmp83?$PMaterialStream2_x_pc_3_1SeedNLSJac9 + $PMaterialStream2_x_pc_3_2SeedNLSJac9:$PMaterialStream2_x_pc_3_2SeedNLSJac9);
  }
  $P$res$P2$P$pDERNLSJac9$PdummyVarNLSJac9 = tmp85;
  TRACE_POP
}

/*
 equation index: 373
 type: SIMPLE_ASSIGN
 $res._3._$pDERNLSJac9._dummyVarNLSJac9 = if Heater1.Pout >= MaterialStream2.Pbubl then MaterialStream2_x_pc_3_1SeedNLSJac9 else if Heater1.Pout >= MaterialStream2.Pdew then MaterialStream2_x_pc_3_1SeedNLSJac9 - MaterialStream2.K_c[1] * MaterialStream2_x_pc_2_1SeedNLSJac9 else MaterialStream2_x_pc_2_1SeedNLSJac9
 */
void Flowsheet_eqFunction_373(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,373};
  modelica_boolean tmp86;
  modelica_boolean tmp87;
  modelica_boolean tmp88;
  modelica_real tmp89;
  tmp86 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[146] /* MaterialStream2._Pbubl variable */);
  tmp88 = (modelica_boolean)tmp86;
  if(tmp88)
  {
    tmp89 = $PMaterialStream2_x_pc_3_1SeedNLSJac9;
  }
  else
  {
    tmp87 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[147] /* MaterialStream2._Pdew variable */);
    tmp89 = (tmp87?$PMaterialStream2_x_pc_3_1SeedNLSJac9 - ((data->localData[0]->realVars[141] /* MaterialStream2._K_c[1] variable */) * ($PMaterialStream2_x_pc_2_1SeedNLSJac9)):$PMaterialStream2_x_pc_2_1SeedNLSJac9);
  }
  $P$res$P3$P$pDERNLSJac9$PdummyVarNLSJac9 = tmp89;
  TRACE_POP
}

/*
 equation index: 374
 type: SIMPLE_ASSIGN
 $res._4._$pDERNLSJac9._dummyVarNLSJac9 = if Heater1.Pout >= MaterialStream2.Pbubl then MaterialStream2_x_pc_3_2SeedNLSJac9 else if Heater1.Pout >= MaterialStream2.Pdew then MaterialStream2_x_pc_2_1SeedNLSJac9 + DIVISION(MaterialStream2.x_pc[1,1] * Heater1.xvapout.$pDERNLSJac9.dummyVarNLSJac9 * (-1.0 + MaterialStream2.K_c[1]), (1.0 + Heater1.xvapout * (-1.0 + MaterialStream2.K_c[1])) ^ 2.0) else MaterialStream2_x_pc_2_2SeedNLSJac9
 */
void Flowsheet_eqFunction_374(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,374};
  modelica_boolean tmp90;
  modelica_boolean tmp91;
  modelica_real tmp92;
  modelica_boolean tmp93;
  modelica_real tmp94;
  modelica_boolean tmp95;
  modelica_real tmp96;
  tmp90 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[146] /* MaterialStream2._Pbubl variable */);
  tmp95 = (modelica_boolean)tmp90;
  if(tmp95)
  {
    tmp96 = $PMaterialStream2_x_pc_3_2SeedNLSJac9;
  }
  else
  {
    tmp91 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[147] /* MaterialStream2._Pdew variable */);
    tmp93 = (modelica_boolean)tmp91;
    if(tmp93)
    {
      tmp92 = 1.0 + (data->localData[0]->realVars[9] /* Heater1._xvapout variable */) * (-1.0 + data->localData[0]->realVars[141] /* MaterialStream2._K_c[1] variable */);
      tmp94 = $PMaterialStream2_x_pc_2_1SeedNLSJac9 + DIVISION_SIM((data->localData[0]->realVars[172] /* MaterialStream2._x_pc[1,1] variable */) * (($PHeater1$Pxvapout$P$pDERNLSJac9$PdummyVarNLSJac9) * (-1.0 + data->localData[0]->realVars[141] /* MaterialStream2._K_c[1] variable */)),(tmp92 * tmp92),"(1.0 + Heater1.xvapout * (-1.0 + MaterialStream2.K_c[1])) ^ 2.0",equationIndexes);
    }
    else
    {
      tmp94 = $PMaterialStream2_x_pc_2_2SeedNLSJac9;
    }
    tmp96 = tmp94;
  }
  $P$res$P4$P$pDERNLSJac9$PdummyVarNLSJac9 = tmp96;
  TRACE_POP
}

/*
 equation index: 375
 type: SIMPLE_ASSIGN
 $res._5._$pDERNLSJac9._dummyVarNLSJac9 = if Heater1.Pout >= MaterialStream2.Pbubl then MaterialStream2_x_pc_2_1SeedNLSJac9 else if Heater1.Pout >= MaterialStream2.Pdew then MaterialStream2_x_pc_2_2SeedNLSJac9 + DIVISION(MaterialStream2.x_pc[1,2] * Heater1.xvapout.$pDERNLSJac9.dummyVarNLSJac9 * (-1.0 + MaterialStream2.K_c[2]), (1.0 + Heater1.xvapout * (-1.0 + MaterialStream2.K_c[2])) ^ 2.0) else MaterialStream2_x_pc_3_1SeedNLSJac9
 */
void Flowsheet_eqFunction_375(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,375};
  modelica_boolean tmp97;
  modelica_boolean tmp98;
  modelica_real tmp99;
  modelica_boolean tmp100;
  modelica_real tmp101;
  modelica_boolean tmp102;
  modelica_real tmp103;
  tmp97 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[146] /* MaterialStream2._Pbubl variable */);
  tmp102 = (modelica_boolean)tmp97;
  if(tmp102)
  {
    tmp103 = $PMaterialStream2_x_pc_2_1SeedNLSJac9;
  }
  else
  {
    tmp98 = GreaterEq(data->localData[0]->realVars[4] /* Heater1._Pout variable */,data->localData[0]->realVars[147] /* MaterialStream2._Pdew variable */);
    tmp100 = (modelica_boolean)tmp98;
    if(tmp100)
    {
      tmp99 = 1.0 + (data->localData[0]->realVars[9] /* Heater1._xvapout variable */) * (-1.0 + data->localData[0]->realVars[142] /* MaterialStream2._K_c[2] variable */);
      tmp101 = $PMaterialStream2_x_pc_2_2SeedNLSJac9 + DIVISION_SIM((data->localData[0]->realVars[173] /* MaterialStream2._x_pc[1,2] variable */) * (($PHeater1$Pxvapout$P$pDERNLSJac9$PdummyVarNLSJac9) * (-1.0 + data->localData[0]->realVars[142] /* MaterialStream2._K_c[2] variable */)),(tmp99 * tmp99),"(1.0 + Heater1.xvapout * (-1.0 + MaterialStream2.K_c[2])) ^ 2.0",equationIndexes);
    }
    else
    {
      tmp101 = $PMaterialStream2_x_pc_3_1SeedNLSJac9;
    }
    tmp103 = tmp101;
  }
  $P$res$P5$P$pDERNLSJac9$PdummyVarNLSJac9 = tmp103;
  TRACE_POP
}
int Flowsheet_functionJacNLSJac9_column(void* inData, threadData_t *threadData)
{
  TRACE_PUSH

  DATA* data = ((DATA*)inData);
  int index = Flowsheet_INDEX_JAC_NLSJac9;
  Flowsheet_eqFunction_368(data, threadData);

  Flowsheet_eqFunction_369(data, threadData);

  Flowsheet_eqFunction_370(data, threadData);

  Flowsheet_eqFunction_371(data, threadData);

  Flowsheet_eqFunction_372(data, threadData);

  Flowsheet_eqFunction_373(data, threadData);

  Flowsheet_eqFunction_374(data, threadData);

  Flowsheet_eqFunction_375(data, threadData);
  
  TRACE_POP
  return 0;
}

/*
 equation index: 297
 type: SIMPLE_ASSIGN
 $res._1._$pDERLSJac8._dummyVarLSJac8 = (MaterialStream1.yg[1] - MaterialStream1.xg[1]) * MaterialStream1_FvapgSeedLSJac8
 */
void Flowsheet_eqFunction_297(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,297};
  $P$res$P1$P$pDERLSJac8$PdummyVarLSJac8 = (data->simulationInfo->realParameter[649] - data->simulationInfo->realParameter[641]) * ($PMaterialStream1_FvapgSeedLSJac8);
  TRACE_POP
}
int Flowsheet_functionJacLSJac8_column(void* inData, threadData_t *threadData)
{
  TRACE_PUSH

  DATA* data = ((DATA*)inData);
  int index = Flowsheet_INDEX_JAC_LSJac8;
  Flowsheet_eqFunction_297(data, threadData);
  
  TRACE_POP
  return 0;
}

/*
 equation index: 189
 type: SIMPLE_ASSIGN
 $res._1._$pDERLSJac5._dummyVarLSJac5 = (MaterialStream2.yg[1] - MaterialStream2.xg[1]) * MaterialStream2_FvapgSeedLSJac5
 */
void Flowsheet_eqFunction_189(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,189};
  $P$res$P1$P$pDERLSJac5$PdummyVarLSJac5 = (data->simulationInfo->realParameter[856] - data->simulationInfo->realParameter[848]) * ($PMaterialStream2_FvapgSeedLSJac5);
  TRACE_POP
}
int Flowsheet_functionJacLSJac5_column(void* inData, threadData_t *threadData)
{
  TRACE_PUSH

  DATA* data = ((DATA*)inData);
  int index = Flowsheet_INDEX_JAC_LSJac5;
  Flowsheet_eqFunction_189(data, threadData);
  
  TRACE_POP
  return 0;
}

/*
 equation index: 95
 type: SIMPLE_ASSIGN
 $res._1._$pDERLSJac2._dummyVarLSJac2 = (Heater1.yg[1] - Heater1.xg[1]) * Heater1_FvapgSeedLSJac2
 */
void Flowsheet_eqFunction_95(DATA *data, threadData_t *threadData)
{
  TRACE_PUSH
  const int clockIndex = 0;
  const int equationIndexes[2] = {1,95};
  $P$res$P1$P$pDERLSJac2$PdummyVarLSJac2 = (data->simulationInfo->realParameter[442] - data->simulationInfo->realParameter[434]) * ($PHeater1_FvapgSeedLSJac2);
  TRACE_POP
}
int Flowsheet_functionJacLSJac2_column(void* inData, threadData_t *threadData)
{
  TRACE_PUSH

  DATA* data = ((DATA*)inData);
  int index = Flowsheet_INDEX_JAC_LSJac2;
  Flowsheet_eqFunction_95(data, threadData);
  
  TRACE_POP
  return 0;
}
int Flowsheet_functionJacA_column(void* data, threadData_t *threadData)
{
  TRACE_PUSH
  TRACE_POP
  return 0;
}
int Flowsheet_functionJacB_column(void* data, threadData_t *threadData)
{
  TRACE_PUSH
  TRACE_POP
  return 0;
}
int Flowsheet_functionJacC_column(void* data, threadData_t *threadData)
{
  TRACE_PUSH
  TRACE_POP
  return 0;
}
int Flowsheet_functionJacD_column(void* data, threadData_t *threadData)
{
  TRACE_PUSH
  TRACE_POP
  return 0;
}