Problem type transformation

Moderator: GiD Team

fcdiass
Posts: 5
Joined: Fri Nov 08, 2019 8:04 pm

Problem type transformation

Postby fcdiass » Mon Sep 21, 2020 4:56 pm

Hi,

I am developing a problem type based on the customlib. Every newly released version, I would like to transform my models into the new version of my problem type (from data tree version 0.5.0 to 0.6.0 for instance). But the following error occurs every time and all data in the data tree is lost.

Code: Select all

Error (l685): Attribute "active" not found!
STACK:
Attribute "active" not found!
    while executing
"$node @active"
    (procedure "import_units_from" line 13)
    invoked from within
"import_units_from -force $domNode_from"
    (procedure "gid_groups_conds::transform_problemtype_no_messages" line 36)
    invoked from within
"gid_groups_conds::transform_problemtype_no_messages $spd_file"
    (procedure "gid_groups_conds::transform_problemtype" line 3)
    invoked from within
"gid_groups_conds::transform_problemtype $filename_spd"
    (procedure "::GiD_Private_Event_AfterTransformProblemType" line 5)


How can I manage this?

Regards,
Francisco Dias.
User avatar
escolano
Posts: 1650
Joined: Thu Sep 18, 2014 3:31 pm

Re: Problem type transformation

Postby escolano » Fri Sep 25, 2020 9:30 pm

attach a zip with all information required to reproduce it. (in a private message if required)
-the problemtype 0.5.0
-the problemtype 0.6.0
-the model saved with old 0.5.0 data
fcdiass
Posts: 5
Joined: Fri Nov 08, 2019 8:04 pm

Re: Problem type transformation

Postby fcdiass » Fri Oct 09, 2020 5:02 pm

I have noticed that this problem does not happen when I remove the following part of code:

Code: Select all

    <units>
        <unit_magnitude n="Angle" pn="Angle" default="deg" SI_base="rad">
            <unit n="deg" pn="degree" p="1" factor="0.01745329251994" help="degree=1/180[pi.rad]"/>
            <unit n="rad" pn="radian" p="2" units_system="SI" factor="1.0"/>
            <unit n="°" pn="degree" p="3" factor="0.01745329251994" printable_name="deg"/>
        </unit_magnitude>
        <unit_magnitude n="F" pn="Force" default="kN" SI_base="N" basic="L*M/T^2">
            <unit n="N" pn="newton" p="2" units_system="SI" factor="1.0" help="Newton=[Kg.m/s2]"/>
            <unit n="kN" pn="kilonewton" p="1" units_system="SI"/>
        </unit_magnitude>
        <unit_magnitude n="L" pn="Length" default="m" SI_base="m">
            <unit n="m" pn="meter" p="1" units_system="SI" factor="1.0"/>
            <unit n="cm" pn="centimeter" p="2" units_system="SI"/>
            <unit n="mm" pn="millimeter" p="2" units_system="SI"/>
            <unit n="um" pn="micrometer" p="2" factor="1.0e-6"/>
            <unit n="µm" pn="micrometer" p="2" printable_name="um" units_system="SI"/>
        </unit_magnitude>
        <unit_magnitude n="P" pn="Pressure" default="kPa" SI_base="Pa" basic="F/L^2">
            <unit n="Pa" pn="pascal" p="2" units_system="SI" factor="1.0" help="Pascal=[N/m2]"/>
            <unit n="kPa" pn="kilopascal" p="1" units_system="SI"/>
            <unit n="MPa" pn="megapascal" p="2" units_system="SI"/>
        </unit_magnitude>
        <unit_magnitude n="Temp" pn="Temperature" default="°C" SI_base="K">
            <unit n="°C" pn="degree Celsius" p="1" units_system="SI" factor="1.0" addend="273.15" help="V[default]=(V[unit]+addend)*factor" printable_name="oC"/>
            <unit n="K" pn="kelvin" p="2" units_system="SI" factor="1.0"/>
            <unit n="°F" pn="degree Farenheit" p="3" units_system="imperial" factor="0.5555555555555556" addend="459.67" help="V[default]=(V[unit]+addend)*factor" printable_name="oF"/>
        </unit_magnitude>
    </units>

Is there a problem with this code snippet?

