thegrumpys / odop

Open Design Optimization Platform (ODOP) - Coil spring design app; mechanical springs; compression spring, extension spring, torsion spring
https://www.springdesignsoftware.org
MIT License
4 stars 5 forks source link

The generic dispatcher.js is creating model-specific entries #699

Open 1fifoto opened 2 years ago

1fifoto commented 2 years ago

The current dispatcher.js is setting model-specific entries: Catalog_Name and Catalog_Number. In other words, Spring specific symbols are polluting the Piston-Cylinder and Solid models,

case CHANGE_INPUT_SYMBOL_VALUES:
    // DO NOT INVOKE invokeInit(store) BECAUSE OF RECURSION
    store.dispatch(changeSymbolValue('Catalog_Name', '', action.payload.merit))
    store.dispatch(changeSymbolValue('Catalog_Number', '', action.payload.merit))
    invokeEquationSet(store);
    propagate(store);
    updateObjectiveValue(store, action.payload.merit);
    break;
case RESTORE_INPUT_SYMBOL_VALUES:
    store.dispatch(changeSymbolValue('Catalog_Name', '', action.payload.merit))
    store.dispatch(changeSymbolValue('Catalog_Number', '', action.payload.merit))
    invokeEquationSet(store);
    propagate(store);
    updateObjectiveValue(store, action.payload.merit);
    break;

These should be moved to a model-specific dispatcher.js or equivalent.

For example, here is a dump of a Piston-Cylinder model

  design3= {
    user: 'USERID0123456789',
    name: 'initialState',
    model: {
      symbol_table: {
        RADIUS: [Object],
        THICKNESS: [Object],
        FORCE: [Object],
        AREA: [Object],
        STRESS: [Object],
        Catalog_Name: [Object], <-----!!!!
        Catalog_Number: [Object], <-----!!!!
        PRESSURE: [Object]
      },
      labels: { COMMENT: [Object] },
      type: 'Piston-Cylinder',
      version: '7',
      result: {
        objective_value: 0.00006650141468530151,
        termination_condition: 'Seek completed. STRESS 8469 --> 0.7925 PSI; 99.99% improvement. TO FURTHER IMPROVE RESULT, RE-EXECUTE SEEK',
        violated_constraint_count: 3
      },
      ...
    }
  }