Question about using PyMPC

Post Reply
youngkyu
Posts: 36
Joined: Tue May 04, 2021 3:36 pm

Question about using PyMPC

Post by youngkyu » Mon Aug 23, 2021 1:48 pm

Dear support team members,

I found an issue with changing the value by using PyMPC.

If you run the python script within the attached .scd file, the value is not changed as described below.

If you look at the command in the line # 103 of the python script,
"doc.getAnalysisStep(13).XObject.getAttribute('duration').real = float(N[k]*0.01)", this does not change the value that I assigned as (N[k]*0.01)

It's weird because the same command for 'numIncr' worked changing the value in the line # 102 as you can see.

I guess that this might be a bug or error in this version of SKTO?

I hope that this issue will be resolved soon.

Best,
Youngkyu
Attachments
PyMPC_Youngkyu.zip
(162.51 KiB) Downloaded 11 times

marafini.f
Posts: 272
Joined: Fri Nov 13, 2020 1:52 pm

Re: Question about using PyMPC

Post by marafini.f » Mon Aug 23, 2021 2:51 pm

Dear youngkyu,

no bug there, just some notation that it's hard to find.

For a transient analysis the attribute duration is called "duration/transient":

So you need to substitute this in line 103 in your code:

Code: Select all

doc.getAnalysisStep(13).XObject.getAttribute('duration/transient').real = float(N[k]*0.01)
If you encounter some other problem you can go in this folder on your computer
C:\Program Files\STKO\external_solvers\opensees
and explore how each X-Object is created.

Here is an example of the information you were looking for, which was found in the AnalysesCommand.py file:
1.png
1.png (20.32 KiB) Viewed 296 times
Let us know if you need anything else.
Francesca :geek:

youngkyu
Posts: 36
Joined: Tue May 04, 2021 3:36 pm

Re: Question about using PyMPC

Post by youngkyu » Tue Aug 24, 2021 10:05 am

Thanks for the quick response. That worked well and I will keep in mind your example for my future application.
Best,
Youngkyu

marafini.f
Posts: 272
Joined: Fri Nov 13, 2020 1:52 pm

Re: Question about using PyMPC

Post by marafini.f » Tue Aug 24, 2021 10:08 am

You are welcome!

youngkyu
Posts: 36
Joined: Tue May 04, 2021 3:36 pm

Re: Question about using PyMPC

Post by youngkyu » Wed Sep 08, 2021 7:59 am

Dear support team member,

Although I viewed PressureDependMultiYield.py script,
it is not straightforward to find the correct expression.

I tried to change the parameters of the models that are
rho, refShearModul, refBulkModul, frictionAng, refPress, PTAng, contrac, dilat1, dilat2, and e through PyPMC as above.
However, I could not change rho, refShearModul, refBulkModul, and refPress.

Could you help find what I missed from the script to access to the object ?

Best,
Youngkyu
Attachments
Change_PDMY_Params.zip
(148.79 KiB) Downloaded 13 times

marafini.f
Posts: 272
Joined: Fri Nov 13, 2020 1:52 pm

Re: Question about using PyMPC

Post by marafini.f » Wed Sep 08, 2021 11:13 am

Those parameters are all QuantityScalar, not reals.

when trying to change them you should call them as for the following example:

SoilP.XObject.getAttribute('refBulkModul').QuantityScalar.value = 10.0

Let me know if you need any more help.
Francesca :geek:

youngkyu
Posts: 36
Joined: Tue May 04, 2021 3:36 pm

Re: Question about using PyMPC

Post by youngkyu » Wed Sep 08, 2021 1:23 pm

Thanks for your quick response.
Actually, the lower case "quantityScalar.value" worked for the job.

Best,
Youngkyu

marafini.f
Posts: 272
Joined: Fri Nov 13, 2020 1:52 pm

Re: Question about using PyMPC

Post by marafini.f » Fri Sep 10, 2021 12:39 pm

Great! Sorry for the typo, but I am happy you managed!
Enjoy your modelling.
Francesca :geek:

Post Reply