State machine transition via J1939 pedal postion

Discuss issues and ideas you have to configuring displays with PowerVision
normanbutchgrant
Posts: 25
Joined: Fri Oct 28, 2016 9:07 am

State machine transition via J1939 pedal postion

Post by normanbutchgrant » Thu Dec 29, 2016 2:38 am

We are trying to use the PV450 with IX3212 and MCS CAN pedal to control a hydraulic hybrid drive. There are numerous states that basically control the engine output and hydraulic pump to meet the demanded torque at any speed

We are just starting to transport the state machine that was developed in Matlab/Simulink to the PV450 controller and can’t get transitions to work
The problem is very basic. We can’t get the state machine to transition from one state to another using a signal from ( in this case a CAN pedal). We can get the transitions to work when we activate them via buttons but that is obviously not a viable solution.

Just to make it simple, how do we (say) transition from “initial state” to “state 1” when pedal postion1 is say 50% and then say to “state2” when pedal position is say 75%.

We do not know if it is a bug or if the pedal position is not a valid variable to use ( and then what would be?)
Just to confirm, we can get the system to transition using buttons, but just not using pedal position.

thankyou once again
normanbutchgrant
Posts: 25
Joined: Fri Oct 28, 2016 9:07 am

Re: State machine transition via J1939 pedal postion

Post by normanbutchgrant » Thu Dec 29, 2016 2:44 am

We are looking for help in this project.

I did ask admin both via this forum and directly if it is possible to post requests for freelancers to help us with everything from simple errors to eventually gauge design. We have not had a reply to three messages yet in this regard, so if this is out of line, I do apologize and will delete this post.

If it is not, I would be interested to hear from freelancers. I don’t see that this will be a long term project, but it may end up as such as this is not a core technology for us, we just want to use the system!

I would suggest that in the beginning, it will be very specific requests for help such as above
normanbutchgrant
Posts: 25
Joined: Fri Oct 28, 2016 9:07 am

Re: State machine transition via J1939 pedal postion

Post by normanbutchgrant » Thu Dec 29, 2016 6:59 am

Further to this issue, we have tried just to use a analog input 0-5v a a signal to trigger state changes with same results ( say >2v) ( meaning NO change occurs)

it seems we can only trigger state changes via buttons?

any suggestions would be welcomed as always

NormanButchGrant
stalley
Enovation Controls Development
Enovation Controls Development
Posts: 618
Joined: Tue Mar 18, 2014 12:57 pm

Re: State machine transition via J1939 pedal postion

Post by stalley » Mon Jan 02, 2017 8:28 am

Hello normanbutchgrant,

I apologize we have taken so long to reply, unfortunately, your questions have come during our holiday break and we are just returning today. Boyce will be out until tomorrow, so I am filling in for today.

If you haven't found the answer to your questions, I have some questions for you ;)

What mechanism are you using to monitor the input? If you have an event with a recurring timer in the state machine, are you firing the 50% (75%) event or a 50% condition on the 50% event? This is confusing and I don't think I have explained it well.

This post describes something similar to what I think you need to do.

Depending on what needs to happen, you might not need a state machine (if you do something like the post describes) or you might want to use three small state machines instead of one big one.

You might also find that Activity Programs are easier to use than state machines. With Activity Programs you can achieve the same results and they are far easier to understand and use. The standard configurations for the PV380s, MPC10 and MPC20 use them extensively so you can find many examples in those configurations.

I am like you, I have to just dig in and do something to actually learn how it works, after I find out how it doesn't work.

I will mention that the latest 2.8 PowerVision Configuration Studio manuals are located here.

We are here to help.
Sara Talley
Software Engineer
Enovation Controls
normanbutchgrant
Posts: 25
Joined: Fri Oct 28, 2016 9:07 am

Re: State machine transition via J1939 pedal postion

Post by normanbutchgrant » Mon Jan 02, 2017 12:17 pm

Hi Sara

Everyone is entitled to leave, just glad you are back!

1) To answer your question, we are using a variable to trigger mulitple, mutually excusive events, which is the state machine. For example, start the vehicle up, and dont pull off until demand > 5%. Enter mode 1 when demand >= 5%, perform those actions. When demand is -10%(regenerative braking), move to state 3 and perform those actions. When demand > 0 and pressure is high, move to mode 4. The actions are changing clutches, engine throttle, and pump displacement.

2) To calculate demand, we are using a variable with a calculation event provided by Eric Carmen. "(J1939_MCSPedal_Accelerator_Pedal_Position_1 * 2) - 100".

As such, we cannot use the example you provided (viewtopic.php?f=7&t=1358&p=3862&hilit=e ... tion#p3862) as that will trigger the change event without us desiring it to do so, because we are in a different mode than the events/flags were designed for. This is why the state machine is needed, we believe. If you can tell us a way that can do the same functions, we will be interested as to how.

The simplest way forward is if there is an example which uses a J1939/CAN bus signal (such as a foot pedal) to trigger state changes. Such as starting in "initial", then moving to "forward" when pedal displacement/calculated demand is > 50%, then "backwards" when below 50%. The function we are looking for is the changing BACK to "forward" when it exceeds 50% again, and back to "inital" when the pedal reaches 0%.

The real issue seems to be that we cannot get a J1939 as a condition for a state change to be honored, despite it being in the code.

Thank you very much,
NormanButchGrant
stalley
Enovation Controls Development
Enovation Controls Development
Posts: 618
Joined: Tue Mar 18, 2014 12:57 pm

Re: State machine transition via J1939 pedal postion

Post by stalley » Mon Jan 02, 2017 2:15 pm

Hello normanbutchgrant,

If I understand in general, I think you need to put the condition event (input > 5%, for example) on the transition event and fire the condition event in the appropriate state.

To better demonstrate what I mean, I have attached a demo config. The config monitors the standard J1939 Engine Speed SPN and changes the display based on the RPMs received. The state machine is found in the Programming group ~Demo State Machine. The state machine has three states, Initial, One and Two. There is a recurring timer event, Monitor Input, fired every 200ms.

The condition event on a particular transition event is fired in each of the states when the recurring timer event is fired.

What you should see on the screen is

RPMs <= 500: The RPMs text gauge only

500 < RPMS < 1000: RPMS text gauge + text One + ellipse widget on the left

RPMs >= 1000: RPMs text gauge + text Two + ellipse widget on the right

I have also created an Activity Program that will do the very same thing if you attach the Monitor Input event in the place where it says "Run On Event" at the top of the activity. You will want to disable the Monitor Input event in the state machine also.

This example is not the only way to solve your problem. You could try using an on change event instead of the recurring timer event. In this case, you wouldn't need the timer on the Monitor Input. Then on the J1939.Engine.Engine Speed variable, there is a Fire on change property where you would associate the Monitor Input event to the variable. I haven't found this to be as reliable for making the transitions as the recurring timer, but it is possible it could work for your system.

I hope this will give you an idea of how to use the state machine feature and how it works as well as the activity program feature.
Attachments
Demo State Transitions.zip
(691.32 KiB) Downloaded 26 times
Sara Talley
Software Engineer
Enovation Controls
normanbutchgrant
Posts: 25
Joined: Fri Oct 28, 2016 9:07 am

Re: State machine transition via J1939 pedal postion

Post by normanbutchgrant » Tue Jan 03, 2017 4:52 am

Sara, I thank you, we have got transitions to work using this method and can now continue

regards
Norman