# PowerModels in MAC OS

**URL:** <https://discourse.julialang.org/t/powermodels-in-mac-os/35384>\
**Category:** Optimization (Mathematical)\
**Tags:** question, package\
**Created:** [March 2, 2020, 3:04am UTC](https://discourse.julialang.org/t/powermodels-in-mac-os/35384 "2020-03-02T03:04:11Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![faoh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/faoh/32/9483_2.png) [@faoh](https://discourse.julialang.org/u/faoh)\
**Post date:** [March 2, 2020, 3:04am UTC](https://discourse.julialang.org/t/powermodels-in-mac-os/35384/1 "2020-03-02T03:04:11Z")

</div>

When I try to use build\_model to see the optimization model, it shows  
‘UndefVarError: build\_model not defined’.  
The code is  
pm = build\_model(“~/PowerModels.jl-master/test/data/matpower/case5\_tnep.m”, ACPPowerModel, PowerModels.post\_tnep, ref\_extensions=[ref\_add\_on\_off\_va\_bounds!,ref\_add\_ne\_branch!])  
This only happens in MAC OS. When I try this code in Windows, it works fine.  
Is there anything I need to change in MAC OS for PowerModels?

Thank you.

---

<div class="post-metadata">

**Author:** ![jling](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/jling/32/212909_2.png) [@jling](https://discourse.julialang.org/u/jling)\
**Post date:** [March 2, 2020, 3:16am UTC](https://discourse.julialang.org/t/powermodels-in-mac-os/35384/2 "2020-03-02T03:16:49Z")

</div>

> [@faoh](#):
>
> When I try this code in Windows,

can you show a minimal working example that works on Windows but not on MacOS?

---

<div class="post-metadata">

**Author:** ![ccoffrin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ccoffrin/32/400_2.png) [@ccoffrin](https://discourse.julialang.org/u/ccoffrin)\
**Post date:** [March 2, 2020, 3:19am UTC](https://discourse.julialang.org/t/powermodels-in-mac-os/35384/3 "2020-03-02T03:19:49Z")

</div>

It sounds like you have a more recent version of PowerModels on OS X than Windows. As of v0.14, `build_model` became `instantiate_model` and `post_tnep` became `build_tnep`.

I tested this on the latest release of PowerModels (v0.15.2) and it seemed to work as expected.

```julia
using PowerModels
pm = instantiate_model("test/data/matpower/case5_tnep.m", ACPPowerModel, PowerModels.build_tnep, ref_extensions=[ref_add_on_off_va_bounds!,ref_add_ne_branch!])

```

---

<div class="post-metadata">

**Author:** ![faoh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/faoh/32/9483_2.png) [@faoh](https://discourse.julialang.org/u/faoh)\
**Post date:** [March 2, 2020, 4:00pm UTC](https://discourse.julialang.org/t/powermodels-in-mac-os/35384/5 "2020-03-02T16:00:21Z")

</div>

It is the same code I use in Windows and Mac OS. I already got the answer and it is the PowerModels in two OS are different so the previous method doesn’t fit the latest version.

Thank you

---

<div class="post-metadata">

**Author:** ![faoh](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/faoh/32/9483_2.png) [@faoh](https://discourse.julialang.org/u/faoh)\
**Post date:** [March 2, 2020, 4:00pm UTC](https://discourse.julialang.org/t/powermodels-in-mac-os/35384/6 "2020-03-02T16:00:49Z")

</div>

Thank you! This is working. So for the V0.15.2, if I want to check the optimization model, I will use ‘instantiate\_model’ and ‘build\_tnep/opf/ost…’, right?  
For each version, do you have any document to emphasize the updates? I check the PowerModel website, but I couldn’t find ‘instantiate\_model’ or ‘build\_tnep’.

Thank you

---

<div class="post-metadata">

**Author:** ![ccoffrin](https://sea2.discourse-cdn.com/julialang/user_avatar/discourse.julialang.org/ccoffrin/32/400_2.png) [@ccoffrin](https://discourse.julialang.org/u/ccoffrin)\
**Post date:** [March 2, 2020, 4:42pm UTC](https://discourse.julialang.org/t/powermodels-in-mac-os/35384/7 "2020-03-02T16:42:23Z")

</div>

That is correct.

The documentation of PowerModels is up to date with the new names as far as as I can tell. If you find inconsistencies there please post an issue and they will be resolved.

[https://lanl-ansi.github.io/PowerModels.jl/stable/quickguide/#Building-PowerModels-from-Network-Data-Dictionaries-1](https://lanl-ansi.github.io/PowerModels.jl/stable/quickguide/#Building-PowerModels-from-Network-Data-Dictionaries-1)

The change log has a summary of what updates where made in each version,

> <https://github.com/lanl-ansi/PowerModels.jl/blob/master/CHANGELOG.md>

In some cases when many renames happen at once there is usually an issue to document it. For example see,

[https://github.com/lanl-ansi/PowerModels.jl/issues/538](https://github.com/lanl-ansi/PowerModels.jl/issues/538)
