Coder Social home page Coder Social logo

pcyl-cli's People

Contributors

1fifoto avatar grumpyinca avatar

Watchers

 avatar  avatar

pcyl-cli's Issues

Add use of ioopt to control output

It appears that we get mismatches between the JS and PLI output because ioopt is not implemented. So we need to implement checking ioopt for output. We do not need to SET IOOPT, because 5 is just fine.

Create update.js

Add "oldvalue" property into design_parameters and state_variables as defined in design.js.
Write update code to store current values of design parameters and state variables into oldvalue for potential later use.
Invoke the update function in start.js.
Make corresponding changes in list.js so that old values appear in "BEFORE SEARCH" column.

Modify fix command to use regular expression

I am trying to have us use a standard pattern for command decode whereby we shift split_line into variables, then check the variables using a regular expression before doing a parseFloat. This also removes the use of 'isNaN'.

NaN in output after fix of DP and search

See last part of session output.

**********************************************
***  Welcome to PCyl Version 1.2
**********************************************
PCyl: fix radius 0.444
fix radius 0.444
RADIUS IS FIXED AT         0.4440   INCH
PCyl: search
search
SEARCH:    OBJ =          0.476569
RETURN ON:      OBJ =           0.002707
THE RESULT IS NOT FEASIBLE.
         YOU NEED TO DO A LITTLE MORE WORK ON THIS DESIGN.
         REFER TO THE DOCUMENTATION SECTION ON  "FEASIBILITY"  FOR SUGGESTIONS.
CONSTRAINT VIOLATIONS
                        VALUE        LEVEL     DIFFERENCE    PERCENT
PRESSURE        MAX    1552.8056    1500.0000     52.8056      3.5204  VIOLATED
FORCE           MIN     961.6851    1000.0000     38.3149      3.8315  VIOLATED
VALUE OF THE OBJECTIVE FUNCTION AT THIS POINT IS:              0.002707
PCyl: list both
list both
INDEPENDENT VARIABLES                                      CONSTRAINT LEVELS
                                            STATUS         MIN           MAX
PRESSURE        =     1552.8056  LB/SQ-IN                             1500.0000
RADIUS          =        0.4440  INCH       FIXED          0.4440        0.4440
THICKNESS       =          -NaN  INCH                      0.0000        0.0500
DEPENDENT VARIABLES                                        CONSTRAINT LEVELS
                                            STATUS         MIN           MAX
FORCE           =      961.6851  LBS.                   1000.0000              
STRESS          =          -NaN  PSI                                  3000.0000
PCyl: 

Create PCyl specific contnt.js

Calculate the value of Pi and return. The Spring specific version of this function will be far more complex … including user interaction.

PL/I code behavior investigation

  1. List levels does not display full set of constraint levels.

  2. List dependent displays a value for area where reading the PL/I code and execution of the JS code suggests that it shouldn't.

Feedback on current state of list command implementation

  1. The response to an empty command line seems to produce an extra prompt:
    PCyl>
    PCyl:
    PCyl>
    Perhaps this is part of a feature that echoes command input.

  2. The state variable "area" is missing from some of the responses. For example:
    list dep
    DEPENDENT VARIABLES CONSTRAINT LEVELS
    STATUS MIN MAX
    force = 251.3274 LBS. 1000.0000
    stress = 2500.0000 PSI 3000.0000

  3. A list command followed by multiple (DPSV) names separated by a single space produces expected results. A list command followed by the same set of names separated by multiple blanks produces unexpected results.

  4. For this case, the term in parens should be "outputs":
    PCyl>list state
    PCyl: list state
    DEPENDENT VARIABLES (inputs)
    force = 251.3274 LBS. 0.0000
    area = 0.5027 SQ.-IN. 0.0000
    stress = 2500.0000 PSI 0.0000
    PCyl>

  5. "list levels" does not produce a listing of constraint levels.

  6. The first design parameter in the listing produced by "list design" has an extra blank space in the "BEFORE SEARCH" column.
    PCyl>list design
    PCyl: list design
    INDEPENDENT VARIABLES (inputs) BEFORE SEARCH
    pressure = 500.0000 LBS/SQ-IN 0.0000
    radius = 0.4000 INCH 0.0000
    thickness = 0.0400 INCH 0.0000
    PCyl>

Make app.js and executable script

Add #!/usr/bin/env node, and make it have execute permission. Also add "test": "./app.js < test/in.txt > test/out.txt" to package.json scripts to execute it. Add out.txt file to .gitignore.

Unexpected behavior of change command ... bug ?

The following listing illustrates the issue. Notes ...

The objective function value of the starting point has been validated by PL/I PCyl. This suggests that despak is working correctly for this case of fixed/free, etc.

It is expected that using the change command to reduce the minimum constraint on FORCE to zero results in an objective function of zero. However, after using the change command to restore the original constraint, the objective function value remains at zero. This aspect of the behavior is unexpected.

**********************************************
***  Welcome to PCyl Version 1.2
**********************************************
START:
  The START command is not yet fully implemented.
PCyl: list both
list both
INDEPENDENT VARIABLES                                      CONSTRAINT LEVELS
                                            STATUS         MIN           MAX
PRESSURE        =      500.0000  LB/SQ-IN                             1500.0000
RADIUS          =        0.4000  INCH                      0.0000        0.5000
THICKNESS       =        0.0400  INCH                      0.0000        0.0500
DEPENDENT VARIABLES                                        CONSTRAINT LEVELS
                                            STATUS         MIN           MAX
FORCE           =      251.3274  LBS.                   1000.0000              
STRESS          =     2500.0000  PSI                                  3000.0000
PCyl: list viol
list viol
CONSTRAINT VIOLATIONS
                        VALUE        LEVEL     DIFFERENCE    PERCENT
FORCE           MIN     251.3274    1000.0000    748.6726     74.8673  VIOLATED
VALUE OF THE OBJECTIVE FUNCTION AT THIS POINT IS:              0.560511
PCyl: change force min 0.0
change force min 0.0
FORCE  MINIMUM CHANGED TO 0.0     LBS.
PCyl: list both
list both
INDEPENDENT VARIABLES                                      CONSTRAINT LEVELS
                                            STATUS         MIN           MAX
PRESSURE        =      500.0000  LB/SQ-IN                             1500.0000
RADIUS          =        0.4000  INCH                      0.0000        0.5000
THICKNESS       =        0.0400  INCH                      0.0000        0.0500
DEPENDENT VARIABLES                                        CONSTRAINT LEVELS
                                            STATUS         MIN           MAX
FORCE           =      251.3274  LBS.                      0.0000              
STRESS          =     2500.0000  PSI                                  3000.0000
PCyl: list viol
list viol
NO CONSTRAINTS ARE VIOLATED
VALUE OF THE OBJECTIVE FUNCTION AT THIS POINT IS:              0.000000
PCyl: change force min 1000.
change force min 1000.
FORCE  MINIMUM CHANGED TO 1000.     LBS.
PCyl: list both
list both
INDEPENDENT VARIABLES                                      CONSTRAINT LEVELS
                                            STATUS         MIN           MAX
PRESSURE        =      500.0000  LB/SQ-IN                             1500.0000
RADIUS          =        0.4000  INCH                      0.0000        0.5000
THICKNESS       =        0.0400  INCH                      0.0000        0.0500
DEPENDENT VARIABLES                                        CONSTRAINT LEVELS
                                            STATUS         MIN           MAX
FORCE           =      251.3274  LBS.                   1000.0000              
STRESS          =     2500.0000  PSI                                  3000.0000
PCyl: list viol
list viol
NO CONSTRAINTS ARE VIOLATED
VALUE OF THE OBJECTIVE FUNCTION AT THIS POINT IS:              0.000000
PCyl: 

Change let-of to index loop and change push() to array access

For example, change from

for (let dp of design_parameters) {
    if (dp.lmin != FIXEDSTAT) {
        nfree++;
        pc.push(dp.value);
    }
}

to

var pc = [];
for (let i = 0; i < design_parameter.length; i++) {
    var dp = design_parameter[i];
    if (dp.lmin != FIXEDSTAT) {
        nfree++;
        pc[i] = dp.value;
    }
}

Add test input, in.txt, and test output, out.txt

These files allows you to run the program feeding it a series of commands, capturing the actual output, and then comparing it to the expected output.

node app.js < test/in.txt > test/actual_out.txt
diff -y -W 256 test/expected_out.txt test/actual_out.txt

This allows a quick check after making changes to verify the system is still operating as expected.

I suggest doing this at each release, and possibly more often. At each release the updated output should be checked in to replace the current test/expected_out.txt to incorporate the updates and prepare for the following release.

Change command acknowledgement wrong for constraint levels

It appears that the problem is only in the acknowledgement; not in the value that is set for constraint levels.

The may be a good time to confirm that parseFloat() is also applied to constants and any other appropriate places in the change.js module.

**********************************************
***  Welcome to PCyl Version 1.2
**********************************************
PCyl: change thick max 0.155
change thick max 0.155
THICKNESS MAXIMUM CHANGED TO         0.0000   INCH
PCyl: change stress max 7000.1
change stress max 7000.1
STRESS MAXIMUM CHANGED TO         0.0000   PSI
PCyl: 
PCyl: list thick

list thick
THICKNESS       =        0.0400  INCH                      0.0000        0.1550
PCyl: list stress
list stress
STRESS          =     2500.0000  PSI                                  7000.1000
PCyl: 

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.