Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fail to detect missing differential equation with autodec and nm-vars plugin #1182

Open
kylebaron opened this issue Mar 22, 2024 · 1 comment
Assignees
Labels

Comments

@kylebaron
Copy link
Collaborator

Looks like you have to be using both

library(mrgsolve)
#> 
#> Attaching package: 'mrgsolve'
#> The following object is masked from 'package:stats':
#> 
#>     filter
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

code <- '
$PLUGIN autodec nm-vars
$CMT D B C2
$DES
dxdt_D = -1; 
dxdt_B = 5;
dxdt_C = 5;
'

mod <- mcode("foo", code)
#> Building foo ...
#> done.


mrgsim(mod)
#> Model:  foo 
#> Dim:    25 x 5 
#> Time:   0 to 24 
#> ID:     1 
#>     ID time  D  B C2
#> 1:   1    0  0  0  0
#> 2:   1    1 -1  5  0
#> 3:   1    2 -2 10  0
#> 4:   1    3 -3 15  0
#> 5:   1    4 -4 20  0
#> 6:   1    5 -5 25  0
#> 7:   1    6 -6 30  0
#> 8:   1    7 -7 35  0

Created on 2024-03-22 with reprex v2.0.2

@kylebaron kylebaron self-assigned this Mar 22, 2024
@kylebaron kylebaron added the bug label Mar 22, 2024
@kylebaron
Copy link
Collaborator Author

If you drop the plugin:

``` r
library(mrgsolve)
#> 
#> Attaching package: 'mrgsolve'
#> The following object is masked from 'package:stats':
#> 
#>     filter
library(dplyr)
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union

code <- '
$CMT D B C2
$DES
dxdt_D = -1; 
dxdt_B = 5;
dxdt_C = 5;
'

mod <- mcode("foo", code)
#> Warning: Missing differential equation(s):
#> --| missing: C2
#> --| suppress with @!audit block option
#> Building foo ...
#> error.
#> 
#> ---:: stderr ::---------------------------------------------
#> using C++ compiler: ‘Apple clang version 14.0.3 (clang-1403.0.22.14.1)’
#> using SDK: ‘MacOSX13.3.sdk’
#> 17:1: error: use of undeclared identifier 'dxdt_C'
#> dxdt_C = 5;
#> ^
#> 1 error generated.
#> make: *** [foo-mread-source.o] Error 1
#> 
#> ------------------------------------------------------------
#> Error: the model build step failed.


mrgsim(mod)
#> Error in eval(expr, envir, enclos): object 'mod' not found

Created on 2024-03-22 with reprex v2.0.2```

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant