Jump to content

Livio Mariano

Members
  • Content Count

    16
  • Joined

  • Last visited

  • Days Won

    2

Reputation Activity

  1. João Marabisa liked a post in a topic by Livio Mariano in Why cases not works in math expression block   
    RoKet is right switch/case is not allowed but...
    You can get exactly what you need with MathExpression block in a much easier way. Please look the attached model.
    Trick:
    - You set your condition between round brackets, if condition is true, it is like having 1 otherwise 0.
    You can use & symbol for "and" and | symbol for "or" in the formulation of you condition.
    -  You multiply the condition by the associated operation that you want to perform when the condition is true (=1).
    - When the condition is false it will return 0 and you will not consider the operation associated to it.
    - You sum the other conditions multiplied by the associated operations.
     
    This way of using the MathExpression block is really powerful and flexible, I use it a lot.   
    Case1.scm
  2. Livio Mariano liked a post in a topic by João Marabisa in Ball & Beam System   
    Hi techs! I've created a Ball & Beam model on MotionView to explore a co-simulation with Activate.
     
    Many of you may have seen this on undergraduate/master class studying on frequency or even on time domain. I've decided to do something different, creating the model on a multibody environment. 
     
    The control is a simple PD, where I've calculated using analytical method (Kp +Kd.s) with a specified overshoot and settling time. You could explore changing its values...
    I'd like to thank @Livio Mariano for suggesting me his own low-pass filter  in a way to filter the input displacement signal (without it I was having a problem to converge).
     
    I've created a short video to show you how it works, and the files are attached. Enjoy! 
     
    João.
     
    Ball_&_beam.zip
     
  3. yugang liked a post in a topic by Livio Mariano in Why cases not works in math expression block   
    RoKet is right switch/case is not allowed but...
    You can get exactly what you need with MathExpression block in a much easier way. Please look the attached model.
    Trick:
    - You set your condition between round brackets, if condition is true, it is like having 1 otherwise 0.
    You can use & symbol for "and" and | symbol for "or" in the formulation of you condition.
    -  You multiply the condition by the associated operation that you want to perform when the condition is true (=1).
    - When the condition is false it will return 0 and you will not consider the operation associated to it.
    - You sum the other conditions multiplied by the associated operations.
     
    This way of using the MathExpression block is really powerful and flexible, I use it a lot.   
    Case1.scm
  4. NilsWaap liked a post in a topic by Livio Mariano in How to do a parameter sweep in activate?   
    Let me add another approach that I've just learned.
     
    There are many options to perform it but I’ve found this method very simple, flexible and self-explanatory.
     
    Summary:
    In the example, watertank.oml is the master file.
    It:
    changes the input parameters (controller gains) runs (repeatedly) the file Watertank_parm.scm (slave) collects results doing post-processing (plot) at the end.  
    I’ve created a quick video to summarize how to run the demo.
    Present working directory must be where you save the files (the video shows how to select the pwd).
    Otherwise use an absolute path in the oml file.
     
    Liv
     
    ParameterSweeping.mp4 watertank.oml watertank_param.scm
  5. robertavarela liked a post in a topic by Livio Mariano in How to do a parameter sweep in activate?   
    Let me add another approach that I've just learned.
     
    There are many options to perform it but I’ve found this method very simple, flexible and self-explanatory.
     
    Summary:
    In the example, watertank.oml is the master file.
    It:
    changes the input parameters (controller gains) runs (repeatedly) the file Watertank_parm.scm (slave) collects results doing post-processing (plot) at the end.  
    I’ve created a quick video to summarize how to run the demo.
    Present working directory must be where you save the files (the video shows how to select the pwd).
    Otherwise use an absolute path in the oml file.
     
    Liv
     
    ParameterSweeping.mp4 watertank.oml watertank_param.scm
  6. stmaster liked a post in a topic by Livio Mariano in Frequency analyses using Altair Activate   
    With the last Activate version 2019.2, under Model we have the new “Finalization” tab
    where we can type an oml script that is executed at the end of the simulation.
    I’ve found this capability extremely useful for frequency analyses...
     
    I’ve created a simple model where we run a co-simulation between Activate & Motion
    (the approach works also using Activate in standalone mode but with the Motion integration is definitely more interesting).
    All the related files and the video are enclosed.
     
    In the example, we have a system of 2 masses: mass1 and mass2. The input to the Multi-body System is the force on mass2 while the output is the displacement of mass1.
     
    Force and displacement are respectively passed as Input1 and Input2 to the FrequencyWorld superblock in the Activate diagram.
     
    When you run the Activate model a dialog box appears.
    Here you can set the sampling frequency (be careful to aliasing issues since the value will affect the Nyquist frequency)
    and the type of analysis:
    Turn 0 to 1 the options if you want to analyse in frequency input 1, input 2 and/or the Transfer Function input1/input2.
    When you turn 1 the last option, the file TF.mat with the transfer function information is generated in the same model folder to be used for further analyses in Compose (e.g. LTI ROM generation…).
     
    For each input, the model calculates the fft together with the PSD.
    The calculation is made in Model-Finalization where we also handle the various options.
    The script is a bit articulated to properly handle every scenario (even/odd number of the sampling data, leakage, normalization…)
     
    Scripts and FrequencyWorld superblock can obviously be re-used for other applications (and easily improved e.g adding filters ...).
     
    Best,
     
    Liv
     

    FFT_PSD_TF.mp4  
     
    FFT_PSD_TF.zip
  7. robertavarela liked a post in a topic by Livio Mariano in Frequency analyses using Altair Activate   
    With the last Activate version 2019.2, under Model we have the new “Finalization” tab
    where we can type an oml script that is executed at the end of the simulation.
    I’ve found this capability extremely useful for frequency analyses...
     
    I’ve created a simple model where we run a co-simulation between Activate & Motion
    (the approach works also using Activate in standalone mode but with the Motion integration is definitely more interesting).
    All the related files and the video are enclosed.
     
    In the example, we have a system of 2 masses: mass1 and mass2. The input to the Multi-body System is the force on mass2 while the output is the displacement of mass1.
     
    Force and displacement are respectively passed as Input1 and Input2 to the FrequencyWorld superblock in the Activate diagram.
     
    When you run the Activate model a dialog box appears.
    Here you can set the sampling frequency (be careful to aliasing issues since the value will affect the Nyquist frequency)
    and the type of analysis:
    Turn 0 to 1 the options if you want to analyse in frequency input 1, input 2 and/or the Transfer Function input1/input2.
    When you turn 1 the last option, the file TF.mat with the transfer function information is generated in the same model folder to be used for further analyses in Compose (e.g. LTI ROM generation…).
     
    For each input, the model calculates the fft together with the PSD.
    The calculation is made in Model-Finalization where we also handle the various options.
    The script is a bit articulated to properly handle every scenario (even/odd number of the sampling data, leakage, normalization…)
     
    Scripts and FrequencyWorld superblock can obviously be re-used for other applications (and easily improved e.g adding filters ...).
     
    Best,
     
    Liv
     

    FFT_PSD_TF.mp4  
     
    FFT_PSD_TF.zip
  8. Livio Mariano liked a post in a topic by Manoj Kandukuri in ReadVectorBuilder   
    Liv,
    If you want to extract the element ID's, you can use "getreqlist" command. 
     
    syntax:
    request_list = getreqlist(filename, datatype)
    request_list = getreqlist(filename, subcase, datatype)
     
    --> you will get a cell variable "request_list" with element ID's with a prefix letter 'E' like ( E1234, ....)
     
    and if you want to get the element id's in a matrix, you can do something like below :
     
    elementid = regexp(request_list,'E','split'); 
    for i = 1:length(request_list)
        elem(i,:) = str2num(elementid{i}{1,2});
    end
     
    Thanks,
    Manoj
×
×
  • Create New...