Unit Script Examples#
Download the SupportResults.fez and SupportStructuralResults.fez for this example.
from rs2.modeler.RS2Modeler import RS2Modeler
from rs2.interpreter.RS2Interpreter import RS2Interpreter
import os, inspect
from pprint import pprint
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(lambda: None)))
RS2Interpreter.startApplication(port=60079)
interpreter = RS2Interpreter(port=60079)
interpreterModel = interpreter.openFile(rf"{current_dir}\example_models\SupportResults.fez")
interpreterModelUnits = interpreterModel.getUnits()
print("\nInterpreter Model Units")
print("\nSolid Units :")
pprint(interpreterModelUnits.solid_units)
print("\nHydro Units :")
pprint(interpreterModelUnits.hydro_units)
print("\nThermal Units :")
pprint(interpreterModelUnits.thermal_units)
RS2Modeler.startApplication(port=60080)
modeler = RS2Modeler(port=60080)
model = modeler.openFile(rf"{current_dir}\example_models\SupportStructuralResults.fez")
modelerUnits = model.getUnits()
print("\nModeler Units")
print("\nSolid Units :")
pprint(modelerUnits.solid_units)
print("\nHydro Units :")
pprint(modelerUnits.hydro_units)
print("\nThermal Units :")
pprint(modelerUnits.thermal_units)
model.ResetProperties()
model.close()
interpreterModel.close()
modeler.closeProgram()
interpreter.closeProgram()
Output#
Interpreter Model Units
Solid Units :
[('Very Small Area', 'in2'),
('Very Small Length ', 'in'),
('Small Length ', 'in'),
('Length ', 'ft'),
('One Over Length ', '1/ft'),
('Volume ', 'ft3'),
('Area ', 'ft2'),
('Force ', 'lbs'),
('Weight ', 'lbs'),
('Pressure ', 'psf'),
('Shear Strength ', 'psf'),
('Bond Strength ', 'lbs/ft'),
('Joint Stiffness ', 'psf/ft'),
('Unit Weight ', 'lbs/ft3'),
('Moment ', 'lbsft'),
('Hoop Moment ', 'lbsft/ft'),
('Time ', 's'),
('Stiffness ', 'lbs/ft'),
('Velocity ', 'ft/s'),
('Acceleration ', 'ft/s2'),
('Sigma ', 'psf'),
('Stress ', 'psf'),
('Mass ', 'lbs')]
Hydro Units :
[('Pore Pressure ', 'psf'),
('Pressure Head ', 'ft'),
('Flow Rate ', 'ft3/s'),
('Discharge Velocity ', 'ft/s'),
('Permeability ', 'ft/s'),
('Water Content ', 'ft3/ft3'),
('MV ', 'ft3/ft3/psf')]
Thermal Units :
[('Heat', 'J'),
('Specific Heat Capacity', 'J/lbs/C'),
('Temperature', 'C'),
('Latent Heat', 'J/ft3'),
('Conductivity', 'W/ft/C'),
('Volumetric Heat Capacity', 'J/ft3/C'),
('Total Thermal Flux', 'W/ft'),
('Unit Heat Flux', 'W/ft2'),
('Heat Transfer', 'J/s/ft2/C')]
Modeler Units
Solid Units :
[('Very Small Area', 'mm2'),
('Very Small Length ', 'mm'),
('Small Length ', 'cm'),
('Length ', 'm'),
('One Over Length ', '1/m'),
('Volume ', 'm3'),
('Area ', 'm2'),
('Force ', 'MN'),
('Weight ', 'MN'),
('Pressure ', 'MPa'),
('Shear Strength ', 'MPa'),
('Bond Strength ', 'MN/m'),
('Joint Stiffness ', 'MPa/m'),
('Unit Weight ', 'MN/m3'),
('Moment ', 'MNm'),
('Hoop Moment ', 'MNm/m'),
('Time ', 's'),
('Stiffness ', 'MN/m'),
('Velocity ', 'm/s'),
('Acceleration ', 'm/s2'),
('Sigma ', 'MPa'),
('Stress ', 'MPa'),
('Mass ', 'kt')]
Hydro Units :
[('Pore Pressure ', 'MPa'),
('Pressure Head ', 'm'),
('Flow Rate ', 'm3/s'),
('Discharge Velocity ', 'm/s'),
('Permeability ', 'm/s'),
('Water Content ', 'm3/m3'),
('MV ', 'm3/m3/MPa')]
Thermal Units :
[('Heat', 'J'),
('Specific Heat Capacity', 'J/kt/C'),
('Temperature', 'C'),
('Latent Heat', 'J/m3'),
('Conductivity', 'W/m/C'),
('Volumetric Heat Capacity', 'J/m3/C'),
('Total Thermal Flux', 'W/m'),
('Unit Heat Flux', 'W/m2'),
('Heat Transfer', 'J/s/m2/C')]