# Feasibility Inquiry: Building a Chemical Process Simulation and Optimization Package with JuMP

**URL:** <https://discourse.julialang.org/t/feasibility-inquiry-building-a-chemical-process-simulation-and-optimization-package-with-jump/109236>\
**Category:** Specific Domains\
**Tags:** jump, chemical-engineering\
**Created:** [January 25, 2024, 5:06am UTC](https://discourse.julialang.org/t/feasibility-inquiry-building-a-chemical-process-simulation-and-optimization-package-with-jump/109236 "2024-01-25T05:06:28Z")\
**Posts on this page:** 5\
**Page:** 3

<div class="post-metadata">

**Author:** ![longemen3000](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/longemen3000/32/7298_2.png) [@longemen3000](https://discourse.julialang.org/u/longemen3000)\
**Post date:** [December 27, 2024, 5:16am UTC](https://discourse.julialang.org/t/feasibility-inquiry-building-a-chemical-process-simulation-and-optimization-package-with-jump/109236/42 "2024-12-27T05:16:07Z")

</div>

Seems like `Clapeyron.fugacity_coefficient` needs to be registered instead. I’m gonna take a look at it and release a new version of Clapeyron tomorrow

---

<div class="post-metadata">

**Author:** ![ysyecust](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ysyecust/32/210991_2.png) [@ysyecust](https://discourse.julialang.org/u/ysyecust)\
**Post date:** [December 27, 2024, 5:56am UTC](https://discourse.julialang.org/t/feasibility-inquiry-building-a-chemical-process-simulation-and-optimization-package-with-jump/109236/43 "2024-12-27T05:56:33Z")

</div>

I have another question that I haven’t found a good solution for: if my problem has 2 degrees of freedom and I have “n+2” variables and “n” equations, how should I switch the model when I’m modeling in MTK? In Pyomo, I can use “unfix/fix” to switch the state of the variables or I can explicitly ASSIGN certain variables in other modeling tools.

---

<div class="post-metadata">

**Author:** ![Vinicius\_Viena](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vinicius_viena/32/36579_2.png) [@Vinicius\_Viena](https://discourse.julialang.org/u/Vinicius_Viena)\
**Post date:** [December 30, 2024, 3:02am UTC](https://discourse.julialang.org/t/feasibility-inquiry-building-a-chemical-process-simulation-and-optimization-package-with-jump/109236/44 "2024-12-30T03:02:59Z")

</div>

Are you referring to any kind of degree of freedom or thermodynamic variables?

As far as I know, by setting state\_priority for a high value in the meta data of a variable, you can force a it to be a state instead of an observable.

---

<div class="post-metadata">

**Author:** ![ysyecust](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ysyecust/32/210991_2.png) [@ysyecust](https://discourse.julialang.org/u/ysyecust)\
**Post date:** [December 30, 2024, 3:22am UTC](https://discourse.julialang.org/t/feasibility-inquiry-building-a-chemical-process-simulation-and-optimization-package-with-jump/109236/45 "2024-12-30T03:22:02Z")

</div>

I should be referring to the degrees of freedom at the model level. For example, in the PTflash calculation, P, T, and vapor fraction are the three variables; P and T are fixed. By then, the P vapor fraction in PV flash is fixed; when I create problems with gPROMS or Pyomo, I usually set the three of them as variables and use ASSIGN or FIX to fix those fixed variables.

---

<div class="post-metadata">

**Author:** ![Vinicius\_Viena](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/vinicius_viena/32/36579_2.png) [@Vinicius\_Viena](https://discourse.julialang.org/u/Vinicius_Viena)\
**Post date:** [December 30, 2024, 3:56am UTC](https://discourse.julialang.org/t/feasibility-inquiry-building-a-chemical-process-simulation-and-optimization-package-with-jump/109236/46 "2024-12-30T03:56:21Z")

</div>

I see. I used gproms for a couple of years and IIRC, you can use ASSIGN to fix the value of a variable like in a procedural programming environment, e.g., P = 10, for example. Then, P is like a parameter and kept at this value for the whole simulation unless an event modify it with REASSIGN.

This is a bit confusing in gproms since P, in this example, could also be a parameter and everything would work in the same way.

I am not sure how gproms handle the ASSIGN keyword in terms of codegen, but in modelingtoolkit P ~ 10 does not define a procedure (it doesn’t assign the number 10 to P), it defines an equation that later is either solved or kept as an observable.

I don’t know how to mimic the ASSIGN behavior of gproms in modelingtoolkit.

[Previous page](https://discourse.julialang.org/t/feasibility-inquiry-building-a-chemical-process-simulation-and-optimization-package-with-jump/109236.md?page=2)