Explaning the reason that I wrote this code snippet:
To define the units in the model, I use an approach similar to "cmas2d_customlib" available in the problem type examples. There, the field 'units' is discribed with the following comment: "by now it is compulsory define this node if units are used (could be empty if defaults are enough)".
I use the field 'units' to change default unit (eg. Force -> kN, Angle -> deg, etc...) and to change the priority of units (field 'p' of 'unit', that assumes values 1,2 or 3).

Yet based on "cmas2d_customlib", use the following structure to allow the user change the units:

Code: Select all

   <value n='units_mesh' pn='Geometry units' unit_mesh_definition="1"/>
   <value n='units_system' pn='Units system' units_system_definition="1">
      <dependencies node="//*[@unit_definition or @unit_mesh_definition='1']" att1='change_units_system' v1='{@v}'/>
   </value>
   <container n="basic_units" pn="Basic units" icon="tree/BasicUnits" help="Basic units to be used in the analysis.">
       <value n="units_angle" pn="Angle" unit_definition="Angle"/>
      <value n="units_force" pn="Force" unit_definition="F"/>
      <value n='units_length' pn='Length' unit_definition="L"/>
      <value n="units_pressure" pn="Pressure" unit_definition="P"/>
      <value n="units_temperature" pn="Temperature" unit_definition="Temp"/>
   </container>

To reaffirm: only removing the first piece of code solves the transformation problem, but I lose the ability to control the standard units and the priority of each one.

How should I proceed in this case?

Regards,
Francisco Dias.
User avatar
compassis
Posts: 3
Joined: Thu Apr 09, 2015 9:29 am
Contact:

Re: Problem type transformation

Postby compassis » Wed Oct 21, 2020 7:13 pm

We have fixed this issue and it will be available in the future GiD versions. In this way, it will be possible to work with <unit_magnitude/> nodes without defining the boolean attribute called 'active', which allows to activate or deactivate these nodes.

By the way, the problem when transforming models can also be avoided in current GiD versions, by adding the attribute active="1" to all the <unit_magnitude> nodes, as follows:

<units>
<unit_magnitude n="Angle" pn="Angle" default="deg" SI_base="rad" active="1">
<unit n="deg" pn="degree" p="1" factor="0.01745329251994" help="degree=1/180[pi.rad]"/>
<unit n="rad" pn="radian" p="2" units_system="SI" factor="1.0"/>
<unit n="°" pn="degree" p="3" factor="0.01745329251994" printable_name="deg"/>
</unit_magnitude>
<unit_magnitude n="F" pn="Force" default="kN" SI_base="N" basic="L*M/T^2" active="1">
<unit n="N" pn="newton" p="2" units_system="SI" factor="1.0" help="Newton=[Kg.m/s2]"/>
<unit n="kN" pn="kilonewton" p="1" units_system="SI"/>
</unit_magnitude>
<unit_magnitude n="L" pn="Length" default="m" SI_base="m" active="1">
<unit n="m" pn="meter" p="1" units_system="SI" factor="1.0"/>
<unit n="cm" pn="centimeter" p="2" units_system="SI"/>
<unit n="mm" pn="millimeter" p="2" units_system="SI"/>
<unit n="um" pn="micrometer" p="2" factor="1.0e-6"/>
<unit n="µm" pn="micrometer" p="2" printable_name="um" units_system="SI"/>
</unit_magnitude>
<unit_magnitude n="P" pn="Pressure" default="kPa" SI_base="Pa" basic="F/L^2" active="1">
<unit n="Pa" pn="pascal" p="2" units_system="SI" factor="1.0" help="Pascal=[N/m2]"/>
<unit n="kPa" pn="kilopascal" p="1" units_system="SI"/>
<unit n="MPa" pn="megapascal" p="2" units_system="SI"/>
</unit_magnitude>
<unit_magnitude n="Temp" pn="Temperature" default="°C" SI_base="K" active="1">
<unit n="°C" pn="degree Celsius" p="1" units_system="SI" factor="1.0" addend="273.15" help="V[default]=(V[unit]+addend)*factor" printable_name="oC"/>
<unit n="K" pn="kelvin" p="2" units_system="SI" factor="1.0"/>
<unit n="°F" pn="degree Farenheit" p="3" units_system="imperial" factor="0.5555555555555556" addend="459.67" help="V[default]=(V[unit]+addend)*factor" printable_name="oF"/>
</unit_magnitude>
</units>

Return to “Customization”

Who is online

Users browsing this forum: No registered users and 1 guest