Optimization Study using Template

Guilherme Gomes
Guilherme Gomes New Altair Community Member
edited January 2023 in Community Q&A

Hi!

I'm trying to use the Optimization Wizard to tune my model with some real test data.

I'm using sensors and a template, its a sequential simulation.

 

For some reason it doesn't run when the template is active:

image

 

Is there any way some make this work?

 

Thank you!

Answers

  • Praful
    Praful
    Altair Employee
    edited January 2023

    Hello Guilherme

    The optimization through the Optimization Wizard works through a Python format of MotionSolve. If the set of simulation commands are python, that should work.

    In order to maintain both xml and python commands you may use a {if} block in the template

    E.g.

    { if (Solver_Filename.ext == ".xml") }

    <Deactivate    
        element_type = "MOTION"
        element_id  = "{mot_spin.l.idstring}"  
    />
    <Deactivate    
        element_type = "MOTION"
        element_id  = "{mot_spin.r.idstring}"  
    />
      <Simulate       
        analysis_type       = "Static" 
              end_time            = "10"      
         print_interval      = "0.1"    
    />

    {elseif (Solver_Filename.ext == ".py")}
     model.an_kc_frnt_mtn_w_spin_l.active = False
     model.an_kc_frnt_mtn_w_spin_r.active = False
     model.simulate(type="STATICS", end=10, dtout=0.1, returnResults=True)

    {endif}

    Hope this helps

    regards

    Praful

  • Guilherme Gomes
    Guilherme Gomes New Altair Community Member
    edited January 2023

    Hello Guilherme

    The optimization through the Optimization Wizard works through a Python format of MotionSolve. If the set of simulation commands are python, that should work.

    In order to maintain both xml and python commands you may use a {if} block in the template

    E.g.

    { if (Solver_Filename.ext == ".xml") }

    <Deactivate    
        element_type = "MOTION"
        element_id  = "{mot_spin.l.idstring}"  
    />
    <Deactivate    
        element_type = "MOTION"
        element_id  = "{mot_spin.r.idstring}"  
    />
      <Simulate       
        analysis_type       = "Static" 
              end_time            = "10"      
         print_interval      = "0.1"    
    />

    {elseif (Solver_Filename.ext == ".py")}
     model.an_kc_frnt_mtn_w_spin_l.active = False
     model.an_kc_frnt_mtn_w_spin_r.active = False
     model.simulate(type="STATICS", end=10, dtout=0.1, returnResults=True)

    {endif}

    Hope this helps

    regards

    Praful

    Hello Praful, thank you for the tip!