pyCAPS
pyCAPS: A Python Extension Module for CAPS
value3.py

Example use cases for interacting the a pyCAPS._capsValue object for setting the limits.

1 from __future__ import print_function
2 
3 # Import pyCAPS module (Linux and OSx = pyCAPS.so file; Windows = pyCAPS.pyd file)
4 import pyCAPS
5 
6 # Instantiate our CAPS problem "myProblem"
7 print("Initiating capsProblem")
8 myProblem = pyCAPS.capsProblem()
9 
10 # Load a *.csm file "./csmData/cfdMultiBody.csm" into our newly created problem.
11 myGeometry = myProblem.loadCAPS("./csmData/cfdMultiBody.csm", "basicTest")
12 
13 # Create a value
14 myValue = myProblem.createValue("Altitude", [0.0, 30000.0, 60000.0], units="ft", limits=[0.0, 70000])
15 
16 print("Name = ", myValue.name)
17 print("Value = ", myValue.value)
18 print("Units = ", myValue.units)
19 print("Limits = ", myValue.limits)
20 
21 # Change the limits
22 myValue.limits = [0.0, 65000]
23 print("New Limits = ", myValue.limits)
24 
25 # or change the limits using the setLimits() function - equivalent to the directly setting the limits
26 myValue.setLimits([0.0, 69000])
27 print("New Limits = ", myValue.limits)
28 
29 # Get the limits using the getLimits() function - equivalent to directly calling the limits
30 print("Current Limits = ", myValue.getLimits())
31 
32 # Close our problems
33 print("Closing our problem")
34 myProblem.closeCAPS()
35