Skip to content

Commit 3ae692d

Browse files
committed
Add examples of how to use scg/jinja to skill
1 parent e0ea248 commit 3ae692d

2 files changed

Lines changed: 70 additions & 0 deletions

File tree

packages/extension/skills/writing-septic-config/SKILL.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,10 @@ When you have multiple similar equipment (e.g., wells) that require similar conf
8484
- **DmmyApplPost layout**: [examples/dmmyapplpost.cnfg](./examples/DmmyApplPost.cnfg) shows the typical layout of a DmmyApplPost file, which contains calculations that are performed after the main MPC calculations.
8585
- **DisplayGroup layout**: [examples/DspGroup.cnfg](./examples/DspGroup.cnfg) shows example layout of a DisplayGroup file, which contains configuration for the HMI (plotting of variables, tables, etc.).
8686

87+
### SCG
88+
89+
- **SCG/Jinja2 in templates**: [examples/scg.cnfg](./examples/scg.cnfg) shows examples of how to use SCG/Jinja2 syntax in SCG templates for generating Septic config files.
90+
8791
## Guidelines
8892

8993
### 1. Naming Conventions
@@ -115,6 +119,7 @@ When you have multiple similar equipment (e.g., wells) that require similar conf
115119
- Validate template output before deployment
116120
- Use descriptive variable names in templates
117121
- Add comments explaining template logic
122+
- Check examples of SCG/Jinja2 syntax in the `examples/` directory when writing in templates
118123

119124
## Code Completion Hints
120125

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
// Examples of how SCG/Jinja2 is used in config files. Asumes that all sources are defined in the SCG config file (.yaml)
2+
3+
4+
// Conditional logic
5+
// Conditional attriute value
6+
7+
Evr: Temperature
8+
Text1= ""
9+
Meas= {{ TempInit if sim else 0 }}
10+
11+
// Conditional object creation
12+
{% if Producer %}
13+
Evr: TempInit
14+
Text1= ""
15+
Meas= 100
16+
{% endif %}
17+
18+
// For loops
19+
// Creating multiple variables
20+
{% for Wellname in wells | unpack("Wellname") %}
21+
Tvr: {{ Wellname }}Temperature
22+
Text1= ""
23+
Meas= 0
24+
25+
{% endfor %}
26+
27+
// Setting attriute values based on for loop
28+
XvrMatrix: AUTOWELL
29+
Row= 4
30+
Col= 1
31+
RowSize= 7
32+
ColSize= 2
33+
Heading= "Downhole Pressure"
34+
ColIds= 3
35+
"Setpoint" "Meas" "High"
36+
RowIds= {{ wells | length}} {# noqa: E301 #}
37+
{%- for Wellname in wells|unpack("Wellname") %}"{{Wellname}}" {% endfor %}
38+
Xvrs= {{ 3 * wells|length}} {# noqa: E301 #}
39+
{%- for Wellname in wells | unpack("Wellname") %}
40+
{{ Wellname }}PdhSP {{ Wellname }}PdhY {{ Wellname }}PdhHigh
41+
{% endfor %}
42+
43+
// Filtering of SCG-source in for loop
44+
{% for Wellname in wells | selectattr(Linename, 'eq', 1) | unpack('Wellname') %}
45+
CalcPvr: {{ Linename }}Add{{Wellname}}Rate
46+
Text1= "Add swing well capacity up if it is active and not upper constrained"
47+
Text2= ""
48+
Alg= "setmeas({{ Linename }}Total, {{ Linename }}Total + {{ Wellname }}Rate)"
49+
50+
{% endfor %}
51+
52+
// Inline in calculations
53+
CalcPvr: {{ Flowline }}TotalCv
54+
Text1= "Total Cv for both topside chokes"
55+
Text2= ""
56+
Alg= "{% for Topline in toplines | selectattr('Flowline', 'eq', Flowline) | unpack('Topline') %}{{ Topline }}ChokeCv{% if not loop.last %} + {% endif %}{% endfor %}"
57+
58+
// Using multiple parameters from one file
59+
{% for Wellname, StepSize in wells | unpack('Wellname', 'StepSize') %}
60+
CalcPvr: {{ Wellname }}PdhDbSize
61+
Text1= ""
62+
Text2= ""
63+
Alg= "max(0.2, 0.8*abs(modget({{ Wellname }}Pdh, {{ Wellname }}Zpc))*{{ StepSize }})"
64+
65+
{% endfor %}

0 commit comments

Comments
 (0)