# Error while running the simulations

**URL:** <https://discourse.pumas.ai/t/error-while-running-the-simulations/1385>\
**Category:** Uncategorized\
**Created:** [March 3, 2026, 1:02pm UTC](https://discourse.pumas.ai/t/error-while-running-the-simulations/1385 "2026-03-03T13:02:17Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bhargav](https://avatars.discourse-cdn.com/v4/letter/b/dfb087/32.png) [@Bhargav](https://discourse.pumas.ai/u/Bhargav)\
**Post date:** [March 3, 2026, 1:02pm UTC](https://discourse.pumas.ai/t/error-while-running-the-simulations/1385/1 "2026-03-03T13:02:17Z")

</div>

Hi everyone,

I am trying to simulate a two-compartment Rucaparib PopPK model in **Pumas** , based on the FDA model (Green et al., 2022).

When I run `simobs`, I get the following error:

ERROR: UndefVarError: `F1` not defined in `Main`  
Suggestion: check for spelling errors or missing imports.  
Stacktrace:  
[1] (::var"#643#653")(\_para@NamedTupl@NamedTupl@NamedTuple::@NamedTuple{…}, \_rando@NamedTupl@NamedTupl@NamedTuple::@NamedTuple{…}, \_subject::Subject{…})  
@ Main .\none:983  
[2] DCPObj  
@ .\none:1070 [inlined]  
[3] dcp(model::PumasModel{…}, subject::Subject{…}, para@NamedTupl@NamedTupl@NamedTuple::@NamedTuple{…}, randeff@NamedTupl@NamedTupl@NamedTuple::@NamedTuple{…})  
@ Pumas .\none:3185  
[4] \_check\_dose\_compartments(model::PumasModel{…}, subject::Subject{…}, para@NamedTupl@NamedTupl@NamedTuple::@NamedTuple{…}, \_randeff@NamedTupl@NamedTupl@NamedTuple::@NamedTuple{…})  
@ Pumas .\none:5426  
[5] \_simobs(…)

---

<div class="post-metadata">

**Author:** ![Bhargav](https://avatars.discourse-cdn.com/v4/letter/b/dfb087/32.png) [@Bhargav](https://discourse.pumas.ai/u/Bhargav)\
**Post date:** [March 3, 2026, 1:05pm UTC](https://discourse.pumas.ai/t/error-while-running-the-simulations/1385/2 "2026-03-03T13:05:09Z")

</div>

![image](https://canada1.discourse-cdn.com/flex030/uploads/pumas/original/1X/eb41edbdd0b9a7f6e1ec6602761a27e92f887c7a.png)

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/pumas/original/1X/b961135fba5c7800b67a7d447a5cffa7160c016c.png)

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/pumas/original/1X/1fa75925e9c285d78511583601f1077c55b9d48a.png)

 ![image](https://canada1.discourse-cdn.com/flex030/uploads/pumas/original/1X/c926bfd8194fa40faed9f91e9e56c46ff75694ef.png)- these are the model codes which i used

`F1` is defined inside `@pre`, but Pumas throws `UndefVarError: F1 not defined` when evaluating `@dosecontrol`.

Is this due to scope rules between `@pre` and `@dosecontrol`?  
Should `F1` instead be defined differently (e.g., as a parameter or moved elsewhere)?

Any clarification on how variables from `@pre` are accessed inside `@dosecontrol` would be greatly appreciated.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![patrick](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.pumas.ai/patrick/32/206_2.png) [@patrick](https://discourse.pumas.ai/u/patrick)\
**Post date:** [March 3, 2026, 4:08pm UTC](https://discourse.pumas.ai/t/error-while-running-the-simulations/1385/3 "2026-03-03T16:08:15Z")

</div>

Dear,

Yes, it is because the dose control block cannot “see” the pre block variables. Instead, you can define them in dose control. The reason for this is one of efficiency. The dose control block is only evaluated whenever there are dose events and evaluating the full pre block adds unnecessary overhead. You should be able to write

```auto
@dosecontrol begin

  F_total := …
  D1i := …
  bioav = (Depot0 = logistic(F_total),)

  duration = (Depot0 = D1i,)

end

```

notice, that the same goes for the duration parameterization D1i . Also notice the use of := that means “define in this block but do not output from this block”. This is to ensure that people do not define lags incorrectly (say by defining a parameter called lag).

Best,  
Patrick

---

<div class="post-metadata">

**Author:** ![Bhargav](https://avatars.discourse-cdn.com/v4/letter/b/dfb087/32.png) [@Bhargav](https://discourse.pumas.ai/u/Bhargav)\
**Post date:** [March 4, 2026, 7:42am UTC](https://discourse.pumas.ai/t/error-while-running-the-simulations/1385/4 "2026-03-04T07:42:12Z")

</div>

Hi Patrick,

Thank you for the clarification. It worked perfectly and resolved the issue.

Best,  
Bhargav
