Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add predefined unit scaling option to print_results methods #48

Open
Agent6-6-6 opened this issue Sep 30, 2022 · 7 comments
Open

add predefined unit scaling option to print_results methods #48

Agent6-6-6 opened this issue Sep 30, 2022 · 7 comments
Assignees
Labels
enhancement New feature or request

Comments

@Agent6-6-6
Copy link
Contributor

When you print results of say a ultimate bending analysis to the terminal, the resulting table values are consistent with the analysis units, for an SI analysis N & mm.

I feel having a way in these methods to return in kN and kNm via a multiplied scaling factor (like n_scale = 1e-3, m_scale = 1e-6), or other for Imperial units would be useful. As typically you're interested in the answer in these units?

By default return in N & mm, but have option to scale by another factor to units more consistent with typical analyses like kN and kNm for axial and moment respectively if working in SI units.

Thoughts?

@robbievanleeuwen robbievanleeuwen self-assigned this Oct 10, 2022
@robbievanleeuwen robbievanleeuwen added the enhancement New feature or request label Oct 10, 2022
@robbievanleeuwen
Copy link
Owner

Will have a look into this, feeling like the mentioning of units could scope creep this one into including forallpeople!

@connorferster thoughts on integrating forallpeople into concrete-properties for someone who has always admired forallpeople but never actually used it?

@connorferster
Copy link

@robbievanleeuwen and @Agent6-6-6,

Re: Units scaling:

I am a big fan of relying on the user to use consistent units/scaling conventions in their own analysis because then the numerical analysis works with any unit system (e.g. kips/inches/ksi or N/mm/MPa, etc). If the outputs are numpy arrays, the user can scale their own array outputs.

Re: forallpeople integration

Because numpy is used, forallpeople would create a slow-down since it uses custom objects instead numpy floats and ints. I have interest to write ufuncs for forallpeople (like pint has done) but it will be a while yet. I wonder if pint units would work, though?

@connorferster
Copy link

connorferster commented Oct 10, 2022

Side note: I love all of the attention and work you are putting into concreteproperties, @Agent6-6-6! I appreciate reading all your posts even though I have responded or chimed in. I get them all in my email 😀

@robbievanleeuwen
Copy link
Owner

Thanks for the info @connorferster! Maybe I'll look into using it for post-processing only similar to the suggestion in the OP, but maybe a bit more intelligent/extended.

@Lomarandil
Copy link

I'm with connor here.. haven't had the time to chip in recently, but following the discussion and cheering you guys on. And when you're ready for ACI integration, make sure to ping me.

@Agent6-6-6
Copy link
Contributor Author

Agent6-6-6 commented Oct 15, 2022

It goes without saying some consistent units should be utilised for the analysis. For metric, this is typically going to be N and mm, but the output you'll typically want to be visualising results is in kN, kNm for forces/moments & MPa for stresses.

@Lomarandil what would be the consistent units someone using imperial would typically use, input and output just out of interest if this is addressed?? Just trying to determine the best way to help out those poor folk in the three countries that are still stuck in the dark ages using the imperial system? 😄

Assuming inches for section and bar sizes/areas, psi for material properties, and output for forces and moments (ksi and ksi-inch)??

I note some of the methods (forget which) I recall seeing that it was stated the inputs had to be in millimetre units anyway, so some metric stuff is being forced upon the imperial folks.

My thoughts in making this suggestion are there are already scaling factors suited to metric output by default in all of the print plot methods to suit SI units consistent with N and mm to return kN and kNm for all the plots to give the typical expected units (M/N and M/M interaction and moment-curvature) for example plot methods all do this by default.

My thoughts on the code were something like this to suit both camps, but to favour the overwhelming fact that metric is more widely utilised except for USA, Liberia and Myanmar with this being the default. The same could be implemented in the plots and any other return of tables to get a more friendly number out of the other end.

def print results(.......metric=True,imperial=False,m_scale=None,n_scale=None...........):
    
    if imperial:
          metric=False
    if m_scale is not None and n_scale is not None:
        #use user defined values, overrides other predefined inputs
        metric = False
        imperial = False
   if (m_scale is None and n_scale is not None) or (m_scale is not None and n_scale is None):
        #raise an exception as only one user defined scaling factor was given if user intended to use user defined scaling
        raise ValueError('for userdefined scaling must enter both m_scale and n_scale factors')
   if metric:
        #set to return kNm and kN by default
        m_scale = 1e6
        n_scale = 1e3
    if imperial:
         #set to return whatever normal units are for force and moment in the imperial world by default
        m_scale = single_blah
        n_scale = double_blah

    #scale results
        #here we would multiply the results by the appropriate scaling determined above by defaults or by user defined factors....


etc........

Want to return in more friendly units for imperial or metric, then just use metric or imperial, want to do something a bit more unique, enter the moment and force scaling factors as specific inputs, but otherwise ignore them as they are populated with the defaults for metric results like they currently are in the plot methods.

If there is a consistent set of imperial units typically used, all an imperial user would have to do is include an imperial=True as an input to flip to the appropriate scaling. Could even refactor it out into a class so these factors are set once and can be used by all other methods so as not to have to repeat all this type of code in any method you want to do some scaling?

In the interim as another possible solution, is it even possible to format using the f-strings to engineering notation in the returned tables instead of scientific notation, you know returning 234.56e6 vs 2.3456e8, the first is at least a bit more palatable to an engineering-orientated brain used to working with and visualising results in Metric. But I favour the above type of approach I've outlined in the code snip for the most flexibility.

Thoughts?

@Lomarandil
Copy link

Lomarandil commented Oct 15, 2022 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants