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

Stateflow translator bugs with networks #19

Open
ttj opened this issue Jan 12, 2016 · 2 comments
Open

Stateflow translator bugs with networks #19

ttj opened this issue Jan 12, 2016 · 2 comments
Assignees
Labels

Comments

@ttj
Copy link
Contributor

ttj commented Jan 12, 2016

Hi Luan,

The network changes you made in the converter have introduced some bugs, and additionally, a few of the latest changes in Hyst now cause some errors in some of the models that previously worked.

I have commented out the failing cases in the script file, and put all the failing cases up front:

https://github.com/ttj/hyst/blob/master/src/matlab/paper_script_ifm2016ha2slsf.m

The two main ones to look at are the cruise control, five dim switch, (which are both non-networked and fails now) and the buck_hysteresis_dcm, which is also not networked but is failing. There are a few other failing models now, but partly due to new features (e.g., time triggered transition support specified in the continization examples, etc.). The errors are:

Undefined function 'children' for input arguments of type 'com.verivital.hyst.ir.base.BaseComponent'.

Error in translateAutomaton (line 15)
        componentsMap = config.root.template.children;

Error in SpaceExToStateflow (line 139)
    translateAutomaton(m, config, options);

Error in paper_script_ifm2016ha2slsf (line 121)
[out_slsf_model, out_slsf_model_path, out_config] = SpaceExToStateflow(xml_file, cfg_file, '-s');```

A couple had failed due to some expression changes, don't worry about these (the comments indicate for each one how it failed).

Additionally, I had modified a bit the network call as far as I gather what it's doing to handle base vs. network components differently, not sure that was the right way to go (it resolves the runtime crash, but some of the models appear to not be translated correctly with this change):

https://github.com/ttj/hyst/blob/master/src/matlab/translateAutomaton.m#L25

This allowed the models to not cause a runtime error, but seems to have broken the translation results for some models. If you comment out the ifs for whether base/network, you'll see all the models that crash.

Could you please look into this and resolve? I debugged some yesterday, but don't have much time today to fix this.

Note that all the changes mentioned are on my fork, but this should be up-to-date with the latest merges made by Stan this morning.
@ttj
Copy link
Contributor Author

ttj commented Jan 12, 2016

Also, just a comment, the way this should be handled should allow the user to select whether a network should be composed by Hyst first, or not composed and attempted to translate the network (which down the road we'll improve for more general networks). The current status is the Stateflow converter is always trying to translate networks over as networks, although of course that will not work in general for now.

The most general (and probably smartest) way to do this would be to match the same arguments for passes as the Hyst executable itself (e.g., this would be specified as say -flatten), and the really best way to implement it would be we could probably use the same library for parsing this and reuse all of Hyst's code directly for this. That said, that will require some work, so just having an argument like -flatten that will apply the composition pass first would be worthwhile.

@LuanVietNguyen
Copy link
Contributor

Yes, I will look into the problem and try to resolve it soon.

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

No branches or pull requests

2 participants